Don't render empty table

This commit is contained in:
Björn Fromme
2022-03-07 17:25:08 +01:00
parent f2040cf7dc
commit 70aaeb6de9
@@ -22,198 +22,199 @@
</f:if> </f:if>
</f:else> </f:else>
</f:if> </f:if>
<f:if condition="{dates}">
<table class="w-full mb-4"> <table class="w-full mb-4">
<thead> <thead>
<tr class="bg-ep-primary-dark text-white"> <tr class="bg-ep-primary-dark text-white">
<th class="border-r border-overlay-white-50 px-2 py-1 md:p-2 text-left text-sm md:text-base"> <th class="border-r border-overlay-white-50 px-2 py-1 md:p-2 text-left text-sm md:text-base">
Termin Termin
</th> </th>
<th class="border-r border-overlay-white-50 px-2 py-1 md:p-2 text-sm md:text-base"> <th class="border-r border-overlay-white-50 px-2 py-1 md:p-2 text-sm md:text-base">
Nächte Nächte
</th> </th>
<th class="border-r border-overlay-white-50 px-2 py-1 md:p-2 text-sm md:text-base"> <th class="border-r border-overlay-white-50 px-2 py-1 md:p-2 text-sm md:text-base">
inklusive inklusive
</th> </th>
<th class="border-r border-overlay-white-50 px-2 py-1 md:p-2 text-sm md:text-base"> <th class="border-r border-overlay-white-50 px-2 py-1 md:p-2 text-sm md:text-base">
ab ab
</th> </th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<f:for each="{dates}" as="row" iteration="iteration"> <f:for each="{dates}" as="row" iteration="iteration">
<tr class="odd:bg-gray-50 hover:bg-gray-100 odd:hover:bg-gray-100{f:if(condition: '{iteration.cycle} > 5', then: ' hidden')}" <tr class="odd:bg-gray-50 hover:bg-gray-100 odd:hover:bg-gray-100{f:if(condition: '{iteration.cycle} > 5', then: ' hidden')}"
data-pricetable-target="row"> data-pricetable-target="row">
<td class="border-r border-gray-200 px-2 py-1 md:p-2"> <td class="border-r border-gray-200 px-2 py-1 md:p-2">
<f:if condition="{bookable} && {row.available} && {row.showBookingButton}"> <f:if condition="{bookable} && {row.available} && {row.showBookingButton}">
<f:then> <f:then>
<button type="button" <button type="button"
class="text-left text-ep-primary-light text-sm md:text-base" class="text-left text-ep-primary-light text-sm md:text-base"
data-action="product-details#loadPrices" data-action="product-details#loadPrices"
data-date-uid="{row.dateUid}"> data-date-uid="{row.dateUid}">
{row.dateStart} - {row.dateEnd} {row.dateStart} - {row.dateEnd}
</button> </button>
</f:then> </f:then>
<f:else> <f:else>
<span class="block text-sm md:text-base{f:if(condition: row.available, else: ' line-through')}"> <span class="block text-sm md:text-base{f:if(condition: row.available, else: ' line-through')}">
{row.dateStart} - {row.dateEnd} {row.dateStart} - {row.dateEnd}
</span> </span>
</f:else> </f:else>
</f:if>
</td>
<td class="border-r border-gray-200 px-2 py-1 md:p-2 text-center">
<span class="block text-sm md:text-base">
{row.nights}
</span>
</td>
<td class="border-r border-gray-200 px-2 p-1">
<div class="flex flex-wrap items-center">
<f:if condition="{row.busIncluded}">
<span class="block p-1"
data-cooltipz-dir="top"
aria-label="Busfahrt inklusive"
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>
</f:if> </f:if>
<f:if condition="{row.skipassIncluded}"> </td>
<span class="block p-1" <td class="border-r border-gray-200 px-2 py-1 md:p-2 text-center">
data-cooltipz-dir="top" <span class="block text-sm md:text-base">
aria-label="{f:if(condition: row.summer, then: 'Bergbahnticket inklusive', else: 'Skipass inklusive')}" {row.nights}
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>
</f:if>
<button type="button"
class="text-ep-primary-light col-span-2 text-sm md:text-base text-left leading-none whitespace-nowrap p-1"
data-action="pricetable#openModal"
data-type="services"
data-uid="{row.dateUid}"
data-cooltipz-dir="top"
aria-label="Alle Inklusivleistungen anzeigen">
Leistungen
</button>
</div>
</td>
<td class="border-r border-gray-200 px-2 py-1 md:p-2 text-center">
<f:if condition="{row.pseudoPrice}">
<span class="block text-sm line-through">
{row.pseudoPrice} €
</span> </span>
</f:if> </td>
<span class="font-bold normal-case text-sm md:text-base whitespace-nowrap" <td class="border-r border-gray-200 px-2 p-1">
data-pricetable-target="price" <div class="flex flex-wrap items-center">
data-room="{row.minPrice}" <f:if condition="{row.busIncluded}">
data-bus="{row.busPrice}" <span class="block p-1"
data-discount="{row.discount}"> data-cooltipz-dir="top"
{row.minPrice} aria-label="Busfahrt inklusive"
</span> role="tooltip"
</td> data-pricetable-target="busIcon"
<td class="px-2 py-1 md:p-2 text-center"> data-bus-included="{row.busIncluded}"
<f:if condition="{row.showBookingButton}"> data-bus-price="{row.busPrice}">
<f:then> <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>
</f:if>
<f:if condition="{row.skipassIncluded}">
<span class="block p-1"
data-cooltipz-dir="top"
aria-label="{f:if(condition: row.summer, then: 'Bergbahnticket inklusive', else: 'Skipass inklusive')}"
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>
</f:if>
<button type="button" <button type="button"
class="flex space-x-1 items-center {f:if(condition: row.available, then: 'text-ep-primary-light', else: 'text-gray-300')}" class="text-ep-primary-light col-span-2 text-sm md:text-base text-left leading-none whitespace-nowrap p-1"
data-action="product-details#loadPrices" data-action="pricetable#openModal"
data-date-uid="{row.dateUid}"> data-type="services"
<svg class="w-6 h-6 hidden md:block"> data-uid="{row.dateUid}"
<use href="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/icons_sprite.svg')}#icon-arrow-circle-right"></use> data-cooltipz-dir="top"
</svg> aria-label="Alle Inklusivleistungen anzeigen">
<span class="font-bold text-xs md:text-sm uppercase"> Leistungen
Infos &amp; buchen
</span>
</button> </button>
</f:then> </div>
<f:else> </td>
<a href="{f:uri.typolink(parameter: settings.travelAlertPageUid)}" <td class="border-r border-gray-200 px-2 py-1 md:p-2 text-center">
title="Reisen-Alert" <f:if condition="{row.pseudoPrice}">
class="flex space-x-1 items-center text-ep-primary-light"> <span class="block text-sm line-through">
<svg class="w-6 h-6 hidden md:block"> {row.pseudoPrice} €
<use href="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/icons_sprite.svg')}#icon-arrow-circle-right"></use> </span>
</svg> </f:if>
<span class="font-bold text-xs md:text-sm uppercase"> <span class="font-bold normal-case text-sm md:text-base whitespace-nowrap"
Reisen-Alert data-pricetable-target="price"
</span> data-room="{row.minPrice}"
</a> data-bus="{row.busPrice}"
</f:else> data-discount="{row.discount}">
</f:if> {row.minPrice}
</td> </span>
</tr> </td>
</f:for> <td class="px-2 py-1 md:p-2 text-center">
</tbody> <f:if condition="{row.showBookingButton}">
</table> <f:then>
<button type="button"
class="flex space-x-1 items-center {f:if(condition: row.available, then: 'text-ep-primary-light', else: 'text-gray-300')}"
data-action="product-details#loadPrices"
data-date-uid="{row.dateUid}">
<svg class="w-6 h-6 hidden md:block">
<use href="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/icons_sprite.svg')}#icon-arrow-circle-right"></use>
</svg>
<span class="font-bold text-xs md:text-sm uppercase">
Infos &amp; buchen
</span>
</button>
</f:then>
<f:else>
<a href="{f:uri.typolink(parameter: settings.travelAlertPageUid)}"
title="Reisen-Alert"
class="flex space-x-1 items-center text-ep-primary-light">
<svg class="w-6 h-6 hidden md:block">
<use href="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/icons_sprite.svg')}#icon-arrow-circle-right"></use>
</svg>
<span class="font-bold text-xs md:text-sm uppercase">
Reisen-Alert
</span>
</a>
</f:else>
</f:if>
</td>
</tr>
</f:for>
</tbody>
</table>
<ul class="divide-y divide-gray-200"> <ul class="divide-y divide-gray-200">
<f:if condition="{hasSurcharge}"> <f:if condition="{hasSurcharge}">
<li class="py-2"> <li class="py-2">
<button type="button" <button type="button"
data-action="pricetable#toggleSurcharge" data-action="pricetable#toggleSurcharge"
class="flex items-center space-x-1 focus:outline-none text-ep-primary-light"> class="flex items-center space-x-1 focus:outline-none text-ep-primary-light">
<svg class="w-6 h-6"> <svg class="w-6 h-6">
<use href="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/icons_sprite.svg')}#icon-arrow-circle-right"></use> <use href="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/icons_sprite.svg')}#icon-arrow-circle-right"></use>
</svg> </svg>
<span data-pricetable-target="surchargeToggleLabel" <span data-pricetable-target="surchargeToggleLabel"
data-label-default="Preise für Eigenanreise anzeigen" data-label-default="Preise für Eigenanreise anzeigen"
data-label-alt="Preise für Busanreise anzeigen"> data-label-alt="Preise für Busanreise anzeigen">
Preise für Eigenanreise anzeigen Preise für Eigenanreise anzeigen
</span> </span>
</button> </button>
</li> </li>
</f:if> </f:if>
<f:if condition="{hasDiscount}"> <f:if condition="{hasDiscount}">
<li class="py-2"> <li class="py-2">
<button type="button" <button type="button"
data-action="pricetable#toggleDiscount" data-action="pricetable#toggleDiscount"
class="flex items-center space-x-1 focus:outline-none text-ep-primary-light"> class="flex items-center space-x-1 focus:outline-none text-ep-primary-light">
<svg class="w-6 h-6"> <svg class="w-6 h-6">
<use href="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/icons_sprite.svg')}#icon-arrow-circle-right"></use> <use href="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/icons_sprite.svg')}#icon-arrow-circle-right"></use>
</svg> </svg>
<span data-pricetable-target="discountToggleLabel" <span data-pricetable-target="discountToggleLabel"
data-label-default="Preise für Busanreise anzeigen" data-label-default="Preise für Busanreise anzeigen"
data-label-alt="Preise für Eigenanreise anzeigen"> data-label-alt="Preise für Eigenanreise anzeigen">
Preise für Busanreise anzeigen Preise für Busanreise anzeigen
</span> </span>
</button> </button>
</li> </li>
</f:if> </f:if>
<f:if condition="{dates -> f:count()} > 5"> <f:if condition="{dates -> f:count()} > 5">
<li class="py-2"> <li class="py-2">
<button type="button" <button type="button"
class="flex items-center space-x-1 focus:outline-none text-ep-primary-light" class="flex items-center space-x-1 focus:outline-none text-ep-primary-light"
data-action="pricetable#toggleRows"> data-action="pricetable#toggleRows">
<svg class="w-6 h-6"> <svg class="w-6 h-6">
<use href="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/icons_sprite.svg')}#icon-plus-circle" <use href="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/icons_sprite.svg')}#icon-plus-circle"
data-pricetable-target="rowToggleIcon"></use> data-pricetable-target="rowToggleIcon"></use>
</svg> </svg>
<span data-pricetable-target="rowToggleLabel"> <span data-pricetable-target="rowToggleLabel">
Alle Termine anzeigen Alle Termine anzeigen
</span> </span>
</button> </button>
</li> </li>
</f:if> </f:if>
<f:if condition="{altProductLink}"> <f:if condition="{altProductLink}">
<li class="py-2"> <li class="py-2">
<a href="{altProductLink}" <a href="{altProductLink}"
title="{altLabel}" title="{altLabel}"
class="flex items-center space-x-1 focus:outline-none text-ep-primary-light"> class="flex items-center space-x-1 focus:outline-none text-ep-primary-light">
<svg class="w-6 h-6"> <svg class="w-6 h-6">
<use href="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/icons_sprite.svg')}#icon-arrow-circle-right"></use> <use href="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/icons_sprite.svg')}#icon-arrow-circle-right"></use>
</svg> </svg>
<span> <span>
{altLabel} {altLabel}
</span> </span>
</a> </a>
</li> </li>
</f:if> </f:if>
</ul> </ul>
</f:if>
</div> </div>
<div class="hidden fixed inset-0 w-full h-full z-50" <div class="hidden fixed inset-0 w-full h-full z-50"