From 8daca7cee7fdb4ed314656612c9463240cc07f0b Mon Sep 17 00:00:00 2001 From: Nate Date: Wed, 18 Dec 2019 15:04:06 -0700 Subject: [PATCH] Call Center: List view updates for Agent Status. --- app/call_centers/app_languages.php | 40 +++ .../call_center_agent_dashboard.php | 176 ++++++------- app/call_centers/call_center_agent_status.php | 241 +++++++++--------- 3 files changed, 237 insertions(+), 220 deletions(-) diff --git a/app/call_centers/app_languages.php b/app/call_centers/app_languages.php index 2987bfb6e1..701caae1ef 100644 --- a/app/call_centers/app_languages.php +++ b/app/call_centers/app_languages.php @@ -1101,6 +1101,46 @@ $text['label-record_template']['ru-ru'] = "Запись"; $text['label-record_template']['sv-se'] = "Spela In"; $text['label-record_template']['uk-ua'] = "Запис"; +$text['label-queue']['en-us'] = "Queue"; +$text['label-queue']['ar-eg'] = "طابور"; +$text['label-queue']['de-at'] = "Warteschlange"; //copied from de-de +$text['label-queue']['de-ch'] = "Warteschlange"; //copied from de-de +$text['label-queue']['de-de'] = "Warteschlange"; +$text['label-queue']['es-cl'] = "Cola"; +$text['label-queue']['es-mx'] = "Cola"; //copied from es-cl +$text['label-queue']['fr-ca'] = "File"; //copied from fr-fr +$text['label-queue']['fr-fr'] = "File"; +$text['label-queue']['he-il'] = "תור"; +$text['label-queue']['it-it'] = "Code"; +$text['label-queue']['nl-nl'] = "Wachtrij"; +$text['label-queue']['pl-pl'] = "Kolejka"; +$text['label-queue']['pt-br'] = "Fila"; //copied from pt-pt +$text['label-queue']['pt-pt'] = "Fila"; +$text['label-queue']['ro-ro'] = ""; +$text['label-queue']['ru-ru'] = "Очередь"; +$text['label-queue']['sv-se'] = "Grupp"; +$text['label-queue']['uk-ua'] = ""; + +$text['label-queues']['en-us'] = "Queues"; +$text['label-queues']['ar-eg'] = ""; +$text['label-queues']['de-at'] = "Warteschlangen"; //copied from de-de +$text['label-queues']['de-ch'] = "Warteschlangen"; //copied from de-de +$text['label-queues']['de-de'] = "Warteschlangen"; +$text['label-queues']['es-cl'] = "Colas"; +$text['label-queues']['es-mx'] = "Colas"; //copied from es-cl +$text['label-queues']['fr-ca'] = "Files d'attente"; //copied from fr-fr +$text['label-queues']['fr-fr'] = "Files d'attente"; +$text['label-queues']['he-il'] = ""; +$text['label-queues']['it-it'] = "Code"; +$text['label-queues']['nl-nl'] = "Wachtrijen"; +$text['label-queues']['pl-pl'] = "Kolejki"; +$text['label-queues']['pt-br'] = "Filas"; //copied from pt-pt +$text['label-queues']['pt-pt'] = "Filas"; +$text['label-queues']['ro-ro'] = ""; +$text['label-queues']['ru-ru'] = "Очереди"; +$text['label-queues']['sv-se'] = "Kö:er"; +$text['label-queues']['uk-ua'] = ""; + $text['label-queue_name']['en-us'] = "Queue Name"; $text['label-queue_name']['ar-eg'] = ""; $text['label-queue_name']['de-at'] = "Name der Warteschlange"; //copied from de-de diff --git a/app/call_centers/call_center_agent_dashboard.php b/app/call_centers/call_center_agent_dashboard.php index 3ace616485..67994a1021 100644 --- a/app/call_centers/call_center_agent_dashboard.php +++ b/app/call_centers/call_center_agent_dashboard.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2017 + Portions created by the Initial Developer are Copyright (C) 2017-2019 the Initial Developer. All Rights Reserved. Contributor(s): @@ -28,6 +28,7 @@ require_once "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; + require_once "resources/paging.php"; //check permissions if (permission_exists('call_center_queue_view')) { @@ -42,11 +43,6 @@ $language = new text; $text = $language->get($_SESSION['domain']['language']['code'], 'app/call_centers'); -//includes and title - require_once "resources/header.php"; - $document['title'] = $text['title-call_center_queues']; - require_once "resources/paging.php"; - //get http variables and set as php variables $order_by = $_GET["order_by"]; $order = $_GET["order"]; @@ -56,11 +52,8 @@ //get the http post values and set them as php variables if (count($_POST) > 0) { - foreach($_POST['agents'] as $row) { + foreach ($_POST['agents'] as $row) { if (strlen($row['agent_status']) > 0) { - //echo "
\n";
-				//print_r($row);
-				//echo "
\n"; //agent set status if ($fp) { @@ -72,9 +65,6 @@ $parameters['user_status'] = $row['agent_status']; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['username'] = $row['agent_name']; - //$database = new database; - //$database->execute($sql, $parameters); - //unset($sql, $parameters); //set the agent status to available and assign the agent to the queue with the tier if ($row['agent_status'] == 'Available') { @@ -93,20 +83,24 @@ $response = event_socket_request($fp, $cmd); } - //echo $cmd."\n"; usleep(200); + unset($parameters); } } } + + //set message + //... + + //redirect + header('Location: '.PROJECT_PATH.'/core/user_settings/user_dashboard.php'); + exit; } //get the agent list from event socket $switch_cmd = 'callcenter_config tier list'; $event_socket_str = trim(event_socket_request($fp, 'api '.$switch_cmd)); $call_center_tiers = csv_to_named_array($event_socket_str, '|'); - //echo "
\n";
-	//print_r($call_center_tiers);
-	//echo "
\n"; //get the call center queues from the database $sql = "select * from v_call_center_queues "; @@ -115,122 +109,110 @@ $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $call_center_queues = $database->select($sql, $parameters, 'all'); + $num_rows = !is_array($call_center_queues) ? 0 : @sizeof($call_center_queues); unset($sql, $parameters); //get the agents from the database $sql = "select * from v_call_center_agents "; $sql .= "where user_uuid = :user_uuid "; $sql .= "and domain_uuid = :domain_uuid "; - //$sql .= "ORDER BY agent_name ASC "; $parameters['user_uuid'] = $_SESSION['user_uuid']; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; $agent = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); - //echo "
\n";
-	//print_r($agent);
-	//echo "
\n"; //update the queue status $x = 0; foreach ($call_center_queues as $queue) { $call_center_queues[$x]['queue_status'] = 'Logged Out'; foreach ($call_center_tiers as $tier) { - if ($queue['queue_name'] .'@'. $_SESSION['domain_name'] == $tier['queue'] - && $agent['agent_name'] .'@'. $_SESSION['domain_name'] == $tier['agent']) { + if ( + $queue['queue_name'] .'@'. $_SESSION['domain_name'] == $tier['queue'] + && $agent['agent_name'] .'@'. $_SESSION['domain_name'] == $tier['agent'] + ) { $call_center_queues[$x]['queue_status'] = 'Available'; } } $x++; } - //echo "
\n";
-	//print_r($call_center_queues);
-	//echo "
\n"; -//set the row styles - $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; +//includes the header + require_once "resources/header.php"; + +//radio button cycle script + echo "\n"; //show the content - echo "
\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo " \n"; - echo "\n"; - //echo "\n"; - //echo " \n"; - //echo "\n"; - echo "
".$text['header-call_center_queues']."\n"; - echo "

