wip: refactored price overrides

This commit is contained in:
Björn Fromme committed 2026-07-16 17:13:15 +02:00
1 parent f8e4fe4d1e
commit eba1a901d6
13 files changed
+668 -118

No files matched your search

+14 -10
View File
@@ -62,13 +62,15 @@
<table class="data-table">
<thead>
<tr>
<th></th>
<th>
von
</th>
<th>
bis
</th>
<th>
Typ
</th>
<th>
Saison
</th>
@@ -90,13 +92,21 @@
<tbody>
{% for price in accommodation.accommodationPrices %}
<tr>
<td></td>
<td>
{{ price.dateFrom | date('d.m.Y') }}
</td>
<td>
{{ price.dateTo | date('d.m.Y') }}
</td>
<td>
{% if price.type is not null %}
{% if price.type.value == 'discount' %}
{{ icon('discount', 'w-5 h-5') }}
{% elseif price.type.value == 'override' %}
{{ icon('stack', 'w-5 h-5') }}
{% endif %}
{% endif %}
</td>
<td>
{{ price.season.token | trans }}
</td>
@@ -104,16 +114,10 @@
{{ price.includedPax }}
</td>
<td>
{{ (price.effectivePricePerNight / 100) | format_currency(accommodation.currency) }}
{% if price.pricePerNightOverride is not null %}
<span class="line-through text-xs">{{ (price.pricePerNight / 100) | format_currency(accommodation.currency) }}</span>
{% endif %}
{{ (price.pricePerNight / 100) | format_currency(accommodation.currency) }}
</td>
<td>
{{ (price.effectivePriceAdditionalPerson / 100) | format_currency(accommodation.currency) }}
{% if price.priceAdditionalPersonOverride is not null %}
<span class="line-through text-xs">{{ (price.priceAdditionalPerson / 100) | format_currency(accommodation.currency) }}</span>
{% endif %}
{{ (price.priceAdditionalPerson / 100) | format_currency(accommodation.currency) }}
</td>
<td>
{% if price.acceptUndersubscription %}
@@ -2,15 +2,14 @@
{{ form_start(form) }}
<div class="grid lg:grid-cols-2 gap-y-4 lg:gap-x-8">
<div class="lg:col-span-2 grid lg:grid-cols-3 gap-y-4 lg:gap-x-8">
<div class="lg:col-span-2 grid lg:grid-cols-4 gap-y-4 lg:gap-x-8">
{{ form_row(form.dateFrom) }}
{{ form_row(form.dateTo) }}
{{ form_row(form.season) }}
{{ form_row(form.type) }}
</div>
{{ form_row(form.pricePerNight) }}
{{ form_row(form.pricePerNightOverride) }}
{{ form_row(form.priceAdditionalPerson) }}
{{ form_row(form.priceAdditionalPersonOverride) }}
{{ form_row(form.includedPax) }}
{{ form_row(form.minNights) }}
{{ form_row(form.acceptUndersubscription) }}
+55 -40
View File
@@ -1,56 +1,71 @@
<div class="grid grid-cols-3 gap-8 mb-4">
{% set weekdays = ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So'] %}
<div class="space-y-4 mb-4">
{% for month in months %}
{% set totalCols = month.firstDow + (month.days | length) %}
<div>
<div class="text-sm font-semibold text-center mb-2">{{ month.label }}</div>
<div class="grid grid-cols-7 rounded-md overflow-hidden ring-1 ring-gray-300">
{% for header in ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So'] %}
<div class="text-center text-xs text-gray-400 font-medium py-1 bg-gray-50 border-r border-b border-gray-200">{{ header }}</div>
{% endfor %}
{% if month.firstDow > 0 %}
{% for i in 1..month.firstDow %}
<div class="h-8 border-r border-b border-gray-200 bg-gray-50/40"></div>
{% endfor %}
{% endif %}
{% for dayNum, day in month.days %}
<div class="{{ html_classes('h-8 flex flex-col items-center justify-between py-1 border-r border-b border-gray-200 cursor-default', { 'bg-secondary/25': day.isToday }) }}"
{% if day.tooltip %}{{ stimulus_controller('tooltip', {'content': day.tooltip}) }}{% endif %}
>
<span class="text-xs text-gray-700 leading-none">{{ dayNum }}</span>
<div class="flex gap-px">
{% if day.hasPrice %}
<span class="w-1.5 h-1.5 rounded-full bg-blue-500"></span>
{% endif %}
{% if day.hasBoard %}
<span class="w-1.5 h-1.5 rounded-full bg-green-500"></span>
{% endif %}
{% if day.hasAdditional %}
<span class="w-1.5 h-1.5 rounded-full bg-amber-500"></span>
{% endif %}
{% if day.isBlocked %}
<span class="w-1.5 h-1.5 rounded-full bg-red-500"></span>
{% endif %}
</div>
<div class="text-sm font-semibold mb-1">{{ month.label }}</div>
<div class="overflow-x-auto">
<div class="w-max">
<div class="flex">
<div class="w-20 shrink-0"></div>
{% for col in 0..(totalCols - 1) %}
{% set dow = col % 7 %}
<div class="w-6 text-center">
<span class="block text-xs leading-none {{ dow >= 5 ? 'text-red-400' : 'text-gray-300' }}">{{ weekdays[dow] }}</span>
</div>
{% endfor %}
</div>
{% endfor %}
<div class="flex mb-0.5">
<div class="w-20 shrink-0"></div>
{% if month.firstDow > 0 %}
{% for i in 1..month.firstDow %}
<div class="w-6"></div>
{% endfor %}
{% endif %}
{% for dayNum, day in month.days %}
<div class="w-6 text-center">
<span class="{{ html_classes('block text-xs leading-none cursor-default', {'font-bold text-secondary': day.isToday, 'text-gray-500': not day.isToday}) }}"
{% if day.tooltip %}{{ stimulus_controller('tooltip', {'content': day.tooltip}) }}{% endif %}
>{{ dayNum }}</span>
</div>
{% endfor %}
</div>
{% for row in [
{label: 'Preis', key: 'hasPrice', color: 'bg-blue-500'},
{label: 'Verpfl.', key: 'hasBoard', color: 'bg-green-500'},
{label: 'Zusatzl.', key: 'hasAdditional', color: 'bg-amber-500'},
{label: 'n. v.', key: 'isBlocked', color: 'bg-red-500'},
] %}
<div class="flex items-center mt-0.5">
<div class="w-20 shrink-0 text-xs text-gray-500">{{ row.label }}</div>
{% if month.firstDow > 0 %}
{% for i in 1..month.firstDow %}
<div class="w-6 px-px"><div class="h-3"></div></div>
{% endfor %}
{% endif %}
{% for dayNum, day in month.days %}
<div class="w-6 px-px">
<div class="h-3 {{ day[row.key] ? row.color : 'bg-gray-100' }}"></div>
</div>
{% endfor %}
</div>
{% endfor %}
</div>
</div>
</div>
{% endfor %}
</div>
<div class="flex justify-around items-center gap-6 mb-4 text-sm text-gray-600">
<div class="flex flex-wrap gap-x-6 gap-y-2 mb-4 text-sm text-gray-600">
<div class="flex items-center gap-1.5">
<span class="inline-block w-3 h-3 rounded-full bg-blue-500"></span> Preiskonfigurationen
<span class="inline-block w-4 h-3 bg-blue-500"></span> Preiskonfigurationen
</div>
<div class="flex items-center gap-1.5">
<span class="inline-block w-3 h-3 rounded-full bg-green-500"></span> Verpflegungsleistungen
<span class="inline-block w-4 h-3 bg-green-500"></span> Verpflegungsleistungen
</div>
<div class="flex items-center gap-1.5">
<span class="inline-block w-3 h-3 rounded-full bg-amber-500"></span> optionale Zusatzleistungen
<span class="inline-block w-4 h-3 bg-amber-500"></span> optionale Zusatzleistungen
</div>
<div class="flex items-center gap-1.5">
<span class="inline-block w-3 h-3 rounded-full bg-red-500"></span> nicht verfügbar
<span class="inline-block w-4 h-3 bg-red-500"></span> nicht verfügbar
</div>
</div>