Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
remdex committed Sep 22, 2023
1 parent dd3ce00 commit 315238b
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 22 deletions.
4 changes: 4 additions & 0 deletions lhc_web/design/defaulttheme/js/angular.lhc.js
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,10 @@ lhcAppControllers.controller('LiveHelperChatCtrl',['$scope','$http','$location',
filter += '/(acs)/'+_that.toggleWidgetData['active_chats_sort'];
}

if (typeof _that.toggleWidgetData['bot_chats_sort'] !== 'undefined' && _that.toggleWidgetData['bot_chats_sort'] !== '') {
filter += '/(bcs)/'+_that.toggleWidgetData['bot_chats_sort'];
}

if (typeof _that.toggleWidgetData['closed_chats_sort'] !== 'undefined' && _that.toggleWidgetData['closed_chats_sort'] !== '') {
filter += '/(clcs)/'+_that.toggleWidgetData['closed_chats_sort'];
}
Expand Down
2 changes: 1 addition & 1 deletion lhc_web/design/defaulttheme/js/angular.lhc.min.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -512,12 +512,17 @@
<div class="col-12">

<div class="btn-group me-2" role="group" aria-label="...">
<button type="submit" class="btn btn-primary btn-sm" name="doSearch"><span class="material-icons">search</span><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Search');?></button>
<button type="submit" class="btn btn-primary btn-sm no-wrap" name="doSearch"><span class="material-icons">search</span><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Search');?></button>
<select class="form-control form-control-sm border-secondary rounded-0 rounded-end" name="sortby">
<option <?php if ($input->sortby == 'id_desc'|| $input->sortby == '') : ?>selected="selected"<?php endif; ?> value="id_desc"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Newest first (default)');?></option>
<option <?php if ($input->sortby == 'id_asc') : ?>selected="selected"<?php endif; ?> value="id_asc"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Oldest first');?></option>
<option <?php if ($input->sortby == 'lmt_dsc') : ?>selected="selected"<?php endif; ?> value="lmt_dsc"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Last interactions first');?></option>
<option <?php if ($input->sortby == 'lmt_asc') : ?>selected="selected"<?php endif; ?> value="lmt_asc"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Last interactions last');?></option>
</select>
</div>

<div class="btn-group" role="group" aria-label="...">


<?php $appendPrintExportURL = ''; if ($pages->items_total > 0) : ?>
<?php include(erLhcoreClassDesign::designtpl('lhchat/lists/search_panel_append_print_multiinclude.tpl.php'));?>
<a target="_blank" class="btn btn-outline-secondary btn-sm" href="<?php echo $pages->serverURL?>/(print)/1?<?php echo $appendPrintExportURL?>"><span class="material-icons">print</span><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Print');?></a>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<table class="table table-sm mb-0 table-small table-fixed list-chat-table">
<thead>
<tr>
<th width="40%">
<th width="60%">
<i title="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmininterface','Visitor');?>" class="material-icons">face</i>
</th>
<?php include(erLhcoreClassDesign::designtpl('lhchat/lists/additional_column_header.tpl.php'));?>
<th width="25%">
<i title="Time ago" class="material-icons">access_time</i>
<th width="20%">
<a ng-click="lhc.toggleWidgetSort('bot_chats_sort','lmt_dsc','lmt_asc',true)">
<i ng-class="{'text-muted' : (lhc.toggleWidgetData['bot_chats_sort'] != 'lmt_asc' && lhc.toggleWidgetData['bot_chats_sort'] != 'lmt_dsc')}" title="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmininterface','Sort by last message time')?>" class="material-icons">{{lhc.toggleWidgetData['bot_chats_sort'] == 'lmt_dsc' || lhc.toggleWidgetData['bot_chats_sort'] != 'lmt_asc' ? 'trending_up' : 'trending_down'}}</i>
</a>
<a ng-click="lhc.toggleWidgetSort('bot_chats_sort','id_dsc','id_asc',true)">
<i ng-class="{'text-muted' : (lhc.toggleWidgetData['bot_chats_sort'] != 'id_asc' && lhc.toggleWidgetData['bot_chats_sort'] != 'id_dsc')}" title="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmininterface','Sort by chat start time')?>" class="material-icons">{{lhc.toggleWidgetData['bot_chats_sort'] == 'id_dsc' || lhc.toggleWidgetData['bot_chats_sort'] != 'id_asc' ? 'trending_up' : 'trending_down'}}</i>
</a>
</th>
<th width="20%">
<i title="Department" class="material-icons">home</i>
Expand All @@ -27,9 +32,11 @@
</td>
<?php include(erLhcoreClassDesign::designtpl('lhchat/lists/additional_column_body.tpl.php'));?>
<td>
<div class="abbr-list" title="{{chat.time_created_front}}">{{chat.time_created_front}}</div>
<div class="abbr-list" title="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmininterface','Chat started at');?> - {{chat.time_created_front}}">
<span class="material-icons text-success" title="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmininterface','Receive or send indicator and time since it happened');?>" ng-class="{'text-danger' : chat.pnd_rsp}"}>{{chat.pnd_rsp === true ? 'call_received' : 'call_made'}}</span>
{{chat.last_msg_time_front ? chat.last_msg_time_front : '&#x2709;'}}
</div>
</td>

