Fix event pricetable rendering empty

This commit is contained in:
Björn Fromme
2022-04-12 09:09:08 +02:00
parent 48a2ad1a2f
commit 4747e27cab
2 changed files with 152 additions and 127 deletions
@@ -1,15 +1,15 @@
<html data-namespace-typo3-fluid="true" lang="en" <html data-namespace-typo3-fluid="true" lang="en"
xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml"
xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers"
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers"> xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<f:section name="Main">
<f:if condition="{pricetable -> f:count()} == 0"> <f:if condition="{pricetable -> f:count()} == 0">
<f:then> <f:then>
<f:render partial="NotBookable" arguments="{_all}"/> <f:render partial="NotBookable" arguments="{_all}"/>
</f:then> </f:then>
<f:else> <f:else>
<div class="w-full max-w-full overflow-x-scroll"> <div class="w-full max-w-full overflow-x-scroll"
data-controller="pricetable"
data-pricetable-show-all-rows-value="true">
<table class="min-w-full border border-gray-200 border-collapse mb-8"> <table class="min-w-full border border-gray-200 border-collapse mb-8">
<thead> <thead>
<tr> <tr>
@@ -32,7 +32,7 @@
<td class="px-2 py-1 border border-gray-200 whitespace-nowrap"> <td class="px-2 py-1 border border-gray-200 whitespace-nowrap">
{row.roomName} {row.roomName}
<div class="lg:hidden"> <div class="lg:hidden">
<f:if condition="{row.roomAvailable}"> <f:if condition="{row.available}">
<f:then> <f:then>
<a href="{row.bookingUrl}"> <a href="{row.bookingUrl}">
Jetzt buchen <i class="fa fa-angle-right"></i> Jetzt buchen <i class="fa fa-angle-right"></i>
@@ -45,36 +45,64 @@
</div> </div>
</td> </td>
<td class="px-2 py-1 border border-gray-200"> <td class="px-2 py-1 border border-gray-200">
<f:if condition="{row.roomAvailable}"> <f:if condition="{row.available}">
<f:then> <f:then>
{row.roomPrice} € {row.minPrice} €
</f:then> </f:then>
<f:else> <f:else>
<s>{row.roomPrice} €</s> <s>{row.minPrice} €</s>
</f:else> </f:else>
</f:if> </f:if>
</td> </td>
<td class="px-2 py-1 border border-gray-200"> <td class="px-2 py-1 border border-gray-200">
<f:if condition="{row.dateBusIncluded}"> <f:if condition="{row.busIncluded}">
<span data-cooltipz-dir="top" aria-label="Busfahrt inklusive" role="tooltip"> <span data-cooltipz-dir="top"
<i class="fa fa-bus"></i> aria-label="Busfahrt"
role="tooltip"
data-pricetable-target="busIcon"
data-bus-included="{row.busIncluded}"
data-bus-price="{row.busPrice}">
<svg class="w-4 h-4 md:w-5 md:h-5">
<use href="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/icons_sprite.svg')}#icon-bus"></use>
</svg>
</span> </span>
</f:if> </f:if>
<f:if condition="{row.dateSkipassIncluded}"> <f:if condition="{row.skipassIncluded}">
<span data-cooltipz-dir="top" aria-label="Skipass inklusive" role="tooltip"> <span data-cooltipz-dir="top"
<i class="fa fa-tag"></i> aria-label="Skipass"
role="tooltip">
<svg class="w-4 h-4 md:w-5 md:h-5">
<use href="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/icons_sprite.svg')}#icon-tag"></use>
</svg>
</span> </span>
</f:if> </f:if>
</td> </td>
<td class="px-2 py-1 border border-gray-200"> <td class="px-2 py-1 border border-gray-200">
<f:if condition="{row.roomOptionalServices}"> <f:if condition="{row.optionalServices} && {row.available}">
<f:render section="Modal" arguments="{index: iteration.cycle, services: row.roomOptionalServices}"/> <button type="button"
data-action="pricetable#openModal"
data-type="options"
data-uid="{row.roomUid}"
data-cooltipz-dir="top"
aria-label="Alle Zusatzleistungen anzeigen"
role="tooltip">
<svg class="w-4 h-4 md:w-5 md:h-5">
<use href="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/icons_sprite.svg')}#icon-plus-circle"></use>
</svg>
</button>
</f:if> </f:if>
</td> </td>
<td class="hidden lg:table-cell px-2 py-1 border border-gray-200"> <td class="hidden lg:table-cell px-2 py-1 border border-gray-200">
<f:if condition="{row.roomAvailable}"> <f:if condition="{row.available}">
<f:then> <f:then>
<a class="button button--small button--booking" href="{row.bookingUrl}" target="_blank">Buchen</a> <a class="button button--small w-full"
href="{row.bookingUrl}"
title="{row.roomName} buchen"
target="_blank">
<span class="font-bold normal-case whitespace-nowrap">
Jetzt buchen
</span>
</a>
</f:then> </f:then>
<f:else> <f:else>
<span class="label label-default">ausgebucht</span> <span class="label label-default">ausgebucht</span>
@@ -88,52 +116,50 @@
</div> </div>
</f:else> </f:else>
</f:if> </f:if>
</f:section> <div class="hidden fixed inset-0 w-full h-full z-50"
data-controller="modal"
<f:section name="Modal"> data-action="pricetable:options-modal:open@window->modal#open">
<a href="#" data-toggle="modal" data-target="#optservices{index}"><i class="fa fa-plus-circle"></i></a> <div class="absolute inset-0 w-full h-full bg-overlay-black z-25"
<div class="modal fade" id="optservices{index}" role="dialog"> data-action="click->modal#close"></div>
<div class="modal-dialog"> <div class="absolute top-1/2 left-1/2 transform -translate-xy-1/2 w-full max-w-xl px-4">
<div class="modal-content"> <div class="shadow flex items-center justify-between p-4 bg-ep-primary-light text-white rounded-t">
<div class="modal-header"> <span class="text-xl font-bold">
Optionale Zusatzleistungen
</span>
<button type="button" <button type="button"
class="close" class="inline-block"
data-dismiss="modal"> data-action="modal#close">
<span>&times;</span> <svg class="w-8 h-8">
<use href="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/icons_sprite.svg')}#icon-close"></use>
</svg>
</button> </button>
<h5 class="modal-title">Optionale Zusatzleistungen</h5>
</div> </div>
<div class="modal-body"> <div class="h-128 p-4 overflow-y-scroll bg-white rounded-b">
<div class="table-responsive"> <f:for each="{pricetable}" as="row">
<f:render section="OptionalServices" arguments="{services: services}"/> <div class="hidden"
data-modal-target="content"
data-uid="{row.roomUid}">
<f:for each="{row.optionalServices}" as="section">
<div class="py-2 -mx-1">
<div class="font-bold text-xl px-1">
{section.label}
</div> </div>
</div> <f:for each="{section.services}" as="service">
</div> <dl class="flex items-start justify-between p-1 hover:bg-gray-50">
</div> <dt class="font-normal">
</div> {service.label}:
</f:section> </dt>
<dd class="whitespace-nowrap">
<f:section name="OptionalServices"> {service.price} €
<v:variable.set name="sectionLabels" value="{ </dd>
BUS: 'Anreise', </dl>
VPF: 'Verpflegung',
SPA: 'Skipass',
KUR: 'Kurse',
VER: 'Verleih'
}"/>
<table class="table table-striped services">
<f:for each="{services}" as="section" key="serviceKey">
<tr>
<th colspan="2">{v:variable.get(name: 'sectionLabels.{serviceKey}')}</th>
</tr>
<f:for each="{section}" as="service">
<tr>
<td>{service.label}</td>
<td>{service.price}€</td>
</tr>
</f:for> </f:for>
</div>
</f:for> </f:for>
</table> </div>
</f:section> </f:for>
</div>
</div>
</div>
</html> </html>
@@ -1,11 +1,10 @@
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" <html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:ep="http://typo3.org/ns/EP/EpTheme/ViewHelpers"
data-namespace-typo3-fluid="true"> data-namespace-typo3-fluid="true">
<f:layout name="Default"/> <f:layout name="Default"/>
<f:section name="Main"> <f:section name="Main">
<f:render partial="Pricetable" section="Main" arguments="{_all}"/> <f:render partial="Pricetable" arguments="{_all}"/>
</f:section> </f:section>
</html> </html>