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, childrenCount: 0,
selectedOptions: [], selectedOptions: [],
selectedBoard: null, selectedBoard: null,
name: null, name: '',
email: null, email: '',
phone: null, phone: '',
remarks: null, remarks: '',
group: null, group: '',
street: null, street: '',
postcode: null, postcode: '',
city: null, city: '',
mode: 'booking', mode: 'booking',
confirmation: false, confirmation: false,
termsUrls: { termsUrls: {
@@ -569,6 +569,17 @@ export default {
}, },
}, },
computed: { 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() { paxCount() {
// subtract number of children from pax for price calculation, but minimum 30 pax // subtract number of children from pax for price calculation, but minimum 30 pax
return Math.max(this.selectedPax - this.childrenCount, 30) 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.EUR = this.paxCount * this.undersubscription30Eur * this.selectedRange.length
undersubscription.CHF = this.paxCount * this.undersubscription30Chf * 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.EUR = this.paxCount * this.undersubscription40Eur * this.selectedRange.length
undersubscription.CHF = this.paxCount * this.undersubscription40Chf * this.selectedRange.length undersubscription.CHF = this.paxCount * this.undersubscription40Chf * this.selectedRange.length
} }
@@ -264,6 +264,10 @@
font-weight:normal; font-weight:normal;
text-decoration:underline; text-decoration:underline;
} }
table.data th,
table.data td {
vertical-align: top;
}
@media only screen and (min-width:768px){ @media only screen and (min-width:768px){
.templateContainer { .templateContainer {
width:600px !important; width:600px !important;
@@ -13,7 +13,7 @@
<h1>Anfrage Gruppenhaus vom <f:format.date date="now" format="d.m.y" /></h1> <h1>Anfrage Gruppenhaus vom <f:format.date date="now" format="d.m.y" /></h1>
</f:else> </f:else>
</f:if> </f:if>
<table> <table class="data">
<tr> <tr>
<th> <th>
Art Art
@@ -94,25 +94,55 @@
</f:for> </f:for>
</ul> </ul>
</f:then> </f:then>
<f:else>
-
</f:else>
</f:if> </f:if>
</td> </td>
</tr> </tr>
<tr> <tr>
<th>Kostenübersicht</th> <th>Kostenübersicht</th>
<td> <td>
Grundpreis: {summary.paxBase}<br> <ul>
Aufpreis Personen: {summary.paxAdditional -> v:or(alternative: '-')}<br> <li>
Verpflegung: {summary.board -> v:or(alternative: '-')}<br> Grundpreis: {summary.paxBase}
Kleingruppen-Verpflegungszuschlag: {summary.undersubscription -> v:or(alternative: '-')}<br> </li>
Aufpreis Kurzzeit: {summary.shortTerm -> v:or(alternative: '-')}<br> <li>
Zusatzleistungen: {summary.options}<br> Aufpreis Personen: {summary.paxAdditional -> v:or(alternative: '-')}
Strom- und Abfallgebühren: {summary.runningCosts -> v:or(alternative: '-')}<br> </li>
<strong>Gesamtpreis: {summary.total}</strong> <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> </td>
</tr> </tr>
<tr> <tr>
<th>Bemerkungen/Wünsche</th> <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> </tr>
</table> </table>
</f:section> </f:section>