<td>
<div class="abbr-list" title="{{chat.department_name}}{{chat.product_name ? ' | '+chat.product_name : ''}}">{{chat.department_name}}{{chat.product_name ? ' | '+chat.product_name : ''}}</div>
</td>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<table class="table table-sm mb-0 table-small table-fixed list-chat-table">
<thead>
<tr>
<th width="15%">
<th width="27%">
<i title="<?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/syncadmininterface','Visitor');?>" class="material-icons">face</i>
</th>
<?php include(erLhcoreClassDesign::designtpl('lhchat/lists/additional_column_header.tpl.php'));?>
<th width="37%">
<th width="25%">
<span class="material-icons">label</span>
</th>
<th width="18%">
Expand Down
25 changes: 20 additions & 5 deletions lhc_web/lib/core/lhchat/searchattr/chat_search.php
Original file line number Diff line number Diff line change
Expand Up @@ -582,12 +582,27 @@
)
);

$fieldsSearch['sortby'] = array (
'type' => 'text',
'trans' => 'Sort by',
'required' => false,
'valid_if_filled' => false,
'filter_type' => false,
'filter_table_field' => 'user_id',
'validation_definition' => new ezcInputFormDefinitionElement(
ezcInputFormDefinitionElement::OPTIONAL, 'string')
);

$fieldSortAttr = array (
'field' => false,
'default' => false,
'serialised' => true,
'disabled' => true,
'options' => array()
'field' => 'sortby',
'default' => 'id_desc',
'serialised' => true,
'options' => array(
'id_desc' => array('sort_column' => '`lh_chat`.`id` DESC'),
'id_asc' => array('sort_column' => '`lh_chat`.`id` ASC'),
'lmt_dsc' => array('sort_column' => '`lh_chat`.`last_msg_id` DESC'),
'lmt_asc' => array('sort_column' => '`lh_chat`.`last_msg_id` ASC'),
)
);

