Improve dashboard stats to show sended sms status stats
This commit is contained in:
parent
552300a971
commit
4e80a6a3a1
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
namespace controllers\internals;
|
namespace controllers\internals;
|
||||||
|
|
||||||
|
use DateInterval;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to call the console scripts.
|
* Class to call the console scripts.
|
||||||
*/
|
*/
|
||||||
|
@ -212,4 +214,46 @@ namespace controllers\internals;
|
||||||
$internal_quota = new \controllers\internals\Quota($bdd);
|
$internal_quota = new \controllers\internals\Quota($bdd);
|
||||||
$internal_quota->renew_quotas();
|
$internal_quota->renew_quotas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do some fake population renewal.
|
||||||
|
*/
|
||||||
|
public function f()
|
||||||
|
{
|
||||||
|
$bdd = \descartes\Model::_connect(DATABASE_HOST, DATABASE_NAME, DATABASE_USER, DATABASE_PASSWORD);
|
||||||
|
$internal_sended = new \controllers\internals\Sended($bdd);
|
||||||
|
|
||||||
|
$destinations = ['+33612345678','+33612345679','+33612345680',];
|
||||||
|
$statuses = [\models\Sended::STATUS_DELIVERED, \models\Sended::STATUS_FAILED, \models\Sended::STATUS_UNKNOWN];
|
||||||
|
$day = new \DateTime();
|
||||||
|
$day->sub(new DateInterval('P30D'));
|
||||||
|
for ($i = 0; $i < 30; $i++)
|
||||||
|
{
|
||||||
|
$day->add(new DateInterval('P1D'));
|
||||||
|
$n = rand(0, 100);
|
||||||
|
for ($j = 0; $j < $n; $j++)
|
||||||
|
{
|
||||||
|
$id_user = 1;
|
||||||
|
$id_phone = rand(1, 2);
|
||||||
|
$destination = $destinations[array_rand($destinations)];
|
||||||
|
$status = $statuses[array_rand($statuses)];
|
||||||
|
$internal_sended->create(
|
||||||
|
$id_user,
|
||||||
|
$id_phone,
|
||||||
|
$day->format('Y-m-d H:i:s'),
|
||||||
|
"TEST N°$i:$j",
|
||||||
|
$destination,
|
||||||
|
uniqid(),
|
||||||
|
'adapters\TestAdapter',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
null,
|
||||||
|
[],
|
||||||
|
null,
|
||||||
|
$status,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,17 +207,9 @@ use Exception;
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function count_by_day_since_for_user(int $id_user, $date)
|
public function count_by_day_and_status_since_for_user(int $id_user, $date)
|
||||||
{
|
{
|
||||||
$counts_by_day = $this->get_model()->count_by_day_since_for_user($id_user, $date);
|
return $this->get_model()->count_by_day_and_status_since_for_user($id_user, $date);
|
||||||
$return = [];
|
|
||||||
|
|
||||||
foreach ($counts_by_day as $count_by_day)
|
|
||||||
{
|
|
||||||
$return[$count_by_day['at_ymd']] = $count_by_day['nb'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -87,11 +87,12 @@ namespace controllers\publics;
|
||||||
$stats_start_date_formated = $stats_start_date->format('Y-m-d');
|
$stats_start_date_formated = $stats_start_date->format('Y-m-d');
|
||||||
}
|
}
|
||||||
|
|
||||||
$nb_sendeds_by_day = $this->internal_sended->count_by_day_since_for_user($id_user, $stats_start_date_formated);
|
$nb_sendeds_by_day = $this->internal_sended->count_by_day_and_status_since_for_user($id_user, $stats_start_date_formated);
|
||||||
$nb_receiveds_by_day = $this->internal_received->count_by_day_since_for_user($id_user, $stats_start_date_formated);
|
$nb_receiveds_by_day = $this->internal_received->count_by_day_since_for_user($id_user, $stats_start_date_formated);
|
||||||
|
|
||||||
//On va traduire ces données pour les afficher en graphique
|
//On va traduire ces données pour les afficher en graphique
|
||||||
$array_area_chart = [];
|
$array_bar_chart_sended = [];
|
||||||
|
$array_bar_chart_received = [];
|
||||||
|
|
||||||
$date = clone $stats_start_date;
|
$date = clone $stats_start_date;
|
||||||
$one_day = new \DateInterval('P1D');
|
$one_day = new \DateInterval('P1D');
|
||||||
|
@ -101,12 +102,15 @@ namespace controllers\publics;
|
||||||
while ($date <= $now)
|
while ($date <= $now)
|
||||||
{
|
{
|
||||||
$date_f = $date->format('Y-m-d');
|
$date_f = $date->format('Y-m-d');
|
||||||
$array_area_chart[$date_f] = [
|
$array_bar_chart_sended[$date_f] = [
|
||||||
'period' => $date_f,
|
'period' => $date_f,
|
||||||
'sendeds' => 0,
|
'sendeds_failed' => 0,
|
||||||
'receiveds' => 0,
|
'sendeds_unknown' => 0,
|
||||||
|
'sendeds_delivered' => 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$array_bar_chart_received[$date_f] = ['period' => $date_f, 'receiveds' => 0];
|
||||||
|
|
||||||
$date->add($one_day);
|
$date->add($one_day);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,15 +118,16 @@ namespace controllers\publics;
|
||||||
$total_receiveds = 0;
|
$total_receiveds = 0;
|
||||||
|
|
||||||
//0n remplie le tableau avec les données adaptées
|
//0n remplie le tableau avec les données adaptées
|
||||||
foreach ($nb_sendeds_by_day as $date => $nb_sended)
|
foreach ($nb_sendeds_by_day as $nb_sended)
|
||||||
{
|
{
|
||||||
$array_area_chart[$date]['sendeds'] = $nb_sended;
|
$array_bar_chart_sended[$nb_sended['at_ymd']]['sendeds_' . $nb_sended['status']] = $nb_sended['nb'];
|
||||||
$total_sendeds += $nb_sended;
|
$array_bar_chart_sended[$nb_sended['at_ymd']]['sendeds_total'] = ($array_bar_chart_sended[$nb_sended['at_ymd']]['sendeds_total'] ?? 0) + $nb_sended['nb'];
|
||||||
|
$total_sendeds += $nb_sended['nb'];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($nb_receiveds_by_day as $date => $nb_received)
|
foreach ($nb_receiveds_by_day as $date => $nb_received)
|
||||||
{
|
{
|
||||||
$array_area_chart[$date]['receiveds'] = $nb_received;
|
$array_bar_chart_received[$date]['receiveds'] = $nb_received;
|
||||||
$total_receiveds += $nb_received;
|
$total_receiveds += $nb_received;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +135,8 @@ namespace controllers\publics;
|
||||||
$avg_sendeds = round($total_sendeds / $nb_days, 2);
|
$avg_sendeds = round($total_sendeds / $nb_days, 2);
|
||||||
$avg_receiveds = round($total_receiveds / $nb_days, 2);
|
$avg_receiveds = round($total_receiveds / $nb_days, 2);
|
||||||
|
|
||||||
$array_area_chart = array_values($array_area_chart);
|
$array_bar_chart_sended = array_values($array_bar_chart_sended);
|
||||||
|
$array_bar_chart_received = array_values($array_bar_chart_received);
|
||||||
|
|
||||||
$this->render('dashboard/show', [
|
$this->render('dashboard/show', [
|
||||||
'nb_contacts' => $nb_contacts,
|
'nb_contacts' => $nb_contacts,
|
||||||
|
@ -145,7 +151,9 @@ namespace controllers\publics;
|
||||||
'sendeds' => $sendeds,
|
'sendeds' => $sendeds,
|
||||||
'receiveds' => $receiveds,
|
'receiveds' => $receiveds,
|
||||||
'events' => $events,
|
'events' => $events,
|
||||||
'data_area_chart' => json_encode($array_area_chart),
|
'data_bar_chart_sended' => json_encode($array_bar_chart_sended),
|
||||||
|
'data_bar_chart_received' => json_encode($array_bar_chart_received),
|
||||||
|
'stats_start_date_formated' => $stats_start_date_formated,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,14 +222,14 @@ namespace models;
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function count_by_day_since_for_user($id_user, $date)
|
public function count_by_day_and_status_since_for_user($id_user, $date)
|
||||||
{
|
{
|
||||||
$query = "
|
$query = "
|
||||||
SELECT COUNT(id) as nb, DATE_FORMAT(at, '%Y-%m-%d') as at_ymd
|
SELECT COUNT(id) as nb, status, DATE_FORMAT(at, '%Y-%m-%d') as at_ymd
|
||||||
FROM sended
|
FROM sended
|
||||||
WHERE at > :date
|
WHERE at > :date
|
||||||
AND id_user = :id_user
|
AND id_user = :id_user
|
||||||
GROUP BY at_ymd
|
GROUP BY at_ymd, status
|
||||||
";
|
";
|
||||||
|
|
||||||
$params = [
|
$params = [
|
||||||
|
|
|
@ -1,147 +1,160 @@
|
||||||
<?php
|
<?php
|
||||||
//Template dashboard
|
//Template dashboard
|
||||||
|
|
||||||
$this->render('incs/head')
|
$this->render('incs/head')
|
||||||
?>
|
?>
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<?php
|
<?php
|
||||||
$this->render('incs/nav', ['page' => 'dashboard'])
|
$this->render('incs/nav', ['page' => 'dashboard'])
|
||||||
?>
|
?>
|
||||||
<div id="page-wrapper">
|
<div id="page-wrapper">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<!-- Page Heading -->
|
<!-- Page Heading -->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<h1 class="page-header">
|
<h1 class="page-header">
|
||||||
Dashboard <small>Statistiques d'utilisation</small>
|
Dashboard <small>Statistiques d'utilisation</small>
|
||||||
</h1>
|
</h1>
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
<li class="active">
|
<li class="active">
|
||||||
<i class="fa fa-dashboard"></i> Dashboard
|
<i class="fa fa-dashboard"></i> Dashboard
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.row -->
|
<!-- /.row -->
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-3 col-md-6">
|
<div class="col-lg-3 col-md-6">
|
||||||
<div class="panel panel-primary">
|
<div class="panel panel-primary">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-3">
|
<div class="col-xs-3">
|
||||||
<i class="fa fa-user fa-5x"></i>
|
<i class="fa fa-user fa-5x"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-9 text-right">
|
<div class="col-xs-9 text-right">
|
||||||
<div class="huge"><?php echo $nb_contacts; ?></div>
|
<div class="huge"><?php echo $nb_contacts; ?></div>
|
||||||
<div>Contacts</div>
|
<div>Contacts</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a href="<?php echo \descartes\Router::url('Contact', 'list') ?>">
|
<a href="<?php echo \descartes\Router::url('Contact', 'list') ?>">
|
||||||
<div class="panel-footer">
|
<div class="panel-footer">
|
||||||
<span class="pull-left">Voir vos contacts</span>
|
<span class="pull-left">Voir vos contacts</span>
|
||||||
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
|
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-3 col-md-6">
|
<div class="col-lg-3 col-md-6">
|
||||||
<div class="panel panel-green">
|
<div class="panel panel-green">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-3">
|
<div class="col-xs-3">
|
||||||
<i class="fa fa-group fa-5x"></i>
|
<i class="fa fa-group fa-5x"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-9 text-right">
|
<div class="col-xs-9 text-right">
|
||||||
<div class="huge"><?php echo $nb_groups; ?></div>
|
<div class="huge"><?php echo $nb_groups; ?></div>
|
||||||
<div>Groupes</div>
|
<div>Groupes</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a href="<?php echo \descartes\Router::url('Group', 'list') ?>">
|
<a href="<?php echo \descartes\Router::url('Group', 'list') ?>">
|
||||||
<div class="panel-footer">
|
<div class="panel-footer">
|
||||||
<span class="pull-left">Voir les groupes</span>
|
<span class="pull-left">Voir les groupes</span>
|
||||||
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
|
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-3 col-md-6">
|
<div class="col-lg-3 col-md-6">
|
||||||
<div class="panel panel-yellow">
|
<div class="panel panel-yellow">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-3">
|
<div class="col-xs-3">
|
||||||
<i class="fa fa-calendar fa-5x"></i>
|
<i class="fa fa-calendar fa-5x"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-9 text-right">
|
<div class="col-xs-9 text-right">
|
||||||
<div class="huge"><?php echo $nb_scheduleds; ?></div>
|
<div class="huge"><?php echo $nb_scheduleds; ?></div>
|
||||||
<div>SMS programmés</div>
|
<div>SMS programmés</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a href="<?php echo \descartes\Router::url('Scheduled', 'list') ?>">
|
<a href="<?php echo \descartes\Router::url('Scheduled', 'list') ?>">
|
||||||
<div class="panel-footer">
|
<div class="panel-footer">
|
||||||
<span class="pull-left">Voir les SMS programmés</span>
|
<span class="pull-left">Voir les SMS programmés</span>
|
||||||
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
|
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-3 col-md-6">
|
<div class="col-lg-3 col-md-6">
|
||||||
<div class="panel panel-red">
|
<div class="panel panel-red">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-3">
|
<div class="col-xs-3">
|
||||||
<i class="fa fa-eye-slash fa-5x"></i>
|
<i class="fa fa-eye-slash fa-5x"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-9 text-right">
|
<div class="col-xs-9 text-right">
|
||||||
<div class="huge"><?php echo $nb_unreads; ?></div>
|
<div class="huge"><?php echo $nb_unreads; ?></div>
|
||||||
<div>SMS non lus</div>
|
<div>SMS non lus</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a href="<?php echo \descartes\Router::url('Received', 'list_unread') ?>">
|
<a href="<?php echo \descartes\Router::url('Received', 'list_unread') ?>">
|
||||||
<div class="panel-footer">
|
<div class="panel-footer">
|
||||||
<span class="pull-left">Voir les SMS non lus</span>
|
<span class="pull-left">Voir les SMS non lus</span>
|
||||||
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
|
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.row -->
|
<!-- /.row -->
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="panel panel-default dashboard-panel-chart">
|
<div class="panel panel-default dashboard-panel-chart">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title"><i class="fa fa-area-chart fa-fw"></i> Activité de la semaine : </h3>
|
<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/>
|
<span style="color: #5CB85C;">SMS envoyés (moyenne = <?php echo $avg_sendeds; ?> par jour).</span><br/>
|
||||||
<span style="color: #EDAB4D">SMS reçus (moyenne = <?php echo $avg_receiveds; ?> par jour).</span>
|
|
||||||
<?php if ($quota_unused) { ?>
|
<?php if ($quota_unused) { ?>
|
||||||
<br/>
|
<br/>
|
||||||
<span style="color: #d9534f">Crédits restants : <?= $quota_unused; ?>.</span>
|
<span style="color: #d9534f">Crédits restants : <?= $quota_unused; ?>.</span>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div id="morris-area-chart"></div>
|
<div id="morris-bar-chart-sended"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.row -->
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-4">
|
<div class="col-lg-12">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default dashboard-panel-chart">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title"><i class="fa fa-upload fa-fw"></i> SMS Envoyés</h3>
|
<h3 class="panel-title"><i class="fa fa-area-chart fa-fw"></i> SMS reçus depuis le <?= $stats_start_date_formated; ?> : </h3>
|
||||||
</div>
|
<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>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<?php if (!$sendeds) { ?>
|
<?php if (!$sendeds) { ?>
|
||||||
Vous n'avez envoyé aucun SMS pour l'instant.
|
Vous n'avez envoyé aucun SMS pour l'instant.
|
||||||
|
@ -168,14 +181,14 @@
|
||||||
<a href="<?php echo \descartes\Router::url('Sended', 'list'); ?>">Voir tous les SMS envoyés <i class="fa fa-arrow-circle-right"></i></a>
|
<a href="<?php echo \descartes\Router::url('Sended', 'list'); ?>">Voir tous les SMS envoyés <i class="fa fa-arrow-circle-right"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title"><i class="fa fa-download fa-fw"></i> SMS Reçus</h3>
|
<h3 class="panel-title"><i class="fa fa-download fa-fw"></i> SMS Reçus</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<?php if (!$receiveds) { ?>
|
<?php if (!$receiveds) { ?>
|
||||||
Vous n'avez reçu aucun SMS pour l'instant.
|
Vous n'avez reçu aucun SMS pour l'instant.
|
||||||
|
@ -204,14 +217,14 @@
|
||||||
<a href="<?php echo \descartes\Router::url('Received', 'list'); ?>">Voir tous les SMS reçus <i class="fa fa-arrow-circle-right"></i></a>
|
<a href="<?php echo \descartes\Router::url('Received', 'list'); ?>">Voir tous les SMS reçus <i class="fa fa-arrow-circle-right"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title"><i class="fa fa-clock-o fa-fw"></i> Évènements survenus</h3>
|
<h3 class="panel-title"><i class="fa fa-clock-o fa-fw"></i> Évènements survenus</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<?php if (!$events) { ?>
|
<?php if (!$events) { ?>
|
||||||
Aucun évènement n'est encore survenu.
|
Aucun évènement n'est encore survenu.
|
||||||
|
@ -228,41 +241,73 @@
|
||||||
<a href="<?php echo \descartes\Router::url('Event', 'list'); ?>">Voirs tous les évènements survenus <i class="fa fa-arrow-circle-right"></i></a>
|
<a href="<?php echo \descartes\Router::url('Event', 'list'); ?>">Voirs tous les évènements survenus <i class="fa fa-arrow-circle-right"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- /.row -->
|
<!-- /.row -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- /.container-fluid -->
|
<!-- /.container-fluid -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- /#page-wrapper -->
|
<!-- /#page-wrapper -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
jQuery(document).ready(function()
|
jQuery(document).ready(function()
|
||||||
{
|
{
|
||||||
Morris.Area({
|
Morris.Bar({
|
||||||
element: 'morris-area-chart',
|
element: 'morris-bar-chart-sended',
|
||||||
behaveLikeLine: true,
|
fillOpacity: 0.4,
|
||||||
fillOpacity: 0.4,
|
data: <?php echo $data_bar_chart_sended;?>,
|
||||||
data: <?php echo $data_area_chart;?>,
|
|
||||||
xkey: 'period',
|
xkey: 'period',
|
||||||
parseTime: false,
|
parseTime: false,
|
||||||
ykeys: ['sendeds', 'receiveds'],
|
ykeys: ['sendeds_failed', 'sendeds_unknown', 'sendeds_delivered'],
|
||||||
labels: ['SMS envoyés', 'SMS reçus'],
|
labels: ['SMS échoués', 'SMS inconnus', 'SMS délivrés'],
|
||||||
lineColors: ['#5CB85C', '#EDAB4D'],
|
barColors: ['#D9534F', '#337AB7', '#5CB85C'],
|
||||||
goals: [<?php echo $avg_sendeds; ?>, <?php echo $avg_receiveds; ?>],
|
goals: [<?php echo $avg_sendeds; ?>,],
|
||||||
goalLineColors: ['#5CB85C', '#EDAB4D'],
|
goalLineColors: ['#5CB85C'],
|
||||||
goalStrokeWidth: 2,
|
goalStrokeWidth: 2,
|
||||||
pointSize: 4,
|
pointSize: 4,
|
||||||
hideHover: 'auto',
|
hideHover: 'auto',
|
||||||
resize: true
|
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,
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<!-- /#wrapper -->
|
<!-- /#wrapper -->
|
||||||
<?php
|
<?php
|
||||||
$this->render('incs/footer');
|
$this->render('incs/footer');
|
||||||
|
|
Loading…
Reference in New Issue