Updated: Display Helper list filters above list table using new list header option
This commit is contained in:
@@ -191,6 +191,84 @@ body.display-modal
|
||||
margin: 15px 0 0!important
|
||||
height: 40px!important
|
||||
|
||||
//list header
|
||||
.list_action_wrapper
|
||||
margin-bottom: 15px
|
||||
.list_availibility_container
|
||||
position: relative
|
||||
.dropdown-menu
|
||||
right: 0
|
||||
padding: 8px 12px
|
||||
label
|
||||
font-weight: 400
|
||||
#selected_filter_container
|
||||
background-color: #fff
|
||||
padding: 8px 20px
|
||||
border: solid 1px #d3d8db
|
||||
border-radius: 5px 5px 0 0
|
||||
font-size: 14px
|
||||
min-height: 52px
|
||||
margin-top: 15px
|
||||
.selected_filters > span
|
||||
font-size: 12px
|
||||
padding: 6px 10px
|
||||
display: inline-block
|
||||
background: #F5F8F9
|
||||
border: 1px solid #A0D0EB
|
||||
border-radius: 3px
|
||||
&+ span
|
||||
margin-left: 12px
|
||||
.filter_value
|
||||
font-weight: 700
|
||||
i
|
||||
cursor: pointer
|
||||
|
||||
#list_filters_panel
|
||||
margin-top: 15px
|
||||
margin-bottom: 0
|
||||
#selected_filter_container + #list_filters_panel
|
||||
margin-top: 0
|
||||
#selected_filter_container + div.panel
|
||||
border-top: transparent
|
||||
border-radius: 0 0 5px 5px
|
||||
.list_filters
|
||||
padding: 0 30px
|
||||
display: grid
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr))
|
||||
gap: 8px 40px
|
||||
&>.row
|
||||
display: flex
|
||||
align-items: center
|
||||
.date_range, .input_range
|
||||
display: flex
|
||||
justify-content: space-between
|
||||
gap: 15px
|
||||
.date_range .input-group:first-child
|
||||
margin-bottom: 0
|
||||
label
|
||||
text-align: right
|
||||
font-weight: 400
|
||||
.actions
|
||||
grid-column-start: 1
|
||||
grid-column-end: 4
|
||||
@media (max-width: $screen-desktop)
|
||||
.list_filters
|
||||
grid-template-columns: repeat(2, 1fr)
|
||||
.actions
|
||||
grid-column-start: 1
|
||||
grid-column-end: 3
|
||||
|
||||
@media (max-width: $screen-tablet)
|
||||
.list_filters
|
||||
grid-template-columns: repeat(1, 1fr)
|
||||
.actions
|
||||
grid-column-start: 1
|
||||
grid-column-end: 2
|
||||
label
|
||||
text-align: left
|
||||
|
||||
|
||||
|
||||
//help containers
|
||||
#main.helpOpen
|
||||
width: 70%
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../../../../../../');
|
||||
exit;
|
||||
@@ -1,36 +0,0 @@
|
||||
{*
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{extends file="helpers/list/list_header.tpl"}
|
||||
|
||||
{block name=leadin}
|
||||
{if isset($category_tree)}
|
||||
<div class="bloc-leadin">
|
||||
<div id="container_category_tree">
|
||||
{$category_tree}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
@@ -65,446 +65,91 @@
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
|
||||
{block name="tableFilter"}{/block}
|
||||
{block name="override_form_extra"}
|
||||
{if !$simple_header && $show_filters}
|
||||
<script>
|
||||
$(function() {
|
||||
if ($("#list_filters_panel .datepicker").length > 0) {
|
||||
$("#list_filters_panel .datepicker").datepicker({
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
altFormat: 'yy-mm-dd'
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<div class="list_action_wrapper">
|
||||
<div class="row">
|
||||
<div class="col-xs-4 col-sm-3 col-md-2">
|
||||
<div class="list_availibility_container">
|
||||
<button type="button" class="btn btn-default btn-left btn-block dropdown-toggle" data-toggle="dropdown">
|
||||
<span>{l s='Available Fields'}
|
||||
<i class="icon-caret-down pull-right"></i>
|
||||
</button>
|
||||
<ul id="optional-list-toggle" class="dropdown-menu">
|
||||
{foreach $fields_optional as $key => $field}
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox" name="list_fields_visibility" value="{$key}" {if isset($field['selected']) && $field['selected']}checked="checked"{/if}>
|
||||
{$field['title']}
|
||||
</label>
|
||||
</li>
|
||||
{/foreach}
|
||||
{assign var="fields_optional" value=array()}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-3 col-xs-offset-5 col-sm-2 col-sm-offset-7 col-md-1 col-md-offset-9">
|
||||
<div class="list_filter_container">
|
||||
<button type="button" class="btn btn-default btn-block" data-toggle="collapse" data-target="#list_filters_panel">
|
||||
<i class="icon-sliders"></i>
|
||||
<span>{l s='Filters'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{if $filters_has_value}
|
||||
<div id="selected_filter_container">
|
||||
{l s='Filters: '}
|
||||
<span class="selected_filters">
|
||||
{foreach $fields_display AS $key => $params}
|
||||
{if (!isset($params.search) || $params.search) && $params.value != ''}
|
||||
{if ($params.type == 'date' || $params.type == 'datetime' || $params.type == 'range') && $params.value|is_array}
|
||||
{assign var="filter_value" value=''}
|
||||
{foreach $params.value as $value}
|
||||
{if (isset($value) && ($value !== '' || $value === 0))}
|
||||
{if !(isset($filter_value) && ($filter_value !== '' || $filter_value === 0))}
|
||||
{assign var="filter_value" value=$value}
|
||||
{else}
|
||||
{assign var="filter_value" value="`$filter_value` - `$value`"}
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if (isset($filter_value) && ($filter_value !== '' || $filter_value === 0))}
|
||||
<span data-filter_key="{if isset($params.name_date)}{$params.name_date}{else}{$key}{/if}" data-filter_type="{$params.type}">
|
||||
{$params['title']|escape:'html':'UTF-8'}: <span class="filter_value">{$filter_value|escape:'html':'UTF-8'}</span>
|
||||
<i class="icon-times"></i>
|
||||
</span>
|
||||
{/if}
|
||||
{elseif $params.type == 'select'}
|
||||
{if isset($params.multiple) && $params.multiple}
|
||||
<span data-filter_key="{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" data-filter_type="{$params.type}" data-multiple="{$params.multiple|intval}" data-operator="{$params.operator}">
|
||||
{$params['title']|escape:'html':'UTF-8'}:
|
||||
<span class="filter_value">
|
||||
{foreach from=$params.value item=option name=foreachInfo}
|
||||
{$params.list[$option]}{if !$smarty.foreach.foreachInfo.last}{if $params.operator == 'or'} | {else}, {/if}{/if}
|
||||
{/foreach}
|
||||
</span>
|
||||
<i class="icon-times"></i>
|
||||
</span>
|
||||
{else}
|
||||
<span data-filter_key="{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" data-filter_type="{$params.type}">
|
||||
{$params['title']|escape:'html':'UTF-8'}: <span class="filter_value">{$params['list'][$params['value']]|replace: ' ' : ''}</span>
|
||||
<i class="icon-times"></i>
|
||||
</span>
|
||||
{/if}
|
||||
{else}
|
||||
<span data-filter_key="{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" data-filter_type="{$params.type}">
|
||||
{$params['title']|escape:'html':'UTF-8'}: <span class="filter_value">{$params['value']|escape:'html':'UTF-8'}</span>
|
||||
<i class="icon-times"></i>
|
||||
</span>
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</span>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="panel collapse" id="list_filters_panel">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="list_filters">
|
||||
{foreach $fields_display AS $key => $params}
|
||||
{if !isset($params.search) || $params.search}
|
||||
<div class="row">
|
||||
<label class="col-xs-3" for="filter_input_{$key}">{$params['title']|escape:'html':'UTF-8'}</label>
|
||||
<div class="col-xs-9">
|
||||
{if $params.type == 'range'}
|
||||
<div class="input_range">
|
||||
<input type="text" class="filter form-control" name="{$list_id}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}[0]" placeholder="{l s='From'}" value="{if isset($params.value.0)}{$params.value.0}{/if}">
|
||||
<input type="text" class="filter form-control" name="{$list_id}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}[1]" placeholder="{l s='To'}" value="{if isset($params.value.1)}{$params.value.1}{/if}">
|
||||
</div>
|
||||
{elseif $params.type == 'bool'}
|
||||
<select id="filter_input_{$key}" class="filter fixed-width-sm center" name="{$list_id}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}">
|
||||
<option value="">-</option>
|
||||
<option value="1" {if $params.value == 1} selected="selected" {/if}>{l s='Yes'}</option>
|
||||
<option value="0" {if $params.value == 0 && $params.value != ''} selected="selected" {/if}>{l s='No'}</option>
|
||||
</select>
|
||||
{elseif $params.type == 'date' || $params.type == 'datetime'}
|
||||
<div class="date_range">
|
||||
<div class="input-group center">
|
||||
<input type="text" class="filter datepicker date-input form-control" id="local_{$params.id_date}_0" name="local_{$params.name_date}[0]" placeholder="{l s='From'}" autocomplete="off"/>
|
||||
<input type="hidden" id="{$params.id_date}_0" name="{$params.name_date}[0]" value="{if isset($params.value.0)}{$params.value.0}{/if}">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-calendar"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="input-group center">
|
||||
<input type="text" class="filter datepicker date-input form-control" id="local_{$params.id_date}_1" name="local_{$params.name_date}[1]" placeholder="{l s='To'}" autocomplete="off"/>
|
||||
<input type="hidden" id="{$params.id_date}_1" name="{$params.name_date}[1]" value="{if isset($params.value.1)}{$params.value.1}{/if}">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-calendar"></i>
|
||||
</span>
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
var dateStart = parseDate($("#{$params.id_date}_0").val());
|
||||
var dateEnd = parseDate($("#{$params.id_date}_1").val());
|
||||
$("#local_{$params.id_date}_0").datepicker("option", "altField", "#{$params.id_date}_0");
|
||||
$("#local_{$params.id_date}_1").datepicker("option", "altField", "#{$params.id_date}_1");
|
||||
if (dateStart !== null){
|
||||
$("#local_{$params.id_date}_0").datepicker("setDate", dateStart);
|
||||
}
|
||||
if (dateEnd !== null){
|
||||
$("#local_{$params.id_date}_1").datepicker("setDate", dateEnd);
|
||||
}
|
||||
|
||||
$('#local_{$params.id_date}_0').datepicker('option', {
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
dateFormat: 'yy-mm-dd',
|
||||
onClose: function() {
|
||||
let dateFrom = $('#local_{$params.id_date}_0').val().trim();
|
||||
let dateTo = $('#local_{$params.id_date}_1').val().trim();
|
||||
|
||||
if ((dateFrom && dateTo) && (dateFrom >= dateTo)) {
|
||||
let objDateToMin = $.datepicker.parseDate('yy-mm-dd', dateFrom);
|
||||
objDateToMin.setDate(objDateToMin.getDate());
|
||||
|
||||
$('#local_{$params.id_date}_1').datepicker('option', 'minDate', objDateToMin);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
$('#local_{$params.id_date}_1').datepicker('option', {
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
dateFormat: 'yy-mm-dd',
|
||||
beforeShow: function() {
|
||||
let dateFrom = $('#local_{$params.id_date}_0').val().trim();
|
||||
|
||||
if (typeof dateFrom != 'undefined' && dateFrom != '') {
|
||||
let objDateToMin = $.datepicker.parseDate('yy-mm-dd', dateFrom);
|
||||
objDateToMin.setDate(objDateToMin.getDate());
|
||||
|
||||
$('#local_{$params.id_date}_1').datepicker('option', 'minDate', objDateToMin);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
{elseif $params.type == 'select'}
|
||||
{if isset($params.multiple) && $params.multiple}
|
||||
<select id="filter_input_{$key}" class="filter{if isset($params.align) && $params.align == 'center'}center{/if} select_multiple_{$params.operator} chosen" multiple name="{$list_id}Filter_{$params.filter_key}[]" {if isset($params.width)} style="width:{$params.width}px"{/if}>
|
||||
{if isset($params.list) && is_array($params.list)}
|
||||
{foreach $params.list AS $option_value => $option_display}
|
||||
<option value="{$option_value}" {if isset($params.value) && $params.value}{if in_array($option_value, $params.value)} selected="selected"{/if}{/if}>{$option_display}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
{else}
|
||||
{if isset($params.filter_key)}
|
||||
<select id="filter_input_{$key}" class="filter{if isset($params.align) && $params.align == 'center'}center{/if} {if isset($params.class)}{$params.class}{/if}" {if !isset($params.remove_onchange) || !$params.remove_onchange}onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();"{/if} name="{$list_id}Filter_{$params.filter_key}" {if isset($params.width)} style="width:{$params.width}px"{/if}>
|
||||
<option value="" {if $params.value == ''} selected="selected" {/if}>-</option>
|
||||
{if isset($params.list) && is_array($params.list)}
|
||||
{foreach $params.list AS $option_value => $option_display}
|
||||
<option value="{$option_value}" {if (string)$option_display === (string)$params.value || (string)$option_value === (string)$params.value} selected="selected"{/if}>{$option_display}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
{/if}
|
||||
{/if}
|
||||
{else}
|
||||
<input type="text" id="filter_input_{$key}" class="filter" name="{$list_id}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" value="{$params.value|escape:'html':'UTF-8'}" {if isset($params.width) && $params.width != 'auto'} style="width:{$params.width}px"{/if} />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if $has_actions || $show_filters}
|
||||
<div class="actions">
|
||||
<hr>
|
||||
{if $show_filters}
|
||||
<span class="pull-right">
|
||||
<button type="submit" id="submitFilterButton{$list_id}" name="submitFilter" class="btn btn-default" data-list-id="{$list_id}">
|
||||
<i class="icon-search"></i> {l s='Search'}
|
||||
</button>
|
||||
{if $filters_has_value}
|
||||
<button type="submit" name="submitReset{$list_id}" class="btn btn-warning">
|
||||
<i class="icon-eraser"></i> {l s='Reset'}
|
||||
</button>
|
||||
{/if}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#selected_filter_container .selected_filters span i').on('click', function() {
|
||||
let form = $(this).closest('form');
|
||||
let type = $(this).parent().data('filter_type');
|
||||
$(this).parent().remove();
|
||||
if (type == 'date' || type == 'datetime') {
|
||||
$('#list_filters_panel').find('[name*="'+$(this).parent().data('filter_key')+'"]').val('');
|
||||
} else if (type == 'range') {
|
||||
$('#list_filters_panel').find('[name*="orderFilter_'+$(this).parent().data('filter_key')+'"]').val('');
|
||||
} else if (type == 'select') {
|
||||
$('#list_filters_panel').find('select[name*="orderFilter_'+$(this).parent().data('filter_key')+'"] option:selected').prop('selected', false);
|
||||
} else {
|
||||
$('#list_filters_panel').find('input[name="orderFilter_'+$(this).parent().data('filter_key')+'"]').val('');
|
||||
}
|
||||
function updateRoomTypeFilter() {
|
||||
let filterInputHotelName = $('#filter_input_hotel_name');
|
||||
let filterInputRoomTypeName = $('#filter_input_room_type_name');
|
||||
|
||||
// set post data for empty multi-select filters
|
||||
$(form).find('select[multiple]').each(function (i, selectElement) {
|
||||
if ($(selectElement).find('option:selected').length == 0) {
|
||||
$(form).append('<input type="hidden" name="' + $(selectElement).attr('name').slice(0, -2) + '" value="">');
|
||||
}
|
||||
});
|
||||
let idHotel = parseInt($(filterInputHotelName).val() || '0');
|
||||
|
||||
form.submit();
|
||||
});
|
||||
$.ajax({
|
||||
url: currentIndex + '&token=' + token,
|
||||
data: {
|
||||
ajax: true,
|
||||
action: 'GetHotelRoomTypes',
|
||||
id_hotel: idHotel,
|
||||
},
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
success: function(response) {
|
||||
if (response.status) {
|
||||
if (response.has_room_types) {
|
||||
$(filterInputRoomTypeName).html(response.html_room_types);
|
||||
} else {
|
||||
$(filterInputRoomTypeName).find('option').not(':first').remove();
|
||||
}
|
||||
|
||||
$('#form-order').submit(function () {
|
||||
let form = $(this);
|
||||
$(form).find('select[multiple]').each(function (i, selectElement) {
|
||||
if ($(selectElement).val() == null) {
|
||||
$(form).append('<input type="hidden" name="' + $(selectElement).attr('name').slice(0, -2) + '" value="">');
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
});
|
||||
});
|
||||
|
||||
function updateRoomTypeFilter() {
|
||||
let filterInputHotelName = $('#filter_input_hotel_name');
|
||||
let filterInputRoomTypeName = $('#filter_input_room_type_name');
|
||||
|
||||
let idHotel = parseInt($(filterInputHotelName).val() || '0');
|
||||
|
||||
$.ajax({
|
||||
url: currentIndex + '&token=' + token,
|
||||
data: {
|
||||
ajax: true,
|
||||
action: 'GetHotelRoomTypes',
|
||||
id_hotel: idHotel,
|
||||
},
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
success: function(response) {
|
||||
if (response.status) {
|
||||
if (response.has_room_types) {
|
||||
$(filterInputRoomTypeName).html(response.html_room_types);
|
||||
} else {
|
||||
$(filterInputRoomTypeName).find('option').not(':first').remove();
|
||||
// destroy current chosen and re-initialize
|
||||
$(filterInputRoomTypeName).chosen('destroy');
|
||||
$(filterInputRoomTypeName).chosen({
|
||||
disable_search_threshold: 5,
|
||||
search_contains: true,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// destroy current chosen and re-initialize
|
||||
$(filterInputRoomTypeName).chosen('destroy');
|
||||
$(filterInputRoomTypeName).chosen({
|
||||
disable_search_threshold: 5,
|
||||
search_contains: true,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
function updateHotelRoomsFilter(useRoomType = true) {
|
||||
let filterInputHotelName = $('#filter_input_hotel_name');
|
||||
let filterInputRoomTypeName = $('#filter_input_room_type_name');
|
||||
let filterInputRoomNumber = $('#filter_input_id_room_information');
|
||||
|
||||
function updateHotelRoomsFilter(useRoomType = true) {
|
||||
let filterInputHotelName = $('#filter_input_hotel_name');
|
||||
let filterInputRoomTypeName = $('#filter_input_room_type_name');
|
||||
let filterInputRoomNumber = $('#filter_input_id_room_information');
|
||||
let idHotel = parseInt($(filterInputHotelName).val() || '0');
|
||||
let idProduct = parseInt($(filterInputRoomTypeName).val() || '0');
|
||||
|
||||
let idHotel = parseInt($(filterInputHotelName).val() || '0');
|
||||
let idProduct = parseInt($(filterInputRoomTypeName).val() || '0');
|
||||
$.ajax({
|
||||
url: currentIndex + '&token=' + token,
|
||||
data: {
|
||||
ajax: true,
|
||||
action: 'GetHotelRooms',
|
||||
id_hotel: idHotel,
|
||||
id_product: useRoomType ? idProduct : 0,
|
||||
},
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
success: function(response) {
|
||||
if (response.status) {
|
||||
if (response.has_hotel_rooms) {
|
||||
$(filterInputRoomNumber).html(response.html_hotel_rooms);
|
||||
} else {
|
||||
$(filterInputRoomNumber).find('option').not(':first').remove();
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: currentIndex + '&token=' + token,
|
||||
data: {
|
||||
ajax: true,
|
||||
action: 'GetHotelRooms',
|
||||
id_hotel: idHotel,
|
||||
id_product: useRoomType ? idProduct : 0,
|
||||
},
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
success: function(response) {
|
||||
if (response.status) {
|
||||
if (response.has_hotel_rooms) {
|
||||
$(filterInputRoomNumber).html(response.html_hotel_rooms);
|
||||
} else {
|
||||
$(filterInputRoomNumber).find('option').not(':first').remove();
|
||||
// destroy current chosen and re-initialize
|
||||
$(filterInputRoomNumber).chosen('destroy');
|
||||
$(filterInputRoomNumber).chosen({
|
||||
disable_search_threshold: 5,
|
||||
search_contains: true,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// destroy current chosen and re-initialize
|
||||
$(filterInputRoomNumber).chosen('destroy');
|
||||
$(filterInputRoomNumber).chosen({
|
||||
disable_search_threshold: 5,
|
||||
search_contains: true,
|
||||
});
|
||||
}
|
||||
},
|
||||
// manage Hotel and Room type filter inputs
|
||||
$(document).on('change', '#filter_input_hotel_name', function () {
|
||||
updateRoomTypeFilter();
|
||||
updateHotelRoomsFilter(false);
|
||||
});
|
||||
}
|
||||
|
||||
// manage Hotel and Room type filter inputs
|
||||
$(document).on('change', '#filter_input_hotel_name', function () {
|
||||
updateRoomTypeFilter();
|
||||
updateHotelRoomsFilter(false);
|
||||
});
|
||||
|
||||
$(document).on('change', '#filter_input_room_type_name', function () {
|
||||
updateHotelRoomsFilter();
|
||||
$(document).on('change', '#filter_input_room_type_name', function () {
|
||||
updateHotelRoomsFilter();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
.list_action_wrapper {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.list_availibility_container {
|
||||
position: relative;}
|
||||
.list_availibility_container .dropdown-menu {
|
||||
right: 0;
|
||||
padding: 8px 12px;}
|
||||
.list_availibility_container .dropdown-menu label {
|
||||
font-weight: 400;}
|
||||
#selected_filter_container {
|
||||
background-color: #fff;
|
||||
padding: 8px 20px;
|
||||
border: solid 1px #d3d8db;
|
||||
border-radius: 5px 5px 0 0;
|
||||
font-size: 14px;
|
||||
min-height: 52px;
|
||||
margin-top: 15px;}
|
||||
#selected_filter_container .selected_filters > span {
|
||||
font-size: 12px;
|
||||
padding: 6px 10px;
|
||||
display: inline-block;
|
||||
background: #F5F8F9;
|
||||
border: 1px solid #A0D0EB;
|
||||
border-radius: 3px;}
|
||||
#selected_filter_container .selected_filters > span + span {
|
||||
margin-left: 12px;}
|
||||
#selected_filter_container .selected_filters > span .filter_value {
|
||||
font-weight: 700;
|
||||
}
|
||||
#selected_filter_container .selected_filters > span i {
|
||||
cursor: pointer;}
|
||||
|
||||
#content.bootstrap #list_filters_panel{
|
||||
margin-top: 15px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
#content.bootstrap #selected_filter_container + #list_filters_panel {
|
||||
margin-top: 0;
|
||||
}
|
||||
#content.bootstrap #selected_filter_container + div.panel {
|
||||
border-top: transparent;
|
||||
border-radius: 0 0 5px 5px;
|
||||
}
|
||||
|
||||
.list_filters {
|
||||
padding: 0 30px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));;
|
||||
gap: 8px 40px;}
|
||||
.list_filters > .row {
|
||||
display: flex;
|
||||
align-items: center;}
|
||||
.list_filters .date_range, .list_filters .input_range {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 15px;}
|
||||
.list_filters .date_range .input-group:first-child {
|
||||
margin-bottom: 0;}
|
||||
.list_filters label {
|
||||
text-align: right;
|
||||
font-weight: 400;}
|
||||
.list_filters .actions {
|
||||
grid-column-start: 1;
|
||||
grid-column-end: 4;}
|
||||
@media (max-width: 992px) {
|
||||
.list_filters {
|
||||
grid-template-columns: repeat(2, 1fr);}
|
||||
.list_filters .actions {
|
||||
grid-column-start: 1;
|
||||
grid-column-end: 3;}
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
.list_filters {
|
||||
grid-template-columns: repeat(1, 1fr);}
|
||||
.list_filters .actions {
|
||||
grid-column-start: 1;
|
||||
grid-column-end: 2;}
|
||||
.list_filters label {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
|
||||
|
||||
@@ -1,417 +0,0 @@
|
||||
{*
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
|
||||
{extends file="helpers/list/list_header.tpl"}
|
||||
|
||||
{block name="tableFilter"}{/block}
|
||||
{block name="override_form_extra"}
|
||||
{if !$simple_header && $show_filters}
|
||||
<script>
|
||||
$(function() {
|
||||
if ($("#list_filters_panel .datepicker").length > 0) {
|
||||
$("#list_filters_panel .datepicker").datepicker({
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
altFormat: 'yy-mm-dd'
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<div class="list_action_wrapper">
|
||||
<div class="row">
|
||||
<div class="col-xs-4 col-sm-3 col-md-2">
|
||||
<div class="list_availibility_container">
|
||||
<button type="button" class="btn btn-default btn-left btn-block dropdown-toggle" data-toggle="dropdown">
|
||||
<span>{l s='Available Fields'}
|
||||
<i class="icon-caret-down pull-right"></i>
|
||||
</button>
|
||||
<ul id="optional-list-toggle" class="dropdown-menu">
|
||||
{foreach $fields_optional as $key => $field}
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox" name="list_fields_visibility" value="{$key}" {if isset($field['selected']) && $field['selected']}checked="checked"{/if}>
|
||||
{$field['title']}
|
||||
</label>
|
||||
</li>
|
||||
{/foreach}
|
||||
{assign var="fields_optional" value=array()}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-3 col-xs-offset-5 col-sm-2 col-sm-offset-7 col-md-1 col-md-offset-9">
|
||||
<div class="list_filter_container">
|
||||
<button type="button" class="btn btn-default btn-block" data-toggle="collapse" data-target="#list_filters_panel">
|
||||
<i class="icon-sliders"></i>
|
||||
<span>{l s='Filters'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{if $filters_has_value}
|
||||
<div id="selected_filter_container">
|
||||
{l s='Filters: '}
|
||||
<span class="selected_filters">
|
||||
{foreach $fields_display AS $key => $params}
|
||||
{if (!isset($params.search) || $params.search) && $params.value != ''}
|
||||
{if ($params.type == 'date' || $params.type == 'datetime') && $params.value|is_array}
|
||||
{assign var="filter_value" value=''}
|
||||
{foreach $params.value as $value}
|
||||
{if ($value|is_string && !empty($value))}
|
||||
{if empty($filter_value)}
|
||||
{assign var="filter_value" value=$value}
|
||||
{else}
|
||||
{assign var="filter_value" value="`$filter_value` - `$value`"}
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if !empty($filter_value)}
|
||||
<span data-filter_key="{if isset($params.name_date)}{$params.name_date}{else}{$key}{/if}" data-filter_type="{$params.type}">
|
||||
{$params['title']|escape:'html':'UTF-8'}: <span class="filter_value">{$filter_value|escape:'html':'UTF-8'}</span>
|
||||
<i class="icon-times"></i>
|
||||
</span>
|
||||
{/if}
|
||||
{elseif $params.type == 'range' && $params.value|is_array}
|
||||
{assign var="filter_value" value=''}
|
||||
{foreach $params.value as $value}
|
||||
{if (isset($value) && ($value !== '' || $value === 0))}
|
||||
{if !(isset($filter_value) && ($filter_value !== '' || $filter_value === 0))}
|
||||
{assign var="filter_value" value=$value}
|
||||
{else}
|
||||
{assign var="filter_value" value="`$filter_value` - `$value`"}
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if (isset($filter_value) && ($filter_value !== '' || $filter_value === 0))}
|
||||
<span data-filter_key="{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" data-filter_type="{$params.type}">
|
||||
{$params['title']|escape:'html':'UTF-8'}: <span class="filter_value">{$filter_value|escape:'html':'UTF-8'}</span>
|
||||
<i class="icon-times"></i>
|
||||
</span>
|
||||
{/if}
|
||||
{elseif $params.type == 'select'}
|
||||
{if isset($params.multiple) && $params.multiple}
|
||||
<span data-filter_key="{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" data-filter_type="{$params.type}" data-multiple="{$params.multiple|intval}" data-operator="{$params.operator}">
|
||||
{$params['title']|escape:'html':'UTF-8'}:
|
||||
<span class="filter_value">
|
||||
{foreach from=$params.value item=option name=foreachInfo}
|
||||
{$params.list[$option]}{if !$smarty.foreach.foreachInfo.last}{if $params.operator == 'or'} | {else}, {/if}{/if}
|
||||
{/foreach}
|
||||
</span>
|
||||
<i class="icon-times"></i>
|
||||
</span>
|
||||
{else}
|
||||
<span data-filter_key="{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" data-filter_type="{$params.type}">
|
||||
{$params['title']|escape:'html':'UTF-8'}: <span class="filter_value">{$params['list'][$params['value']]|replace: ' ' : ''}</span>
|
||||
<i class="icon-times"></i>
|
||||
</span>
|
||||
{/if}
|
||||
{elseif $params.type == 'bool' && $key == 'advance_payment'}
|
||||
<span data-filter_key="{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" data-filter_type="{$params.type}">
|
||||
{$params['title']|escape:'html':'UTF-8'}: <span class="filter_value">{if $params['value'] == 1}{l s='Yes'}{elseif $params['value'] == 0}{l s='No'}{/if}</span>
|
||||
<i class="icon-times"></i>
|
||||
</span>
|
||||
{else}
|
||||
<span data-filter_key="{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" data-filter_type="{$params.type}">
|
||||
{$params['title']|escape:'html':'UTF-8'}: <span class="filter_value">{$params['value']|escape:'html':'UTF-8'}</span>
|
||||
<i class="icon-times"></i>
|
||||
</span>
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</span>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="panel collapse" id="list_filters_panel">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="list_filters">
|
||||
{foreach $fields_display AS $key => $params}
|
||||
{if !isset($params.search) || $params.search}
|
||||
<div class="row">
|
||||
<label class="col-xs-3" for="filter_input_{$key}">{$params['title']|escape:'html':'UTF-8'}</label>
|
||||
<div class="col-xs-9">
|
||||
{if $params.type == 'range'}
|
||||
<div class="input_range">
|
||||
<input type="text" class="filter form-control" name="{$list_id}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}[0]" placeholder="{l s='From'}" value="{if isset($params.value.0)}{$params.value.0}{/if}">
|
||||
<input type="text" class="filter form-control" name="{$list_id}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}[1]" placeholder="{l s='To'}" value="{if isset($params.value.1)}{$params.value.1}{/if}">
|
||||
</div>
|
||||
{else if $params.type == 'bool'}
|
||||
<select id="filter_input_{$key}" class="filter center" name="{$list_id}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}">
|
||||
<option value="">-</option>
|
||||
<option value="1" {if $params.value == 1} selected="selected" {/if}>{l s='Yes'}</option>
|
||||
<option value="0" {if $params.value == 0 && $params.value != ''} selected="selected" {/if}>{l s='No'}</option>
|
||||
</select>
|
||||
{elseif $params.type == 'date' || $params.type == 'datetime'}
|
||||
<div class="date_range">
|
||||
<div class="input-group center">
|
||||
<input type="text" class="filter datepicker date-input form-control" id="local_{$params.id_date}_0" name="local_{$params.name_date}[0]" placeholder="{l s='From'}" autocomplete="off"/>
|
||||
<input type="hidden" id="{$params.id_date}_0" name="{$params.name_date}[0]" value="{if isset($params.value.0)}{$params.value.0}{/if}">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-calendar"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="input-group center">
|
||||
<input type="text" class="filter datepicker date-input form-control" id="local_{$params.id_date}_1" name="local_{$params.name_date}[1]" placeholder="{l s='To'}" autocomplete="off"/>
|
||||
<input type="hidden" id="{$params.id_date}_1" name="{$params.name_date}[1]" value="{if isset($params.value.1)}{$params.value.1}{/if}">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-calendar"></i>
|
||||
</span>
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
var dateStart = parseDate($("#{$params.id_date}_0").val());
|
||||
var dateEnd = parseDate($("#{$params.id_date}_1").val());
|
||||
$("#local_{$params.id_date}_0").datepicker("option", "altField", "#{$params.id_date}_0");
|
||||
$("#local_{$params.id_date}_1").datepicker("option", "altField", "#{$params.id_date}_1");
|
||||
if (dateStart !== null){
|
||||
$("#local_{$params.id_date}_0").datepicker("setDate", dateStart);
|
||||
}
|
||||
if (dateEnd !== null){
|
||||
$("#local_{$params.id_date}_1").datepicker("setDate", dateEnd);
|
||||
}
|
||||
|
||||
$('#local_{$params.id_date}_0').datepicker('option', {
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
dateFormat: 'yy-mm-dd',
|
||||
beforeShow: function() {
|
||||
let dateTo = $('#local_{$params.id_date}_1').val().trim();
|
||||
if (typeof dateTo != 'undefined' && dateTo != '') {
|
||||
let objDateToMax = $.datepicker.parseDate('yy-mm-dd', dateTo);
|
||||
objDateToMax.setDate(objDateToMax.getDate() - 1);
|
||||
$('#local_{$params.id_date}_0').datepicker('option', 'maxDate', objDateToMax);
|
||||
}
|
||||
},
|
||||
onClose: function() {
|
||||
let dateFrom = $('#local_{$params.id_date}_0').val().trim();
|
||||
let dateTo = $('#local_{$params.id_date}_1').val().trim();
|
||||
|
||||
if (dateFrom >= dateTo) {
|
||||
let objDateToMin = $.datepicker.parseDate('yy-mm-dd', dateFrom);
|
||||
objDateToMin.setDate(objDateToMin.getDate() + 1);
|
||||
|
||||
$('#local_{$params.id_date}_1').datepicker('option', 'minDate', objDateToMin);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
$('#local_{$params.id_date}_1').datepicker('option', {
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
dateFormat: 'yy-mm-dd',
|
||||
beforeShow: function() {
|
||||
let dateFrom = $('#local_{$params.id_date}_0').val().trim();
|
||||
|
||||
if (typeof dateFrom != 'undefined' && dateFrom != '') {
|
||||
let objDateToMin = $.datepicker.parseDate('yy-mm-dd', dateFrom);
|
||||
objDateToMin.setDate(objDateToMin.getDate() + 1);
|
||||
|
||||
$('#local_{$params.id_date}_1').datepicker('option', 'minDate', objDateToMin);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
{elseif $params.type == 'select'}
|
||||
{if isset($params.multiple) && $params.multiple}
|
||||
<select id="filter_input_{$key}" class="filter{if isset($params.align) && $params.align == 'center'}center{/if} select_multiple_{$params.operator} chosen" multiple name="{$list_id}Filter_{$params.filter_key}[]" {if isset($params.width)} style="width:{$params.width}px"{/if}>
|
||||
{if isset($params.list) && is_array($params.list)}
|
||||
{foreach $params.list AS $option_value => $option_display}
|
||||
<option value="{$option_value}" {if isset($params.value) && $params.value}{if in_array($option_value, $params.value)} selected="selected"{/if}{/if}>{$option_display}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
{else}
|
||||
{if isset($params.filter_key)}
|
||||
<select id="filter_input_{$key}" class="filter{if isset($params.align) && $params.align == 'center'}center{/if} {if isset($params.class)}{$params.class}{/if}" {if !isset($params.remove_onchange) || !$params.remove_onchange}onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();"{/if} name="{$list_id}Filter_{$params.filter_key}" {if isset($params.width)} style="width:{$params.width}px"{/if}>
|
||||
<option value="" {if $params.value == ''} selected="selected" {/if}>-</option>
|
||||
{if isset($params.list) && is_array($params.list)}
|
||||
{foreach $params.list AS $option_value => $option_display}
|
||||
<option value="{$option_value}" {if (string)$option_display === (string)$params.value || (string)$option_value === (string)$params.value} selected="selected"{/if}>{$option_display}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
{/if}
|
||||
{/if}
|
||||
{else}
|
||||
<input type="text" class="filter" name="{$list_id}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" value="{$params.value|escape:'html':'UTF-8'}" {if isset($params.width) && $params.width != 'auto'} style="width:{$params.width}px"{/if} />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if $has_actions || $show_filters}
|
||||
<div class="actions">
|
||||
<hr>
|
||||
{if $show_filters}
|
||||
<span class="pull-right">
|
||||
<button type="submit" id="submitFilterButton{$list_id}" name="submitFilter" class="btn btn-default" data-list-id="{$list_id}">
|
||||
<i class="icon-search"></i> {l s='Search'}
|
||||
</button>
|
||||
{if $filters_has_value}
|
||||
<button type="submit" name="submitReset{$list_id}" class="btn btn-warning">
|
||||
<i class="icon-eraser"></i> {l s='Reset'}
|
||||
</button>
|
||||
{/if}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#selected_filter_container .selected_filters span i').on('click', function() {
|
||||
let form = $(this).closest('form');
|
||||
let type = $(this).parent().data('filter_type');
|
||||
$(this).parent().remove();
|
||||
if (type == 'date' || type == 'datetime') {
|
||||
$('#list_filters_panel').find('[name*="'+$(this).parent().data('filter_key')+'"]').val('');
|
||||
} else if (type == 'range') {
|
||||
$('#list_filters_panel').find('[name*="productFilter_'+$(this).parent().data('filter_key')+'"]').val('');
|
||||
} else if (type == 'select') {
|
||||
$('#list_filters_panel').find('select[name*="productFilter_'+$(this).parent().data('filter_key')+'"] option:selected').prop('selected', false);
|
||||
} else if (type == 'bool' && $(this).parent().data('filter_key') == 'advance_payment') {
|
||||
$('#list_filters_panel').find('select[name*="productFilter_'+$(this).parent().data('filter_key')+'"] option:selected').prop('selected', false);
|
||||
} else {
|
||||
$('#list_filters_panel').find('input[name*="productFilter_'+$(this).parent().data('filter_key')+'"]').val('');
|
||||
}
|
||||
|
||||
// set post data for empty multi-select filters
|
||||
$(form).find('select[multiple]').each(function (i, selectElement) {
|
||||
if ($(selectElement).find('option:selected').length == 0) {
|
||||
$(form).append('<input type="hidden" name="' + $(selectElement).attr('name').slice(0, -2) + '" value="">');
|
||||
}
|
||||
});
|
||||
|
||||
form.submit();
|
||||
});
|
||||
|
||||
$('#form-product').submit(function () {
|
||||
let form = $(this);
|
||||
$(form).find('select[multiple]').each(function (i, selectElement) {
|
||||
if ($(selectElement).val() == null) {
|
||||
$(form).append('<input type="hidden" name="' + $(selectElement).attr('name').slice(0, -2) + '" value="">');
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
.list_action_wrapper {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.list_availibility_container {
|
||||
position: relative;}
|
||||
.list_availibility_container .dropdown-menu {
|
||||
right: 0;
|
||||
padding: 8px 12px;}
|
||||
.list_availibility_container .dropdown-menu label {
|
||||
font-weight: 400;}
|
||||
#selected_filter_container {
|
||||
background-color: #fff;
|
||||
padding: 8px 20px;
|
||||
border: solid 1px #d3d8db;
|
||||
border-radius: 5px 5px 0 0;
|
||||
font-size: 14px;
|
||||
min-height: 52px;
|
||||
margin-top: 15px;}
|
||||
#selected_filter_container .selected_filters > span {
|
||||
font-size: 12px;
|
||||
padding: 6px 10px;
|
||||
display: inline-block;
|
||||
background: #F5F8F9;
|
||||
border: 1px solid #A0D0EB;
|
||||
border-radius: 3px;}
|
||||
#selected_filter_container .selected_filters > span + span {
|
||||
margin-left: 12px;}
|
||||
#selected_filter_container .selected_filters > span .filter_value {
|
||||
font-weight: 700;
|
||||
}
|
||||
#selected_filter_container .selected_filters > span i {
|
||||
cursor: pointer;}
|
||||
|
||||
#content.bootstrap #list_filters_panel{
|
||||
margin-top: 15px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
#content.bootstrap #selected_filter_container + #list_filters_panel {
|
||||
margin-top: 0;
|
||||
}
|
||||
#content.bootstrap #selected_filter_container + div.panel {
|
||||
border-top: transparent;
|
||||
border-radius: 0 0 5px 5px;
|
||||
}
|
||||
|
||||
.list_filters {
|
||||
padding: 0 30px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 8px 40px;}
|
||||
.list_filters > .row {
|
||||
display: flex;
|
||||
align-items: center;}
|
||||
.list_filters .date_range, .list_filters .input_range {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 15px;}
|
||||
.list_filters .date_range .input-group:first-child {
|
||||
margin-bottom: 0;}
|
||||
.list_filters label {
|
||||
text-align: right;
|
||||
font-weight: 400;}
|
||||
.list_filters .actions {
|
||||
grid-column-start: 1;
|
||||
grid-column-end: 4;}
|
||||
@media (max-width: 992px) {
|
||||
.list_filters {
|
||||
grid-template-columns: repeat(2, 1fr);}
|
||||
.list_filters .actions {
|
||||
grid-column-start: 1;
|
||||
grid-column-end: 3;}
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
.list_filters {
|
||||
grid-template-columns: repeat(1, 1fr);}
|
||||
.list_filters .actions {
|
||||
grid-column-start: 1;
|
||||
grid-column-end: 2;}
|
||||
.list_filters label {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
{/if}
|
||||
{/block}
|
||||
@@ -75,8 +75,8 @@
|
||||
$('#submitFilter{$list_id}').val(1);
|
||||
});
|
||||
|
||||
if ($("table .datepicker").length > 0) {
|
||||
$("table .datepicker").datepicker({
|
||||
if ($("form .datepicker").length > 0) {
|
||||
$("form .datepicker").datepicker({
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
altFormat: 'yy-mm-dd'
|
||||
@@ -121,7 +121,305 @@
|
||||
<input type="hidden" name="page" value="{$page|intval}"/>
|
||||
<input type="hidden" name="selected_pagination" value="{$selected_pagination|intval}"/>
|
||||
{block name="override_form_extra"}{/block}
|
||||
<div class="panel col-lg-12">
|
||||
{if !$simple_header && $show_filters}
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#selected_filter_container .selected_filters span i').on('click', function() {
|
||||
let form = $(this).closest('form');
|
||||
let type = $(this).parent().data('filter_type');
|
||||
$(this).parent().remove();
|
||||
if (type == 'date' || type == 'datetime') {
|
||||
$(form).find('#list_filters_panel [name*="'+$(this).parent().data('filter_key')+'"]').val('');
|
||||
} else if (type == 'range') {
|
||||
$(form).find('#list_filters_panel [name*="{$list_id}Filter_'+$(this).parent().data('filter_key')+'"]').val('');
|
||||
} else if (type == 'select' || type == 'bool') {
|
||||
$(form).find('#list_filters_panel select[name*="{$list_id}Filter_'+$(this).parent().data('filter_key')+'"] option:selected').prop('selected', false);
|
||||
} else {
|
||||
$(form).find('#list_filters_panel input[name="{$list_id}Filter_'+$(this).parent().data('filter_key')+'"]').val('');
|
||||
}
|
||||
|
||||
// set post data for empty multi-select filters
|
||||
$(form).find('select[multiple]').each(function (i, selectElement) {
|
||||
if ($(selectElement).find('option:selected').length == 0) {
|
||||
$(form).append('<input type="hidden" name="' + $(selectElement).attr('name').slice(0, -2) + '" value="">');
|
||||
}
|
||||
});
|
||||
|
||||
form.submit();
|
||||
});
|
||||
{if $fields_optional|count}
|
||||
toggleVisibleColumns($('#form-{$list_id}'));
|
||||
{/if}
|
||||
$('#optional-list-toggle').on('click', function(e) {
|
||||
e.stopPropagation();
|
||||
})
|
||||
$('#form-{$list_id} input[name="list_fields_visibility"]').on('change', function(){
|
||||
toggleVisibleColumns($('#form-{$list_id}'));
|
||||
})
|
||||
});
|
||||
|
||||
function toggleVisibleColumns(form) {
|
||||
var list_fields_visibility = [];
|
||||
$(form).find('input[name="list_fields_visibility"]:checked').each(function(i, field){
|
||||
list_fields_visibility.push($(field).val());
|
||||
});
|
||||
|
||||
$(form).find('table.table .field_optional').hide();
|
||||
$(form).find('table.table .field_optional').each(function(i, val) {
|
||||
if (list_fields_visibility.includes($(this).data('key'))) {
|
||||
$(this).show();
|
||||
}
|
||||
});
|
||||
updateListVisibility(list_fields_visibility)
|
||||
}
|
||||
function updateListVisibility(list_fields_visibility) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: { "cache-control": "no-cache" },
|
||||
url: '{$action}',
|
||||
data: {
|
||||
ajax: 1,
|
||||
action: 'updateListVisivility',
|
||||
list_fields_visibility: list_fields_visibility
|
||||
},
|
||||
cache: false,
|
||||
dataType: 'json'
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{/if}
|
||||
{block name="updatelist"}
|
||||
{if $use_new_header_filters}
|
||||
<div class="list_action_wrapper">
|
||||
<div class="row">
|
||||
{if $fields_optional|count}
|
||||
<div class="col-xs-4 col-sm-3 col-md-2">
|
||||
<div class="list_availibility_container">
|
||||
<button type="button" class="btn btn-default btn-left btn-block dropdown-toggle" data-toggle="dropdown">
|
||||
<span>{l s='Available Fields'}
|
||||
<i class="icon-caret-down pull-right"></i>
|
||||
</button>
|
||||
<ul id="optional-list-toggle" class="dropdown-menu">
|
||||
{foreach $fields_optional as $key => $field}
|
||||
<li>
|
||||
<label>
|
||||
<input type="checkbox" name="list_fields_visibility" value="{$key}" {if isset($field['selected']) && $field['selected']}checked="checked"{/if}>
|
||||
{$field['title']}
|
||||
</label>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if !$simple_header && $show_filters}
|
||||
<div class="col-xs-3 col-xs-offset-{if $fields_optional|count}}5{else}9{/if} col-sm-2 col-sm-offset-{if $fields_optional|count}}7{else}10{/if} col-md-1 col-md-offset-{if $fields_optional|count}9{else}11{/if}">
|
||||
<div class="list_filter_container">
|
||||
<button type="button" class="btn btn-default btn-block" data-toggle="collapse" data-target="#list_filters_panel">
|
||||
<i class="icon-sliders"></i>
|
||||
<span>{l s='Filters'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{if $filters_has_value}
|
||||
<div id="selected_filter_container">
|
||||
{l s='Filters: '}
|
||||
<span class="selected_filters">
|
||||
{foreach $fields_display AS $key => $params}
|
||||
{if (!isset($params.search) || $params.search) && $params.value != ''}
|
||||
{if ($params.type == 'date' || $params.type == 'datetime' || $params.type == 'range') && $params.value|is_array}
|
||||
{assign var="filter_value" value=''}
|
||||
{foreach $params.value as $value}
|
||||
{if (isset($value) && ($value !== '' || $value === 0))}
|
||||
{if !(isset($filter_value) && ($filter_value !== '' || $filter_value === 0))}
|
||||
{assign var="filter_value" value=$value}
|
||||
{else}
|
||||
{assign var="filter_value" value="`$filter_value` - `$value`"}
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if (isset($filter_value) && ($filter_value !== '' || $filter_value === 0))}
|
||||
<span data-filter_key="{if isset($params.name_date)}{$params.name_date}{else}{$key}{/if}" data-filter_type="{$params.type}">
|
||||
{$params['title']|escape:'html':'UTF-8'}: <span class="filter_value">{$filter_value|escape:'html':'UTF-8'}</span>
|
||||
<i class="icon-times"></i>
|
||||
</span>
|
||||
{/if}
|
||||
{elseif $params.type == 'select'}
|
||||
{if isset($params.multiple) && $params.multiple}
|
||||
<span data-filter_key="{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" data-filter_type="{$params.type}" data-multiple="{$params.multiple|intval}" data-operator="{$params.operator}">
|
||||
{$params['title']|escape:'html':'UTF-8'}:
|
||||
<span class="filter_value">
|
||||
{foreach from=$params.value item=option name=foreachInfo}
|
||||
{$params.list[$option]}{if !$smarty.foreach.foreachInfo.last}{if $params.operator == 'or'} | {else}, {/if}{/if}
|
||||
{/foreach}
|
||||
</span>
|
||||
<i class="icon-times"></i>
|
||||
</span>
|
||||
{else}
|
||||
<span data-filter_key="{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" data-filter_type="{$params.type}">
|
||||
{$params['title']|escape:'html':'UTF-8'}: <span class="filter_value">{$params['list'][$params['value']]|replace: ' ' : ''}</span>
|
||||
<i class="icon-times"></i>
|
||||
</span>
|
||||
{/if}
|
||||
{elseif $params.type == 'bool'}
|
||||
<span data-filter_key="{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" data-filter_type="{$params.type}">
|
||||
{$params['title']|escape:'html':'UTF-8'}: <span class="filter_value">{if $params['value'] == 1}{l s='Yes'}{else}{l s='No'}{/if}</span>
|
||||
<i class="icon-times"></i>
|
||||
</span>
|
||||
{else}
|
||||
<span data-filter_key="{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" data-filter_type="{$params.type}">
|
||||
{$params['title']|escape:'html':'UTF-8'}: <span class="filter_value">{$params['value']|escape:'html':'UTF-8'}</span>
|
||||
<i class="icon-times"></i>
|
||||
</span>
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</span>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="panel collapse" id="list_filters_panel">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="list_filters">
|
||||
{foreach $fields_display AS $key => $params}
|
||||
{if !isset($params.search) || $params.search}
|
||||
<div class="row">
|
||||
<label class="col-xs-3" for="filter_input_{$key}">{$params['title']|escape:'html':'UTF-8'}</label>
|
||||
<div class="col-xs-9">
|
||||
{if $params.type == 'range'}
|
||||
<div class="input_range">
|
||||
<input type="text" class="filter form-control" name="{$list_id}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}[0]" placeholder="{l s='From'}" value="{if isset($params.value.0)}{$params.value.0}{/if}">
|
||||
<input type="text" class="filter form-control" name="{$list_id}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}[1]" placeholder="{l s='To'}" value="{if isset($params.value.1)}{$params.value.1}{/if}">
|
||||
</div>
|
||||
{elseif $params.type == 'bool'}
|
||||
<select id="filter_input_{$key}" class="filter center" name="{$list_id}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}">
|
||||
<option value="">-</option>
|
||||
<option value="1" {if $params.value == 1} selected="selected" {/if}>{l s='Yes'}</option>
|
||||
<option value="0" {if $params.value == 0 && $params.value != ''} selected="selected" {/if}>{l s='No'}</option>
|
||||
</select>
|
||||
{elseif $params.type == 'date' || $params.type == 'datetime'}
|
||||
<div class="date_range">
|
||||
<div class="input-group center">
|
||||
<input type="text" class="filter datepicker date-input form-control" id="local_{$params.id_date}_0" name="local_{$params.name_date}[0]" placeholder="{l s='From'}" autocomplete="off"/>
|
||||
<input type="hidden" id="{$params.id_date}_0" name="{$params.name_date}[0]" value="{if isset($params.value.0)}{$params.value.0}{/if}">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-calendar"></i>
|
||||
</span>
|
||||
</div>
|
||||
<div class="input-group center">
|
||||
<input type="text" class="filter datepicker date-input form-control" id="local_{$params.id_date}_1" name="local_{$params.name_date}[1]" placeholder="{l s='To'}" autocomplete="off"/>
|
||||
<input type="hidden" id="{$params.id_date}_1" name="{$params.name_date}[1]" value="{if isset($params.value.1)}{$params.value.1}{/if}">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-calendar"></i>
|
||||
</span>
|
||||
</div>
|
||||
<script>
|
||||
$(function() {
|
||||
var dateStart = parseDate($("#{$params.id_date}_0").val());
|
||||
var dateEnd = parseDate($("#{$params.id_date}_1").val());
|
||||
$("#local_{$params.id_date}_0").datepicker("option", "altField", "#{$params.id_date}_0");
|
||||
$("#local_{$params.id_date}_1").datepicker("option", "altField", "#{$params.id_date}_1");
|
||||
if (dateStart !== null){
|
||||
$("#local_{$params.id_date}_0").datepicker("setDate", dateStart);
|
||||
}
|
||||
if (dateEnd !== null){
|
||||
$("#local_{$params.id_date}_1").datepicker("setDate", dateEnd);
|
||||
}
|
||||
|
||||
$('#local_{$params.id_date}_0').datepicker('option', {
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
dateFormat: 'yy-mm-dd',
|
||||
onClose: function() {
|
||||
let dateFrom = $('#local_{$params.id_date}_0').val().trim();
|
||||
let dateTo = $('#local_{$params.id_date}_1').val().trim();
|
||||
|
||||
if ((dateFrom && dateTo) && (dateFrom >= dateTo)) {
|
||||
let objDateToMin = $.datepicker.parseDate('yy-mm-dd', dateFrom);
|
||||
objDateToMin.setDate(objDateToMin.getDate());
|
||||
|
||||
$('#local_{$params.id_date}_1').datepicker('option', 'minDate', objDateToMin);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
$('#local_{$params.id_date}_1').datepicker('option', {
|
||||
prevText: '',
|
||||
nextText: '',
|
||||
dateFormat: 'yy-mm-dd',
|
||||
beforeShow: function() {
|
||||
let dateFrom = $('#local_{$params.id_date}_0').val().trim();
|
||||
|
||||
if (typeof dateFrom != 'undefined' && dateFrom != '') {
|
||||
let objDateToMin = $.datepicker.parseDate('yy-mm-dd', dateFrom);
|
||||
objDateToMin.setDate(objDateToMin.getDate());
|
||||
|
||||
$('#local_{$params.id_date}_1').datepicker('option', 'minDate', objDateToMin);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
{elseif $params.type == 'select'}
|
||||
{if isset($params.multiple) && $params.multiple}
|
||||
<select id="filter_input_{$key}" class="filter{if isset($params.align) && $params.align == 'center'}center{/if} select_multiple_{$params.operator} chosen" multiple name="{$list_id}Filter_{$params.filter_key}[]" {if isset($params.width)} style="width:{$params.width}px"{/if}>
|
||||
{if isset($params.list) && is_array($params.list)}
|
||||
{foreach $params.list AS $option_value => $option_display}
|
||||
<option value="{$option_value}" {if isset($params.value) && $params.value}{if in_array($option_value, $params.value)} selected="selected"{/if}{/if}>{$option_display}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
{else}
|
||||
{if isset($params.filter_key)}
|
||||
<select id="filter_input_{$key}" class="filter{if isset($params.align) && $params.align == 'center'}center{/if} {if isset($params.class)}{$params.class}{/if}" {if !isset($params.remove_onchange) || !$params.remove_onchange}onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();"{/if} name="{$list_id}Filter_{$params.filter_key}" {if isset($params.width)} style="width:{$params.width}px"{/if}>
|
||||
<option value="" {if $params.value == ''} selected="selected" {/if}>-</option>
|
||||
{if isset($params.list) && is_array($params.list)}
|
||||
{foreach $params.list AS $option_value => $option_display}
|
||||
<option value="{$option_value}" {if (string)$option_display === (string)$params.value || (string)$option_value === (string)$params.value} selected="selected"{/if}>{$option_display}</option>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</select>
|
||||
{/if}
|
||||
{/if}
|
||||
{else}
|
||||
<input type="text" id="filter_input_{$key}" class="filter" name="{$list_id}Filter_{if isset($params.filter_key)}{$params.filter_key}{else}{$key}{/if}" value="{$params.value|escape:'html':'UTF-8'}" {if isset($params.width) && $params.width != 'auto'} style="width:{$params.width}px"{/if} />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if $has_actions || $show_filters}
|
||||
<div class="actions">
|
||||
<hr>
|
||||
{if $show_filters}
|
||||
<span class="pull-right">
|
||||
<button type="submit" id="submitFilterButton{$list_id}" name="submitFilter" class="btn btn-default" data-list-id="{$list_id}">
|
||||
<i class="icon-search"></i> {l s='Search'}
|
||||
</button>
|
||||
{if $filters_has_value}
|
||||
<button type="submit" name="submitReset{$list_id}" class="btn btn-warning">
|
||||
<i class="icon-eraser"></i> {l s='Reset'}
|
||||
</button>
|
||||
{/if}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
<div class="panel col-lg-12">
|
||||
{block name="panel_heading"}
|
||||
<div class="panel-heading">
|
||||
{if isset($icon)}<i class="{$icon}"></i> {/if}{if is_array($title)}{$title|end}{else}{$title}{/if}
|
||||
@@ -138,7 +436,7 @@
|
||||
</a>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if $fields_optional|count}
|
||||
{if $fields_optional|count && !$use_new_header_filters}
|
||||
<a class="list-toolbar-btn dropdown-toggle" data-toggle="dropdown" data-target="#dropdown-option-toggle">
|
||||
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="{l s='Toggle list'}" data-html="true" data-placement="top">
|
||||
<i class="process-icon-cogs"></i>
|
||||
@@ -154,46 +452,6 @@
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
updateListVisibility();
|
||||
$('#optional-list-toggle').on('click', function(e) {
|
||||
e.stopPropagation();
|
||||
})
|
||||
$('input[name="list_fields_visibility"]').on('change', function(){
|
||||
updateListVisibility();
|
||||
})
|
||||
});
|
||||
function updateListVisibility() {
|
||||
var list_fields_visibility = [];
|
||||
$('input[name="list_fields_visibility"]:checked').each(function(i, field){
|
||||
list_fields_visibility.push($(field).val());
|
||||
});
|
||||
const table = $('table.table.{$table}');
|
||||
$(table).find('.field_optional').hide();
|
||||
$(table).find('.field_optional').each(function(i, val) {
|
||||
if (list_fields_visibility.includes($(this).data('key'))) {
|
||||
$(this).show();
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: { "cache-control": "no-cache" },
|
||||
url: '{$action}',
|
||||
data: {
|
||||
ajax: 1,
|
||||
action: 'updateListVisivility',
|
||||
list_fields_visibility: list_fields_visibility
|
||||
},
|
||||
cache: false,
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<a class="list-toolbar-btn" href="javascript:location.reload();">
|
||||
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="{l s='Refresh list'}" data-html="true" data-placement="top">
|
||||
<i class="process-icon-refresh"></i>
|
||||
@@ -364,7 +622,7 @@
|
||||
</tr>
|
||||
{/block}
|
||||
{block name="tableFilter"}
|
||||
{if !$simple_header && $show_filters}
|
||||
{if !$simple_header && $show_filters && !$use_new_header_filters}
|
||||
<tr class="nodrag nodrop filter {if $row_hover}row_hover{/if}">
|
||||
{if $has_bulk_actions}
|
||||
<th class="text-center">
|
||||
|
||||
@@ -197,6 +197,9 @@ class AdminControllerCore extends Controller
|
||||
/** @var string */
|
||||
protected $_filterHaving;
|
||||
|
||||
/** @var string */
|
||||
protected $_use_new_header_filters = false;
|
||||
|
||||
/** @var array Temporary SQL table WHERE clause determined by filter fields */
|
||||
protected $_tmpTableFilter = '';
|
||||
|
||||
@@ -2511,6 +2514,7 @@ class AdminControllerCore extends Controller
|
||||
}
|
||||
|
||||
$this->setHelperDisplay($helper);
|
||||
$helper->_use_new_header_filters = $this->_use_new_header_filters;
|
||||
$helper->_default_pagination = $this->_default_pagination;
|
||||
$helper->_pagination = $this->_pagination;
|
||||
$helper->tpl_vars = $this->getTemplateListVars();
|
||||
|
||||
@@ -38,6 +38,8 @@ class HelperListCore extends Helper
|
||||
/** @var array WHERE clause determined by filter fields */
|
||||
protected $_filter;
|
||||
|
||||
public $_use_new_header_filters = false;
|
||||
|
||||
/** @var array Number of results in list per page (used in select field) */
|
||||
public $_pagination = array(20, 50, 100, 300, 1000);
|
||||
|
||||
@@ -742,6 +744,7 @@ class HelperListCore extends Helper
|
||||
Context::getContext()->smarty->assign(array(
|
||||
'page' => $page,
|
||||
'simple_header' => $this->simple_header,
|
||||
'use_new_header_filters' => $this->_use_new_header_filters,
|
||||
'total_pages' => $total_pages,
|
||||
'selected_pagination' => $selected_pagination,
|
||||
'pagination' => $this->_pagination,
|
||||
|
||||
@@ -71,7 +71,14 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$titles_array[$gender->id_gender] = $gender->name;
|
||||
}
|
||||
|
||||
$groups_array = array();
|
||||
$groups = Group::getGroups(Context::getContext()->language->id);
|
||||
foreach ($groups as $group) {
|
||||
$groups_array[$group['id_group']] = $group['name'];
|
||||
}
|
||||
|
||||
$this->_join = 'LEFT JOIN '._DB_PREFIX_.'gender_lang gl ON (a.id_gender = gl.id_gender AND gl.id_lang = '.(int)$this->context->language->id.')';
|
||||
$this->_join .= ' LEFT JOIN '._DB_PREFIX_.'group_lang grl ON (a.id_default_group = grl.id_group AND grl.id_lang = '.(int)$this->context->language->id.')';
|
||||
$this->_use_found_rows = false;
|
||||
$this->fields_list = array(
|
||||
'id_customer' => array(
|
||||
@@ -107,9 +114,25 @@ class AdminCustomersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
$this->fields_list = array_merge($this->fields_list, array(
|
||||
'default_group_name' => array(
|
||||
'title' => $this->l('Default Group'),
|
||||
'optional' => true,
|
||||
'type' => 'select',
|
||||
'list' => $groups_array,
|
||||
'filter_key' => 'a!id_default_group',
|
||||
),
|
||||
'total_orders' => array(
|
||||
'title' => $this->l('Number of orders'),
|
||||
'optional' => true,
|
||||
'visible_default' => true,
|
||||
'havingFilter' => true,
|
||||
'order_key' => 'total_orders'
|
||||
),
|
||||
'total_spent' => array(
|
||||
'title' => $this->l('Sales'),
|
||||
'type' => 'price',
|
||||
'optional' => true,
|
||||
'visible_default' => true,
|
||||
'search' => false,
|
||||
'havingFilter' => true,
|
||||
'align' => 'text-right',
|
||||
@@ -155,13 +178,19 @@ class AdminCustomersControllerCore extends AdminController
|
||||
parent::__construct();
|
||||
|
||||
$this->_select = '
|
||||
a.date_add, gl.name as title, (
|
||||
a.date_add, gl.name as title, grl.name as default_group_name, (
|
||||
SELECT SUM(total_paid_real / conversion_rate)
|
||||
FROM '._DB_PREFIX_.'orders o
|
||||
WHERE o.id_customer = a.id_customer
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
AND o.valid = 1
|
||||
) as total_spent, (
|
||||
SELECT COUNT(o.`id_order`)
|
||||
FROM '._DB_PREFIX_.'orders o
|
||||
WHERE o.id_customer = a.id_customer
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
AND o.valid = 1
|
||||
) as total_orders, (
|
||||
SELECT c.date_add FROM '._DB_PREFIX_.'guest g
|
||||
LEFT JOIN '._DB_PREFIX_.'connections c ON c.id_guest = g.id_guest
|
||||
WHERE g.id_customer = a.id_customer
|
||||
@@ -326,6 +355,8 @@ class AdminCustomersControllerCore extends AdminController
|
||||
);
|
||||
}
|
||||
|
||||
$this->_use_new_header_filters = true;
|
||||
|
||||
return parent::renderList();
|
||||
}
|
||||
|
||||
@@ -601,7 +632,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
$birthday = explode('-', $this->getFieldValue($obj, 'birthday'));
|
||||
|
||||
|
||||
$this->fields_value = array(
|
||||
'years' => Tools::getValue('years', $this->getFieldValue($obj, 'birthday') ? $birthday[0] : 0),
|
||||
'months' => Tools::getValue('months', $this->getFieldValue($obj, 'birthday') ? $birthday[1] : 0),
|
||||
@@ -1062,7 +1093,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$days = Tools::getValue('days');
|
||||
$months = Tools::getValue('months');
|
||||
$years = Tools::getValue('years');
|
||||
|
||||
|
||||
if ($days || $months || $years) {
|
||||
if (!$days) {
|
||||
$this->errors[] = Tools::displayError("Please select a valid date of birthday");
|
||||
@@ -1074,10 +1105,10 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError("Please select a valid month of birthday");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$customer = new Customer();
|
||||
$this->errors = array_merge($this->errors, $customer->validateFieldsRequiredDatabase());
|
||||
|
||||
|
||||
return parent::processSave();
|
||||
}
|
||||
|
||||
|
||||
@@ -168,6 +168,15 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
$join_category = true;
|
||||
}
|
||||
|
||||
$priceAdditionType = array(
|
||||
Product::PRICE_ADDITION_TYPE_WITH_ROOM => $this->l('Add price in room price'),
|
||||
Product::PRICE_ADDITION_TYPE_INDEPENDENT => $this->l('Convenience Fee')
|
||||
);
|
||||
$priceCalculationMethod = array(
|
||||
Product::PRICE_CALCULATION_METHOD_PER_BOOKING => $this->l('Add price once for the booking range'),
|
||||
Product::PRICE_CALCULATION_METHOD_PER_DAY => $this->l('Add price for each day of booking')
|
||||
);
|
||||
|
||||
$this->_join .= '
|
||||
LEFT JOIN `'._DB_PREFIX_.'stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0
|
||||
'.StockAvailable::addSqlShopRestriction(null, null, 'sav').') ';
|
||||
@@ -188,7 +197,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product` rsp ON (rsp.`id_product` = a.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'address` aa ON (aa.`id_hotel` = hb.`id`)';
|
||||
|
||||
$this->_select .= ' IF(a.`auto_add_to_cart`, "'.$this->l('Yes').'", "'.$this->l('No').'") as auto_added, IF(a.`auto_add_to_cart`, 1, 0) as badge_success, (SELECT COUNT(hri.`id`) FROM `'._DB_PREFIX_.'htl_room_information` hri WHERE hri.`id_product` = a.`id_product`) as num_rooms, ';
|
||||
$this->_select .= ' IF(a.`auto_add_to_cart`, "'.$this->l('Yes').'", "'.$this->l('No').'") as auto_added, IF(a.`auto_add_to_cart`, 1, 0) as badge_success, IF(a.`show_at_front`, "'.$this->l('Yes').'", "'.$this->l('No').'") as show_at_front_txt, IF(a.`price_calculation_method` = '.(int)Product::PRICE_CALCULATION_METHOD_PER_DAY.', "'.$this->l('Per Day').'", "'.$this->l('Per Booking').'") as price_calculation_method_txt, (SELECT COUNT(hri.`id`) FROM `'._DB_PREFIX_.'htl_room_information` hri WHERE hri.`id_product` = a.`id_product`) as num_rooms, ';
|
||||
$this->_select .= ' COUNT(rsp.`id_product`) as products_associated, hrt.`adults`, hrt.`children`, hb.`id` as id_hotel, aa.`city`, hbl.`hotel_name`, ';
|
||||
$this->_select .= 'shop.`name` AS `shopname`, a.`id_shop_default`, ';
|
||||
$this->_select .= $alias_image.'.`id_image` AS `id_image`, cl.`name` AS `name_category`, '.$alias.'.`price`, 0 AS `price_final`, a.`is_virtual`, pd.`nb_downloadable`, sav.`quantity` AS `sav_quantity`, '.$alias.'.`active`, IF(sav.`quantity`<=0, 1, 0) AS `badge_danger`';
|
||||
@@ -227,14 +236,62 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
'title' => $this->l('Associated Rooms types'),
|
||||
'class' => 'fixed-width-sm',
|
||||
'havingFilter' => true,
|
||||
'optional' => true,
|
||||
'visible_default' => true,
|
||||
);
|
||||
$this->fields_list['auto_added'] = array(
|
||||
'title' => $this->l('Auto Added'),
|
||||
'filter_key' => 'a!auto_add_to_cart',
|
||||
'align' => 'text-center',
|
||||
'type' => 'bool',
|
||||
'optional' => true,
|
||||
'visible_default' => true,
|
||||
'badge_success' => true
|
||||
);
|
||||
$this->fields_list['show_at_front_txt'] = array(
|
||||
'title' => $this->l('Show at Front'),
|
||||
'filter_key' => 'a!show_at_front',
|
||||
'align' => 'text-center',
|
||||
'type' => 'bool',
|
||||
'optional' => true,
|
||||
);
|
||||
$this->fields_list['available_for_order'] = array(
|
||||
'displayed' => false,
|
||||
'title' => $this->l('Available for order'),
|
||||
'filter_key' => 'a!available_for_order',
|
||||
'type' => 'bool',
|
||||
);
|
||||
$this->fields_list['price_addition_type'] = array(
|
||||
'displayed' => false,
|
||||
'title' => $this->l('Price display preference'),
|
||||
'filter_key' => 'a!price_addition_type',
|
||||
'type' => 'select',
|
||||
'list' => $priceAdditionType,
|
||||
);
|
||||
$this->fields_list['price_calculation_method_txt'] = array(
|
||||
'title' => $this->l('Price calculation method'),
|
||||
'filter_key' => 'a!price_calculation_method',
|
||||
'type' => 'select',
|
||||
'list' => $priceCalculationMethod,
|
||||
'visible_default' => true,
|
||||
'optional' => true,
|
||||
);
|
||||
$this->servicesCategory = array();
|
||||
$idServiceCategory = Configuration::get('PS_SERVICE_CATEGORY');
|
||||
$this->objLocationsCategory = new Category($idServiceCategory, $this->context->language->id);
|
||||
$nestedCategories = Category::getNestedCategories($idServiceCategory);
|
||||
if ($nestedCategories) {
|
||||
foreach ($nestedCategories[$idServiceCategory]['children'] as $childCategory) {
|
||||
$this->buildCategoryOptions($childCategory);
|
||||
}
|
||||
}
|
||||
$this->fields_list['name_category'] = array(
|
||||
'title' => $this->l('Default Category'),
|
||||
'type' => 'select',
|
||||
'list' => $this->servicesCategory,
|
||||
'filter_key' => 'a!id_category_default',
|
||||
'optional' => true,
|
||||
);
|
||||
// $serviceProductType = array(
|
||||
// Product::SERVICE_PRODUCT_WITH_ROOMTYPE => $this->l('Bought with room type'),
|
||||
// Product::SERVICE_PRODUCT_WITHOUT_ROOMTYPE => $this->l('Bought without room type')
|
||||
@@ -288,6 +345,18 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
private function buildCategoryOptions($category)
|
||||
{
|
||||
$space = str_repeat(' ', 5 * (($category['level_depth'] - $this->objLocationsCategory->level_depth) - 1));
|
||||
$this->servicesCategory[$category['id_category']] = $space.$category['name'];
|
||||
|
||||
if (isset($category['children']) && count($category['children'])) {
|
||||
foreach ($category['children'] as $childCategory) {
|
||||
$this->buildCategoryOptions($childCategory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getBuyingOption($service_product_type, $row)
|
||||
{
|
||||
if ($service_product_type == Product::SERVICE_PRODUCT_WITH_ROOMTYPE) {
|
||||
@@ -2446,6 +2515,9 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
$this->addRowAction('edit');
|
||||
$this->addRowAction('duplicate');
|
||||
$this->addRowAction('delete');
|
||||
|
||||
$this->_use_new_header_filters = true;
|
||||
|
||||
return parent::renderList();
|
||||
}
|
||||
|
||||
|
||||
@@ -675,6 +675,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
$this->tpl_list_vars['title'] = $this->l('Orders');
|
||||
|
||||
$this->_use_new_header_filters = true;
|
||||
|
||||
return parent::renderList();
|
||||
}
|
||||
|
||||
|
||||
@@ -2552,6 +2552,8 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
$this->tpl_list_vars['title'] = $this->l('Room Types');
|
||||
|
||||
$this->_use_new_header_filters = true;
|
||||
|
||||
return parent::renderList();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user