feat: make groups price calculator not rely on CHF prices

This commit is contained in:
Björn Fromme
2025-02-25 08:18:32 +01:00
parent e4040033a8
commit d97a614b68
@@ -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,