Enable limiting of dates on detail pages according to teasers

This commit is contained in:
Björn Fromme
2020-02-15 17:26:08 +01:00
parent a130eca733
commit f58d503529
13 changed files with 109 additions and 75 deletions
@@ -78,6 +78,14 @@
daytrip: {
type: Number,
default: 0
},
dateFrom: {
type: String,
default: null
},
dateTo: {
type: String,
default: null
}
},
computed: {
@@ -91,12 +99,15 @@
this.datesShow = true;
this.priceTableShow = false;
this.detailShow = false;
const data = $.param({
'tx_epproducts_ajax[paCode]': this.$store.state.config.paCode,
'tx_epproducts_ajax[dateFrom]': this.dateFrom,
'tx_epproducts_ajax[dateTo]': this.dateTo
});
axios({
url: this.uris['dates'],
method: 'post',
data: {
paCode: this.$store.state.config.paCode
}
data: data
}).then(response => {
const json = response.data;
if (json.dates.length === 1) {
@@ -6,30 +6,9 @@
<f:section name="Teaser">
<div class="teaserbox teaserbox--product teaserbox--flippable">
<f:if condition="{teaser.forceHotelUid}">
<f:then>
<f:link.action
pageUid="{teaser.product.detailPage}"
action="detail"
controller="Product"
arguments="{product: teaser.product.uid, hotel: teaser.hotel.uid}"
extensionName="epproducts"
pluginName="product_detail"
class="teaserbox__flip"
title="{teaser.product.name}">
<f:render section="Inner" arguments="{_all}"/>
</f:link.action>
</f:then>
<f:else>
<f:variable name="teaserUrl" value="{f:uri.typolink(parameter: teaser.product.detailPage)}"/>
<f:if condition="{slug}">
<f:variable name="teaserUrl" value="{teaserUrl}{slug}/"/>
</f:if>
<a href="{teaserUrl}" class="teaserbox__flip" title="{teaser.product.name}">
<f:render section="Inner" arguments="{_all}"/>
</a>
</f:else>
</f:if>
<a href="{ep:uri.product(forceHotelUid: teaser.forceHotelUid, product: teaser.product, hotel: teaser.hotel, dateFrom: dateFrom, dateTo: dateTo, slug: slug)}" class="teaserbox__flip" title="{teaser.product.name}">
<f:render section="Inner" arguments="{_all}"/>
</a>
</div>
</f:section>
@@ -5,17 +5,7 @@
xmlns:f="http://typo3.org/ns/fluid/ViewHelpers">
<f:section name="Teaser">
<f:if condition="{teaser.forceHotelUid}">
<f:then>
<f:variable name="teaserUrl" value="{f:uri.action(pageUid: teaser.product.detailPage, action: 'detail', controller: 'Product', arguments: '{product: teaser.product.uid, hotel: teaser.hotel.uid}', extensionName: 'epproducts', pluginName: 'product_detail')}"/>
</f:then>
<f:else>
<f:variable name="teaserUrl" value="{f:uri.typolink(parameter: teaser.product.detailPage)}"/>
<f:if condition="{slug}">
<f:variable name="teaserUrl" value="{teaserUrl}{slug}/"/>
</f:if>
</f:else>
</f:if>
{ep:uri.product(forceHotelUid: teaser.forceHotelUid, product: teaser.product, hotel: teaser.hotel, dateFrom: dateFrom, dateTo: dateTo, slug: slug) -> f:variable(name: 'teaserUrl')}
<f:render section="Inner" arguments="{_all}"/>
</f:section>
@@ -20,6 +20,8 @@
:bus-pro-id="{product.busProId -> f:format.raw()}"
name-internal="{product.nameInternal -> f:format.raw()}"
:daytrip="{product.daytrip -> v:variable.convert(type: 'int')}"
date-from="{dateFrom}"
date-to="{dateTo}"
inline-template>
<article>
<f:render partial="Product/HeaderDetail" arguments="{_all}"/>
@@ -12,11 +12,11 @@
<f:for each="{teasers}" as="teaser">
<f:if condition="{settings.layout} == 'rows'">
<f:then>
<f:render partial="Product/TeaserWide" section="Teaser" arguments="{teaser: teaser}"/>
<f:render partial="Product/TeaserWide" section="Teaser" arguments="{teaser: teaser, dateFrom: dateFrom, dateTo: dateTo}"/>
</f:then>
<f:else>
<div class="col-md-3">
<f:render partial="Product/Teaser" section="Teaser" arguments="{teaser: teaser}"/>
<f:render partial="Product/Teaser" section="Teaser" arguments="{teaser: teaser, dateFrom: dateFrom, dateTo: dateTo}"/>
</div>
</f:else>
</f:if>