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 }) { formatCurrency({ EUR, CHF }) {
let price = parseFloat(EUR).toFixed(2).replace(/\./, ',') + ' €' 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` price += `/${parseFloat(CHF).toFixed(2).replace(/\./, ',')} CHF`
} }
@@ -598,9 +598,16 @@ export default {
return price return price
}, },
priceRunningCosts() { 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 { return {
EUR: this.nightsCount * this.totalPax * this.runningCostsFactorEur, EUR: this.nightsCount * this.totalPax * this.runningCostsFactorEur,
CHF: this.nightsCount * this.totalPax * this.runningCostsFactorChf CHF
} }
}, },
priceTotal() { priceTotal() {
@@ -612,13 +619,19 @@ export default {
+ this.priceShortTerm.EUR + this.priceShortTerm.EUR
+ this.priceRunningCosts.EUR + this.priceRunningCosts.EUR
let totalCHF = this.pricePax.base.CHF let totalCHF = 0
+ this.pricePax.additional.CHF
+ this.pricePax.undersubscription.CHF // calculate CHF price when pax price in CHF is available since CHF prices may not be provided via CMS yet
+ this.priceOptions.CHF if (0 < this.pricePax.base.CHF) {
+ this.priceBoard.CHF totalCHF = this.pricePax.base.CHF
+ this.priceShortTerm.CHF + this.pricePax.additional.CHF
+ this.priceRunningCosts.CHF + this.pricePax.undersubscription.CHF
+ this.priceOptions.CHF
+ this.priceBoard.CHF
+ this.priceShortTerm.CHF
+ this.priceRunningCosts.CHF
}
return { return {
EUR: totalEUR, EUR: totalEUR,