diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php index 710cce6c..31514b51 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/AjaxGroupsPriceController.php @@ -28,6 +28,7 @@ namespace EP\EpProducts\Controller; use EP\EpProducts\Domain\Model\Dto\GroupsPriceInquiry; use EP\EpProducts\Domain\Model\GroupsPriceBoard; +use EP\EpProducts\Domain\Model\GroupsPriceOption; use EP\EpProducts\Domain\Model\Hotel; use EP\EpProducts\Domain\Repository\GroupsPriceOptionRepository; use EP\EpProducts\Service\EmailService; @@ -69,6 +70,9 @@ class AjaxGroupsPriceController extends ActionController public function processFormAction(Hotel $hotel, GroupsPriceInquiry $groupsPriceInquiry) { $mode = $groupsPriceInquiry->getMode(); + $country = $hotel->getCountry()->getCode(); + $effectivePax = $groupsPriceInquiry->getEffectivePax(); + $nights = $groupsPriceInquiry->getNights(); if (false === in_array($mode, [GroupsPriceInquiry::MODE_BOOKING, GroupsPriceInquiry::MODE_INQUIRY])) { $mode = GroupsPriceInquiry::MODE_BOOKING; @@ -86,10 +90,25 @@ class AjaxGroupsPriceController extends ActionController 'templateName' => 'GroupsPrice', ]; + $optionPrice = function (GroupsPriceOption $option) use ($country, $effectivePax, $nights) { + $price = 'CH' === $country ? $option->getPriceChf() : $option->getPrice(); + $currency = 'CH' === $country ? 'CHF' : '€'; + + if (GroupsPriceOption::TYPE_PER_PAX === $option->getType()) { + $price = $price * $effectivePax; + } elseif (GroupsPriceOption::TYPE_PER_NIGHT === $option->getType()) { + $price = $price * $nights; + } elseif (GroupsPriceOption::TYPE_PER_PAX_AND_NIGHT === $option->getType()) { + $price = $price * $nights * $effectivePax; + } + + return $price.' '.$currency; + }; + try { $options = $this->groupsPriceOptionRepository->findByUids($groupsPriceInquiry->getOptions()); - $selectedOptions = array_map(function ($option) { - return $option->getTitle(); + $selectedOptions = array_map(function ($option) use ($optionPrice) { + return $option->getTitle().': '.$optionPrice($option); }, $options); } catch (InvalidQueryException $e) { @@ -111,6 +130,10 @@ class AjaxGroupsPriceController extends ActionController 'dateTo' => $groupsPriceInquiry->getDateTo(), 'nights' => $groupsPriceInquiry->getNights(), 'pax' => $groupsPriceInquiry->getPax(), + 'children' => $groupsPriceInquiry->getChildren(), + 'minors' => $groupsPriceInquiry->getMinors(), + 'adolescents' => $groupsPriceInquiry->getAdolescents(), + 'adolescentsAge' => $hotel->getGroupsPriceAdolescentsAge(), 'options' => $selectedOptions, 'board' => $groupsPriceInquiry->getBoard(), 'summary' => $groupsPriceInquiry->getSummary(), diff --git a/public/typo3conf/ext/ep_products/Classes/Controller/GroupsPriceController.php b/public/typo3conf/ext/ep_products/Classes/Controller/GroupsPriceController.php index e68a4fca..9b78065f 100644 --- a/public/typo3conf/ext/ep_products/Classes/Controller/GroupsPriceController.php +++ b/public/typo3conf/ext/ep_products/Classes/Controller/GroupsPriceController.php @@ -62,5 +62,6 @@ class GroupsPriceController extends ActionController $this->view->assign('options', json_encode($hotel->getGroupsPriceOptions()->toArray(), JSON_HEX_APOS)); $this->view->assign('mainSeasonFrom', $mainSeasonFrom); $this->view->assign('mainSeasonTo', $mainSeasonTo); + $this->view->assign('adolescentsAge', $hotel->getGroupsPriceAdolescentsAge() ?? 0); } } 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 bb6af366..141ce4e0 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 @@ -119,6 +119,16 @@ class GroupsPriceInquiry */ protected $children; + /** + * @var string + */ + protected $minors; + + /** + * @var string + */ + protected $adolescents; + /** * @var array */ @@ -384,6 +394,46 @@ class GroupsPriceInquiry $this->children = $children; } + /** + * @return string + */ + public function getMinors() + { + return $this->minors; + } + + /** + * @param string $minors + */ + public function setMinors($minors) + { + $this->minors = $minors; + } + + /** + * @return string + */ + public function getAdolescents() + { + return $this->adolescents; + } + + /** + * @param string $adolescents + */ + public function setAdolescents($adolescents) + { + $this->adolescents = $adolescents; + } + + /** + * @return int + */ + public function getEffectivePax() + { + return max(30, $this->getPax() - $this->getChildren()); + } + /** * @return array */ diff --git a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php index 0b36000c..efdab7c9 100644 --- a/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php +++ b/public/typo3conf/ext/ep_products/Classes/Domain/Model/Hotel.php @@ -265,6 +265,11 @@ class Hotel extends AbstractEntity implements TeaserInterface */ protected $groupsPriceBoards; + /** + * @var int + */ + protected $groupsPriceAdolescentsAge; + /** * @var string */ @@ -1059,6 +1064,16 @@ class Hotel extends AbstractEntity implements TeaserInterface $this->groupsPriceBoards = $groupsPriceBoards; } + public function getGroupsPriceAdolescentsAge() + { + return $this->groupsPriceAdolescentsAge; + } + + public function setGroupsPriceAdolescentsAge($groupsPriceAdolescentsAge) + { + $this->groupsPriceAdolescentsAge = $groupsPriceAdolescentsAge; + } + public function getGroupsPriceTaxLabel() { return $this->groupsPriceTaxLabel; diff --git a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_hotel.php b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_hotel.php index e8d84681..d1ec1cc3 100644 --- a/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_hotel.php +++ b/public/typo3conf/ext/ep_products/Configuration/TCA/tx_epproducts_domain_model_hotel.php @@ -30,7 +30,8 @@ return [ --div--;Texte, teaser, description, features, room_types, additional_information, --div--;Verknüpfungen, facts, teamer, additional_codes, --div--;Bilder/Dateien, teaser_images, header_images, images, reseller_images, - --div--;Gruppenhaus Preise, --palette--;;season,groups_price_tax_label, groups_price_configs, groups_price_boards, groups_price_options', + --div--;Gruppenhaus Preise, --palette--;;season,--palette--;;others, groups_price_configs, + groups_price_boards, groups_price_options', ], ], 'palettes' => [ @@ -41,6 +42,7 @@ return [ 'name' => ['showitem' => 'name,short_name,--linebreak--,header_title,header_subtitle,--linebreak--,headline'], 'categories' => ['showitem' => 'type,category'], 'season' => ['showitem' => 'main_season_from, main_season_to'], + 'others' => ['showitem' => 'season,groups_price_tax_label, groups_price_adolescents_age'] ], 'columns' => [ @@ -702,6 +704,15 @@ return [ 'default' => 'zzgl. vor Ort zu entrichtender Ortstaxe', ], ], + 'groups_price_adolescents_age' => [ + 'exclude' => 0, + 'label' => 'Altersgrenze Jugendliche (6-X Jahre)', + 'config' => [ + 'type' => 'input', + 'size' => 50, + 'eval' => 'int', + ], + ], 'main_season_from' => [ 'exclude' => false, 'label' => 'Hauptsaison von', diff --git a/public/typo3conf/ext/ep_products/ext_tables.sql b/public/typo3conf/ext/ep_products/ext_tables.sql index 9353ecd5..2c71cbf4 100644 --- a/public/typo3conf/ext/ep_products/ext_tables.sql +++ b/public/typo3conf/ext/ep_products/ext_tables.sql @@ -213,73 +213,74 @@ CREATE TABLE tx_epproducts_domain_model_date CREATE TABLE tx_epproducts_domain_model_hotel ( - 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, - earlybird tinyint(4) unsigned DEFAULT '0' NOT NULL, - new tinyint(4) unsigned DEFAULT '0' NOT NULL, - low_contingent tinyint(4) unsigned DEFAULT '0' NOT NULL, - show_as_teaser tinyint(4) unsigned DEFAULT '0' NOT NULL, - detail_page varchar(255) DEFAULT '' NOT NULL, - name varchar(255) DEFAULT '' NOT NULL, - short_name varchar(255) DEFAULT '' NOT NULL, - headline varchar(255) DEFAULT '' NOT NULL, - description text NOT NULL, - keywords text NOT NULL, - features text NOT NULL, - room_types text NOT NULL, - additional_information text NOT NULL, - teaser text NOT NULL, - header_title varchar(255) DEFAULT '' NOT NULL, - header_subtitle varchar(255) DEFAULT '' NOT NULL, - teaser_images int(11) unsigned NOT NULL default '0', - header_images int(11) unsigned NOT NULL default '0', - images int(11) unsigned NOT NULL default '0', - reseller_images int(11) unsigned NOT NULL default '0', - code varchar(255) DEFAULT '' NOT NULL, - external_link varchar(255) DEFAULT '' NOT NULL, - path_segment varchar(255) DEFAULT '' NOT NULL, - type varchar(255) DEFAULT '' NOT NULL, - category int(11) DEFAULT '0' NOT NULL, - country int(11) unsigned DEFAULT '0', - region int(11) unsigned DEFAULT '0', - city int(11) unsigned DEFAULT '0', - teamer int(11) unsigned DEFAULT '0' NOT NULL, - products int(11) unsigned DEFAULT '0' NOT NULL, - rooms int(11) unsigned DEFAULT '0' NOT NULL, - facts int(11) unsigned DEFAULT '0' NOT NULL, - additional_codes int(11) unsigned DEFAULT '0' NOT NULL, - address varchar(255) DEFAULT '' NOT NULL, - latitude varchar(255) DEFAULT '' NOT NULL, - longitude varchar(255) DEFAULT '' NOT NULL, - groups_price_configs int(11) unsigned NOT NULL default '0', - groups_price_options int(11) unsigned NOT NULL default '0', - groups_price_boards int(11) unsigned NOT NULL default '0', - groups_price_tax_label varchar(255) DEFAULT '' NOT NULL, - main_season_from date DEFAULT NULL, - main_season_to date DEFAULT NULL, + earlybird tinyint(4) unsigned DEFAULT '0' NOT NULL, + new tinyint(4) unsigned DEFAULT '0' NOT NULL, + low_contingent tinyint(4) unsigned DEFAULT '0' NOT NULL, + show_as_teaser tinyint(4) unsigned DEFAULT '0' NOT NULL, + detail_page varchar(255) DEFAULT '' NOT NULL, + name varchar(255) DEFAULT '' NOT NULL, + short_name varchar(255) DEFAULT '' NOT NULL, + headline varchar(255) DEFAULT '' NOT NULL, + description text NOT NULL, + keywords text NOT NULL, + features text NOT NULL, + room_types text NOT NULL, + additional_information text NOT NULL, + teaser text NOT NULL, + header_title varchar(255) DEFAULT '' NOT NULL, + header_subtitle varchar(255) DEFAULT '' NOT NULL, + teaser_images int(11) unsigned NOT NULL default '0', + header_images int(11) unsigned NOT NULL default '0', + images int(11) unsigned NOT NULL default '0', + reseller_images int(11) unsigned NOT NULL default '0', + code varchar(255) DEFAULT '' NOT NULL, + external_link varchar(255) DEFAULT '' NOT NULL, + path_segment varchar(255) DEFAULT '' NOT NULL, + type varchar(255) DEFAULT '' NOT NULL, + category int(11) DEFAULT '0' NOT NULL, + country int(11) unsigned DEFAULT '0', + region int(11) unsigned DEFAULT '0', + city int(11) unsigned DEFAULT '0', + teamer int(11) unsigned DEFAULT '0' NOT NULL, + products int(11) unsigned DEFAULT '0' NOT NULL, + rooms int(11) unsigned DEFAULT '0' NOT NULL, + facts int(11) unsigned DEFAULT '0' NOT NULL, + additional_codes int(11) unsigned DEFAULT '0' NOT NULL, + address varchar(255) DEFAULT '' NOT NULL, + latitude varchar(255) DEFAULT '' NOT NULL, + longitude varchar(255) DEFAULT '' NOT NULL, + groups_price_configs int(11) unsigned NOT NULL default '0', + groups_price_options int(11) unsigned NOT NULL default '0', + groups_price_boards int(11) unsigned NOT NULL default '0', + groups_price_adolescents_age int(11) unsigned NOT NULL default '0', + groups_price_tax_label varchar(255) DEFAULT '' NOT NULL, + main_season_from date DEFAULT NULL, + main_season_to date DEFAULT 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, + 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 8395f3de..b697d936 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 @@ -43,9 +43,48 @@ v-model.number="childrenCount" @change="onPaxUpdated()" v-show="nightsCount > 0"/> -
- Kinder werden nur bei Strom- und Abfallgebühren berücksichtigt +
+ Bitte zuerst einen Zeitraum wählen
++ Kinder werden nur bei Strom- und Abfallgebühren berücksichtigt. +
+ ++ Bitte zuerst einen Zeitraum wählen +
++ Bitte zuerst einen Zeitraum wählen +
+