Files
myep/templates/groups/offer/view.html.twig
T

213 lines
9.7 KiB
Twig

{% extends 'layout_booking.html.twig' %}
{% macro imageGallery(images, thumbImages, defaultAlt) %}
{% if images|length > 0 %}
<div class="grid md:grid-cols-2 gap-8" {{ stimulus_controller('gallery') }}>
{% for image in images %}
<div class="relative block w-full h-auto cursor-pointer{{ loop.index0 >= 2 ? ' hidden' : '' }}"
data-gallery-target="item"
data-gallery-href="{{ image.url }}"
data-gallery-alt="{{ image.alt ?? defaultAlt }}">
<img src="{{ thumbImages[loop.index0].url ?? image.url }}"
alt="{{ image.alt ?? defaultAlt }}"
class="block w-full h-auto">
{% if loop.index0 == 1 and images|length > 2 %}
<div class="absolute inset-0 bg-black/50 flex items-center justify-center text-white font-bold text-lg">
+{{ images|length - 2 }}
</div>
{% endif %}
</div>
{% endfor %}
</div>
{% endif %}
{% endmacro %}
{% import _self as macros %}
{% block title %}{{ booking.acceptedAt is not null ? 'Deine Buchung' : 'Dein Angebot' }}{% endblock %}
{% block background %}bg-outer bg-outer--summer{% endblock %}
{% block content %}
{% set currency = booking.pricingCurrency ?? priceBreakdown.currency %}
<div class="flex-1 flex flex-col lg:grid lg:grid-cols-5 min-h-0 relative">
{# Sidebar summary #}
<div id="booking-summary-wrapper"
class="order-1 lg:order-2 lg:flex-1 lg:min-h-0 lg:col-span-2"
{{ stimulus_controller('toggle', { 'open': false }, { 'closed': 'hidden', 'open': 'absolute inset-0 z-20', 'iconOpen': 'rotate-180' }) }}>
{% include 'groups/offer/_summary.html.twig' with {
booking: booking,
ctx: ctx,
currency: currency,
} %}
</div>
{# Main area #}
<div class="flex-1 order-2 lg:order-1 lg:col-span-3 bg-white flex flex-col gap-y-8 min-h-0 overflow-y-auto scroll-stable px-4 lg:px-8 py-8">
{% include '_partials/_flashes.html.twig' %}
<hgroup>
<h1 class="text-2xl lg:text-4xl font-bold mb-2">
{{ booking.acceptedAt is not null ? 'Deine Buchung' : 'Dein Angebot' }}
</h1>
<p class="text-2xl">
{{ ctx.accommodation.name }}
</p>
</hgroup>
{# Booked services #}
{% if booking.boardServiceLabel or booking.additionalServices | length > 0 %}
<div>
<h2 class="text-xl font-bold mb-2">
{{ booking.acceptedAt is not null ? 'Gebuchte' : 'Angebotene' }} Leistungen
</h2>
<ul class="list-disc pl-4">
{% if booking.boardServiceLabel %}
<li>{{ booking.boardServiceLabel }}</li>
{% endif %}
{% for service in booking.additionalServices %}
<li>{{ service.label }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if booking.open %}
<div>
<button type="button"
class="button button--primary w-full"
hx-get="{{ path('app_groups_offer_confirm', { uuid: booking.uuid }) }}"
hx-target="body"
hx-swap="beforeend">
Angebot verbindlich buchen
</button>
</div>
{% elseif booking.confirmedAt is not null %}
<div class="flex items-center space-x-2">
{{ icon('info', 'w-5 h-5') }}
<div class="text-gray-500">
Buchung bestätigt am {{ booking.confirmedAt | date('d.m.Y') }}
</div>
</div>
{% elseif booking.acceptedAt is not null %}
<div class="flex items-center space-x-2">
{{ icon('info', 'w-5 h-5') }}
<div class="text-gray-500">
Am {{ booking.acceptedAt | date('d.m.Y') }} bei uns eingegangen — wir prüfen deine
Buchung und melden uns mit der Bestätigung bei dir.
</div>
</div>
{% endif %}
{# hotel description #}
{% if ctx.hotelCmsData is not null %}
{% embed '_partials/_collapsible.html.twig' with {
heading: 'Die Unterkunft',
id: 'accommodation',
} %}
{% block body %}
{% set icons = ctx.hotelCmsData.icons %}
{% if icons is not empty %}
<ul class="grid grid-cols-2 md:grid-cols-3 gap-2">
{% for item in icons %}
<li class="flex items-center gap-2">
<div class="border-2 border-gray-900 rounded-full w-16 h-16 shrink-0 flex flex-col items-center justify-center">
{% if item.icon %}
{{ icon(item.icon, 'w-8 h-8 shrink-0 text-gray-900') }}
{% endif %}
</div>
{% if item.label is not same as(false) %}
<div class="text-sm font-bold">{{ item.label }}</div>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{{ ctx.hotelCmsData.description | raw }}
{% if ctx.hotelCmsData.features|striptags|trim is not empty %}
<h2>
Details zur Unterkunft
</h2>
{{ ctx.hotelCmsData.features | raw }}
{% endif %}
{% if ctx.hotelCmsData.roomTypes|striptags|trim is not empty %}
<h2>
Die Zimmer
</h2>
{{ ctx.hotelCmsData.roomTypes | raw }}
{% endif %}
{% endblock %}
{% endembed %}
{{ macros.imageGallery(ctx.hotelCmsData.images.resized.l, ctx.hotelCmsData.images.resized.m, ctx.accommodation.name) }}
{% endif %}
{# additional information #}
{% if ctx.hotelCmsData is not null and ctx.hotelCmsData.additionalInformation|striptags|trim is not empty %}
{% embed '_partials/_collapsible.html.twig' with {
heading: 'Zusatzinformationen',
id: 'additional-information',
} %}
{% block body %}
{{ ctx.hotelCmsData.additionalInformation | raw }}
{% endblock %}
{% endembed %}
{% endif %}
{# region description #}
{% if ctx.hotelCmsData is not null and ctx.hotelCmsData.region is not null %}
{% set region = ctx.hotelCmsData.region %}
{% embed '_partials/_collapsible.html.twig' with {
heading: 'Die Region ' ~ region.name,
id: 'region',
region: region,
} %}
{% block body %}
{% if region.altitude or region.length or region.lifts %}
<ul class="flex flex-wrap gap-x-6 text-sm not-prose">
{% if region.altitude %}
<li>{{ region.altitude }} m Höhe</li>
{% endif %}
{% if region.length %}
<li>{{ region.length }} km Pisten</li>
{% endif %}
{% if region.lifts %}
<li>{{ region.lifts }} Lifte</li>
{% endif %}
</ul>
{% endif %}
{% if region.webcam %}
<p>
<a href="{{ region.webcam }}" target="_blank" rel="noopener">Webcam der Region</a>
</p>
{% endif %}
{{ region.description | default('') | raw }}
{{ region.skiArea | default('') | raw }}
{{ region.skiAreaExtended | default('') | raw }}
{% if region.news %}
<h2>Aktuelles aus der Region</h2>
{{ region.news | raw }}
{% endif %}
{% endblock %}
{% endembed %}
{% if region.regionMaps is not null and region.regionMaps | length > 0 %}
{% set regionMapImages = region.regionMaps | map(url => {url: url}) %}
{{ macros.imageGallery(regionMapImages, [], region.name) }}
{% endif %}
{{ macros.imageGallery(region.images.resized.l ?? [], region.images.resized.m ?? [], region.name) }}
{% endif %}
</div>
</div>
{% endblock %}