engelsystem/resources/views/admin/schedule/edit.twig

79 lines
2.9 KiB
Twig
Raw Normal View History

2020-11-21 20:54:04 +01:00
{% extends 'admin/schedule/index.twig' %}
{% import 'macros/base.twig' as m %}
{% import 'macros/form.twig' as f %}
{% block title %}{{ schedule ? __('schedule.edit.title') : __('schedule.import.title') }}{% endblock %}
2023-12-06 19:03:12 +01:00
{% block content_title %}
{{ m.button(m.icon('chevron-left'), url('/admin/schedule'), 'secondary', 'sm', __('general.back')) }}
2023-12-06 19:03:12 +01:00
{{ block('title') }}
2023-11-03 15:02:54 +01:00
{% endblock %}
2020-11-21 20:54:04 +01:00
{% block row_content %}
{% if schedule and schedule.updated_at %}
<div class="col-md-12">
2023-12-27 03:18:05 +01:00
<p>{{ __('schedule.last_update', [schedule.updated_at.format(__('general.datetime'))]) }}</p>
2020-11-21 20:54:04 +01:00
</div>
{% endif %}
<form method="post">
{{ csrf() }}
2023-12-27 03:18:05 +01:00
<div class="row">
<div class="col-md-6">
{{ f.input('name', __('schedule.name'), {
'required': true,
'value': schedule ? schedule.name : '',
2023-12-08 21:25:24 +01:00
}) }}
2023-12-27 03:18:05 +01:00
{{ f.input('url', __('schedule.url'), {
'type': 'url',
'required': true,
'value': schedule ? schedule.url : ''
}) }}
{{ f.select('shift_type', __('schedule.shift-type'), shift_types|default([]), {
'selected': schedule ? schedule.shift_type : '',
}) }}
{{ f.checkbox('needed_from_shift_type', __('schedule.needed-from-shift-type'), {
'checked': schedule ? schedule.needed_from_shift_type : '',
}) }}
{{ f.input('minutes_before', __('schedule.minutes-before'), {
'type': 'number',
'required': true,
'value': schedule ? schedule.minutes_before : 15
}) }}
{{ f.input('minutes_after', __('schedule.minutes-after'), {
'type': 'number',
'required': true,
'value': schedule ? schedule.minutes_after : 15
}) }}
{{ f.save(__('form.save')) }}
{% if schedule %}
{{ f.delete(__('form.delete'), {
'confirm_title': __('schedule.delete.title', [schedule.shifts|length])
}) }}
{% endif %}
</div>
<div class="col-md-6">
<h3>{{ __('schedule.for_locations') }}</h3>
<div class="row">
{% for id,name in locations %}
<div class="col-md-3">
2023-12-27 15:11:00 +01:00
{{ f.checkbox(
'location_' ~ id,
name,
{'checked': schedule and id in schedule.activeLocations.pluck('id')}
) }}
2023-12-27 03:18:05 +01:00
</div>
{% endfor %}
</div>
</div>
2020-11-21 20:54:04 +01:00
</div>
</form>
{% endblock %}