fix: incorrect calculation of undersubscription costs

This commit is contained in:
Björn Fromme
2025-05-28 09:54:58 +02:00
parent f5f12d94a9
commit 14d4fa02b5
3 changed files with 65 additions and 20 deletions
@@ -412,14 +412,14 @@ export default {
childrenCount: 0,
selectedOptions: [],
selectedBoard: null,
name: null,
email: null,
phone: null,
remarks: null,
group: null,
street: null,
postcode: null,
city: null,
name: '',
email: '',
phone: '',
remarks: '',
group: '',
street: '',
postcode: '',
city: '',
mode: 'booking',
confirmation: false,
termsUrls: {
@@ -569,6 +569,17 @@ export default {
},
},
computed: {
isSelfCatering() {
let selectedBoard = this.selectedBoard
if (null === selectedBoard) {
return false
}
if ('CH' === this.countryCode) {
return selectedBoard.price.CHF === 0
} else {
return selectedBoard.price.EUR === 0
}
},
paxCount() {
// subtract number of children from pax for price calculation, but minimum 30 pax
return Math.max(this.selectedPax - this.childrenCount, 30)
@@ -613,10 +624,10 @@ export default {
}
}
}
if (this.selectedBoard && this.paxCount < 40) {
if (false === this.isSelfCatering && this.paxCount < 40) {
undersubscription.EUR = this.paxCount * this.undersubscription30Eur * this.selectedRange.length
undersubscription.CHF = this.paxCount * this.undersubscription30Chf * this.selectedRange.length
} else if (this.selectedBoard && this.paxCount < 50) {
} else if (false === this.isSelfCatering && this.paxCount < 50) {
undersubscription.EUR = this.paxCount * this.undersubscription40Eur * this.selectedRange.length
undersubscription.CHF = this.paxCount * this.undersubscription40Chf * this.selectedRange.length
}
@@ -264,6 +264,10 @@
font-weight:normal;
text-decoration:underline;
}
table.data th,
table.data td {
vertical-align: top;
}
@media only screen and (min-width:768px){
.templateContainer {
width:600px !important;
@@ -13,7 +13,7 @@
<h1>Anfrage Gruppenhaus vom <f:format.date date="now" format="d.m.y" /></h1>
</f:else>
</f:if>
<table>
<table class="data">
<tr>
<th>
Art
@@ -94,25 +94,55 @@
</f:for>
</ul>
</f:then>
<f:else>
-
</f:else>
</f:if>
</td>
</tr>
<tr>
<th>Kostenübersicht</th>
<td>
Grundpreis: {summary.paxBase}<br>
Aufpreis Personen: {summary.paxAdditional -> v:or(alternative: '-')}<br>
Verpflegung: {summary.board -> v:or(alternative: '-')}<br>
Kleingruppen-Verpflegungszuschlag: {summary.undersubscription -> v:or(alternative: '-')}<br>
Aufpreis Kurzzeit: {summary.shortTerm -> v:or(alternative: '-')}<br>
Zusatzleistungen: {summary.options}<br>
Strom- und Abfallgebühren: {summary.runningCosts -> v:or(alternative: '-')}<br>
<strong>Gesamtpreis: {summary.total}</strong>
<ul>
<li>
Grundpreis: {summary.paxBase}
</li>
<li>
Aufpreis Personen: {summary.paxAdditional -> v:or(alternative: '-')}
</li>
<li>
Verpflegung: {summary.board -> v:or(alternative: '-')}
</li>
<li>
Kleingruppen-Verpflegungszuschlag: {summary.undersubscription -> v:or(alternative: '-')}
</li>
<li>
Aufpreis Kurzzeit: {summary.shortTerm -> v:or(alternative: '-')}
</li>
<li>
Zusatzleistungen: {summary.options}
</li>
<li>
Strom- und Abfallgebühren: {summary.runningCosts -> v:or(alternative: '-')}
</li>
<li>
<strong>Gesamtpreis: {summary.total}</strong>
</li>
</ul>
</td>
</tr>
<tr>
<th>Bemerkungen/Wünsche</th>
<td>{remarks -> v:or(alternative: '-') -> f:format.nl2br()}</td>
<td>
<f:if condition="{remarks}">
<f:then>
{remarks -> f:format.nl2br()}
</f:then>
<f:else>
-
</f:else>
</f:if>
</td>
</tr>
</table>
</f:section>