From d97a614b68f1b66a7c58d86823da063bc74265b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Tue, 25 Feb 2025 08:18:32 +0100 Subject: [PATCH] feat: make groups price calculator not rely on CHF prices --- .../js/components/GroupsPriceCalculator.vue | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) 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 e3c0a42c..3cf5bbf6 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 @@ -358,7 +358,7 @@ export default { formatCurrency({ EUR, CHF }) { let price = parseFloat(EUR).toFixed(2).replace(/\./, ',') + ' €' - if ('CH' === this.countryCode && null !== CHF) { + if ('CH' === this.countryCode && 0 < CHF) { price += `/${parseFloat(CHF).toFixed(2).replace(/\./, ',')} CHF` } @@ -598,9 +598,16 @@ 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.totalPax * this.runningCostsFactorChf + } + return { EUR: this.nightsCount * this.totalPax * this.runningCostsFactorEur, - CHF: this.nightsCount * this.totalPax * this.runningCostsFactorChf + CHF } }, priceTotal() { @@ -612,13 +619,19 @@ export default { + this.priceShortTerm.EUR + this.priceRunningCosts.EUR - let totalCHF = this.pricePax.base.CHF - + this.pricePax.additional.CHF - + this.pricePax.undersubscription.CHF - + this.priceOptions.CHF - + this.priceBoard.CHF - + this.priceShortTerm.CHF - + this.priceRunningCosts.CHF + let totalCHF = 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) { + totalCHF = this.pricePax.base.CHF + + this.pricePax.additional.CHF + + this.pricePax.undersubscription.CHF + + this.priceOptions.CHF + + this.priceBoard.CHF + + this.priceShortTerm.CHF + + this.priceRunningCosts.CHF + } + return { EUR: totalEUR,