Added: Feature to create Advanced price rules for multiple room types at once in the back office.
This commit is contained in:
@@ -189,8 +189,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
|
||||
|
||||
|
||||
)) {
|
||||
$this->errors[] = $this->l('An advanced price rule already exists in which some dates are common with this
|
||||
plan. Please select a different date range.');
|
||||
$this->errors[] = $this->l('An advanced price rule already exists in which some dates are common with this plan. Please select a different date range.');
|
||||
return ;
|
||||
}
|
||||
}
|
||||
@@ -202,17 +201,21 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
|
||||
public function initToolbar()
|
||||
{
|
||||
parent::initToolbar();
|
||||
$this->page_header_toolbar_btn['new'] = array(
|
||||
'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token,
|
||||
'desc' => $this->l('Add new rule'),
|
||||
'imgclass' => 'new'
|
||||
);
|
||||
if (empty($this->display) || $this->display == 'list') {
|
||||
$this->page_header_toolbar_btn['new'] = array(
|
||||
'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token,
|
||||
'desc' => $this->l('Add new rule'),
|
||||
'imgclass' => 'new'
|
||||
);
|
||||
}
|
||||
$this->toolbar_btn = array();
|
||||
}
|
||||
|
||||
public function renderList()
|
||||
{
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('delete');
|
||||
|
||||
return parent::renderList();
|
||||
}
|
||||
|
||||
@@ -245,17 +248,42 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
|
||||
$smartyVars['edit'] = 1;
|
||||
|
||||
$smartyVars['feature_price_groups'] = $objFeaturePrice->getGroups($idFeaturePrice);
|
||||
} else {
|
||||
$tree = new HelperTree('hotels-tree');
|
||||
if ($treeData = HotelHelper::generateTreeData([
|
||||
'rootNode' => HotelHelper::NODE_HOTEL,
|
||||
'leafNode' => HotelHelper::NODE_ROOM_TYPE,
|
||||
'selectedElements' => array(
|
||||
'room_type' => Tools::getValue('room_type_box', array())
|
||||
)
|
||||
])) {
|
||||
foreach ($treeData as $idHotel => $data) {
|
||||
if (!isset($data['children']) || empty($data['children'])) {
|
||||
unset($treeData[$idHotel]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tree->setData($treeData)
|
||||
->setUseCheckBox(true)
|
||||
->setAutoSelectChildren(true)
|
||||
->setUseBulkActions(true)
|
||||
->setUseSearch(true);
|
||||
$smartyVars['hotel_tree'] = $tree->render();
|
||||
}
|
||||
|
||||
$smartyVars['defaultcurrency_sign'] = $currencySign;
|
||||
$smartyVars['date_from'] = $dateFrom;
|
||||
$smartyVars['date_to'] = $dateTo;
|
||||
$smartyVars['groups'] = Group::getGroups($this->context->language->id);
|
||||
|
||||
$this->context->smarty->assign($smartyVars);
|
||||
$this->fields_form = array(
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
),
|
||||
);
|
||||
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
@@ -343,151 +371,196 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
|
||||
$groups = Tools::getValue('groupBox');
|
||||
$jsonSpecialDays = json_encode($specialDays);
|
||||
$defaultLangId = Configuration::get('PS_LANG_DEFAULT');
|
||||
$createMultiple = Tools::getValue('create_multiple');
|
||||
|
||||
$objFeaturePricing = new HotelRoomTypeFeaturePricing();
|
||||
|
||||
if ($priceImpactWay == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE) {
|
||||
$priceImpactType = HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE;
|
||||
}
|
||||
|
||||
$languages = Language::getLanguages(false);
|
||||
$objDefaultLang = new language($defaultLangId);
|
||||
$objDefaultLang = new Language($defaultLangId);
|
||||
if (!($priceRuleNameDefault = Tools::getValue('feature_price_name_'.$defaultLangId))) {
|
||||
$this->errors[] = sprintf($this->l('Advanced price rule name is required at least in %s'), $objDefaultLang->name);
|
||||
} else {
|
||||
if (preg_match('{room_type_name}', $priceRuleNameDefault)) {
|
||||
$priceRuleNameDefault = str_replace('{room_type_name}', '%s', $priceRuleNameDefault);
|
||||
}
|
||||
}
|
||||
|
||||
$toUpdatePriceRuleName = false;
|
||||
$validateRules = call_user_func(
|
||||
array('HotelRoomTypeFeaturePricing', 'getValidationRules'),
|
||||
'HotelRoomTypeFeaturePricing'
|
||||
);
|
||||
foreach ($languages as $lang) {
|
||||
$priceRuleName = Tools::getValue('feature_price_name_'.$lang['id_lang']);
|
||||
if (preg_match('{room_type_name}', $priceRuleName)) {
|
||||
$priceRuleName = str_replace('{room_type_name}', '%s', $priceRuleName);
|
||||
$toUpdatePriceRuleName = true;
|
||||
}
|
||||
if (!Validate::isCatalogName($priceRuleName)) {
|
||||
$this->errors[] = $this->l('Advanced price rule name is invalid in ').$lang['name'];
|
||||
} elseif (Tools::strlen($priceRuleName) > $validateRules['sizeLang']['feature_price_name']) {
|
||||
$this->errors[] = sprintf(
|
||||
$this->l('Advanced price rule Name field is too long (%d chars max) in ').$lang['name'],
|
||||
$validateRules['sizeLang']['feature_price_name'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$featurePricingName = array();
|
||||
$roomTypeIds = array();
|
||||
if (!$createMultiple) {
|
||||
if ($roomTypeId) {
|
||||
$roomTypeIds = array($roomTypeId);
|
||||
} else {
|
||||
$this->errors[] = $this->l('Room type is not selected. Please try again.');
|
||||
}
|
||||
} else if (!$roomTypeIds = Tools::getValue('room_type_box')) {
|
||||
$this->errors[] = $this->l('Please select at least one room type for creating multiple price rules.');
|
||||
}
|
||||
|
||||
if ($roomTypeIds && !$this->errors) {
|
||||
foreach ($roomTypeIds as $idRoomType) {
|
||||
$objProduct = new Product((int) $idRoomType);
|
||||
foreach ($languages as $lang) {
|
||||
$priceRuleName = Tools::getValue('feature_price_name_'.$lang['id_lang']);
|
||||
if ($priceRuleName && $toUpdatePriceRuleName) {
|
||||
if (preg_match('{room_type_name}', $priceRuleName)) {
|
||||
$priceRuleName = str_replace('{room_type_name}', $objProduct->name[$lang['id_lang']], $priceRuleName);
|
||||
}
|
||||
if (Tools::strlen($priceRuleName) > $validateRules['sizeLang']['feature_price_name']) {
|
||||
$this->errors[] = sprintf(
|
||||
$this->l('Advanced price rule Name field is too long (%d chars max) for "%s" room type in ').$lang['name'],
|
||||
$validateRules['sizeLang']['feature_price_name'],
|
||||
$objProduct->name[$lang['id_lang']]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($priceRuleName) {
|
||||
$featurePricingName[$idRoomType][$lang['id_lang']] = $priceRuleName;
|
||||
} else {
|
||||
$featurePricingName[$idRoomType][$lang['id_lang']] = $priceRuleNameDefault;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($dateSelectionType == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) {
|
||||
$dateFrom = $specificDate;
|
||||
$dateTo = date('Y-m-d', strtotime("+1 day", strtotime($specificDate)));
|
||||
} else if ($dateSelectionType == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE) {
|
||||
if ($dateFrom == '') {
|
||||
$this->errors[] = $this->l('Please choose Date from for the advanced price rule.');
|
||||
}
|
||||
if ($dateTo == '') {
|
||||
$this->errors[] = $this->l('Please choose Date to for the advanced price rule.');
|
||||
}
|
||||
$dateFrom = date('Y-m-d', strtotime($dateFrom));
|
||||
$dateTo = date('Y-m-d', strtotime($dateTo));
|
||||
if (!Validate::isDate($dateFrom)) {
|
||||
$this->errors[] = $this->l('Invalid Date From.');
|
||||
}
|
||||
if (!Validate::isDate($dateTo)) {
|
||||
$this->errors[] = $this->l('Invalid Date To.');
|
||||
}
|
||||
if ($dateTo < $dateFrom) {
|
||||
$this->errors[] = $this->l('Date To cannot be smaller than Date From.');
|
||||
}
|
||||
if ($isSpecialDaysExists) {
|
||||
if (!isset($specialDays) || !$specialDays) {
|
||||
$this->errors[] = $this->l('Please select at least one day for week days restriction.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($specificDate == '') {
|
||||
$this->errors[] = $this->l('Please choose Date from for the advanced price rule.');
|
||||
}
|
||||
$specificDate = date('Y-m-d', strtotime($specificDate));
|
||||
if (!Validate::isDate($specificDate)) {
|
||||
$this->errors[] = $this->l('Invalid Date From.');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$impactValue) {
|
||||
$this->errors[] = $this->l('Please enter a valid impact value.');
|
||||
} else if (!Validate::isPrice($impactValue)) {
|
||||
$this->errors[] = $this->l('Invalid value of impact value.');
|
||||
}
|
||||
|
||||
if (!(bool)$groups) {
|
||||
$this->errors[] = $this->l('Please select at least one group for the group access');
|
||||
}
|
||||
|
||||
$isPlanTypeExists = 0;
|
||||
if ($isSpecialDaysExists && $jsonSpecialDays == 'false') {
|
||||
$this->errors[] = $this->l('Please select at least one day for week days restriction.');
|
||||
} else {
|
||||
$isPlanTypeExists = $this->validateExistingFeaturePrice(
|
||||
$dateSelectionType,
|
||||
$roomTypeId,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
$groups,
|
||||
$idFeaturePrice,
|
||||
$isSpecialDaysExists,
|
||||
$jsonSpecialDays
|
||||
);
|
||||
}
|
||||
if ($isPlanTypeExists) {
|
||||
$this->errors[] = $this->l('An advanced price rule already exists in which some dates are common with this
|
||||
plan. Please select a different date range.');
|
||||
} else {
|
||||
if (!$roomTypeId) {
|
||||
$this->errors[] = $this->l('Room is not selected. Please try again.');
|
||||
}
|
||||
if (!Tools::getValue('feature_price_name_'.$defaultLangId)) {
|
||||
$this->errors[] = sprintf(
|
||||
$this->l('Advanced price rule name is required at least in %s'),
|
||||
$objDefaultLang->name
|
||||
|
||||
if (empty($this->errors)) {
|
||||
foreach ($roomTypeIds as $idRoomType) {
|
||||
$isPlanTypeExists = $this->validateExistingFeaturePrice(
|
||||
$dateSelectionType,
|
||||
$idRoomType,
|
||||
$dateFrom,
|
||||
$dateTo,
|
||||
$groups,
|
||||
$idFeaturePrice,
|
||||
$isSpecialDaysExists,
|
||||
$jsonSpecialDays
|
||||
);
|
||||
|
||||
if ($isPlanTypeExists) {
|
||||
$objProduct = new Product((int) $idRoomType, false, $this->context->language->id);
|
||||
$this->errors[] = sprintf($this->l('An advanced price rule already exists for "%s" for the selected date range. Please select a different date range.'), $objProduct->name);
|
||||
}
|
||||
}
|
||||
$validateRules = call_user_func(
|
||||
array('HotelRoomTypeFeaturePricing', 'getValidationRules'),
|
||||
'HotelRoomTypeFeaturePricing'
|
||||
);
|
||||
foreach ($languages as $language) {
|
||||
if (!Validate::isCatalogName(Tools::getValue('feature_price_name_'.$language['id_lang']))) {
|
||||
$this->errors[] = $this->l('Advanced price rule name is invalid in ').$language['name'];
|
||||
} elseif (Tools::strlen(Tools::getValue('feature_price_name_'.$language['id_lang'])) > $validateRules['sizeLang']['feature_price_name']) {
|
||||
sprintf(
|
||||
$this->l('Advanced price rule Name field is too long (%2$d chars max).'),
|
||||
$validateRules['sizeLang']['feature_price_name']
|
||||
}
|
||||
|
||||
if (!$isPlanTypeExists && !count($this->errors)) {
|
||||
if ($idFeaturePrice) {
|
||||
$objFeaturePricing = new HotelRoomTypeFeaturePricing($idFeaturePrice);
|
||||
}
|
||||
|
||||
// lang fields
|
||||
$objFeaturePricing->date_selection_type = $dateSelectionType;
|
||||
$objFeaturePricing->date_from = $dateFrom;
|
||||
$objFeaturePricing->date_to = $dateTo;
|
||||
$objFeaturePricing->impact_way = $priceImpactWay;
|
||||
$objFeaturePricing->is_special_days_exists = $isSpecialDaysExists;
|
||||
$objFeaturePricing->special_days = $jsonSpecialDays;
|
||||
$objFeaturePricing->impact_type = $priceImpactType;
|
||||
$objFeaturePricing->impact_value = $impactValue;
|
||||
$objFeaturePricing->active = $enableFeaturePrice;
|
||||
|
||||
// set the values of the groups for this feature price
|
||||
$objFeaturePricing->groupBox = $groups;
|
||||
$objFeaturePricing->id_product = $roomTypeId;
|
||||
if ($createMultiple) {
|
||||
foreach ($roomTypeIds as $idRoomType) {
|
||||
$objFeaturePricing->id_product = $idRoomType;
|
||||
$objFeaturePricing->feature_price_name = $featurePricingName[$idRoomType];
|
||||
$objFeaturePricing->add();
|
||||
}
|
||||
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=3&token='.$this->token);
|
||||
} else {
|
||||
$objFeaturePricing->feature_price_name = $featurePricingName[$roomTypeId];
|
||||
}
|
||||
|
||||
if ($objFeaturePricing->save()) {
|
||||
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) {
|
||||
Tools::redirectAdmin(
|
||||
self::$currentIndex.'&id_feature_price='.(int) $objFeaturePricing->id.
|
||||
'&update'.$this->table.'&conf=4&token='.$this->token
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($dateSelectionType == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE) {
|
||||
if ($dateFrom == '') {
|
||||
$this->errors[] = $this->l('Please choose Date from for the advanced price rule.');
|
||||
}
|
||||
if ($dateTo == '') {
|
||||
$this->errors[] = $this->l('Please choose Date to for the advanced price rule.');
|
||||
}
|
||||
$dateFrom = date('Y-m-d', strtotime($dateFrom));
|
||||
$dateTo = date('Y-m-d', strtotime($dateTo));
|
||||
if (!Validate::isDate($dateFrom)) {
|
||||
$this->errors[] = $this->l('Invalid Date From.');
|
||||
}
|
||||
if (!Validate::isDate($dateTo)) {
|
||||
$this->errors[] = $this->l('Invalid Date To.');
|
||||
}
|
||||
if ($dateTo < $dateFrom) {
|
||||
$this->errors[] = $this->l('Date To must be a date after Date From.');
|
||||
}
|
||||
if ($isSpecialDaysExists) {
|
||||
if (!isset($specialDays) || !$specialDays) {
|
||||
$this->errors[] = $this->l('Please select at least one day for week days restriction.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($specificDate == '') {
|
||||
$this->errors[] = $this->l('Please choose Date from for the advanced price rule.');
|
||||
}
|
||||
$specificDate = date('Y-m-d', strtotime($specificDate));
|
||||
if (!Validate::isDate($specificDate)) {
|
||||
$this->errors[] = $this->l('Invalid Date From.');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$impactValue) {
|
||||
$this->errors[] = $this->l('Please enter a valid impact value.');
|
||||
} else {
|
||||
if (!Validate::isPrice($impactValue)) {
|
||||
$this->errors[] = $this->l('Invalid value of impact value.');
|
||||
}
|
||||
}
|
||||
|
||||
if (!(bool)$groups) {
|
||||
$this->errors[] = $this->l('Please select at least one group for the group access');
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
if ($idFeaturePrice) {
|
||||
$objFeaturePricing = new HotelRoomTypeFeaturePricing($idFeaturePrice);
|
||||
}
|
||||
$objFeaturePricing->id_product = $roomTypeId;
|
||||
// lang fields
|
||||
foreach ($languages as $language) {
|
||||
if (Tools::getValue('feature_price_name_'.$language['id_lang'])) {
|
||||
$objFeaturePricing->feature_price_name[$language['id_lang']] = Tools::getValue(
|
||||
'feature_price_name_'.$language['id_lang']
|
||||
);
|
||||
} else {
|
||||
$objFeaturePricing->feature_price_name[$language['id_lang']] = Tools::getValue(
|
||||
'feature_price_name_'.$defaultLangId
|
||||
);
|
||||
}
|
||||
}
|
||||
$objFeaturePricing->date_selection_type = $dateSelectionType;
|
||||
$objFeaturePricing->date_from = $dateFrom;
|
||||
$objFeaturePricing->date_to = $dateTo;
|
||||
$objFeaturePricing->impact_way = $priceImpactWay;
|
||||
$objFeaturePricing->is_special_days_exists = $isSpecialDaysExists;
|
||||
$objFeaturePricing->special_days = $jsonSpecialDays;
|
||||
$objFeaturePricing->impact_type = $priceImpactType;
|
||||
$objFeaturePricing->impact_value = $impactValue;
|
||||
$objFeaturePricing->active = $enableFeaturePrice;
|
||||
|
||||
// set the values of the groups for this feature price
|
||||
$objFeaturePricing->groupBox = $groups;
|
||||
|
||||
if ($objFeaturePricing->save()) {
|
||||
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) {
|
||||
Tools::redirectAdmin(
|
||||
self::$currentIndex.'&id_feature_price='.(int) $objFeaturePricing->id.
|
||||
'&update'.$this->table.'&conf=4&token='.$this->token
|
||||
);
|
||||
} else {
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Some error occured while saving advanced price rule.');
|
||||
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Some error occured while saving advanced price rule.');
|
||||
}
|
||||
}
|
||||
if (isset($idFeaturePrice) && $idFeaturePrice) {
|
||||
@@ -499,15 +572,14 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
|
||||
|
||||
public function ajaxProcessSearchProductByName()
|
||||
{
|
||||
$productName = Tools::getValue('room_type_name');
|
||||
if ($productName) {
|
||||
$productsByName = Product::searchByName($this->context->language->id, $productName);
|
||||
// filter room types as per accessed hotels
|
||||
$productsByName = HotelBranchInformation::filterDataByHotelAccess(
|
||||
$productsByName,
|
||||
$this->context->employee->id_profile
|
||||
);
|
||||
if ($productsByName) {
|
||||
$response = array('status' => 'failed');
|
||||
if ($productName = Tools::getValue('room_type_name')) {
|
||||
if ($productsByName = Product::searchByName($this->context->language->id, $productName)) {
|
||||
$productsByName = HotelBranchInformation::filterDataByHotelAccess(
|
||||
$productsByName,
|
||||
$this->context->employee->id_profile
|
||||
);
|
||||
// filter room types as per accessed hotels
|
||||
foreach ($productsByName as &$product) {
|
||||
$hotelRoomType = new HotelRoomType();
|
||||
$roomInfoByIdProduct = $hotelRoomType->getRoomTypeInfoByIdProduct($product['id_product']);
|
||||
@@ -517,22 +589,16 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
|
||||
$product['name'].= ' / '.$onjBranchInfo->hotel_name;
|
||||
}
|
||||
}
|
||||
echo json_encode($productsByName, true);
|
||||
die;
|
||||
|
||||
$response = $productsByName;
|
||||
} else {
|
||||
die(
|
||||
json_encode(
|
||||
array('status' => 'failed', 'msg' => $this->l('No match found for entered room type name.'))
|
||||
)
|
||||
);
|
||||
$response['msg'] = $this->l('No match found for entered room type name.');
|
||||
}
|
||||
} else {
|
||||
die(
|
||||
json_encode(
|
||||
array('status' => 'failed', 'msg' => $this->l('No match found for entered room type name.'))
|
||||
)
|
||||
);
|
||||
$response['msg'] = $this->l('No match found for entered room type name.');
|
||||
}
|
||||
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
public function setMedia()
|
||||
|
||||
@@ -569,6 +569,28 @@ $(document).ready(function() {
|
||||
|
||||
/* ---- AdminHotelFeaturePricesSettingsController Admin ---- */
|
||||
|
||||
if ($('input[name="create_multiple"]:checked').val() == 1) {
|
||||
$('.room-type-name').hide();
|
||||
$('.room-type-name-tree').show();
|
||||
$('[name="submitAddhtl_room_type_feature_pricingAndStay"]').hide();
|
||||
} else {
|
||||
$('.room-type-name').show();
|
||||
$('[name="submitAddhtl_room_type_feature_pricingAndStay"]').show();
|
||||
$('.room-type-name-tree').hide();
|
||||
}
|
||||
|
||||
$(document).on('change', 'input[name="create_multiple"]', function() {
|
||||
if ($('input[name="create_multiple"]:checked').val() == 1) {
|
||||
$('.room-type-name').hide();
|
||||
$('.room-type-name-tree').show();
|
||||
$('[name="submitAddhtl_room_type_feature_pricingAndStay"]').hide();
|
||||
} else {
|
||||
$('.room-type-name').show();
|
||||
$('[name="submitAddhtl_room_type_feature_pricingAndStay"]').show();
|
||||
$('.room-type-name-tree').hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#date_selection_type').on('change', function() {
|
||||
if ($('#date_selection_type').val() == date_selection_types.specific) {
|
||||
$(".specific_date_type").show(200);
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label required" for="feature_price_name" >
|
||||
{l s='Advanced Price Rule Name :' mod='hotelreservationsystem'}
|
||||
{l s='Advanced Price Rule Name ' mod='hotelreservationsystem'}
|
||||
</label>
|
||||
<div class="col-lg-3">
|
||||
{foreach from=$languages item=language}
|
||||
@@ -55,43 +55,80 @@
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="col-lg-9 col-lg-offset-3">
|
||||
<div class="help-block">
|
||||
{l s='Use {room_type_name} to generate dynamic feature price names.' mod='hotelreservationsystem'}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if !isset($objFeaturePrice) || !$objFeaturePrice->id}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-lg-3">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title="{l s='Enable this option to create advance price rules for multiple room types.' mod='hotelreservationsystem'}">
|
||||
{l s='Create for multiple room types' mod='hotelreservationsystem'}
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-lg-9 ">
|
||||
<span class="switch prestashop-switch fixed-width-lg">
|
||||
<input type="radio" {if isset($smarty.post.create_multiple) && $smarty.post.create_multiple == 1}checked="checked" {/if} value="1" id="create_multiple_on" name="create_multiple">
|
||||
<label for="create_multiple_on">{l s='Yes' mod='hotelreservationsystem'}</label>
|
||||
<input {if !isset($smarty.post.create_multiple) || isset($smarty.post.create_multiple) && $smarty.post.create_multiple == 0} checked="checked" {/if} type="radio" value="0" id="create_multiple_off" name="create_multiple">
|
||||
<label for="create_multiple_off">{l s='No' mod='hotelreservationsystem'}</label>
|
||||
<a class="slide-button btn"></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{if isset($hotel_tree)}
|
||||
<div class="form-group room-type-name-tree" style="display:none;">
|
||||
<label class="col-sm-3 control-label required" for="feature_price_name" >
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title="{l s='Select the room types for which you are going to create this advanced price rule.' mod='hotelreservationsystem'}">
|
||||
{l s='Room Types' mod='hotelreservationsystem'}
|
||||
</span>
|
||||
</label>
|
||||
<div class="col-sm-7">
|
||||
{$hotel_tree}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<div class="form-group room-type-name">
|
||||
<label class="col-sm-3 control-label required" for="feature_price_name" >
|
||||
{l s='Room Type :' mod='hotelreservationsystem'}
|
||||
{l s='Room Type' mod='hotelreservationsystem'}
|
||||
</label>
|
||||
<div class="col-sm-3">
|
||||
<input autocomplete="off" type="text" id="room_type_name" name="room_type_name" class="form-control" placeholder= "{l s='Enter room type name' mod='hotelreservationsystem'}" value="{if isset($productName)}{$productName}{/if}"/>
|
||||
<input type="hidden" id="room_type_id" name="room_type_id" class="form-control" value="{if isset($objFeaturePrice->id_product)}{$objFeaturePrice->id_product}{else}0{/if}"/>
|
||||
<div class="dropdown">
|
||||
<ul class="room_type_search_results_ul"></ul>
|
||||
</div>
|
||||
<ul class="room_type_search_results_ul"></ul>
|
||||
</div>
|
||||
<p class="error-block" style="display:none; color: #CD5D5D;">{l s='No match found for this search. Please try with an existing name.' mod='hotelreservationsystem'}</p>
|
||||
</div>
|
||||
<div class="col-lg-9 col-lg-offset-3">
|
||||
<div class="help-block">
|
||||
{l s='Enter room type name and select the room for which you are going to create this advanced price rule.' mod='hotelreservationsystem'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="date_selection_type" class="control-label col-lg-3">
|
||||
{l s='Date Selection type :' mod='hotelreservationsystem'}
|
||||
{l s='Date Selection type' mod='hotelreservationsystem'}
|
||||
</label>
|
||||
<div class="col-lg-3">
|
||||
<select class="form-control" name="date_selection_type" id="date_selection_type">
|
||||
<option value="{HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE}" {if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE}selected = "selected"{/if}>
|
||||
<option value="{HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE}" {if (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE) || (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE)}selected = "selected"{/if}>
|
||||
{l s='Date Range' mod='hotelreservationsystem'}
|
||||
</option>
|
||||
<option value="{HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}" {if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}selected = "selected"{/if}>
|
||||
<option value="{HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}" {if (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC)}selected = "selected"{/if}>
|
||||
{l s='Specific Date' mod='hotelreservationsystem'}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group specific_date_type" {if isset($edit) && $edit}{if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}{else}style="display:none;"{/if}>
|
||||
<div class="form-group specific_date_type" {if (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC)}style="display:none;"{else if !isset($edit) && !isset($smarty.post.date_selection_type)}style="display:none;"{/if}>
|
||||
<label class="col-sm-3 control-label required" for="specific_date" >
|
||||
{l s='Specific Date' mod='hotelreservationsystem'}
|
||||
</label>
|
||||
@@ -100,24 +137,24 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group date_range_type" {if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}>
|
||||
<div class="form-group date_range_type" {if (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE)}style="display:none;"{/if}>
|
||||
<label class="col-sm-3 control-label required" for="date_form" >
|
||||
{l s='Date From' mod='hotelreservationsystem'}
|
||||
</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="text" id="feature_plan_date_from" name="date_from" class="form-control datepicker-input" value="{if isset($objFeaturePrice->date_from)}{$objFeaturePrice->date_from|date_format:'%d-%m-%Y'}{else}{$date_from|date_format:'%d-%m-%Y'}{/if}" readonly/>
|
||||
<input type="text" id="feature_plan_date_from" name="date_from" class="form-control datepicker-input" value="{if isset($smarty.post.date_from) && $smarty.post.date_from}{$smarty.post.date_from}{elseif isset($objFeaturePrice->date_from)}{$objFeaturePrice->date_from|date_format:'%d-%m-%Y'}{else}{$date_from|date_format:'%d-%m-%Y'}{/if}" readonly/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group date_range_type" {if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}>
|
||||
<div class="form-group date_range_type" {if (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE)}style="display:none;"{/if}>
|
||||
<label class="col-sm-3 control-label required" for="date_to" >
|
||||
{l s='Date To' mod='hotelreservationsystem'}
|
||||
</label>
|
||||
<div class="col-sm-3">
|
||||
<input type="text" id="feature_plan_date_to" name="date_to" class="form-control datepicker-input" value="{if isset($objFeaturePrice->date_to)}{$objFeaturePrice->date_to|date_format:'%d-%m-%Y'}{else}{$date_to|date_format:'%d-%m-%Y'}{/if}" readonly/>
|
||||
<input type="text" id="feature_plan_date_to" name="date_to" class="form-control datepicker-input" value="{if isset($smarty.post.date_to) && $smarty.post.date_to}{$smarty.post.date_to}{elseif isset($objFeaturePrice->date_to)}{$objFeaturePrice->date_to|date_format:'%d-%m-%Y'}{else}{$date_to|date_format:'%d-%m-%Y'}{/if}" readonly/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group special_days_content" {if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}>
|
||||
<div class="form-group special_days_content" {if (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE)}style="display:none;"{/if}>
|
||||
<label class="control-label col-lg-3">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title="{l s='Enable this option to restrict this rule to specific week days (for example, weekends) of the selected date range. If disabled, rule will be applicable to all week days.' mod='hotelreservationsystem'}">
|
||||
{l s='Restrict to Week Days' mod='hotelreservationsystem'}
|
||||
@@ -127,7 +164,7 @@
|
||||
<span class="switch prestashop-switch fixed-width-lg">
|
||||
<input type="radio" {if isset($smarty.post.is_special_days_exists) && $smarty.post.is_special_days_exists == 1}checked="checked"{elseif isset($edit) && $objFeaturePrice->is_special_days_exists == 1}checked="checked"{/if} value="1" id="is_special_days_exists_on" name="is_special_days_exists">
|
||||
<label for="is_special_days_exists_on">{l s='Yes' mod='hotelreservationsystem'}</label>
|
||||
<input {if isset($edit) && $objFeaturePrice->is_special_days_exists == 0} checked="checked" {elseif !isset($smarty.post.is_special_days_exists) && !isset($edit)}checked="checked"{/if} type="radio" value="0" id="is_special_days_exists_off" name="is_special_days_exists">
|
||||
<input {if isset($smarty.post.is_special_days_exists) && $smarty.post.is_special_days_exists == 0} checked="checked" {elseif (isset($edit) && $objFeaturePrice->is_special_days_exists == 0) || !isset($edit)} checked="checked"{/if} type="radio" value="0" id="is_special_days_exists_off" name="is_special_days_exists">
|
||||
<label for="is_special_days_exists_off">{l s='No' mod='hotelreservationsystem'}</label>
|
||||
<a class="slide-button btn"></a>
|
||||
</span>
|
||||
@@ -135,7 +172,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group week_days" {if (isset($smarty.post.is_special_days_exists) && $smarty.post.is_special_days_exists) || (isset($objFeaturePrice->is_special_days_exists) && $objFeaturePrice->is_special_days_exists)}style="display:block;"{/if}>
|
||||
<label for="Price Impact Way" class="control-label col-lg-3">
|
||||
<label for="special_days" class="control-label col-lg-3">
|
||||
{l s='Select Week Days' mod='hotelreservationsystem'}
|
||||
</label>
|
||||
<div class="col-lg-3 checkboxes-wrap">
|
||||
@@ -200,17 +237,17 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label for="Price Impact Way" class="control-label col-lg-3">
|
||||
{l s='Impact Way :' mod='hotelreservationsystem'}
|
||||
{l s='Impact Way' mod='hotelreservationsystem'}
|
||||
</label>
|
||||
<div class="col-lg-3">
|
||||
<select class="form-control" name="price_impact_way" id="price_impact_way">
|
||||
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE}" {if isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE}selected = "selected"{/if}>
|
||||
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE}" {if (isset($smarty.post.price_impact_way) && $smarty.post.price_impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE) || (isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE && !isset($smarty.post.price_impact_way))}selected = "selected"{/if}>
|
||||
{l s='Decrease Price' mod='hotelreservationsystem'}
|
||||
</option>
|
||||
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_INCREASE}" {if isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_INCREASE}selected = "selected"{/if}>
|
||||
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_INCREASE}" {if (isset($smarty.post.price_impact_way) && $smarty.post.price_impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_INCREASE) || (isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_INCREASE && !isset($smarty.post.price_impact_way))}selected = "selected"{/if}>
|
||||
{l s='Increase Price' mod='hotelreservationsystem'}
|
||||
</option>
|
||||
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE}" {if isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE}selected = "selected"{/if}>
|
||||
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE}" {if (isset($smarty.post.price_impact_way) && $smarty.post.price_impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE) || (isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE && !isset($smarty.post.price_impact_way))}selected = "selected"{/if}>
|
||||
{l s='Fixed Price' mod='hotelreservationsystem'}
|
||||
</option>
|
||||
</select>
|
||||
@@ -219,14 +256,14 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label for="Price Impact Type" class="control-label col-lg-3">
|
||||
{l s='Impact Type :' mod='hotelreservationsystem'}
|
||||
{l s='Impact Type' mod='hotelreservationsystem'}
|
||||
</label>
|
||||
<div class="col-lg-3">
|
||||
<select class="form-control" name="price_impact_type" id="price_impact_type" {if isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE}disabled="disabled"{/if}>
|
||||
<option value="{HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE}" {if isset($objFeaturePrice->impact_type) && $objFeaturePrice->impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE}selected = "selected"{/if}>
|
||||
<select class="form-control" name="price_impact_type" id="price_impact_type" {if (isset($smarty.post.price_impact_way) && $smarty.post.price_impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE) || (isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE && !isset($smarty.post.price_impact_way))}disabled="disabled"{/if}>
|
||||
<option value="{HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE}" {if (isset($smarty.post.price_impact_type) && $smarty.post.price_impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE) || (isset($objFeaturePrice->impact_type) && $objFeaturePrice->impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE && !isset($smarty.post.price_impact_type))}selected = "selected"{/if}>
|
||||
{l s='Percentage' mod='hotelreservationsystem'}
|
||||
</option>
|
||||
<option value="{HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE}" {if isset($objFeaturePrice->impact_type) && $objFeaturePrice->impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE}selected = "selected"{/if}>
|
||||
<option value="{HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE}" {if (isset($smarty.post.price_impact_way) && $smarty.post.price_impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE) || (isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE && !isset($smarty.post.price_impact_way)) || (isset($smarty.post.price_impact_type) && $smarty.post.price_impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE) || (isset($objFeaturePrice->impact_type) && $objFeaturePrice->impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE && !isset($smarty.post.price_impact_type))}selected = "selected"{/if}>
|
||||
{l s='Amount' mod='hotelreservationsystem'}
|
||||
</option>
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user