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

67 lines
2.7 KiB
Twig
Raw Normal View History

2023-10-15 19:25:55 +02:00
{% extends 'admin/locations/index.twig' %}
2023-02-26 11:27:41 +01:00
{% import 'macros/base.twig' as m %}
{% import 'macros/form.twig' as f %}
2023-10-15 19:25:55 +02:00
{% block title %}{{ location ? __('location.edit.title') : __('location.create.title') }}{% endblock %}
2023-02-26 11:27:41 +01:00
{% block row_content %}
<form method="post">
{{ csrf() }}
2023-10-15 19:25:55 +02:00
{{ f.hidden('id', location ? location.id : '') }}
2023-02-26 11:27:41 +01:00
<div class="row">
<div class="col-lg-6">
2023-10-02 16:15:25 +02:00
{{ f.input('name', __('general.name'), {
'required': true,
'required_icon': true,
2023-10-15 19:25:55 +02:00
'value': f.formData('location', location ? location.name : ''),
}) }}
2023-02-26 11:27:41 +01:00
2023-10-02 16:15:25 +02:00
{{ f.input('dect', __('general.dect'), {
2023-10-15 19:25:55 +02:00
'value': f.formData('dect', location ? location.dect : ''),
}) }}
2023-10-15 19:25:55 +02:00
{{ f.input('map_url', __('location.map_url'), {
'type': 'url',
2023-10-15 19:25:55 +02:00
'value': f.formData('map_url', location ? location.map_url : ''),
'info': __('location.map_url.info'),
}) }}
2023-02-26 11:27:41 +01:00
2023-10-02 16:15:25 +02:00
{{ f.textarea('description', __('general.description'), {
2023-10-15 19:25:55 +02:00
'value': f.formData('description', location ? location.description : ''),
'rows': 5,
'info': __('form.markdown')
}) }}
2023-02-26 11:27:41 +01:00
</div>
<div class="col-lg-6">
2023-10-15 19:25:55 +02:00
<h4>{{ __('location.required_angels') }}</h4>
2023-02-26 11:27:41 +01:00
{% for types in angel_types.chunk(3) %}
<div class="row">
{% for angel_type in types %}
{% set needed = needed_angel_types ? needed_angel_types.where('angel_type_id', angel_type.id).first() : null %}
{% set name = 'angel_type_' ~ angel_type.id %}
<div class="col-md-4">
{{ f.number(name, angel_type.name, {
'value': f.formData(name, needed ? needed.count : 0),
'min': 0,
'step': 1,
}) }}
2023-02-26 11:27:41 +01:00
</div>
{% endfor %}
</div>
{% endfor %}
</div>
</div>
<div class="col-md-12">
<div class="btn-group">
{{ f.submit(__('form.save'), {'icon_left': 'save'}) }}
2023-10-15 19:25:55 +02:00
{% if location %}
2023-11-10 16:20:01 +01:00
{{ f.delete(__('form.delete'), {'confirm_title': __('location.delete.title', [location.name|e])}) }}
2023-02-26 11:27:41 +01:00
{% endif %}
</div>
</div>
</form>
{% endblock %}