From 1c412bbe28c054ae8f379ae967021f99fcdea52a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Fri, 28 Feb 2025 11:26:29 +0100 Subject: [PATCH] fix: adopt changes in price calculator to email --- .../Controller/AjaxGroupsPriceController.php | 8 ++-- ...roducts_domain_model_groupspriceconfig.php | 2 - .../js/components/GroupsPriceCalculator.vue | 37 ++++++++++--------- .../Resources/Private/Language/locallang.xlf | 4 +- .../Private/Templates/Email/GroupsPrice.html | 2 +- 5 files changed, 26 insertions(+), 27 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php index 96f9ba2a..9e22f84b 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php @@ -87,7 +87,10 @@ class AjaxGroupsPriceController extends ActionController ]; try { - $selectedOptions = $this->groupsPriceOptionRepository->findByUids($groupsPriceInquiry->getOptions()); + $options = $this->groupsPriceOptionRepository->findByUids($groupsPriceInquiry->getOptions()); + $selectedOptions = array_map(function ($option) { + return $option->getTitle(); + }, $options); } catch (InvalidQueryException $e) { $selectedOptions = []; @@ -105,9 +108,6 @@ class AjaxGroupsPriceController extends ActionController 'dateFrom' => $groupsPriceInquiry->getDateFrom(), 'dateTo' => $groupsPriceInquiry->getDateTo(), 'pax' => $groupsPriceInquiry->getPax(), - 'paxGroup1' => $groupsPriceInquiry->getPaxGroup1(), - 'paxGroup2' => $groupsPriceInquiry->getPaxGroup2(), - 'paxGroup3' => $groupsPriceInquiry->getPaxGroup3(), 'options' => $selectedOptions, 'board' => $groupsPriceInquiry->getBoard(), 'summary' => $groupsPriceInquiry->getSummary(), diff --git a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groupspriceconfig.php b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groupspriceconfig.php index 68328b08..1cd229f5 100644 --- a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groupspriceconfig.php +++ b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groupspriceconfig.php @@ -166,7 +166,6 @@ return [ 'price_additional_person' => [ 'exclude' => false, 'label' => 'Preis weitere Person', - 'description' => 'ohne Jokercard, alle Altersgruppen', 'config' => [ 'type' => 'input', 'size' => 8, @@ -176,7 +175,6 @@ return [ 'price_additional_person_chf' => [ 'exclude' => false, 'label' => 'Preis weitere Person in CHF', - 'description' => 'ohne Jokercard, alle Altersgruppen', 'config' => [ 'type' => 'input', 'size' => 8, diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue index 2a9aee95..13dc8c1a 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue @@ -83,32 +83,32 @@ {{ formatCurrency(pricePax.base) }} + v-if="pricePax.additional.EUR > 0 || pricePax.additional.CHF > 0"> Aufpreis Personenzahl {{ formatCurrency(pricePax.additional) }} + v-if="priceShortTerm.EUR > 0 || priceShortTerm.CHF > 0"> Aufpreis Kurzzeit {{ formatCurrency(priceShortTerm) }} - Zusatzleistungen - {{ formatCurrency(priceOptions) }} + v-for="selectedOption in selectedOptions"> + {{ selectedOption.title }} + {{ formatCurrency(optionPrice(selectedOption)) }} + v-if="priceBoard.EUR > 0 || priceBoard.CHF > 0"> Verpflegung {{ formatCurrency(priceBoard) }} + v-if="pricePax.undersubscription.EUR > 0 || pricePax.undersubscription.CHF > 0"> Kleingruppen-Verpflegungszuschlag {{ formatCurrency(pricePax.undersubscription) }} + v-if="priceRunningCosts.EUR > 0 || priceRunningCosts.CHF > 0"> Strom- und Abfallgebühren {{ formatCurrency(priceRunningCosts) }} @@ -143,7 +143,7 @@ v-show="formErrors.name" v-html="formErrors.name"> -
+
@@ -370,6 +370,14 @@ export default { return ` (${this.formatCurrency(option.price)})` }, + optionPrice(option) { + let factor = true === option.ignoreWithBoard && this.selectedBoard ? -1 : 1 + + return { + EUR: option.price.EUR * factor, + CHF: option.price.CHF * factor, + } + }, initSelectableRanges() { let enabledDates = []; for (let config of this.configs) { @@ -417,7 +425,7 @@ export default { 'tx_epproducts_ajax[groupsPriceInquiry][summary][paxAdditional]': this.formatCurrency(this.pricePax.additional), 'tx_epproducts_ajax[groupsPriceInquiry][summary][undersubscription]': this.formatCurrency(this.pricePax.undersubscription), 'tx_epproducts_ajax[groupsPriceInquiry][summary][shortTerm]': this.formatCurrency(this.priceShortTerm), - 'tx_epproducts_ajax[groupsPriceInquiry][summary][options]': this.priceOptions, + 'tx_epproducts_ajax[groupsPriceInquiry][summary][options]': this.formatCurrency(this.priceOptions), 'tx_epproducts_ajax[groupsPriceInquiry][summary][board]': this.formatCurrency(this.priceBoard), 'tx_epproducts_ajax[groupsPriceInquiry][summary][runningCosts]': this.formatCurrency(this.priceRunningCosts), 'tx_epproducts_ajax[groupsPriceInquiry][summary][total]': this.formatCurrency(this.priceTotal), @@ -550,16 +558,9 @@ export default { return price }, priceRunningCosts() { - let CHF = 0 - - // calculate CHF price when pax price in CHF is available since CHF prices may not be provided via CMS yet - if (0 < this.pricePax.base.CHF) { - CHF = this.nightsCount * this.selectedPax * this.runningCostsFactorChf - } - return { EUR: this.nightsCount * this.selectedPax * this.runningCostsFactorEur, - CHF + CHF: this.nightsCount * this.selectedPax * this.runningCostsFactorChf, } }, priceTotal() { diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Language/locallang.xlf b/public/typo3conf/ext/ep_theme/Resources/Private/Language/locallang.xlf index 4210b9e1..7f02300e 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Language/locallang.xlf +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Language/locallang.xlf @@ -84,10 +84,10 @@ Bitte angeben - + Bitte angeben - + Bitte angeben diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Email/GroupsPrice.html b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Email/GroupsPrice.html index 89960989..7a9ba2cf 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Email/GroupsPrice.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Email/GroupsPrice.html @@ -74,7 +74,7 @@
    -
  • {option.title}
  • +
  • {option}