Cleanup the Fix

This commit is contained in:
Igor Scheller 2023-12-27 15:11:00 +01:00 committed by msquare
parent 8140ebd1cc
commit 3c0cbe55b6
2 changed files with 5 additions and 5 deletions

View File

@ -91,11 +91,7 @@ class ImportSchedule extends BaseController
public function edit(Request $request): Response public function edit(Request $request): Response
{ {
$scheduleId = $request->getAttribute('schedule_id'); // optional $scheduleId = $request->getAttribute('schedule_id'); // optional
$schedule = ScheduleUrl::find($scheduleId); $schedule = ScheduleUrl::find($scheduleId);
if ($schedule == null) {
$schedule = new ScheduleUrl();
}
return $this->response->withView( return $this->response->withView(
'admin/schedule/edit.twig', 'admin/schedule/edit.twig',

View File

@ -64,7 +64,11 @@
<div class="row"> <div class="row">
{% for id,name in locations %} {% for id,name in locations %}
<div class="col-md-3"> <div class="col-md-3">
{{ f.checkbox('location_' ~ id, name, {'checked': id in schedule.activeLocations.pluck('id')}) }} {{ f.checkbox(
'location_' ~ id,
name,
{'checked': schedule and id in schedule.activeLocations.pluck('id')}
) }}
</div> </div>
{% endfor %} {% endfor %}
</div> </div>