feat: configurable main season for groups price calculator

This commit is contained in:
Björn Fromme
2025-02-26 15:10:49 +01:00
parent b1ddf46500
commit 5c1b2bf245
7 changed files with 97 additions and 8 deletions
@@ -40,6 +40,15 @@ class GroupsPriceController extends ActionController
return $a->getDateFrom() > $b->getDateFrom(); return $a->getDateFrom() > $b->getDateFrom();
}); });
$mainSeasonFrom = $mainSeasonTo = null;
if (null !== $hotel->getMainSeasonFrom()) {
$mainSeasonFrom = $hotel->getMainSeasonFrom()->format('d.m.Y');
}
if (null !== $hotel->getMainSeasonTo()) {
$mainSeasonTo = $hotel->getMainSeasonTo()->format('d.m.Y');
}
$this->view->assign('hotel', $hotel); $this->view->assign('hotel', $hotel);
$this->view->assign('runningCostsEUR', $this->settings['runningCostsEUR']); $this->view->assign('runningCostsEUR', $this->settings['runningCostsEUR']);
$this->view->assign('runningCostsCHF', $this->settings['runningCostsCHF']); $this->view->assign('runningCostsCHF', $this->settings['runningCostsCHF']);
@@ -49,5 +58,7 @@ class GroupsPriceController extends ActionController
$this->view->assign('configs', json_encode(array_values($configs), JSON_HEX_APOS)); $this->view->assign('configs', json_encode(array_values($configs), JSON_HEX_APOS));
$this->view->assign('boards', json_encode($hotel->getGroupsPriceBoards()->toArray(), JSON_HEX_APOS)); $this->view->assign('boards', json_encode($hotel->getGroupsPriceBoards()->toArray(), JSON_HEX_APOS));
$this->view->assign('options', json_encode($hotel->getGroupsPriceOptions()->toArray(), JSON_HEX_APOS)); $this->view->assign('options', json_encode($hotel->getGroupsPriceOptions()->toArray(), JSON_HEX_APOS));
$this->view->assign('mainSeasonFrom', $mainSeasonFrom);
$this->view->assign('mainSeasonTo', $mainSeasonTo);
} }
} }
@@ -275,6 +275,16 @@ class Hotel extends AbstractEntity implements TeaserInterface
*/ */
protected $groupsPriceBoards; protected $groupsPriceBoards;
/**
* @var \DateTime
*/
protected $mainSeasonFrom;
/**
* @var \DateTime
*/
protected $mainSeasonTo;
public function __construct() public function __construct()
{ {
$this->initStorageObjects(); $this->initStorageObjects();
@@ -1073,4 +1083,24 @@ class Hotel extends AbstractEntity implements TeaserInterface
{ {
$this->tourLink = $tourLink; $this->tourLink = $tourLink;
} }
public function getMainSeasonFrom()
{
return $this->mainSeasonFrom;
}
public function setMainSeasonFrom(\DateTime $mainSeasonFrom)
{
$this->mainSeasonFrom = $mainSeasonFrom;
}
public function getMainSeasonTo()
{
return $this->mainSeasonTo;
}
public function setMainSeasonTo(\DateTime $mainSeasonTo)
{
$this->mainSeasonTo = $mainSeasonTo;
}
} }
@@ -178,7 +178,7 @@ return [
], ],
'price_additional_person_chf' => [ 'price_additional_person_chf' => [
'exclude' => false, 'exclude' => false,
'label' => 'Preis weitere Person', 'label' => 'Preis weitere Person in CHF',
'description' => 'ohne Jokercard, alle Altersgruppen', 'description' => 'ohne Jokercard, alle Altersgruppen',
'config' => [ 'config' => [
'type' => 'input', 'type' => 'input',
@@ -238,7 +238,7 @@ return [
], ],
'price_additional_person_group_3_chf' => [ 'price_additional_person_group_3_chf' => [
'exclude' => false, 'exclude' => false,
'label' => 'Preis weitere Person', 'label' => 'Preis weitere Person in CHF',
'description' => 'mit Jokercard, ab 15 Jahre', 'description' => 'mit Jokercard, ab 15 Jahre',
'config' => [ 'config' => [
'type' => 'input', 'type' => 'input',
@@ -30,7 +30,7 @@ return [
--div--;Texte, teaser, description, features, room_types, additional_information, --div--;Texte, teaser, description, features, room_types, additional_information,
--div--;Verknüpfungen, facts, teamer, additional_codes, --div--;Verknüpfungen, facts, teamer, additional_codes,
--div--;Bilder/Dateien, teaser_images, header_images, images, reseller_images, tour_thumbnail, --div--;Bilder/Dateien, teaser_images, header_images, images, reseller_images, tour_thumbnail,
--div--;Gruppenhaus Preise, groups_price_configs, groups_price_boards, groups_price_options', --div--;Gruppenhaus Preise, --palette--;;season, groups_price_configs, groups_price_boards, groups_price_options',
], ],
], ],
'palettes' => [ 'palettes' => [
@@ -40,6 +40,7 @@ return [
'destinations' => ['showitem' => 'country,region,city'], 'destinations' => ['showitem' => 'country,region,city'],
'name' => ['showitem' => 'name,short_name,--linebreak--,header_title,header_subtitle,--linebreak--,headline'], 'name' => ['showitem' => 'name,short_name,--linebreak--,header_title,header_subtitle,--linebreak--,headline'],
'categories' => ['showitem' => 'type,category'], 'categories' => ['showitem' => 'type,category'],
'season' => ['showitem' => 'main_season_from, main_season_to'],
], ],
'columns' => [ 'columns' => [
@@ -740,5 +741,31 @@ return [
], ],
], ],
], ],
'main_season_from' => [
'exclude' => false,
'label' => 'Hauptsaison von',
'config' => [
'dbType' => 'date',
'type' => 'input',
'size' => 7,
'eval' => 'date',
'checkbox' => 0,
'default' => '0000-00-00',
'renderType' => 'inputDateTime',
],
],
'main_season_to' => [
'exclude' => false,
'label' => 'Hauptsaison bis',
'config' => [
'dbType' => 'date',
'type' => 'input',
'size' => 7,
'eval' => 'date',
'checkbox' => 0,
'default' => '0000-00-00',
'renderType' => 'inputDateTime',
],
],
], ],
]; ];
@@ -255,6 +255,8 @@ CREATE TABLE tx_epproducts_domain_model_hotel
groups_price_configs int(11) unsigned NOT NULL default '0', groups_price_configs int(11) unsigned NOT NULL default '0',
groups_price_options 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_boards int(11) unsigned NOT NULL default '0',
main_season_from date DEFAULT NULL,
main_season_to date DEFAULT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL, tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL, crdate int(11) unsigned DEFAULT '0' NOT NULL,
@@ -8,7 +8,10 @@
<input type="text" <input type="text"
class="form-field" class="form-field"
placeholder="von... bis" ref="picker"/> placeholder="von... bis" ref="picker"/>
<p class="text-sm italic" <p class="text-sm mt-2" v-if="mainSeasonFrom && mainSeasonTo">
in der Hauptsaison {{ mainSeasonFrom }}-{{ mainSeasonTo }} mind. {{ minBookingDays }} Tage
</p>
<p class="text-sm italic mt-2"
v-show="nightsCount === 1"> v-show="nightsCount === 1">
Einzelne Nächte sind nur auf Anfrage buchbar Einzelne Nächte sind nur auf Anfrage buchbar
</p> </p>
@@ -326,6 +329,18 @@ export default {
] ]
} }
}, },
mainSeasonFrom: {
type: String,
default: null,
},
mainSeasonTo: {
type: String,
default: null,
},
minBookingDays: {
type: Number,
default: 5,
},
}, },
data() { data() {
return { return {
@@ -356,10 +371,12 @@ export default {
}, },
methods: { methods: {
formatCurrency({ EUR, CHF }) { formatCurrency({ EUR, CHF }) {
let price = parseFloat(EUR).toFixed(2).replace(/\./, ',') + ' €' let price
if ('CH' === this.countryCode && 0 < CHF) { if ('CH' === this.countryCode && 0 < CHF) {
price += `/${parseFloat(CHF).toFixed(2).replace(/\./, ',')} CHF` price = `${parseFloat(CHF).toFixed(2).replace(/\./, ',')} CHF`
} else {
price = parseFloat(EUR).toFixed(2).replace(/\./, ',') + ' €'
} }
return price return price
@@ -20,8 +20,10 @@
country-code="{countryCode}" country-code="{countryCode}"
endpoint="{ep:uri.ajax(action: 'processForm', controller: 'AjaxGroupsPrice', pageUid: settings.defaultAjaxUid, arguments: '{hotel: hotel}')}" endpoint="{ep:uri.ajax(action: 'processForm', controller: 'AjaxGroupsPrice', pageUid: settings.defaultAjaxUid, arguments: '{hotel: hotel}')}"
loader-uri="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/ajax-loader-white.gif')}" loader-uri="{f:uri.image(src: 'EXT:ep_theme/Resources/Public/images/ajax-loader-white.gif')}"
logo-at="{f:uri.image(src: 'fileadmin/user_upload/Logos_Banner/Alpinevacation.jpg')}" logo-ch="{f:uri.image(src: 'fileadmin/user_upload/Logos_Banner/Alpinevacation.jpg')}"
logo-ch="{f:uri.image(src: 'fileadmin/user_upload/Logos_Banner/Cllt_Touristik_frei_gestellt.jpg')}" logo-at="{f:uri.image(src: 'fileadmin/user_upload/Logos_Banner/Cllt_Touristik_frei_gestellt.jpg')}"
main-season-from="{mainSeasonFrom}"
main-season-to="{mainSeasonTo}"
> >
</groups-price-calculator> </groups-price-calculator>
</f:format.raw> </f:format.raw>