From fc42801c8ae8051087123666ef4038f0a50c131f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Mon, 9 Aug 2021 17:34:58 +0200 Subject: [PATCH] Add age range based prices to groups price config --- .../Controller/AjaxGroupsPriceController.php | 3 + .../Domain/Model/Dto/GroupsPriceInquiry.php | 64 +- .../Domain/Model/GroupsPriceConfig.php | 90 +++ ...roducts_domain_model_groupspriceconfig.php | 49 +- .../typo3conf/ext/ep_products/ext_tables.sql | 58 +- .../js/components/GroupsPriceCalculator.vue | 597 ++++++++++-------- .../Private/Templates/Email/GroupsPrice.html | 14 +- 7 files changed, 576 insertions(+), 299 deletions(-) diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php index bf04ce55..9503bf26 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php @@ -95,6 +95,9 @@ class AjaxGroupsPriceController extends ActionController 'dateFrom' => $groupsPriceInquiry->getDateFrom(), 'dateTo' => $groupsPriceInquiry->getDateTo(), 'pax' => $groupsPriceInquiry->getPax(), + 'paxGroup1' => $groupsPriceInquiry->getPaxGroup1(), + 'paxGroup2' => $groupsPriceInquiry->getPaxGroup2(), + 'paxGroup3' => $groupsPriceInquiry->getPaxGroup3(), 'options' => $selectedOptions, 'board' => $groupsPriceInquiry->getBoard(), 'summary' => $groupsPriceInquiry->getSummary(), diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Dto/GroupsPriceInquiry.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Dto/GroupsPriceInquiry.php index 32671e56..36d41d84 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Dto/GroupsPriceInquiry.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Dto/GroupsPriceInquiry.php @@ -66,10 +66,24 @@ class GroupsPriceInquiry /** * @var string - * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty") */ protected $pax; + /** + * @var string + */ + protected $paxGroup1; + + /** + * @var string + */ + protected $paxGroup2; + + /** + * @var string + */ + protected $paxGroup3; + /** * @var array */ @@ -197,6 +211,54 @@ class GroupsPriceInquiry $this->pax = $pax; } + /** + * @return string + */ + public function getPaxGroup1() + { + return $this->paxGroup1; + } + + /** + * @param string $paxGroup1 + */ + public function setPaxGroup1($paxGroup1) + { + $this->paxGroup1 = $paxGroup1; + } + + /** + * @return string + */ + public function getPaxGroup2() + { + return $this->paxGroup2; + } + + /** + * @param string $paxGroup2 + */ + public function setPaxGroup2($paxGroup2) + { + $this->paxGroup2 = $paxGroup2; + } + + /** + * @return string + */ + public function getPaxGroup3() + { + return $this->paxGroup3; + } + + /** + * @param string $paxGroup3 + */ + public function setPaxGroup3($paxGroup3) + { + $this->paxGroup3 = $paxGroup3; + } + /** * @return array */ diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php index e5ef594b..4a59d058 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/GroupsPriceConfig.php @@ -56,6 +56,26 @@ class GroupsPriceConfig extends AbstractEntity implements \JsonSerializable */ protected $priceAdditionalPerson; + /** + * @var float + */ + protected $priceAdditionalPersonGroup1; + + /** + * @var float + */ + protected $priceAdditionalPersonGroup2; + + /** + * @var float + */ + protected $priceAdditionalPersonGroup3; + + /** + * @var bool + */ + protected $bonusCardIncluded = false; + /** * @return \DateTime */ @@ -136,6 +156,70 @@ class GroupsPriceConfig extends AbstractEntity implements \JsonSerializable $this->priceAdditionalPerson = $priceAdditionalPerson; } + /** + * @return float + */ + public function getPriceAdditionalPersonGroup1(): float + { + return $this->priceAdditionalPersonGroup1; + } + + /** + * @param float $priceAdditionalPersonGroup1 + */ + public function setPriceAdditionalPersonGroup1(float $priceAdditionalPersonGroup1): void + { + $this->priceAdditionalPersonGroup1 = $priceAdditionalPersonGroup1; + } + + /** + * @return float + */ + public function getPriceAdditionalPersonGroup2(): float + { + return $this->priceAdditionalPersonGroup2; + } + + /** + * @param float $priceAdditionalPersonGroup2 + */ + public function setPriceAdditionalPersonGroup2(float $priceAdditionalPersonGroup2): void + { + $this->priceAdditionalPersonGroup2 = $priceAdditionalPersonGroup2; + } + + /** + * @return float + */ + public function getPriceAdditionalPersonGroup3(): float + { + return $this->priceAdditionalPersonGroup3; + } + + /** + * @param float $priceAdditionalPersonGroup3 + */ + public function setPriceAdditionalPersonGroup3(float $priceAdditionalPersonGroup3): void + { + $this->priceAdditionalPersonGroup3 = $priceAdditionalPersonGroup3; + } + + /** + * @return bool + */ + public function isBonusCardIncluded(): bool + { + return $this->bonusCardIncluded; + } + + /** + * @param bool $bonusCardIncluded + */ + public function setBonusCardIncluded(bool $bonusCardIncluded): void + { + $this->bonusCardIncluded = $bonusCardIncluded; + } + /** * @return array */ @@ -148,6 +232,12 @@ class GroupsPriceConfig extends AbstractEntity implements \JsonSerializable 'personsIncluded' => $this->getPersonsIncluded(), 'price' => $this->getPrice(), 'priceAdditionalPerson' => $this->getPriceAdditionalPerson(), + 'priceAdditionalPersonByGroup' => [ + 1 => $this->getPriceAdditionalPersonGroup1(), + 2 => $this->getPriceAdditionalPersonGroup2(), + 3 => $this->getPriceAdditionalPersonGroup3(), + ], + 'bonusCardIncluded' => $this->isBonusCardIncluded(), ]; } } diff --git a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groupspriceconfig.php b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groupspriceconfig.php index f66297d1..428a5a99 100644 --- a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groupspriceconfig.php +++ b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_groupspriceconfig.php @@ -25,16 +25,20 @@ return [ ], 'interface' => [ 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, date_from, date_to, - persons_included, price, price_additional_person', + persons_included, bonus_card_included, price, price_additional_person, + price_additional_person_group_1, price_additional_person_group_2, price_additional_person_group_3', ], 'types' => [ '1' => [ - 'showitem' => '--palette--;;dates, --palette--;;prices, persons_included', + 'showitem' => '--palette--;;dates, --palette--;;included, --palette--;;prices, --palette--;;prices_groups', ], ], 'palettes' => [ 'dates' => ['showitem' => 'date_from, date_to'], + 'included' => ['showitem' => 'bonus_card_included, persons_included'], 'prices' => ['showitem' => 'price, price_additional_person'], + 'prices_groups' => ['showitem' => 'price_additional_person_group_1, price_additional_person_group_2, + --linebreak--, price_additional_person_group_3'], ], 'columns' => [ @@ -50,6 +54,7 @@ return [ ['LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', -1], ['LLL:EXT:lang/Resources/Private/Language/locallang_general.xlf:LGL.default_value', 0] ], + 'default' => -1, ], ], 'l10n_parent' => [ @@ -166,11 +171,49 @@ return [ 'price_additional_person' => [ 'exclude' => false, 'label' => 'Preis weitere Person', + 'description' => 'ohne Jokercard, alle Altersgruppen', 'config' => [ 'type' => 'input', 'size' => 8, - 'eval' => 'double2,required', + 'eval' => 'double2', ] ], + 'price_additional_person_group_1' => [ + 'exclude' => false, + 'label' => 'Preis weitere Person', + 'description' => 'mit Jokercard, 4-6 Jahre', + 'config' => [ + 'type' => 'input', + 'size' => 8, + 'eval' => 'double2', + ] + ], + 'price_additional_person_group_2' => [ + 'exclude' => false, + 'label' => 'Preis weitere Person', + 'description' => 'mit Jokercard, 7-14 Jahre', + 'config' => [ + 'type' => 'input', + 'size' => 8, + 'eval' => 'double2', + ] + ], + 'price_additional_person_group_3' => [ + 'exclude' => false, + 'label' => 'Preis weitere Person', + 'description' => 'mit Jokercard, ab 15 Jahre', + 'config' => [ + 'type' => 'input', + 'size' => 8, + 'eval' => 'double2', + ] + ], + 'bonus_card_included' => [ + 'exclude' => 0, + 'label' => 'Jokercard inklusive', + 'config' => [ + 'type' => 'check', + ], + ], ], ]; diff --git a/public/typo3conf/ext/ep_products/ext_tables.sql b/public/typo3conf/ext/ep_products/ext_tables.sql index d4905809..3e0dfe78 100644 --- a/public/typo3conf/ext/ep_products/ext_tables.sql +++ b/public/typo3conf/ext/ep_products/ext_tables.sql @@ -280,37 +280,41 @@ CREATE TABLE tx_epproducts_domain_model_hotel CREATE TABLE tx_epproducts_domain_model_groupspriceconfig ( - uid int(11) NOT NULL auto_increment, - pid int(11) DEFAULT '0' NOT NULL, + uid int(11) NOT NULL auto_increment, + pid int(11) DEFAULT '0' NOT NULL, - date_from int(11) unsigned DEFAULT '0' NOT NULL, - date_to int(11) unsigned DEFAULT '0' NOT NULL, - persons_included int(11) unsigned DEFAULT '0' NOT NULL, - price float(8) unsigned DEFAULT '0' NOT NULL, - price_additional_person float(8) unsigned DEFAULT '0' NOT NULL, - hotel int(11) unsigned DEFAULT '0', + date_from int(11) unsigned DEFAULT '0' NOT NULL, + date_to int(11) unsigned DEFAULT '0' NOT NULL, + persons_included int(11) unsigned DEFAULT '0' NOT NULL, + price float(8) unsigned DEFAULT '0' NOT NULL, + price_additional_person float(8) unsigned DEFAULT '0' NOT NULL, + price_additional_person_group_1 float(8) unsigned DEFAULT '0' NOT NULL, + price_additional_person_group_2 float(8) unsigned DEFAULT '0' NOT NULL, + price_additional_person_group_3 float(8) unsigned DEFAULT '0' NOT NULL, + bonus_card_included tinyint(4) unsigned DEFAULT '0' NOT NULL, + hotel int(11) unsigned DEFAULT '0', - tstamp int(11) unsigned DEFAULT '0' NOT NULL, - crdate int(11) unsigned DEFAULT '0' NOT NULL, - cruser_id int(11) unsigned DEFAULT '0' NOT NULL, - deleted tinyint(4) unsigned DEFAULT '0' NOT NULL, - hidden tinyint(4) unsigned DEFAULT '0' NOT NULL, - starttime int(11) unsigned DEFAULT '0' NOT NULL, - endtime int(11) unsigned DEFAULT '0' NOT NULL, + tstamp int(11) unsigned DEFAULT '0' NOT NULL, + crdate int(11) unsigned DEFAULT '0' NOT NULL, + cruser_id int(11) unsigned DEFAULT '0' NOT NULL, + deleted tinyint(4) unsigned DEFAULT '0' NOT NULL, + hidden tinyint(4) unsigned DEFAULT '0' NOT NULL, + starttime int(11) unsigned DEFAULT '0' NOT NULL, + endtime int(11) unsigned DEFAULT '0' NOT NULL, - t3ver_oid int(11) DEFAULT '0' NOT NULL, - t3ver_id int(11) DEFAULT '0' NOT NULL, - t3ver_wsid int(11) DEFAULT '0' NOT NULL, - t3ver_label varchar(255) DEFAULT '' NOT NULL, - t3ver_state tinyint(4) DEFAULT '0' NOT NULL, - t3ver_stage int(11) DEFAULT '0' NOT NULL, - t3ver_count int(11) DEFAULT '0' NOT NULL, - t3ver_tstamp int(11) DEFAULT '0' NOT NULL, - t3ver_move_id int(11) DEFAULT '0' NOT NULL, + t3ver_oid int(11) DEFAULT '0' NOT NULL, + t3ver_id int(11) DEFAULT '0' NOT NULL, + t3ver_wsid int(11) DEFAULT '0' NOT NULL, + t3ver_label varchar(255) DEFAULT '' NOT NULL, + t3ver_state tinyint(4) DEFAULT '0' NOT NULL, + t3ver_stage int(11) DEFAULT '0' NOT NULL, + t3ver_count int(11) DEFAULT '0' NOT NULL, + t3ver_tstamp int(11) DEFAULT '0' NOT NULL, + t3ver_move_id int(11) DEFAULT '0' NOT NULL, - sys_language_uid int(11) DEFAULT '0' NOT NULL, - l10n_parent int(11) DEFAULT '0' NOT NULL, - l10n_diffsource mediumblob, + sys_language_uid int(11) DEFAULT '0' NOT NULL, + l10n_parent int(11) DEFAULT '0' NOT NULL, + l10n_diffsource mediumblob, PRIMARY KEY (uid), KEY parent (pid), diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue index 0bcfc4cf..85ce68d4 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Assets/js/components/GroupsPriceCalculator.vue @@ -6,7 +6,23 @@
- + +
+
+ ab 15 Jahre + +
+
+ 7-14 Jahre + +
+
+ 4-6 Jahre + +
+
+

Bitte wählen Sie einen Zeitraum

@@ -22,7 +38,9 @@
Erst ab 30 Personen buchbar. @@ -33,38 +51,39 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Zeitraum{{ rangeFormatted }}, {{ nightsCount }} Nächte
Basispreis{{ formatCurrency(pricePax.base) }}
Aufpreis Personenzahl{{ formatCurrency(pricePax.additional) }}
Aufpreis Kurzzeit{{ formatCurrency(priceShortTerm) }}
Zusatzleistungen{{ formatCurrency(priceOptions) }}
Verpflegung{{ formatCurrency(priceBoard) }}
Strom- und Abfallgebühren{{ formatCurrency(priceRunningCosts) }}
Gesamtpreis{{ formatCurrency(priceTotal) }}
zzgl. vor Ort zu entrichtender Ortstaxe
Zeitraum{{ rangeFormatted }}, {{ nightsCount }} Nächte
Basispreis{{ formatCurrency(pricePax.base) }}
Aufpreis Personenzahl{{ formatCurrency(pricePax.additional) }}
Aufpreis Kurzzeit{{ formatCurrency(priceShortTerm) }}
Zusatzleistungen{{ formatCurrency(priceOptions) }}
Verpflegung{{ formatCurrency(priceBoard) }}
Strom- und Abfallgebühren{{ formatCurrency(priceRunningCosts) }}
Gesamtpreis{{ formatCurrency(priceTotal) }}
zzgl. vor Ort zu entrichtender + Ortstaxe
@@ -114,260 +133,304 @@ diff --git a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Email/GroupsPrice.html b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Email/GroupsPrice.html index 5e157cd5..6a165088 100644 --- a/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Email/GroupsPrice.html +++ b/public/typo3conf/ext/ep_theme/Resources/Private/Templates/Email/GroupsPrice.html @@ -29,7 +29,19 @@ Anzahl der Personen - {pax} + {pax -> v:or(alternative: '-')} + + + Anzahl der Personen (ab 15 Jahre) + {paxGroup3 -> v:or(alternative: '-')} + + + Anzahl der Personen (7-14 Jahre) + {paxGroup2 -> v:or(alternative: '-')} + + + Anzahl der Personen (4-6 Jahre) + {paxGroup1 -> v:or(alternative: '-')} Verpflegung