raspisms/templates/dashboard/show.php

314 lines
15 KiB
PHP
Raw Normal View History

2019-10-29 14:57:13 +01:00
<?php
//Template dashboard
$this->render('incs/head')
2019-10-29 14:57:13 +01:00
?>
<div id="wrapper">
<?php
$this->render('incs/nav', ['page' => 'dashboard'])
2019-10-29 14:57:13 +01:00
?>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Dashboard <small>Statistiques d'utilisation</small>
</h1>
<ol class="breadcrumb">
<li class="active">
<i class="fa fa-dashboard"></i> Dashboard
</li>
</ol>
</div>
</div>
<!-- /.row -->
2019-10-29 14:57:13 +01:00
<div class="row">
<div class="col-lg-3 col-md-6">
<div class="panel panel-primary">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-user fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge"><?php echo $nb_contacts; ?></div>
<div>Contacts</div>
</div>
</div>
</div>
<a href="<?php echo \descartes\Router::url('Contact', 'list') ?>">
<div class="panel-footer">
<span class="pull-left">Voir vos contacts</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
<div class="col-lg-3 col-md-6">
<div class="panel panel-green">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-group fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge"><?php echo $nb_groups; ?></div>
<div>Groupes</div>
</div>
</div>
</div>
<a href="<?php echo \descartes\Router::url('Group', 'list') ?>">
<div class="panel-footer">
<span class="pull-left">Voir les groupes</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
<div class="col-lg-3 col-md-6">
<div class="panel panel-yellow">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-calendar fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge"><?php echo $nb_scheduleds; ?></div>
<div>SMS programmés</div>
</div>
</div>
</div>
<a href="<?php echo \descartes\Router::url('Scheduled', 'list') ?>">
<div class="panel-footer">
<span class="pull-left">Voir les SMS programmés</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
<div class="col-lg-3 col-md-6">
<div class="panel panel-red">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-eye-slash fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge"><?php echo $nb_unreads; ?></div>
<div>SMS non lus</div>
</div>
</div>
</div>
<a href="<?php echo \descartes\Router::url('Received', 'list_unread') ?>">
<div class="panel-footer">
<span class="pull-left">Voir les SMS non lus</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
</div>
<!-- /.row -->
2019-10-29 14:57:13 +01:00
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default dashboard-panel-chart">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-area-chart fa-fw"></i> SMS envoyés depuis le <?= $stats_start_date_formated; ?> : </h3>
<span style="color: #5CB85C;">SMS envoyés (moyenne = <?php echo $avg_sendeds; ?> par jour).</span><br/>
<?php if ($quota_unused) { ?>
2021-06-14 20:21:06 +02:00
<br/>
<span style="color: #d9534f">Crédits restants : <?= $quota_unused; ?>.</span>
2021-06-14 20:21:06 +02:00
<?php } ?>
</div>
<div class="panel-body">
<div id="morris-bar-chart-sended"></div>
</div>
</div>
</div>
</div>
2019-10-29 14:57:13 +01:00
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default dashboard-panel-chart">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-area-chart fa-fw"></i> SMS reçus depuis le <?= $stats_start_date_formated; ?> : </h3>
<span style="color: #EDAB4D">SMS reçus (moyenne = <?php echo $avg_receiveds; ?> par jour).</span>
</div>
<div class="panel-body">
<div id="morris-bar-chart-received"></div>
</div>
</div>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-upload fa-fw"></i> SMS Envoyés</h3>
</div>
2019-10-29 14:57:13 +01:00
<div class="panel-body">
<?php if (!$sendeds) { ?>
Vous n'avez envoyé aucun SMS pour l'instant.
<?php } else { ?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th>Numéro</th>
<th>Date</th>
</tr>
</thead>
<tbody>
2019-11-07 17:52:33 +01:00
<?php foreach ($sendeds as $sended) { ?>
2019-10-29 14:57:13 +01:00
<tr>
<td><?php echo \controllers\internals\Tool::phone_link($sended['destination']); ?></td>
2019-10-29 14:57:13 +01:00
<td><?php $this->s($sended['at']); ?></td>
</tr>
2019-11-07 17:52:33 +01:00
<?php } ?>
2019-10-29 14:57:13 +01:00
</tbody>
</table>
</div>
<div class="text-right">
2019-11-07 17:52:33 +01:00
<a href="<?php echo \descartes\Router::url('Sended', 'list'); ?>">Voir tous les SMS envoyés <i class="fa fa-arrow-circle-right"></i></a>
2019-10-29 14:57:13 +01:00
</div>
<?php } ?>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-download fa-fw"></i> SMS Reçus</h3>
</div>
2019-10-29 14:57:13 +01:00
<div class="panel-body">
<?php if (!$receiveds) { ?>
Vous n'avez reçu aucun SMS pour l'instant.
<?php } else { ?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th>Numéro</th>
<th>Date</th>
<th>Commande</th>
</tr>
</thead>
<tbody>
2019-11-07 17:52:33 +01:00
<?php foreach ($receiveds as $received) { ?>
<tr>
<td><?php echo \controllers\internals\Tool::phone_link($received['origin']); ?></td>
2019-11-07 17:52:33 +01:00
<td><?php $this->s($received['at']); ?></td>
<td><?php echo ($received['command']) ? 'Oui' : 'Non'; ?></td>
2019-11-07 17:52:33 +01:00
</tr>
<?php } ?>
2019-10-29 14:57:13 +01:00
</tbody>
</table>
</div>
<div class="text-right">
2019-11-07 17:52:33 +01:00
<a href="<?php echo \descartes\Router::url('Received', 'list'); ?>">Voir tous les SMS reçus <i class="fa fa-arrow-circle-right"></i></a>
2019-10-29 14:57:13 +01:00
</div>
<?php } ?>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-clock-o fa-fw"></i> Évènements survenus</h3>
</div>
2019-10-29 14:57:13 +01:00
<div class="panel-body">
<?php if (!$events) { ?>
2019-11-14 22:33:00 +01:00
Aucun évènement n'est encore survenu.
2019-10-29 14:57:13 +01:00
<?php } else { ?>
<div class="list-group">
2019-11-07 17:52:33 +01:00
<?php foreach ($events as $event) { ?>
2019-10-29 14:57:13 +01:00
<a href="#" class="list-group-item">
<span class="badge"><?php $this->s($event['at']); ?></span>
2019-11-07 17:52:33 +01:00
<i class="fa fa-fw <?php echo \controllers\internals\Tool::event_type_to_icon($event['type']); ?>"></i> <?php $this->s($event['text']); ?>
2019-10-29 14:57:13 +01:00
</a>
2019-11-07 17:52:33 +01:00
<?php } ?>
2019-10-29 14:57:13 +01:00
</div>
<div class="text-right">
2019-11-07 17:52:33 +01:00
<a href="<?php echo \descartes\Router::url('Event', 'list'); ?>">Voirs tous les évènements survenus <i class="fa fa-arrow-circle-right"></i></a>
2019-10-29 14:57:13 +01:00
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<!-- /.row -->
2019-10-29 14:57:13 +01:00
</div>
<!-- /.container-fluid -->
2019-10-29 14:57:13 +01:00
</div>
<!-- /#page-wrapper -->
2019-10-29 14:57:13 +01:00
</div>
<script>
jQuery(document).ready(function()
{
Morris.Bar({
element: 'morris-bar-chart-sended',
fillOpacity: 0.4,
data: <?php echo $data_bar_chart_sended;?>,
xkey: 'period',
parseTime: false,
ykeys: ['sendeds_failed', 'sendeds_unknown', 'sendeds_delivered'],
labels: ['SMS échoués', 'SMS inconnus', 'SMS délivrés'],
barColors: ['#D9534F', '#337AB7', '#5CB85C'],
goals: [<?php echo $avg_sendeds; ?>,],
goalLineColors: ['#5CB85C'],
goalStrokeWidth: 2,
pointSize: 4,
hideHover: 'auto',
resize: true,
stacked: true,
hoverCallback: function (index, options, content, row) {
ret = '';
for (i = 0; i < options.ykeys.length; i++)
{
ret += options.labels[i];
ret += ' : ';
ret += row[options.ykeys[i]];
ret += ' (';
ret += (row[options.ykeys[i]] / (row.sendeds_total ? row.sendeds_total : 1) * 100).toFixed(2);
ret += '%)';
ret += "<br/>";
}
return ret;
}
});
Morris.Bar({
element: 'morris-bar-chart-received',
fillOpacity: 0.4,
data: <?php echo $data_bar_chart_received;?>,
xkey: 'period',
parseTime: false,
ykeys: ['receiveds'],
labels: ['SMS reçus'],
barColors: ['#EDAB4D'],
goals: [<?php echo $avg_receiveds; ?>],
goalLineColors: ['#EDAB4D'],
goalStrokeWidth: 2,
pointSize: 4,
hideHover: 'auto',
resize: true,
});
});
2019-10-29 14:57:13 +01:00
</script>
<!-- /#wrapper -->
<?php
$this->render('incs/footer');