".$text['label-agent']."

".$agent['agent_name']."\n"; - echo "
\n"; - //echo $text['description-call_center_queues']."

\n"; - //echo "
\n"; + echo "
\n"; + echo "
".$text['header-call_center_queues'].($agent['agent_name'] != '' ? "    Agent: ".$agent['agent_name']."" : "")."
\n"; + echo "
\n"; + echo button::create(['type'=>'button','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'collapse'=>false,'onclick'=>"list_form_submit('form_list_call_center_agent_dashboard');"]); + echo "
\n"; + echo "
\n"; + echo "
\n"; - echo "\n"; - echo "\n"; + echo "\n"; + + echo "
\n"; + echo "\n"; echo " \n"; - echo " \n"; - echo " \n"; + echo " \n"; +// echo " \n"; echo "\n"; - if (count($call_center_queues) > 0) { + if (is_array($call_center_queues) && @sizeof($call_center_queues) != 0) { $x = 0; - foreach($call_center_queues as $row) { - echo "\n"; - echo " \n"; + echo " \n"; +// echo " \n"; + echo " \n"; - - echo " \n"; - - echo " \n"; - - //echo " \n"; echo "\n"; $x++; - if ($c==0) { $c=1; } else { $c=0; } - } //end foreach - unset($sql, $result, $row_count); - } //end if results - echo "\n"; - echo "\n"; - echo "\n"; + } + unset($call_center_queues); + } - - echo "
".$text['label-queue_name']."".$text['label-status']."".$text['label-options']."".$text['label-status']."".$text['label-options']."
\n"; - echo " ".escape($row['queue_name'])."\n"; + foreach ($call_center_queues as $row) { + $onclick = "onclick=\"cycle('agents[".$x."][agent_status]');\""; + echo "
".escape($row['queue_name']).""; +// if ($row['queue_status'] == "Available") { +// echo $text['option-available']; +// } +// if ($row['queue_status'] == "Logged Out") { +// echo $text['option-logged_out']; +// } +// echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; echo " \n"; - if ($row['queue_status'] == "Available") { - echo $text['option-available']; - } - if ($row['queue_status'] == "Logged Out") { - echo $text['option-logged_out']; - } - echo " "; - echo " \n"; - echo " \n"; - echo " \n"; - //echo "   \n"; - echo "   \n"; - echo "   \n"; - //echo "   \n"; - //echo " \n"; - echo " ".$row[queue_description]." 
\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
 \n"; - echo "