return array(
Expand Down
2 changes: 1 addition & 1 deletion lhc_web/modules/lhchat/addmsgadmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
if ($userData->invisible_mode == 0 && erLhcoreClassChat::hasAccessToWrite($Chat)) {
$Chat->status = erLhcoreClassModelChat::STATUS_ACTIVE_CHAT;

$Chat->pnd_time = time();
$Chat->pnd_time = time() - 2;
$Chat->wait_time = 1;

$Chat->user_id = $currentUser->getUserID();
Expand Down
3 changes: 2 additions & 1 deletion lhc_web/modules/lhchat/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@
$ViewList['syncadmininterface'] = array(
'params' => array(),
'uparams' => array(
'bcs',
'oopu',
'oopugroups',
'subjectd',
Expand Down Expand Up @@ -278,7 +279,7 @@

$ViewList['list'] = array(
'params' => array(),
'uparams' => array('timefromts','transfer_happened','phone','not_invitation','proactive_chat','view','dropped_chat','abandoned_chat','country_ids','has_unread_op_messages','cls_us','export','chat_status_ids','cf','with_bot','no_operator','has_operator','without_bot','bot_ids','ip','department_ids','department_group_ids','user_ids','group_ids','subject_id','anonymized','una','chat_duration_from','chat_duration_till','wait_time_from','wait_time_till','chat_id','nick','email','timefrom','timeto','department_id','user_id','print','xls','fbst','chat_status','hum','product_id','timefrom','timefrom_seconds','timefrom_minutes','timefrom_hours','timeto', 'timeto_minutes', 'timeto_seconds', 'timeto_hours', 'department_group_id', 'group_id', 'invitation_id',
'uparams' => array('sortby','timefromts','transfer_happened','phone','not_invitation','proactive_chat','view','dropped_chat','abandoned_chat','country_ids','has_unread_op_messages','cls_us','export','chat_status_ids','cf','with_bot','no_operator','has_operator','without_bot','bot_ids','ip','department_ids','department_group_ids','user_ids','group_ids','subject_id','anonymized','una','chat_duration_from','chat_duration_till','wait_time_from','wait_time_till','chat_id','nick','email','timefrom','timeto','department_id','user_id','print','xls','fbst','chat_status','hum','product_id','timefrom','timefrom_seconds','timefrom_minutes','timefrom_hours','timeto', 'timeto_minutes', 'timeto_seconds', 'timeto_hours', 'department_group_id', 'group_id', 'invitation_id',
'country_ids',
'region',
'iwh_ids',
Expand Down
13 changes: 12 additions & 1 deletion lhc_web/modules/lhchat/syncadmininterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,14 +541,25 @@
}
}

$sortArray = array(
'id_asc' => 'id ASC',
'id_dsc' => 'id DESC',
'lmt_asc' => 'last_msg_id ASC',
'lmt_dsc' => 'last_msg_id DESC'
);

if (!empty($Params['user_parameters_unordered']['bcs']) && key_exists($Params['user_parameters_unordered']['bcs'], $sortArray)) {
$filter['sort'] = $sortArray[$Params['user_parameters_unordered']['bcs']];
}

/**
* Bot chats
* */
$chats = erLhcoreClassChat::getBotChats($limitList,0,$filter);

$chatsListAll = $chatsListAll+$chats;

erLhcoreClassChat::prefillGetAttributes($chats,array('user_status_front','time_created_front','department_name','plain_user_name','product_name','msg_v','aicons','aalert'),array('iwh','product_id','product','department','pnd_time','time','status','user_id','user','additional_data','additional_data_array','chat_variables','chat_variables_array'),array('additional_columns' => $columnsAdditional));
erLhcoreClassChat::prefillGetAttributes($chats,array('pnd_rsp','last_msg_time_front','user_status_front','time_created_front','department_name','plain_user_name','product_name','msg_v','aicons','aalert'),array('iwh','product_id','product','department','pnd_time','time','status','user_id','user','additional_data','additional_data_array','chat_variables','chat_variables_array'),array('additional_columns' => $columnsAdditional));
$ReturnMessages['bot_chats'] = array('last_id_identifier' => 'bot_chats', 'list' => array_values($chats),'tt' => erLhcoreClassModule::getDifference($startTimeRequestItem, microtime()));
$chatsList[] = & $ReturnMessages['bot_chats']['list'];

Expand Down

0 comments on commit 315238b

Please sign in to comment.