feat: custom destinations

This commit is contained in:
Björn Fromme
2024-05-15 17:32:07 +02:00
parent 57e1082f2f
commit efc4b58077
27 changed files with 826 additions and 40 deletions
@@ -0,0 +1,45 @@
{% macro collectionRow(form) %}
<div {{ stimulus_target('form-collection', 'field') }}>
<div class="flex items-center space-x-4">
{{ form_widget(form) }}
<button type="button" {{ stimulus_action('form-collection', 'removeItem') }}>
{{ icon('delete', 'w-4 h-4 mt-2 pointer-events-none') }}
</button>
</div>
{{ form_errors(form) }}
</div>
{% endmacro %}
{{ form_start(form) }}
<div class="flex flex-col space-y-4 pb-8">
{{ form_row(form.product) }}
{{ form_row(form.dateFrom) }}
{{ form_row(form.dateTo) }}
{{ form_row(form.hotelBusProId) }}
<div {{ stimulus_controller('form-collection', { 'prototype': _self.collectionRow(form.pickups.vars.prototype)|json_encode }) }}>
<h4 class="font-bold pb-2">
Buszustiege
</h4>
<div {{ stimulus_target('form-collection', 'fields')}} class="flex flex-col space-y-4 mb-4">
{% do form.pickups.setRendered %}
{%- for pickup in form.pickups -%}{{- _self.collectionRow(pickup) -}}{%- endfor -%}
</div>
<div class="flex justify-end">
<button type="button"
{{ stimulus_action('form-collection', 'addItem') }}
title="Zustieg hinzufügen">
{{ icon('plus', 'w-4 h-4 pointer-events-none') }}
</button>
</div>
</div>
</div>
<div class="flex items-center space-x-2">
<button type="submit" class="btn">
Speichern
</button>
<a href="{{ path('app_administrative_system_destination_index') }}" class="btn btn--secondary">
Abbrechen
</a>
</div>
{{ form_rest(form) }}
{{ form_end(form) }}
@@ -0,0 +1,10 @@
{% extends 'administrative/layout.html.twig' %}
{% block title %}Reise anlegen{% endblock %}
{% block content %}
<h1 class="text-2xl font-bold pb-8">
Reise anlegen
</h1>
{% include 'administrative/system/destination/_form.html.twig' %}
{% endblock %}
@@ -0,0 +1,10 @@
{% extends 'administrative/layout.html.twig' %}
{% block title %}Reise duplizieren{% endblock %}
{% block content %}
<h1 class="text-2xl font-bold pb-8">
Reise duplizieren
</h1>
{% include 'administrative/system/destination/_form.html.twig' %}
{% endblock %}
@@ -0,0 +1,10 @@
{% extends 'administrative/layout.html.twig' %}
{% block title %}Reise bearbeiten{% endblock %}
{% block content %}
<h1 class="text-2xl font-bold pb-8">
Reise bearbeiten
</h1>
{% include 'administrative/system/destination/_form.html.twig' %}
{% endblock %}
@@ -0,0 +1,89 @@
{% extends 'administrative/layout.html.twig' %}
{% block title %}Reisen{% endblock %}
{% block content %}
<div class="flex items-start justify-between pb-4">
<h1 class="text-2xl font-bold">
Manuell angelegte Reisen
</h1>
</div>
<div class="data-table-wrapper">
<div class="data-table-wrapper__inner">
<table class="data-table">
<thead>
<tr>
<th>
{{ knp_pagination_sortable(pagination, 'Produkt', 'destination.product') }}
</th>
<th>
{{ knp_pagination_sortable(pagination, 'Vertragspartner', 'destination.hotel') }}
</th>
<th>
{{ knp_pagination_sortable(pagination, 'Zeitraum von', 'destination.dateFrom') }}
</th>
<th>
{{ knp_pagination_sortable(pagination, 'Zeitraum bis', 'destination.dateTo') }}
</th>
<th></th>
</tr>
</thead>
<tbody>
{% for destination in pagination %}
<tr>
<td>
{{ destination.product }}
</td>
<td>
{{ destination.hotel }}{% if destination.hotelCode is not null %} ({{ destination.hotelCode }}){% endif %}
</td>
<td>
{{ destination.dateFrom | date('d.m.Y') }}
</td>
<td>
{{ destination.dateTo | date('d.m.Y') }}
</td>
<td>
<twig:DropDown>
<button type="button"
class="text-red-500 hover:text-primary block px-4 py-2 text-sm w-full text-left"
role="menuitem"
tabindex="-1"
hx-get="{{ path('app_administrative_system_destination_delete', { 'id': destination.id }) }}"
hx-target="body"
hx-swap="beforeend">
löschen
</button>
<a href="{{ path('app_administrative_system_destination_duplicate', { 'id': destination.id }) }}"
class="text-gray-700 hover:text-primary block px-4 py-2 text-sm"
role="menuitem"
tabindex="-1">
duplizieren
</a>
<a href="{{ path('app_administrative_system_destination_edit', { 'id': destination.id }) }}"
class="text-gray-700 hover:text-primary block px-4 py-2 text-sm"
role="menuitem"
tabindex="-1">
bearbeiten
</a>
</twig:DropDown>
</td>
</tr>
{% else %}
<tr>
<td colspan="5">
Keine Daten...
</td>
</tr>
{% endfor %}
</tbody>
</table>
{{ knp_pagination_render(pagination) }}
</div>
</div>
<a href="{{ path('app_administrative_system_destination_create') }}" class="btn">
Neu
</a>
{% endblock %}
@@ -0,0 +1,7 @@
{% extends 'htmx_confirmation_modal.html.twig' %}
{% block content %}
<div>
Möchtest du die Reise <em>{{ destination }}</em> wirklich löschen?
</div>
{% endblock %}