From aa9eac06849ed02ccb96d9fa53acb26e95969b1f Mon Sep 17 00:00:00 2001 From: AlexC <40072887+alexdcrane@users.noreply.github.com> Date: Tue, 9 Nov 2021 23:19:37 -0700 Subject: [PATCH] Update voicemails.php (#6115) --- .../resources/dashboard/voicemails.php | 206 +++++++++--------- 1 file changed, 105 insertions(+), 101 deletions(-) diff --git a/app/voicemails/resources/dashboard/voicemails.php b/app/voicemails/resources/dashboard/voicemails.php index 6cb9253a9c..ad036a3a64 100644 --- a/app/voicemails/resources/dashboard/voicemails.php +++ b/app/voicemails/resources/dashboard/voicemails.php @@ -22,116 +22,120 @@ $theme_image_path = $_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/"; //voicemail - //if (is_array($selected_blocks) && in_array('voicemail', $selected_blocks) && permission_exists('voicemail_message_view') && file_exists($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/app/voicemails/")) { - //required class - require_once "app/voicemails/resources/classes/voicemail.php"; - //get the voicemail - $vm = new voicemail; - $vm->db = $db; - $vm->domain_uuid = $_SESSION['domain_uuid']; - $vm->order_by = $order_by; - $vm->order = $order; - $voicemails = $vm->messages(); - //sum total and new - $messages['total'] = 0; - $messages['new'] = 0; - if (sizeof($voicemails) > 0) { - foreach($voicemails as $field) { - $messages[$field['voicemail_uuid']]['ext'] = $field['voicemail_id']; - $messages[$field['voicemail_uuid']]['total'] = 0; - $messages[$field['voicemail_uuid']]['new'] = 0; - foreach($field['messages'] as &$row) { - if ($row['message_status'] == '') { - $messages[$field['voicemail_uuid']]['new']++; - $messages['new']++; - } - $messages[$field['voicemail_uuid']]['total']++; - $messages['total']++; - } + echo "
\n"; + +//required class + require_once "app/voicemails/resources/classes/voicemail.php"; + +//get the voicemail + $vm = new voicemail; + $vm->db = $db; + $vm->domain_uuid = $_SESSION['domain_uuid']; + $vm->order_by = $order_by; + $vm->order = $order; + $voicemails = $vm->messages(); + +//sum total and new + $messages['total'] = 0; + $messages['new'] = 0; + if (sizeof($voicemails) > 0) { + foreach($voicemails as $field) { + $messages[$field['voicemail_uuid']]['ext'] = $field['voicemail_id']; + $messages[$field['voicemail_uuid']]['total'] = 0; + $messages[$field['voicemail_uuid']]['new'] = 0; + foreach($field['messages'] as &$row) { + if ($row['message_status'] == '') { + $messages[$field['voicemail_uuid']]['new']++; + $messages['new']++; } + $messages[$field['voicemail_uuid']]['total']++; + $messages['total']++; } + } + } - //add doughnut chart - echo " -
-
-
+//add doughnut chart + echo " +
+
+
- - "; - - echo "
"; - if (sizeof($voicemails) > 0) { - echo ""; - echo ""; - echo " "; - echo " "; - echo " "; - echo ""; - - $c = 0; - $row_style["0"] = "row_style0"; - $row_style["1"] = "row_style1"; - - foreach ($messages as $voicemail_uuid => $row) { - if (is_uuid($voicemail_uuid)) { - $tr_link = "href='".PROJECT_PATH."/app/voicemails/voicemail_messages.php?id=".(permission_exists('voicemail_view') ? $voicemail_uuid : $row['ext'])."'"; - echo ""; - echo " "; - echo " "; - echo " "; - echo ""; - $c = ($c) ? 0 : 1; + legend: { + display: false + }, + title: { + display: true, + text: '".$text['label-new_messages']."', + fontFamily: chart_font_family + } } - } + }, + plugins: [chart_counter], + }; - echo "
".$text['label-voicemail']."".$text['label-new']."".$text['label-total']."
".$row['ext']."".$row['new']."".$row['total']."
"; + const new_messages_chart = new Chart( + document.getElementById('new_messages_chart'), + new_messages_config + ); + + "; + + echo "
"; + if (sizeof($voicemails) > 0) { + echo ""; + echo ""; + echo " "; + echo " "; + echo " "; + echo ""; + + $c = 0; + $row_style["0"] = "row_style0"; + $row_style["1"] = "row_style1"; + + foreach ($messages as $voicemail_uuid => $row) { + if (is_uuid($voicemail_uuid)) { + $tr_link = "href='".PROJECT_PATH."/app/voicemails/voicemail_messages.php?id=".(permission_exists('voicemail_view') ? $voicemail_uuid : $row['ext'])."'"; + echo ""; + echo " "; + echo " "; + echo " "; + echo ""; + $c = ($c) ? 0 : 1; } - else { - echo "
".$text['label-no_voicemail_assigned']; - } - echo ""; - $n++; - //} - echo " "; + } + + echo "
".$text['label-voicemail']."".$text['label-new']."".$text['label-total']."
".$row['ext']."".$row['new']."".$row['total']."
"; + } + else { + echo "
".$text['label-no_voicemail_assigned']; + } + echo "
"; + $n++; + + echo ""; + echo "
\n"; ?>