changed filters view in admin orders controller
This commit is contained in:
@@ -206,4 +206,13 @@
|
||||
cursor: pointer
|
||||
|
||||
#recommendation-wrapper
|
||||
margin-bottom: 20px
|
||||
margin-bottom: 20px
|
||||
|
||||
//list column selection
|
||||
#optional-list-toggle
|
||||
font-family: "Open Sans",Helvetica,Arial,sans-serif
|
||||
font-size: 13px
|
||||
padding: 8px 12px
|
||||
text-transform: none
|
||||
label
|
||||
font-weight: 400
|
||||
@@ -106,6 +106,8 @@ body
|
||||
text-align: center
|
||||
font-size: 18px
|
||||
line-height: 30px
|
||||
.dropdown-menu
|
||||
line-height: normal
|
||||
.panel-danger .panel-heading
|
||||
background-color: $badge-notif-color!important
|
||||
form .alert
|
||||
|
||||
@@ -148,6 +148,8 @@ tr.highlighted td
|
||||
|
||||
.date_range .input-group:first-child
|
||||
margin-bottom: 5px
|
||||
.input_range > :first-child
|
||||
margin-bottom: 5px
|
||||
|
||||
@media (max-width: $screen-sm-max)
|
||||
.table-responsive-row
|
||||
|
||||
@@ -65,3 +65,271 @@
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
|
||||
{block name="tableFilter"}{/block}
|
||||
{block name="override_form_extra"}
|
||||
<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-sm-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-sm-1 col-sm-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 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 ($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}
|
||||
{else if $params.type == 'select'}
|
||||
<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']]|escape:'html':'UTF-8'}</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">
|
||||
{if !$simple_header && $show_filters}
|
||||
<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-sm-3" for="filter_input_{$key}">{$params['title']|escape:'html':'UTF-8'}</label>
|
||||
<div class="col-sm-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 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);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
{elseif $params.type == 'select'}
|
||||
{if isset($params.filter_key)}
|
||||
<select id="filter_input_{$key}" class="filter{if isset($params.align) && $params.align == 'center'}center{/if}" onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();" 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}
|
||||
{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>
|
||||
{/if}
|
||||
</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('');
|
||||
}
|
||||
form.submit();
|
||||
});
|
||||
});
|
||||
</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, 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;}
|
||||
</style>
|
||||
{/block}
|
||||
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
</td>
|
||||
{/if}
|
||||
{foreach $fields_display AS $key => $params}
|
||||
{if isset($params.displayed) && $params.displayed === false}{continue}{/if}
|
||||
{block name="open_td"}
|
||||
<td
|
||||
{if isset($params.position)}
|
||||
@@ -47,12 +48,14 @@
|
||||
class="{strip}{if !$no_link}pointer{/if}
|
||||
{if isset($params.position) && $order_by == 'position' && $order_way != 'DESC'} dragHandle{/if}
|
||||
{if isset($params.class)} {$params.class}{/if}
|
||||
{if isset($params.align)} {$params.align}{/if}{/strip}"
|
||||
{if isset($params.align)} {$params.align}{/if}
|
||||
{if isset($params.optional) && $params.optional} field_optional{/if}{/strip}"
|
||||
{if (!isset($params.position) && !$no_link && !isset($params.remove_onclick))}
|
||||
onclick="document.location = '{$current_index|escape:'html':'UTF-8'}&{$identifier|escape:'html':'UTF-8'}={$tr.$identifier|escape:'html':'UTF-8'}{if $view}&view{else}&update{/if}{$table|escape:'html':'UTF-8'}{if $page > 1}&page={$page|intval}{/if}&token={$token|escape:'html':'UTF-8'}'">
|
||||
onclick="document.location = '{$current_index|escape:'html':'UTF-8'}&{$identifier|escape:'html':'UTF-8'}={$tr.$identifier|escape:'html':'UTF-8'}{if $view}&view{else}&update{/if}{$table|escape:'html':'UTF-8'}{if $page > 1}&page={$page|intval}{/if}&token={$token|escape:'html':'UTF-8'}'"
|
||||
{else}
|
||||
>
|
||||
{/if}
|
||||
{/if}
|
||||
data-key="{$key}"
|
||||
>
|
||||
{/block}
|
||||
{block name="td_content"}
|
||||
{if isset($params.prefix)}{$params.prefix}{/if}
|
||||
|
||||
@@ -121,45 +121,105 @@
|
||||
<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">
|
||||
<div class="panel-heading">
|
||||
{if isset($icon)}<i class="{$icon}"></i> {/if}{if is_array($title)}{$title|end}{else}{$title}{/if}
|
||||
{if isset($toolbar_btn) && count($toolbar_btn) >0}
|
||||
<span class="badge">{$list_total}</span>
|
||||
<span class="panel-heading-action">
|
||||
{foreach from=$toolbar_btn item=btn key=k}
|
||||
{if $k != 'modules-list' && $k != 'back'}
|
||||
<a id="desc-{$table}-{if isset($btn.imgclass)}{$btn.imgclass}{else}{$k}{/if}" class="list-toolbar-btn{if isset($btn.target) && $btn.target} _blank{/if}"{if isset($btn.href)} href="{$btn.href|escape:'html':'UTF-8'}"{/if}{if isset($btn.js) && $btn.js} onclick="{$btn.js}"{/if}>
|
||||
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="{l s=$btn.desc}" data-html="true" data-placement="top">
|
||||
<i class="process-icon-{if isset($btn.imgclass)}{$btn.imgclass}{else}{$k}{/if}{if isset($btn.class)} {$btn.class}{/if}"></i>
|
||||
</span>
|
||||
</a>
|
||||
{/if}
|
||||
{/foreach}
|
||||
<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>
|
||||
</span>
|
||||
</a>
|
||||
{if isset($sql) && $sql}
|
||||
{assign var=sql_manager value=Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminRequestSql'))}
|
||||
<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}
|
||||
{if isset($toolbar_btn) && count($toolbar_btn) >0}
|
||||
<span class="badge">{$list_total}</span>
|
||||
{block name="panel_heading_action"}
|
||||
<span class="panel-heading-action">
|
||||
{foreach from=$toolbar_btn item=btn key=k}
|
||||
{if $k != 'modules-list' && $k != 'back'}
|
||||
<a id="desc-{$table}-{if isset($btn.imgclass)}{$btn.imgclass}{else}{$k}{/if}" class="list-toolbar-btn{if isset($btn.target) && $btn.target} _blank{/if}"{if isset($btn.href)} href="{$btn.href|escape:'html':'UTF-8'}"{/if}{if isset($btn.js) && $btn.js} onclick="{$btn.js}"{/if}>
|
||||
<span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="{l s=$btn.desc}" data-html="true" data-placement="top">
|
||||
<i class="process-icon-{if isset($btn.imgclass)}{$btn.imgclass}{else}{$k}{/if}{if isset($btn.class)} {$btn.class}{/if}"></i>
|
||||
</span>
|
||||
</a>
|
||||
{/if}
|
||||
{/foreach}
|
||||
{if $fields_optional|count}
|
||||
<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>
|
||||
</a>
|
||||
<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>
|
||||
{/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();
|
||||
}
|
||||
});
|
||||
|
||||
{if $sql_manager.view == 1}
|
||||
<a class="list-toolbar-btn" href="javascript:void(0);" onclick="$('.leadin').first().append('<div class=\'alert alert-info\'>' + $('#sql_query_{$list_id|escape:'html':'UTF-8'}').val() + '</div>'); $(this).attr('onclick', '');">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-original-title="{l s='Show SQL query'}" data-html="true" data-placement="top" >
|
||||
<i class="process-icon-terminal"></i>
|
||||
</span>
|
||||
</a>
|
||||
<a class="list-toolbar-btn" href="javascript:void(0);" onclick="$('#sql_name_{$list_id|escape:'html':'UTF-8'}').val(createSqlQueryName()); $('#sql_query_{$list_id|escape:'html':'UTF-8'}').val($('#sql_query_{$list_id|escape:'html':'UTF-8'}').val().replace(/\s+limit\s+[0-9,\s]+$/ig, '').trim()); $('#sql_form_{$list_id|escape:'html':'UTF-8'}').submit();">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-original-title="{l s='Export to SQL Manager'}" data-html="true" data-placement="top" >
|
||||
<i class="process-icon-database"></i>
|
||||
</span>
|
||||
</a>
|
||||
{/if}
|
||||
$.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>
|
||||
</span>
|
||||
</a>
|
||||
{if isset($sql) && $sql}
|
||||
{assign var=sql_manager value=Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminRequestSql'))}
|
||||
|
||||
{if $sql_manager.view == 1}
|
||||
<a class="list-toolbar-btn" href="javascript:void(0);" onclick="$('.leadin').first().append('<div class=\'alert alert-info\'>' + $('#sql_query_{$list_id|escape:'html':'UTF-8'}').val() + '</div>'); $(this).attr('onclick', '');">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-original-title="{l s='Show SQL query'}" data-html="true" data-placement="top" >
|
||||
<i class="process-icon-terminal"></i>
|
||||
</span>
|
||||
</a>
|
||||
<a class="list-toolbar-btn" href="javascript:void(0);" onclick="$('#sql_name_{$list_id|escape:'html':'UTF-8'}').val(createSqlQueryName()); $('#sql_query_{$list_id|escape:'html':'UTF-8'}').val($('#sql_query_{$list_id|escape:'html':'UTF-8'}').val().replace(/\s+limit\s+[0-9,\s]+$/ig, '').trim()); $('#sql_form_{$list_id|escape:'html':'UTF-8'}').submit();">
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-original-title="{l s='Export to SQL Manager'}" data-html="true" data-placement="top" >
|
||||
<i class="process-icon-database"></i>
|
||||
</span>
|
||||
</a>
|
||||
{/if}
|
||||
{/if}
|
||||
</span>
|
||||
{/block}
|
||||
{/if}
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
{if $show_toolbar}
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
@@ -235,6 +295,7 @@
|
||||
<style>
|
||||
@media (max-width: 992px) {
|
||||
{foreach from=$fields_display item=param name=params}
|
||||
{if isset($params.displayed) && $params.displayed === false}{continue}{/if}
|
||||
.table-responsive-row td:nth-of-type({math equation="x+y" x=$smarty.foreach.params.index y=$y}):before {
|
||||
content: "{$param.title}";
|
||||
}
|
||||
@@ -246,12 +307,14 @@
|
||||
<div class="table-responsive-row clearfix{if isset($use_overflow) && $use_overflow} overflow-y{/if}">
|
||||
<table{if $table_id} id="table-{$table_id}"{/if} class="table{if $table_dnd} tableDnD{/if} {$table}" >
|
||||
<thead>
|
||||
{block name="tableHeadings"}
|
||||
<tr class="nodrag nodrop">
|
||||
{if $bulk_actions && $has_bulk_actions}
|
||||
<th class="center fixed-width-xs"></th>
|
||||
{/if}
|
||||
{foreach $fields_display AS $key => $params}
|
||||
<th class="{if isset($params.class)}{$params.class}{/if}{if isset($params.align)} {$params.align}{/if}">
|
||||
{if isset($params.displayed) && $params.displayed === false}{continue}{/if}
|
||||
<th class="{if isset($params.optional) && $params.optional}field_optional{/if}{if isset($params.class)} {$params.class}{/if}{if isset($params.align)} {$params.align}{/if}" data-key="{$key}">
|
||||
<span class="title_box{if isset($order_by) && ($key == $order_by)} active{/if}">
|
||||
{if isset($params.hint)}
|
||||
<span class="label-tooltip" data-toggle="tooltip"
|
||||
@@ -299,94 +362,103 @@
|
||||
<th>{if !$simple_header}{/if}</th>
|
||||
{/if}
|
||||
</tr>
|
||||
{if !$simple_header && $show_filters}
|
||||
<tr class="nodrag nodrop filter {if $row_hover}row_hover{/if}">
|
||||
{if $has_bulk_actions}
|
||||
<th class="text-center">
|
||||
--
|
||||
</th>
|
||||
{/if}
|
||||
{* Filters (input, select, date or bool) *}
|
||||
{foreach $fields_display AS $key => $params}
|
||||
<th {if isset($params.align)} class="{$params.align}" {/if}>
|
||||
{if isset($params.search) && !$params.search}
|
||||
{/block}
|
||||
{block name="tableFilter"}
|
||||
{if !$simple_header && $show_filters}
|
||||
<tr class="nodrag nodrop filter {if $row_hover}row_hover{/if}">
|
||||
{if $has_bulk_actions}
|
||||
<th class="text-center">
|
||||
--
|
||||
{else}
|
||||
{if $params.type == 'bool'}
|
||||
<select 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 row">
|
||||
<div class="input-group fixed-width-md 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'}" />
|
||||
<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 fixed-width-md 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'}" />
|
||||
<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);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
{elseif $params.type == 'select'}
|
||||
{if isset($params.filter_key)}
|
||||
<select class="filter{if isset($params.align) && $params.align == 'center'}center{/if}" onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();" 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}
|
||||
</th>
|
||||
{/if}
|
||||
{* Filters (input, select, date or bool) *}
|
||||
{foreach $fields_display AS $key => $params}
|
||||
{if isset($params.displayed) && $params.displayed === false}{continue}{/if}
|
||||
<th class="{if isset($params.optional) && $params.optional}field_optional{/if}{if isset($params.align)} {$params.align}{/if}" data-key="{$key}">
|
||||
{if isset($params.search) && !$params.search}
|
||||
--
|
||||
{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 $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 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 row">
|
||||
<div class="input-group fixed-width-md 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'}" />
|
||||
<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 fixed-width-md 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'}" />
|
||||
<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);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
{elseif $params.type == 'select'}
|
||||
{if isset($params.filter_key)}
|
||||
<select class="filter{if isset($params.align) && $params.align == 'center'}center{/if}" onchange="$('#submitFilterButton{$list_id}').focus();$('#submitFilterButton{$list_id}').click();" 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}
|
||||
{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}
|
||||
{/if}
|
||||
{/if}
|
||||
</th>
|
||||
{/foreach}
|
||||
</th>
|
||||
{/foreach}
|
||||
|
||||
{if $shop_link_type}
|
||||
<th>--</th>
|
||||
{/if}
|
||||
{if $has_actions || $show_filters}
|
||||
<th class="actions">
|
||||
{if $show_filters}
|
||||
<span class="pull-right">
|
||||
{*Search must be before reset for default form submit*}
|
||||
<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'}
|
||||
{if $shop_link_type}
|
||||
<th>--</th>
|
||||
{/if}
|
||||
{if $has_actions || $show_filters}
|
||||
<th class="actions">
|
||||
{if $show_filters}
|
||||
<span class="pull-right">
|
||||
{*Search must be before reset for default form submit*}
|
||||
<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}
|
||||
</span>
|
||||
{/if}
|
||||
</th>
|
||||
{/if}
|
||||
</tr>
|
||||
{/if}
|
||||
</th>
|
||||
{/if}
|
||||
</tr>
|
||||
{/if}
|
||||
{/block}
|
||||
</thead>
|
||||
|
||||
@@ -709,6 +709,18 @@ class AdminControllerCore extends Controller
|
||||
$filter_value .= ' - '.$date[1];
|
||||
}
|
||||
}
|
||||
} elseif (isset($t['type']) && $t['type'] == 'range') {
|
||||
$range = json_decode($val, true);
|
||||
if (isset($range[0]) && !empty($range[0])) {
|
||||
$filter_value = $range[0];
|
||||
if (isset($range[1]) && !empty($range[1])) {
|
||||
$filter_value .= ' - '.$range[1];
|
||||
}
|
||||
} else {
|
||||
if (isset($range[1]) && !empty($range[1])) {
|
||||
$filter_value = $range[1];
|
||||
}
|
||||
}
|
||||
} elseif (is_string($val)) {
|
||||
$filter_value = htmlspecialchars($val, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
@@ -856,7 +868,7 @@ class AdminControllerCore extends Controller
|
||||
|
||||
if ($field = $this->filterToField($key, $filter)) {
|
||||
$type = (array_key_exists('filter_type', $field) ? $field['filter_type'] : (array_key_exists('type', $field) ? $field['type'] : false));
|
||||
if (($type == 'date' || $type == 'datetime') && is_string($value)) {
|
||||
if (($type == 'date' || $type == 'datetime' || $type == 'range') && is_string($value)) {
|
||||
$value = json_decode($value, true);
|
||||
}
|
||||
$key = isset($tmp_tab[1]) ? $tmp_tab[0].'.`'.$tmp_tab[1].'`' : '`'.$tmp_tab[0].'`';
|
||||
@@ -874,22 +886,34 @@ class AdminControllerCore extends Controller
|
||||
} else {
|
||||
$sql_filter = & $this->_filter;
|
||||
}
|
||||
|
||||
/* Only for date filtering (from, to) */
|
||||
if (is_array($value)) {
|
||||
if (isset($value[0]) && !empty($value[0])) {
|
||||
if (!Validate::isDate($value[0])) {
|
||||
$this->errors[] = Tools::displayError('The \'From\' date format is invalid (YYYY-MM-DD)');
|
||||
} else {
|
||||
$sql_filter .= ' AND '.pSQL($key).' >= \''.pSQL(Tools::dateFrom($value[0])).'\'';
|
||||
if ($type == 'range') {
|
||||
if (isset($value[0]) && !empty($value[0])) {
|
||||
if (!Validate::isUnsignedInt($value[0])) {
|
||||
$this->errors[] = Tools::displayError('The \'From\' value is invalid');
|
||||
} else {
|
||||
$sql_filter .= ' AND '.pSQL($key).' >= '.pSQL($value[0]);
|
||||
}
|
||||
}
|
||||
if (isset($value[1]) && !empty($value[1])) {
|
||||
$sql_filter .= ' AND '.pSQL($key).' <= '.pSQL($value[1]);
|
||||
}
|
||||
} else {
|
||||
if (isset($value[0]) && !empty($value[0])) {
|
||||
if (!Validate::isDate($value[0])) {
|
||||
$this->errors[] = Tools::displayError('The \'From\' date format is invalid (YYYY-MM-DD)');
|
||||
} else {
|
||||
$sql_filter .= ' AND '.pSQL($key).' >= \''.pSQL(Tools::dateFrom($value[0])).'\'';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($value[1]) && !empty($value[1])) {
|
||||
if (!Validate::isDate($value[1])) {
|
||||
$this->errors[] = Tools::displayError('The \'To\' date format is invalid (YYYY-MM-DD)');
|
||||
} else {
|
||||
$sql_filter .= ' AND '.pSQL($key).' <= \''.pSQL(Tools::dateTo($value[1])).'\'';
|
||||
if (isset($value[1]) && !empty($value[1])) {
|
||||
if (!Validate::isDate($value[1])) {
|
||||
$this->errors[] = Tools::displayError('The \'To\' date format is invalid (YYYY-MM-DD)');
|
||||
} else {
|
||||
$sql_filter .= ' AND '.pSQL($key).' <= \''.pSQL(Tools::dateTo($value[1])).'\'';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -915,6 +939,15 @@ class AdminControllerCore extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function processListVisibility()
|
||||
{
|
||||
$listFieldsVisibility = Tools::getValue('list_fields_visibility');
|
||||
$controller = 'list_visibility_'.$this->context->controller->className;
|
||||
$this->context->cookie->$controller = json_encode($listFieldsVisibility);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @TODO uses redirectAdmin only if !$this->ajax
|
||||
* @return bool
|
||||
@@ -3923,6 +3956,22 @@ class AdminControllerCore extends Controller
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
/**
|
||||
* Save list visible columns
|
||||
*
|
||||
* @return json as response
|
||||
*/
|
||||
public function ajaxProcessUpdateListVisivility()
|
||||
{
|
||||
$response = array(
|
||||
'success' => false
|
||||
);
|
||||
|
||||
$response['success'] = $this->processListVisibility();
|
||||
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable multiple items
|
||||
*
|
||||
|
||||
@@ -81,6 +81,8 @@ class HelperListCore extends Helper
|
||||
*/
|
||||
protected $fields_list;
|
||||
|
||||
protected $fields_optional = array();
|
||||
|
||||
/** @var bool Content line is clickable if true */
|
||||
public $no_link = false;
|
||||
|
||||
@@ -333,6 +335,12 @@ class HelperListCore extends Helper
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->fields_list as $key => $params) {
|
||||
if (isset($field['optional']) && $field['optional']) {
|
||||
$this->fields_optional[$key] = $field;
|
||||
}
|
||||
}
|
||||
|
||||
$this->content_tpl->assign(array_merge($this->tpl_vars, array(
|
||||
'shop_link_type' => $this->shopLinkType,
|
||||
'name' => isset($name) ? $name : null,
|
||||
@@ -348,6 +356,7 @@ class HelperListCore extends Helper
|
||||
'order_way' => $this->orderWay,
|
||||
'is_cms' => $this->is_cms,
|
||||
'fields_display' => $this->fields_list,
|
||||
'fields_optional' => $this->fields_optional,
|
||||
'list' => $this->_list,
|
||||
'actions' => $this->actions,
|
||||
'no_link' => $this->no_link,
|
||||
@@ -635,6 +644,12 @@ class HelperListCore extends Helper
|
||||
$this->context->controller->addJqueryUI('ui.datepicker');
|
||||
break;
|
||||
|
||||
case 'range':
|
||||
if (is_string($value)) {
|
||||
$value = json_decode($value, true);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'select':
|
||||
foreach ($params['list'] as $option_value => $option_display) {
|
||||
if (isset(Context::getContext()->cookie->{$prefix.$this->list_id.'Filter_'.$params['filter_key']})
|
||||
@@ -667,9 +682,22 @@ class HelperListCore extends Helper
|
||||
$has_value = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// get selected fields to display
|
||||
$list_visibility = json_decode($this->context->cookie->{'list_visibility_'.$this->context->controller->className});
|
||||
foreach ($this->fields_list as $key => $field) {
|
||||
if (!(isset($field['search']) && $field['search'] === false)) {
|
||||
$has_search_field = true;
|
||||
}
|
||||
if (isset($field['optional']) && $field['optional']) {
|
||||
$this->fields_optional[$key] = $field;
|
||||
if ((empty($list_visibility) && isset($field['visible_default']) && $field['visible_default'])
|
||||
|| $list_visibility && in_array($key , $list_visibility)
|
||||
) {
|
||||
$this->fields_optional[$key]['selected'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context::getContext()->smarty->assign(array(
|
||||
@@ -699,6 +727,7 @@ class HelperListCore extends Helper
|
||||
'order_way' => $this->orderWay,
|
||||
'order_by' => $this->orderBy,
|
||||
'fields_display' => $this->fields_list,
|
||||
'fields_optional' => $this->fields_optional,
|
||||
'delete' => in_array('delete', $this->actions),
|
||||
'identifier' => $this->identifier,
|
||||
'id_cat' => $id_cat,
|
||||
|
||||
@@ -63,46 +63,108 @@ class AdminOrdersControllerCore extends AdminController
|
||||
CONCAT(c.`firstname`, \' \', c.`lastname`) AS `customer`,
|
||||
osl.`name` AS `osname`, os.`color`,
|
||||
IF((SELECT so.id_order FROM `'._DB_PREFIX_.'orders` so WHERE so.id_customer = a.id_customer AND so.id_order < a.id_order LIMIT 1) > 0, 0, 1) as new,
|
||||
IF(a.valid, 1, 0) badge_success';
|
||||
IF(a.valid, 1, 0) badge_success,
|
||||
hbil.`hotel_name`, COUNT(hbd.`id`) as `num_rooms`, SUM(hbd.`adults`) + SUM(hbd.`children`) as `total_guests`,
|
||||
CONCAT(
|
||||
SUM(hbd.`adults`),
|
||||
\' '.$this->l('Adult(s)').' \',
|
||||
IF(SUM(hbd.`children`), CONCAT(SUM(hbd.`children`), \' '.$this->l('Children').'\'), \'\')
|
||||
) as `guest_text`,
|
||||
SUM(DATEDIFF(hbd.`date_to`, hbd.`date_from`)) as los,
|
||||
GROUP_CONCAT(hbd.`date_from`) as `all_date_from`, GROUP_CONCAT(hbd.`date_to`) as `all_date_to`,
|
||||
GROUP_CONCAT(hbd.`room_type_name`) as `all_room_types`';
|
||||
|
||||
$this->_join = '
|
||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = a.`current_state`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int) $this->context->language->id.')';
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int) $this->context->language->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id_order` = a.`id_order`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbil ON (hbil.`id` = hbd.`id_hotel`)';
|
||||
|
||||
$this->_orderBy = 'id_order';
|
||||
$this->_orderWay = 'DESC';
|
||||
$this->_use_found_rows = true;
|
||||
|
||||
$this->_group = ' GROUP BY hbd.`id_order`';
|
||||
|
||||
$statuses = OrderState::getOrderStates((int)$this->context->language->id);
|
||||
foreach ($statuses as $status) {
|
||||
$this->statuses_array[$status['id_order_state']] = $status['name'];
|
||||
}
|
||||
$all_order_sources = Db::getInstance()->executeS('SELECT DISTINCT(`source`) FROM `'._DB_PREFIX_.'orders`');
|
||||
foreach ($all_order_sources as $source) {
|
||||
$this->all_order_sources[$source['source']] = $source['source'];
|
||||
}
|
||||
|
||||
$this->fields_list = array(
|
||||
'id_order' => array(
|
||||
'title' => $this->l('ID'),
|
||||
'align' => 'text-center',
|
||||
'class' => 'fixed-width-xs'
|
||||
'class' => 'fixed-width-xs',
|
||||
),
|
||||
'reference' => array(
|
||||
'title' => $this->l('Reference')
|
||||
),
|
||||
'new' => array(
|
||||
'title' => $this->l('New client'),
|
||||
'align' => 'text-center',
|
||||
'type' => 'bool',
|
||||
'tmpTableFilter' => true,
|
||||
'orderby' => false,
|
||||
'callback' => 'printNewCustomer'
|
||||
),
|
||||
'customer' => array(
|
||||
'title' => $this->l('Customer'),
|
||||
'havingFilter' => true,
|
||||
'optional' => true,
|
||||
'visible_default' => true
|
||||
),
|
||||
'order_source' => array(
|
||||
'title' => $this->l('Order Source'),
|
||||
'type' => 'select',
|
||||
'filter_key' => 'a!source',
|
||||
'list' => $this->all_order_sources,
|
||||
'optional' => true,
|
||||
'visible_default' => true
|
||||
),
|
||||
'hotel_name' => array(
|
||||
'title' => $this->l('Hotel'),
|
||||
'filter_key' => 'hbil!hotel_name',
|
||||
'optional' => true,
|
||||
'visible_default' => true
|
||||
),
|
||||
'all_date_from' => array(
|
||||
'title' => $this->l('Check-in'),
|
||||
'filter_key' => 'hbd!date_from',
|
||||
'type'=>'date',
|
||||
'displayed' => false,
|
||||
),
|
||||
'all_date_to' => array(
|
||||
'title' => $this->l('Check-out'),
|
||||
'filter_key' => 'hbd!date_to',
|
||||
'type'=>'date',
|
||||
'displayed' => false,
|
||||
),
|
||||
'all_room_types' => array(
|
||||
'title' => $this->l('Room type'),
|
||||
'filter_key' => 'hbd!room_type_name',
|
||||
'type'=>'text',
|
||||
'displayed' => false,
|
||||
),
|
||||
'guest_text' => array(
|
||||
'title' => $this->l('Guests'),
|
||||
'type' => 'range',
|
||||
'filter_key' => 'total_guests',
|
||||
'optional' => true,
|
||||
'havingFilter' => true,
|
||||
),
|
||||
'num_rooms' => array(
|
||||
'title' => $this->l('No. of rooms'),
|
||||
'align' => 'text-center',
|
||||
'type' => 'range',
|
||||
'optional' => true,
|
||||
'havingFilter' => true,
|
||||
'visible_default' => true
|
||||
),
|
||||
'los' => array(
|
||||
'title' => $this->l('Stay period'),
|
||||
'align' => 'text-center',
|
||||
'type' => 'range',
|
||||
'havingFilter' => true,
|
||||
'optional' => true,
|
||||
),
|
||||
);
|
||||
|
||||
if (Configuration::get('PS_B2B_ENABLE')) {
|
||||
@@ -131,6 +193,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'havingFilter' => true,
|
||||
'callback' => 'setOrderCurrency',
|
||||
'badge_success' => true,
|
||||
'optional' => true,
|
||||
'visible_default' => true
|
||||
),
|
||||
'payment' => array(
|
||||
'title' => $this->l('Payment')
|
||||
@@ -142,13 +206,17 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'list' => $this->statuses_array,
|
||||
'filter_key' => 'os!id_order_state',
|
||||
'filter_type' => 'int',
|
||||
'order_key' => 'osname'
|
||||
'order_key' => 'osname',
|
||||
'optional' => true,
|
||||
'visible_default' => true
|
||||
),
|
||||
'date_add' => array(
|
||||
'title' => $this->l('Date'),
|
||||
'title' => $this->l('Order date'),
|
||||
'align' => 'text-right',
|
||||
'type' => 'datetime',
|
||||
'filter_key' => 'a!date_add'
|
||||
'filter_key' => 'a!date_add',
|
||||
'optional' => true,
|
||||
'visible_default' => true
|
||||
),
|
||||
'id_pdf' => array(
|
||||
'title' => $this->l('PDF'),
|
||||
@@ -156,7 +224,8 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'callback' => 'printPDFIcons',
|
||||
'orderby' => false,
|
||||
'search' => false,
|
||||
'remove_onclick' => true
|
||||
'remove_onclick' => true,
|
||||
'optional' => true,
|
||||
)
|
||||
));
|
||||
|
||||
@@ -1287,56 +1356,56 @@ class AdminOrdersControllerCore extends AdminController
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
public function renderKpis()
|
||||
{
|
||||
$time = time();
|
||||
$kpis = array();
|
||||
// public function renderKpis()
|
||||
// {
|
||||
// $time = time();
|
||||
// $kpis = array();
|
||||
|
||||
$helper = new HelperKpi();
|
||||
$helper->id = 'box-conversion-rate';
|
||||
$helper->icon = 'icon-sort-by-attributes-alt';
|
||||
//$helper->chart = true;
|
||||
$helper->color = 'color1';
|
||||
$helper->title = $this->l('Conversion Rate', null, null, false);
|
||||
$helper->subtitle = $this->l('30 days', null, null, false);
|
||||
if (ConfigurationKPI::get('CONVERSION_RATE_CHART') !== false) {
|
||||
$helper->data = ConfigurationKPI::get('CONVERSION_RATE_CHART');
|
||||
}
|
||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=conversion_rate';
|
||||
$kpis[] = $helper->generate();
|
||||
// $helper = new HelperKpi();
|
||||
// $helper->id = 'box-conversion-rate';
|
||||
// $helper->icon = 'icon-sort-by-attributes-alt';
|
||||
// //$helper->chart = true;
|
||||
// $helper->color = 'color1';
|
||||
// $helper->title = $this->l('Conversion Rate', null, null, false);
|
||||
// $helper->subtitle = $this->l('30 days', null, null, false);
|
||||
// if (ConfigurationKPI::get('CONVERSION_RATE_CHART') !== false) {
|
||||
// $helper->data = ConfigurationKPI::get('CONVERSION_RATE_CHART');
|
||||
// }
|
||||
// $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=conversion_rate';
|
||||
// $kpis[] = $helper->generate();
|
||||
|
||||
$helper = new HelperKpi();
|
||||
$helper->id = 'box-carts';
|
||||
$helper->icon = 'icon-shopping-cart';
|
||||
$helper->color = 'color2';
|
||||
$helper->title = $this->l('Abandoned Carts', null, null, false);
|
||||
$helper->subtitle = $this->l('Today', null, null, false);
|
||||
$helper->href = $this->context->link->getAdminLink('AdminCarts').'&action=filterOnlyAbandonedCarts';
|
||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=abandoned_cart';
|
||||
$kpis[] = $helper->generate();
|
||||
// $helper = new HelperKpi();
|
||||
// $helper->id = 'box-carts';
|
||||
// $helper->icon = 'icon-shopping-cart';
|
||||
// $helper->color = 'color2';
|
||||
// $helper->title = $this->l('Abandoned Carts', null, null, false);
|
||||
// $helper->subtitle = $this->l('Today', null, null, false);
|
||||
// $helper->href = $this->context->link->getAdminLink('AdminCarts').'&action=filterOnlyAbandonedCarts';
|
||||
// $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=abandoned_cart';
|
||||
// $kpis[] = $helper->generate();
|
||||
|
||||
$helper = new HelperKpi();
|
||||
$helper->id = 'box-average-order';
|
||||
$helper->icon = 'icon-money';
|
||||
$helper->color = 'color3';
|
||||
$helper->title = $this->l('Average Order Value', null, null, false);
|
||||
$helper->subtitle = $this->l('30 days', null, null, false);
|
||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=average_order_value';
|
||||
$kpis[] = $helper->generate();
|
||||
// $helper = new HelperKpi();
|
||||
// $helper->id = 'box-average-order';
|
||||
// $helper->icon = 'icon-money';
|
||||
// $helper->color = 'color3';
|
||||
// $helper->title = $this->l('Average Order Value', null, null, false);
|
||||
// $helper->subtitle = $this->l('30 days', null, null, false);
|
||||
// $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=average_order_value';
|
||||
// $kpis[] = $helper->generate();
|
||||
|
||||
$helper = new HelperKpi();
|
||||
$helper->id = 'box-net-profit-visit';
|
||||
$helper->icon = 'icon-user';
|
||||
$helper->color = 'color4';
|
||||
$helper->title = $this->l('Net Profit per Visit', null, null, false);
|
||||
$helper->subtitle = $this->l('30 days', null, null, false);
|
||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=netprofit_visit';
|
||||
$kpis[] = $helper->generate();
|
||||
// $helper = new HelperKpi();
|
||||
// $helper->id = 'box-net-profit-visit';
|
||||
// $helper->icon = 'icon-user';
|
||||
// $helper->color = 'color4';
|
||||
// $helper->title = $this->l('Net Profit per Visit', null, null, false);
|
||||
// $helper->subtitle = $this->l('30 days', null, null, false);
|
||||
// $helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=netprofit_visit';
|
||||
// $kpis[] = $helper->generate();
|
||||
|
||||
$helper = new HelperKpiRow();
|
||||
$helper->kpis = $kpis;
|
||||
return $helper->generate();
|
||||
}
|
||||
// $helper = new HelperKpiRow();
|
||||
// $helper->kpis = $kpis;
|
||||
// return $helper->generate();
|
||||
// }
|
||||
|
||||
public function renderView()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user