Skip to content

Commit 86c69a0

Browse files
authored
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
2 parents b45c954 + 78a54fb commit 86c69a0

File tree

4 files changed

+57
-51
lines changed

4 files changed

+57
-51
lines changed

modules/hotelreservationsystem/controllers/admin/AdminHotelFeaturePricesSettings.php

+4-8
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ public function processSave()
353353
}
354354

355355
$isPlanTypeExists = 0;
356-
if (isset($isSpecialDaysExists) && $isSpecialDaysExists == 'on' && $jsonSpecialDays == "false") {
357-
$this->errors[] = $this->l('Please select at least one day for the special day selection.');
356+
if ($isSpecialDaysExists && $jsonSpecialDays == 'false') {
357+
$this->errors[] = $this->l('Please select at least one day for week days restriction.');
358358
} else {
359359
$isPlanTypeExists = $this->validateExistingFeaturePrice(
360360
$dateSelectionType,
@@ -412,14 +412,10 @@ public function processSave()
412412
if ($dateTo < $dateFrom) {
413413
$this->errors[] = $this->l('Date To must be a date after Date From.');
414414
}
415-
if (isset($isSpecialDaysExists) && $isSpecialDaysExists == 'on') {
416-
$isSpecialDaysExists = 1;
415+
if ($isSpecialDaysExists) {
417416
if (!isset($specialDays) || !$specialDays) {
418-
$isSpecialDaysExists = 0;
419-
$this->errors[] = $this->l('Please select at least one day for the special day selection.');
417+
$this->errors[] = $this->l('Please select at least one day for week days restriction.');
420418
}
421-
} else {
422-
$isSpecialDaysExists = 0;
423419
}
424420
} else {
425421
if ($specificDate == '') {

modules/hotelreservationsystem/views/css/HotelReservationAdmin.css

+6
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,12 @@ p.room_cat_data
492492
.week_days {
493493
display: none;
494494
}
495+
.week_days .checkboxes-wrap {
496+
display: flex;
497+
}
498+
.week_days .checkboxes-wrap .day-wrap {
499+
min-width: 50px;
500+
}
495501
.room_type_search_results_ul {
496502
padding: 0px;
497503
background: #ffffff none repeat scroll 0 0;

modules/hotelreservationsystem/views/js/HotelReservationAdmin.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -580,8 +580,8 @@ $(document).ready(function() {
580580
});
581581

582582

583-
$(".is_special_days_exists").on ('click', function() {
584-
if ($(this).is(':checked')) {
583+
$('[name="is_special_days_exists"]').on('change', function() {
584+
if (parseInt($('[name="is_special_days_exists"]:checked').val())) {
585585
$('.week_days').show(200);
586586
} else {
587587
$('.week_days').hide(200);

modules/hotelreservationsystem/views/templates/admin/hotel_feature_prices_settings/helpers/form/form.tpl

+45-41
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,7 @@
2929
{if isset($edit)}
3030
<input type="hidden" value="{$objFeaturePrice->id|escape:'html':'UTF-8'}" name="id_feature_price" />
3131
{/if}
32-
<div class="form-group">
33-
<label class="col-sm-3 control-label required" for="feature_price_name" >
34-
{l s='Room Type :' mod='hotelreservationsystem'}
35-
</label>
36-
<div class="col-sm-3">
37-
<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}"/>
38-
<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}"/>
39-
<div class="dropdown">
40-
<ul class="room_type_search_results_ul"></ul>
41-
</div>
42-
<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>
43-
</div>
44-
<div class="help-block">
45-
**{l s='Enter room type name and select the room for which you are going to create this advanced price rule.' mod='hotelreservationsystem'}
46-
</div>
47-
</div>
32+
4833
<div class="form-group">
4934
<label class="col-sm-3 control-label required" for="feature_price_name" >
5035
{l s='Advanced Price Rule Name :' mod='hotelreservationsystem'}
@@ -72,6 +57,24 @@
7257
{/if}
7358
</div>
7459

60+
<div class="form-group room-type-name">
61+
<label class="col-sm-3 control-label required" for="feature_price_name" >
62+
{l s='Room Type :' mod='hotelreservationsystem'}
63+
</label>
64+
<div class="col-sm-3">
65+
<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}"/>
66+
<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}"/>
67+
<div class="dropdown">
68+
<ul class="room_type_search_results_ul"></ul>
69+
</div>
70+
<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>
71+
<div class="help-block">
72+
{l s='Enter room type name and select the room for which you are going to create this advanced price rule.' mod='hotelreservationsystem'}
73+
</div>
74+
</div>
75+
76+
</div>
77+
7578
<div class="form-group">
7679
<label for="date_selection_type" class="control-label col-lg-3">
7780
{l s='Date Selection type :' mod='hotelreservationsystem'}
@@ -113,77 +116,78 @@
113116
<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/>
114117
</div>
115118
</div>
116-
<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}>
119+
120+
<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}>
117121
<label class="control-label col-lg-3">
118-
<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'}">
119-
{l s='For Special Days' mod='hotelreservationsystem'}
122+
<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'}">
123+
{l s='Restrict to Week Days' mod='hotelreservationsystem'}
120124
</span>
121125
</label>
122-
<div class="col-sm-2">
123-
<p class="checkbox">
124-
<label>
125-
<input class="is_special_days_exists pull-left" type="checkbox" name="is_special_days_exists"
126-
{if (isset($smarty.post.is_special_days_exists) && $smarty.post.is_special_days_exists)
127-
|| (isset($objFeaturePrice->is_special_days_exists) && $objFeaturePrice->is_special_days_exists)}
128-
checked="checked"
129-
{/if}/>
130-
{l s='Check to select special days' mod='hotelreservationsystem'}
131-
</label>
132-
</p>
126+
<div class="col-lg-9 ">
127+
<span class="switch prestashop-switch fixed-width-lg">
128+
<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">
129+
<label for="is_special_days_exists_on">{l s='Yes' mod='hotelreservationsystem'}</label>
130+
<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">
131+
<label for="is_special_days_exists_off">{l s='No' mod='hotelreservationsystem'}</label>
132+
<a class="slide-button btn"></a>
133+
</span>
133134
</div>
134-
<div class="col-sm-7 week_days"
135-
{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)}
136-
style="display:block;"
137-
{/if}>
138-
<div class="col-sm-1">
135+
</div>
136+
137+
<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}>
138+
<label for="Price Impact Way" class="control-label col-lg-3">
139+
{l s='Select Week Days' mod='hotelreservationsystem'}
140+
</label>
141+
<div class="col-lg-3 checkboxes-wrap">
142+
<div class="day-wrap">
139143
<input type="checkbox" name="special_days[]" value="mon"
140144
{if (isset($smarty.post.special_days) && in_array('mon', $smarty.post.special_days))
141145
|| (isset($special_days) && $special_days && in_array('mon', $special_days))}
142146
checked="checked"
143147
{/if}/>
144148
<p>{l s='Mon' mod='hotelreservationsystem'}</p>
145149
</div>
146-
<div class="col-sm-1">
150+
<div class="day-wrap">
147151
<input type="checkbox" name="special_days[]" value="tue"
148152
{if (isset($smarty.post.special_days) && in_array('tue', $smarty.post.special_days))
149153
|| (isset($special_days) && $special_days && in_array('tue', $special_days))}
150154
checked="checked"
151155
{/if}/>
152156
<p>{l s='Tue' mod='hotelreservationsystem'}</p>
153157
</div>
154-
<div class="col-sm-1">
158+
<div class="day-wrap">
155159
<input type="checkbox" name="special_days[]" value="wed"
156160
{if (isset($smarty.post.special_days) && in_array('wed', $smarty.post.special_days))
157161
|| (isset($special_days) && $special_days && in_array('wed', $special_days))}
158162
checked="checked"
159163
{/if}/>
160164
<p>{l s='Wed' mod='hotelreservationsystem'}</p>
161165
</div>
162-
<div class="col-sm-1">
166+
<div class="day-wrap">
163167
<input type="checkbox" name="special_days[]" value="thu"
164168
{if (isset($smarty.post.special_days) && in_array('thu', $smarty.post.special_days))
165169
|| (isset($special_days) && $special_days && in_array('thu', $special_days))}
166170
checked="checked"
167171
{/if}/>
168172
<p>{l s='Thu' mod='hotelreservationsystem'}</p>
169173
</div>
170-
<div class="col-sm-1">
174+
<div class="day-wrap">
171175
<input type="checkbox" name="special_days[]" value="fri"
172176
{if (isset($smarty.post.special_days) && in_array('fri', $smarty.post.special_days))
173177
|| (isset($special_days) && $special_days && in_array('fri', $special_days))}
174178
checked="checked"
175179
{/if}/>
176180
<p>{l s='Fri' mod='hotelreservationsystem'}</p>
177181
</div>
178-
<div class="col-sm-1">
182+
<div class="day-wrap">
179183
<input type="checkbox" name="special_days[]" value="sat"
180184
{if (isset($smarty.post.special_days) && in_array('sat', $smarty.post.special_days))
181185
|| (isset($special_days) && $special_days && in_array('sat', $special_days))}
182186
checked="checked"
183187
{/if}/>
184188
<p>{l s='Sat' mod='hotelreservationsystem'}</p>
185189
</div>
186-
<div class="col-sm-1">
190+
<div class="day-wrap">
187191
<input type="checkbox" name="special_days[]" value="sun"
188192
{if (isset($smarty.post.special_days) && in_array('sun', $smarty.post.special_days))
189193
|| (isset($special_days) && $special_days && in_array('sun', $special_days))}

0 commit comments

Comments
 (0)