\n"; - echo " \n"; - echo "
\n"; - echo "
"; - echo "

"; + echo "\n"; + echo "
\n"; + echo "\n"; echo "
\n"; //include footer require_once "resources/footer.php"; -?> + +?> \ No newline at end of file diff --git a/app/call_centers/call_center_agent_status.php b/app/call_centers/call_center_agent_status.php index 96745e4b9f..afbfb0b343 100644 --- a/app/call_centers/call_center_agent_status.php +++ b/app/call_centers/call_center_agent_status.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2018 + Portions created by the Initial Developer are Copyright (C) 2008-2019 the Initial Developer. All Rights Reserved. Contributor(s): @@ -28,6 +28,7 @@ require_once "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; + require_once "resources/paging.php"; //check permissions if (permission_exists('call_center_agent_view')) { @@ -42,11 +43,6 @@ $language = new text; $text = $language->get(); -//includes and title - require_once "resources/header.php"; - $document['title'] = $text['title-call_center_agent_status']; - require_once "resources/paging.php"; - //get the agents from the database $sql = "select * from v_call_center_tiers "; $sql .= "where domain_uuid = :domain_uuid "; @@ -67,11 +63,6 @@ //get the http post values and set them as php variables if (count($_POST) > 0) { - //debug info - //echo "
\n";
-		//print_r($_POST);
-		//echo "
\n"; - foreach($_POST['agents'] as $row) { if (strlen($row['agent_status']) > 0) { //agent set status @@ -219,6 +210,8 @@ $call_center_queues = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); +// view_array($call_center_queues, false); + //add the status to the call_center_queues array $x = 0; foreach ($call_center_queues as $queue) { @@ -230,6 +223,8 @@ $x++; } +// view_array($call_center_queues, false); + //get the agent status from mod_callcenter and update the agent status in the agents array $x = 0; foreach ($agents as $row) { @@ -263,132 +258,132 @@ $x++; } -//debug info - //echo "
\n";
-	//print_r($agents);
-	//echo "
\n"; +//includes the header + $document['title'] = $text['title-call_center_agent_status']; + require_once "resources/header.php"; -//set the row style - $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; +//radio button cycle script + echo "\n"; //show the content - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "
\n"; + echo "
".$text['header-call_center_agent_status']."
\n"; + echo "
\n"; + echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'collapse'=>'hide-xs','style'=>'margin-right: 15px;','link'=>'call_center_queues.php']); + echo button::create(['type'=>'button','label'=>$text['button-refresh'],'icon'=>$_SESSION['theme']['button_icon_refresh'],'collapse'=>'hide-xs','link'=>'call_center_agent_status.php']); + echo button::create(['type'=>'button','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'collapse'=>'hide-xs','onclick'=>"list_form_submit('form_list');"]); + echo "
\n"; + echo "
\n"; + echo "
\n"; + + echo $text['description-call_center_agent_status']."\n"; + echo "

\n"; + + echo "\n"; + + echo "
".$text['header-call_center_agent_status']."\n"; - echo " \n"; - echo " \n"; - echo "
\n"; + echo "\n"; + echo " \n"; + echo " \n"; +// echo " \n"; + echo " \n"; + if ($per_queue_login) { + echo " \n"; + } echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
".$text['label-agent']."".$text['label-status']."".$text['label-options']." ".$text['label-queues']."
\n"; - echo $text['description-call_center_agent_status']."

