Add 'Reisen-Alert' button in place of booking button when hidden

This commit is contained in:
Björn Fromme
2020-03-05 12:59:28 +01:00
parent 734946d3c7
commit 6c5ea3956a
8 changed files with 35 additions and 5 deletions
@@ -102,12 +102,15 @@ class DateService implements SingletonInterface
$filterSettings = $this->filterService->getDefaultFilterSettings();
}
$nonBookableDateUids = $this->productRepository->getNonBookableDateUids($product);
return $this->preprocessPriceTable([
'priceTableData' => $this->productRepository->getPricetable($product, $hotel, $filterSettings, $date),
'template' => $template,
'paCode' => $paCode,
'isDayTrip' => $product->isDaytrip(),
'isHideBookingButton' => $product->getHideBookingButton(),
'nonBookableDateUids' => $nonBookableDateUids,
]);
}
@@ -271,7 +274,7 @@ class DateService implements SingletonInterface
public function preprocessPriceTable(array $options)
{
$resolver = new OptionsResolver();
$resolver->setDefined(['paCode', 'isDayTrip', 'isHideBookingButton']);
$resolver->setDefined(['paCode', 'isDayTrip', 'isHideBookingButton', 'nonBookableDateUids']);
$resolver->setRequired(['priceTableData', 'template']);
$resolver->setDefault('isDayTrip', false);
$resolver->setDefault('isHideBookingButton', false);
@@ -282,10 +285,12 @@ class DateService implements SingletonInterface
$template = $resolvedOptions['template'];
$paCode = $resolvedOptions['paCode'];
$isDayTrip = $resolvedOptions['isDayTrip'];
$isHideBookingButton = $resolvedOptions['isHideBookingButton'];
$nonBookableDateUids = $resolvedOptions['nonBookableDateUids'];
foreach ($priceTableData as $row)
{
$isHideBookingButton = $resolvedOptions['isHideBookingButton'] || in_array($row['dateUid'], $nonBookableDateUids, false);
$dateStart = new \DateTime($row['dateStart']);
$dateEnd = new \DateTime($row['dateEnd']);
$bookingUrl = BookingUrlUtility::generateUrl([
@@ -40,6 +40,7 @@ plugin.tx_epproducts {
googleMapsApiKey = {$plugin.tx_eptheme.settings.googleMapsApiKey}
resellerExportPageUid = {$plugin.tx_epproducts.settings.resellerExportPageUid}
ratingPageUid = {$plugin.tx_eptheme.settings.ratingPageUid}
travelAlertPageUid = {$plugin.tx_eptheme.settings.travelAlertPageUid}
searchPageHeaderImage = {$plugin.tx_eptheme.settings.searchPageHeaderImage}
bpnBookingUrlTemplateCode = {$plugin.tx_eptheme.settings.bpnBookingUrlTemplateCode}
groupsPricePopupPageUid = {$plugin.tx_eptheme.settings.groupsPricePopupPageUid}
@@ -60,6 +60,8 @@ plugin.tx_eptheme {
bookingLinksPid =
# cat=eptheme/200/330; type=string; label=Groups price popup page UID
groupsPricePopupPageUid =
# cat=eptheme/200/340; type=string; label='Reisen Alert' page UID
travelAlertPageUid =
# cat=eptheme/400/100; type=string; label=Phone number general
phoneNumber = 0221 - 272 276 0
@@ -89,6 +89,7 @@ plugin.tx_eptheme {
englishPageUid = {$plugin.tx_eptheme.settings.englishPageUid}
germanPageUid = {$plugin.tx_eptheme.settings.germanPageUid}
conceptsPageUid = {$plugin.tx_eptheme.settings.conceptsPageUid}
travelAlertPageUid = {$plugin.tx_eptheme.settings.travelAlertPageUid}
myEpPageUid = {$plugin.tx_eptheme.settings.myEpPageUid}
myEpApiEndpointUrl = {$plugin.tx_eptheme.settings.myEpApiEndpointUrl}
myEpApiToken = {$plugin.tx_eptheme.settings.myEpApiToken}
@@ -73,6 +73,7 @@
<td class="dates-table__cell dates-table__cell--buttons hidden-xs">
<button v-if="row.available || row.isHideBookingButton" class="button button--small" @click="loadPriceTable(row.dateUid)">Details</button>
<a :href="row.bookingUrl" target="_blank" v-if="row.available && !row.isHideBookingButton" class="button button--small button--action">Buchen</a>
<a :href="travelAlertUrl" v-if="row.isHideBookingButton" class="button button--small button--mute">Reisen-Alert</a>
<span v-if="!row.available && !row.isHideBookingButton" class="label label-default">ausgebucht</span>
</td>
</tr>
@@ -143,6 +144,10 @@
showHeader: {
type: Boolean,
default: true
},
travelAlertUrl: {
type: String,
required: true
}
},
data () {
@@ -77,6 +77,8 @@
<td class="hidden-xs hidden-md">
<a class="button button--small button--action" v-if="row.roomAvailable && !row.isHideBookingButton"
:href="row.bookingUrl" target="_blank">Buchen</a>
<a class="button button--small button--mute" v-if="row.isHideBookingButton"
:href="travelAlertUrl">Reisen-Alert</a>
<span v-if="!row.roomAvailable && !row.isHideBookingButton" class="label label-default">ausgebucht</span>
</td>
</tr>
@@ -132,8 +134,12 @@
default: false
},
showHeader: {
typoe: Boolean,
type: Boolean,
default: true
},
travelAlertUrl: {
type: String,
required: true
}
},
data () {
@@ -78,6 +78,11 @@
color: white;
}
&--mute {
background-color: $color-grey-dark;
color: white;
}
.button-group &:not(:last-of-type) {
margin-right: 8px;
}
@@ -159,6 +159,7 @@
:alt-label="altLabel"
hotel-name="{hotel.name}"
:bookable="bookable"
travel-alert-url="{f:uri.typolink(parameter: settings.travelAlertPageUid)}"
></dates-table>
</template>
<f:if condition="{isProductWithNoInfoConcept}">
@@ -175,8 +176,12 @@
<!-- /Dates -->
<!-- Prices -->
<div v-cloak v-show="!loading && priceTableShow">
<price-table :price-table-rows="priceTableRows" :services-included="servicesIncluded"
:date-label="dateLabel" :single-date="singleDate"></price-table>
<price-table :price-table-rows="priceTableRows"
:services-included="servicesIncluded"
:date-label="dateLabel"
:single-date="singleDate"
travel-alert-url="{f:uri.typolink(parameter: settings.travelAlertPageUid)}"
></price-table>
<f:alias map="{currentPageUid: 1}">
<f:render partial="Product/Details" arguments="{_all}"/>
</f:alias>