diff --git a/admin/themes/default/template/controllers/customer_threads/helpers/list/list_header.tpl b/admin/themes/default/template/controllers/customer_threads/helpers/list/list_header.tpl index de58eaab0..e53c819f7 100644 --- a/admin/themes/default/template/controllers/customer_threads/helpers/list/list_header.tpl +++ b/admin/themes/default/template/controllers/customer_threads/helpers/list/list_header.tpl @@ -25,49 +25,19 @@ {extends file="helpers/list/list_header.tpl"} -{block name="leadin"} -
- {assign var=nb_categories value=count($categories)} - {foreach $categories as $key => $val} - - {assign var=total_thread value=0} - {assign var=id_customer_thread value=0} - - {foreach $contacts as $tmp => $tmp2} - {if $val.id_contact == $tmp2.id_contact} - {assign var=total_thread value=$tmp2.total} - {assign var=id_customer_thread value=$tmp2.id_customer_thread} - {/if} - {/foreach} -
-
-
- {$val.name} -
- {if $nb_categories < 6} -

{$val.description}

- {/if} - {if $total_thread == 0} - {l s='No new messages'} - {else} - - {$total_thread} - {if $total_thread > 1}{l s='New messages'}{else}{l s='New message'}{/if} - - {/if} -
-
- {/foreach} -
-
-
- {l s='Meaning of status'} -
+{block name="list_action_filter_fields" append} +
+
+ +
diff --git a/admin/themes/default/template/helpers/list/list_header.tpl b/admin/themes/default/template/helpers/list/list_header.tpl index 7f9266286..6b20667e5 100644 --- a/admin/themes/default/template/helpers/list/list_header.tpl +++ b/admin/themes/default/template/helpers/list/list_header.tpl @@ -194,237 +194,245 @@ {block name="updatelist"} {if $new_list_header_design} -
-
- {if $fields_optional|count} -
-
- - -
-
- {/if} - {if !$simple_header && $show_filters} -
-
- -
-
- {/if} -
-
-
- {if $filters_has_value} -
- {l s='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} + {block name="list_action_wrapper"} +
+ {block name="list_action_buttons"} +
+ {block name="list_action_optional_fields"} + {if $fields_optional|count} +
+
+ + +
+
+ {/if} + {/block} + {block name="list_action_filter_fields"} + {if !$simple_header && $show_filters} +
+
+ +
+
+ {/if} + {/block} +
+ {/block} +
+
+ {if $filters_has_value} +
+ {l s='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))} + + {$params['title']|escape:'html':'UTF-8'}: {$filter_value|escape:'html':'UTF-8'} + + {/if} + {elseif $params.type == 'select'} + {if isset($params.multiple) && $params.multiple} + + {$params['title']|escape:'html':'UTF-8'}: + + {foreach from=$params.value item=option name=foreachInfo} + {$params.list[$option]}{if !$smarty.foreach.foreachInfo.last}{if $params.operator == 'or'} | {else}, {/if}{/if} + {/foreach} + + + + {else} + + {$params['title']|escape:'html':'UTF-8'}: {$params['list'][$params['value']]|replace: ' ' : ''} + + + {/if} + {elseif $params.type == 'bool'} + + {$params['title']|escape:'html':'UTF-8'}: {if $params['value'] == 1}{l s='Yes'}{else}{l s='No'}{/if} {else} - {$params['title']|escape:'html':'UTF-8'}: {$params['list'][$params['value']]|replace: ' ' : ''} + {$params['title']|escape:'html':'UTF-8'}: {$params['value']|escape:'html':'UTF-8'} {/if} - {elseif $params.type == 'bool'} - - {$params['title']|escape:'html':'UTF-8'}: {if $params['value'] == 1}{l s='Yes'}{else}{l s='No'}{/if} - - - {else} - - {$params['title']|escape:'html':'UTF-8'}: {$params['value']|escape:'html':'UTF-8'} - - {/if} - {/if} - {/foreach} - -
- {/if} -
-
-
-
- {foreach $fields_display AS $key => $params} - {if !isset($params.search) || $params.search} -
- -
- {if $params.type == 'range'} - {$field_name="`$list_id`Filter_{if isset($params.filter_key)}`$params.filter_key`{else}`$key`{/if}"} -
- - -
- {elseif $params.type == 'bool'} - {$field_name="`$list_id`Filter_{if isset($params.filter_key)}`$params.filter_key`{else}`$key`{/if}"} - - {elseif $params.type == 'date' || $params.type == 'datetime'} -
-
- - - - - + {/foreach} + +
+ {/if} +
+
+
+
+ {foreach $fields_display AS $key => $params} + {if !isset($params.search) || $params.search} +
+ +
+ {if $params.type == 'range'} + {$field_name="`$list_id`Filter_{if isset($params.filter_key)}`$params.filter_key`{else}`$key`{/if}"} +
+ +
-
- - - - - -
- -
- {elseif $params.type == 'select'} - {$field_name="`$list_id`Filter_`$params.filter_key`"} - {if isset($params.multiple) && $params.multiple} - + + + - {else} - {if isset($params.filter_key)} - + + + + +
+
+ + + + + +
+ +
+ {elseif $params.type == 'select'} + {$field_name="`$list_id`Filter_`$params.filter_key`"} + {if isset($params.multiple) && $params.multiple} + + {else} + {if isset($params.filter_key)} + + {/if} {/if} + {else} + {$field_name="`$list_id`Filter_{if isset($params.filter_key)}`$params.filter_key`{else}`$key`{/if}"} + {/if} - {else} - {$field_name="`$list_id`Filter_{if isset($params.filter_key)}`$params.filter_key`{else}`$key`{/if}"} - - {/if} +
+ {/if} + {/foreach} + {if $has_actions || $show_filters} +
+
+ {if $show_filters} + + + {if $filters_has_value} + + {/if} + + {/if}
{/if} - {/foreach} - {if $has_actions || $show_filters} -
-
- {if $show_filters} - - - {if $filters_has_value} - - {/if} - - {/if} -
- {/if} +
-
+ {/block} {/if} {/block}
diff --git a/controllers/admin/AdminCustomerThreadsController.php b/controllers/admin/AdminCustomerThreadsController.php index fed00a41c..4d120c055 100644 --- a/controllers/admin/AdminCustomerThreadsController.php +++ b/controllers/admin/AdminCustomerThreadsController.php @@ -393,13 +393,6 @@ class AdminCustomerThreadsControllerCore extends AdminController $this->_orderBy = 'id_customer_thread'; $this->_orderWay = 'DESC'; - $contacts = CustomerThread::getContacts(); - $categories = Contact::getCategoriesContacts(); - $this->tpl_list_vars = array( - 'contacts' => $contacts, - 'categories' => $categories, - ); - return parent::renderList(); } @@ -799,12 +792,41 @@ class AdminCustomerThreadsControllerCore extends AdminController $helper = new HelperKpi(); $helper->id = 'box-pending-messages'; $helper->icon = 'icon-envelope'; - $helper->color = 'color1'; + $helper->color = 'color3'; $helper->title = $this->l('Closed threads', null, null, false); $helper->value = (int) ($all - ($open + $pending)); $helper->tooltip = $this->l('Total number of messages having closed status.'); $this->kpis[] = $helper; + $contacts = CustomerThread::getContacts(); + $categories = Contact::getCategoriesContacts(); + if ($contacts) { + $contacts = array_column($contacts, null, 'id_contact'); + } + + if ($categories) { + foreach ($categories as $idContact => $category) { + $helper = new HelperKpi(); + $helper->id = 'box-pending-messages'; + $helper->icon = 'icon-envelope'; + $helper->color = 'color'.(($idContact+1)%3 ? ($idContact+1)%3 : '4'); + $helper->title = $category['name']; + if (isset($contacts[$category['id_contact']])) { + $helper->href = self::$currentIndex.'&token='.$this->token.'&id_customer_thread='.$contacts[$category['id_contact']]['id_customer_thread'].'&viewcustomer_thread'; + if ($contacts[$category['id_contact']]['total'] > 1) { + $helper->value = $contacts[$category['id_contact']]['total'].' '.$this->l('New messages'); + } else { + $helper->value = $contacts[$category['id_contact']]['total'].' '.$this->l('New message'); + } + } else { + $helper->value = $this->l('No new messages'); + } + + $helper->tooltip = $this->l('Total number of messages sent to').' '.$category['name']; + $this->kpis[] = $helper; + } + } + return parent::renderKpis(); }