Merge pull request #808 from abhishek-webkul/gli-766

Updated: Move Week Days list in a new row on Advanced Price Rule form at back office
This commit is contained in:
Rohit Jain
2024-03-18 13:36:04 +05:30
committed by GitHub
4 changed files with 57 additions and 51 deletions

View File

@@ -353,8 +353,8 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
}
$isPlanTypeExists = 0;
if (isset($isSpecialDaysExists) && $isSpecialDaysExists == 'on' && $jsonSpecialDays == "false") {
$this->errors[] = $this->l('Please select at least one day for the special day selection.');
if ($isSpecialDaysExists && $jsonSpecialDays == 'false') {
$this->errors[] = $this->l('Please select at least one day for week days restriction.');
} else {
$isPlanTypeExists = $this->validateExistingFeaturePrice(
$dateSelectionType,
@@ -412,14 +412,10 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
if ($dateTo < $dateFrom) {
$this->errors[] = $this->l('Date To must be a date after Date From.');
}
if (isset($isSpecialDaysExists) && $isSpecialDaysExists == 'on') {
$isSpecialDaysExists = 1;
if ($isSpecialDaysExists) {
if (!isset($specialDays) || !$specialDays) {
$isSpecialDaysExists = 0;
$this->errors[] = $this->l('Please select at least one day for the special day selection.');
$this->errors[] = $this->l('Please select at least one day for week days restriction.');
}
} else {
$isSpecialDaysExists = 0;
}
} else {
if ($specificDate == '') {

View File

@@ -492,6 +492,12 @@ p.room_cat_data
.week_days {
display: none;
}
.week_days .checkboxes-wrap {
display: flex;
}
.week_days .checkboxes-wrap .day-wrap {
min-width: 50px;
}
.room_type_search_results_ul {
padding: 0px;
background: #ffffff none repeat scroll 0 0;

View File

@@ -580,8 +580,8 @@ $(document).ready(function() {
});
$(".is_special_days_exists").on ('click', function() {
if ($(this).is(':checked')) {
$('[name="is_special_days_exists"]').on('change', function() {
if (parseInt($('[name="is_special_days_exists"]:checked').val())) {
$('.week_days').show(200);
} else {
$('.week_days').hide(200);

View File

@@ -29,22 +29,7 @@
{if isset($edit)}
<input type="hidden" value="{$objFeaturePrice->id|escape:'html':'UTF-8'}" name="id_feature_price" />
{/if}
<div class="form-group">
<label class="col-sm-3 control-label required" for="feature_price_name" >
{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>
<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="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 class="form-group">
<label class="col-sm-3 control-label required" for="feature_price_name" >
{l s='Advanced Price Rule Name :' mod='hotelreservationsystem'}
@@ -72,6 +57,24 @@
{/if}
</div>
<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'}
</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>
<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 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'}
@@ -113,29 +116,30 @@
<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/>
</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}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='If you want to create this Advanced price rule only for some special days of the week of selected date range then you can select select days after checking this option. Otherwise rule will be created for whole selected date range.' mod='hotelreservationsystem'}">
{l s='For Special Days' mod='hotelreservationsystem'}
<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'}
</span>
</label>
<div class="col-sm-2">
<p class="checkbox">
<label>
<input class="is_special_days_exists pull-left" type="checkbox" name="is_special_days_exists"
{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)}
checked="checked"
{/if}/>
{l s='Check to select special days' mod='hotelreservationsystem'}
</label>
</p>
<div class="col-lg-9 ">
<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">
<label for="is_special_days_exists_off">{l s='No' mod='hotelreservationsystem'}</label>
<a class="slide-button btn"></a>
</span>
</div>
<div class="col-sm-7 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}>
<div class="col-sm-1">
</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">
{l s='Select Week Days' mod='hotelreservationsystem'}
</label>
<div class="col-lg-3 checkboxes-wrap">
<div class="day-wrap">
<input type="checkbox" name="special_days[]" value="mon"
{if (isset($smarty.post.special_days) && in_array('mon', $smarty.post.special_days))
|| (isset($special_days) && $special_days && in_array('mon', $special_days))}
@@ -143,7 +147,7 @@
{/if}/>
<p>{l s='Mon' mod='hotelreservationsystem'}</p>
</div>
<div class="col-sm-1">
<div class="day-wrap">
<input type="checkbox" name="special_days[]" value="tue"
{if (isset($smarty.post.special_days) && in_array('tue', $smarty.post.special_days))
|| (isset($special_days) && $special_days && in_array('tue', $special_days))}
@@ -151,7 +155,7 @@
{/if}/>
<p>{l s='Tue' mod='hotelreservationsystem'}</p>
</div>
<div class="col-sm-1">
<div class="day-wrap">
<input type="checkbox" name="special_days[]" value="wed"
{if (isset($smarty.post.special_days) && in_array('wed', $smarty.post.special_days))
|| (isset($special_days) && $special_days && in_array('wed', $special_days))}
@@ -159,7 +163,7 @@
{/if}/>
<p>{l s='Wed' mod='hotelreservationsystem'}</p>
</div>
<div class="col-sm-1">
<div class="day-wrap">
<input type="checkbox" name="special_days[]" value="thu"
{if (isset($smarty.post.special_days) && in_array('thu', $smarty.post.special_days))
|| (isset($special_days) && $special_days && in_array('thu', $special_days))}
@@ -167,7 +171,7 @@
{/if}/>
<p>{l s='Thu' mod='hotelreservationsystem'}</p>
</div>
<div class="col-sm-1">
<div class="day-wrap">
<input type="checkbox" name="special_days[]" value="fri"
{if (isset($smarty.post.special_days) && in_array('fri', $smarty.post.special_days))
|| (isset($special_days) && $special_days && in_array('fri', $special_days))}
@@ -175,7 +179,7 @@
{/if}/>
<p>{l s='Fri' mod='hotelreservationsystem'}</p>
</div>
<div class="col-sm-1">
<div class="day-wrap">
<input type="checkbox" name="special_days[]" value="sat"
{if (isset($smarty.post.special_days) && in_array('sat', $smarty.post.special_days))
|| (isset($special_days) && $special_days && in_array('sat', $special_days))}
@@ -183,7 +187,7 @@
{/if}/>
<p>{l s='Sat' mod='hotelreservationsystem'}</p>
</div>
<div class="col-sm-1">
<div class="day-wrap">
<input type="checkbox" name="special_days[]" value="sun"
{if (isset($smarty.post.special_days) && in_array('sun', $smarty.post.special_days))
|| (isset($special_days) && $special_days && in_array('sun', $special_days))}