Update voicemails.php (#6952)

This commit is contained in:
Alex 2024-04-18 16:11:05 -07:00 committed by GitHub
parent 808e2cbe66
commit 4e06ce8c14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 49 additions and 47 deletions

View File

@ -52,56 +52,58 @@
} }
} }
echo " <div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px;' onclick=\"$('#hud_voicemail_details').slideToggle('fast');\">\n";
echo " <span class='hud_title' style='color: ".$dashboard_heading_text_color.";' onclick=\"document.location.href='".PROJECT_PATH."/app/voicemails/voicemail_messages.php'\">".$text['label-new_messages']."</span>";
//add doughnut chart if ($dashboard_chart_type == "doughnut") {
?> //add doughnut chart
<div style='display: flex; flex-wrap: wrap; justify-content: center; padding-bottom: 20px;' onclick="$('#hud_voicemail_details').slideToggle('fast');"> ?>
<canvas id='new_messages_chart' width='175px' height='175px'></canvas> <div style='height: 143px;'><canvas id='new_messages_chart'></canvas></div>
</div>
<script> <script>
const new_messages_chart = new Chart( const new_messages_chart = new Chart(
document.getElementById('new_messages_chart').getContext('2d'), document.getElementById('new_messages_chart').getContext('2d'),
{ {
type: 'doughnut', type: 'doughnut',
data: { data: {
datasets: [{ datasets: [{
data: ['<?php echo $messages['new']; ?>', 0.00001], data: ['<?php echo $messages['new']; ?>', 0.00001],
backgroundColor: [ backgroundColor: [
'<?php echo $_SESSION['dashboard']['new_messages_chart_main_background_color']['text']; ?>', '<?php echo $_SESSION['dashboard']['new_messages_chart_main_background_color']['text']; ?>',
'<?php echo $_SESSION['dashboard']['new_messages_chart_sub_background_color']['text']; ?>' '<?php echo $_SESSION['dashboard']['new_messages_chart_sub_background_color']['text']; ?>'
], ],
borderColor: '<?php echo $_SESSION['dashboard']['new_messages_chart_border_color']['text']; ?>', borderColor: '<?php echo $_SESSION['dashboard']['new_messages_chart_border_color']['text']; ?>',
borderWidth: '<?php echo $_SESSION['dashboard']['new_messages_chart_border_width']['text']; ?>', borderWidth: '<?php echo $_SESSION['dashboard']['new_messages_chart_border_width']['text']; ?>',
}] }]
}, },
options: { options: {
plugins: { plugins: {
chart_number: { chart_number: {
text: '<?php echo $messages['new']; ?>' text: '<?php echo $messages['new']; ?>'
}, }
title: {
text: '<?php echo $text['label-new_messages']; ?>',
color: '<?php echo $dashboard_heading_text_color; ?>'
} }
} },
}, plugins: [{
plugins: [{ id: 'chart_number',
id: 'chart_number', beforeDraw(chart, args, options){
beforeDraw(chart, args, options){ const {ctx, chartArea: {top, right, bottom, left, width, height} } = chart;
const {ctx, chartArea: {top, right, bottom, left, width, height} } = chart; ctx.font = chart_text_size + 'px ' + chart_text_font;
ctx.font = chart_text_size + 'px ' + chart_text_font; ctx.textBaseline = 'middle';
ctx.textBaseline = 'middle'; ctx.textAlign = 'center';
ctx.textAlign = 'center'; ctx.fillStyle = '<?php echo $dashboard_number_text_color; ?>';
ctx.fillStyle = '<?php echo $dashboard_number_text_color; ?>'; ctx.fillText(options.text, width / 2, top + (height / 2));
ctx.fillText(options.text, width / 2, top + (height / 2)); ctx.save();
ctx.save(); }
} }]
}] }
} );
); </script>
</script> <?php
<?php }
if ($dashboard_chart_type == "none") {
echo " <span class='hud_stat' style='color: ".$dashboard_number_text_color.";' onclick=\"$('#hud_voicemail_details').slideToggle('fast');\">".$messages['new']."</span>";
}
echo " </div>\n";
echo "<div class='hud_details hud_box' id='hud_voicemail_details'>"; echo "<div class='hud_details hud_box' id='hud_voicemail_details'>";
if (sizeof($voicemails) > 0) { if (sizeof($voicemails) > 0) {