\n"; - echo "
\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "\n"; - $x = 0; - foreach($agents as $row) { - $html = "\n"; - $html .= " \n"; + if (is_array($agents) && @sizeof($agents) != 0) { + $x = 0; + foreach ($agents as $row) { + $onclick = "onclick=\"cycle('agents[".$x."][agent_status]');\""; + $html = "\n"; + $html .= " \n"; +// $html .= " \n"; + $html .= " \n"; + $html .= " \n"; - //$html .= " \n"; - $html .= " \n"; - $html .= " \n"; - - $html .= " \n"; - $html .= "\n"; - if (count($_SESSION['domains']) > 1) { - if ($row['domain_name'] == $_SESSION['domain_name']) { + $html .= "\n"; + if (count($_SESSION['domains']) > 1) { + if ($row['domain_name'] == $_SESSION['domain_name']) { + echo $html; + } + } + else { echo $html; - if ($c==0) { $c=1; } else { $c=0; } } + $x++; } - else { - echo $html; - if ($c==0) { $c=1; } else { $c=0; } - } - $x++; - } //end foreach - unset($sql, $agents); + unset($agents); + } - echo "\n"; - echo "\n"; - echo "\n"; - - echo "
".$text['label-agent']."".$text['label-status']."".$text['label-options']."".$text['label-queues']."
".escape($row['agent_name'])." 
".escape($row['agent_name'])." ".escape($row['agent_status'])." "; + $html .= " \n"; + $html .= " \n"; + $html .= " \n"; + $html .= " \n"; + $html .= " \n"; +// $html .= " \n"; + $html .= "  ".$row['agent_name']." ".escape($row['agent_status'])." "; - $html .= " \n"; - $html .= " \n"; - //$html .= "   \n"; - $html .= "   \n"; - $html .= "   \n"; - $html .= "   \n"; - //$html .= " \n"; - $html .= " "; - if (is_array($row['queues']) && $per_queue_login) { - $html .= " \n"; - $html .= " \n"; - $html .= " \n"; - $html .= " \n"; - $html .= " \n"; - $html .= " \n"; - foreach ($row['queues'] as $queue) { - $x++; - $html .= " \n"; - $html .= " \n"; - - $html .= " \n"; - - $html .= " \n"; - $html .= " \n"; + $html .= " \n"; } - $html .= "
".$text['label-agent']."".$text['label-status']."".$text['label-options']."
\n"; - $html .= " ".$queue['queue_name']."\n"; - $html .= " \n"; - //.$row[queue_status]."  - if ($queue['queue_status'] == "Available") { - $html .= " ".$text['option-available']."\n"; + if ($per_queue_login) { + $html .= " "; + if (is_array($row['queues'])) { + $html .= " \n"; +// $html .= " \n"; +// $html .= " \n"; +// $html .= " \n"; +// $html .= " \n"; +// $html .= " \n"; + foreach ($row['queues'] as $queue) { + $x++; + $onclick = "onclick=\"cycle('agents[".$x."][agent_status]');\""; + $html .= " \n"; + $html .= " \n"; +// $html .= " \n"; + $html .= " \n"; + $html .= " \n"; + } + $html .= "
".$text['label-queue']."".$text['label-status']."".$text['label-options']."
".$queue['queue_name']."\n"; +// if ($queue['queue_status'] == "Available") { +// $html .= " ".$text['option-available']."\n"; +// } +// if ($queue['queue_status'] == "Logged Out") { +// $html .= " ".$text['option-logged_out']."\n"; +// } +// $html .= " "; + $html .= " \n"; + $html .= " \n"; + $html .= " \n"; + $html .= " \n"; + $html .= " \n"; + $html .= "  \n"; + $html .= " \n"; + $html .= "
\n"; } - if ($queue['queue_status'] == "Logged Out") { - $html .= " ".$text['option-logged_out']."\n"; - } - $html .= "
"; - //$html .= "   \n"; - $html .= "   \n"; - $html .= "   \n"; - $html .= " \n"; - $html .= " \n"; - $html .= " \n"; - $html .= " \n"; - $html .= " \n"; - $html .= "
\n"; - } - $html .= "
\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
 $paging_controls\n"; - echo "
\n"; - echo " \n"; - echo "
\n"; - echo "
"; - echo "

"; + echo "\n"; + echo "
\n"; + echo "\n"; echo "\n"; //show the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file