Merge branch 'hotfix/grups-price-fix' into develop

This commit is contained in:
Björn Fromme
2021-08-23 17:15:03 +02:00
2 changed files with 26 additions and 14 deletions
@@ -143,7 +143,7 @@ class GroupsPriceConfig extends AbstractEntity implements \JsonSerializable
/**
* @return float
*/
public function getPriceAdditionalPerson(): float
public function getPriceAdditionalPerson(): ?float
{
return $this->priceAdditionalPerson;
}
@@ -159,7 +159,7 @@ class GroupsPriceConfig extends AbstractEntity implements \JsonSerializable
/**
* @return float
*/
public function getPriceAdditionalPersonGroup1(): float
public function getPriceAdditionalPersonGroup1(): ?float
{
return $this->priceAdditionalPersonGroup1;
}
@@ -175,7 +175,7 @@ class GroupsPriceConfig extends AbstractEntity implements \JsonSerializable
/**
* @return float
*/
public function getPriceAdditionalPersonGroup2(): float
public function getPriceAdditionalPersonGroup2(): ?float
{
return $this->priceAdditionalPersonGroup2;
}
@@ -191,7 +191,7 @@ class GroupsPriceConfig extends AbstractEntity implements \JsonSerializable
/**
* @return float
*/
public function getPriceAdditionalPersonGroup3(): float
public function getPriceAdditionalPersonGroup3(): ?float
{
return $this->priceAdditionalPersonGroup3;
}
@@ -36,13 +36,13 @@
</div>
<div class="form-group" v-show="boards.length > 0 && !submitted">
<label>Optionale Verpflegungsleistungen</label>
<select class="form-control" v-model="selectedBoard" v-if="selectedPax >= 30">
<select class="form-control" v-model="selectedBoard" v-if="totalPax >= 30">
<option :value="null">Keine Auswahl</option>
<option v-for="board of boards" :value="board" :key="board.uid">{{ board.title }}
({{ formatCurrency(board.price) }} pro Person und Nacht)
</option>
</select>
<div v-show="selectedPax < 30">
<div v-show="totalPax < 30">
<span class="label label-warning">Erst ab 30 Personen buchbar.</span>
</div>
</div>
@@ -170,7 +170,20 @@ export default {
options: {
type: Array,
required: true
}
},
runningCostsFactor: {
type: Number,
default: 1.7,
},
shortTermFactors: {
type: Object,
default() {
return {
2: 0.2,
3: 0.1,
}
}
},
},
data() {
return {
@@ -239,7 +252,7 @@ export default {
this.selectedRange = range;
},
onPaxUpdated() {
if (this.selectedPax < 30) {
if (this.totalPax < 30) {
this.selectedBoard = null;
}
},
@@ -371,11 +384,10 @@ export default {
priceShortTerm() {
let price = 0;
const totalPricePax = (this.pricePax.base + this.pricePax.additional);
if (2 === this.nightsCount) {
price = totalPricePax * 0.2;
}
if (3 === this.nightsCount) {
price = totalPricePax * 0.1;
for (let [nights, factor] of Object.entries(this.shortTermFactors)) {
if (nights === this.nightsCount) {
price = totalPricePax * factor;
}
}
return price;
},
@@ -383,7 +395,7 @@ export default {
if (this.selectedBoard) {
return 0;
}
return this.nightsCount * this.totalPax * 1.7;
return this.nightsCount * this.totalPax * this.runningCostsFactor;
},
priceTotal() {
return this.pricePax.base + this.pricePax.additional + this.priceOptions