Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated: Move Week Days list in a new row on Advanced Price Rule form at back office #808

Merged
merged 8 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ public function processSave()
}

$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,
Expand Down Expand Up @@ -412,14 +412,10 @@ public function processSave()
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 == '') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
Expand Down Expand Up @@ -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'}
Expand Down Expand Up @@ -113,77 +116,78 @@
<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))}
checked="checked"
{/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))}
checked="checked"
{/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))}
checked="checked"
{/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))}
checked="checked"
{/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))}
checked="checked"
{/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))}
checked="checked"
{/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))}
Expand Down