Add unread messages support

This commit is contained in:
osaajani 2019-12-02 01:55:06 +01:00
parent cfde77a0c1
commit 88b00e4e9f
12 changed files with 249 additions and 15 deletions

View file

@ -96,17 +96,17 @@
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-terminal fa-5x"></i>
<i class="fa fa-eye-slash fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge"><?php echo $nb_commands; ?></div>
<div>Commandes</div>
<div class="huge"><?php echo $nb_unreads; ?></div>
<div>SMS non lus</div>
</div>
</div>
</div>
<a href="<?php echo \descartes\Router::url('Command', 'list') ?>">
<a href="<?php echo \descartes\Router::url('Received', 'list_unread') ?>">
<div class="panel-footer">
<span class="pull-left">Voir les commandes</span>
<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>

View file

@ -49,7 +49,7 @@
<?php foreach ($discussions as $discussion) { ?>
<tr class="goto" url="<?php $this->s(\descartes\Router::url('Discussion', 'show', ['number' => $discussion['number']])); ?>">
<td><?php $this->s($discussion['at']); ?></td>
<td><?php $this->s(isset($discussion['contact']) ? $discussion['contact'] . ' (' . \controllers\internals\Tool::phone_format($discussion['number']) . ')' : \controllers\internals\Tool::phone_link($discussion['number'])); ?></td>
<td><?php $this->s(isset($discussion['contact']) ? $discussion['contact'] . ' (' . \controllers\internals\Tool::phone_format($discussion['number']) . ')' : \controllers\internals\Tool::phone_format($discussion['number'])); ?></td>
</tr>
<?php } ?>
</tbody>

View file

@ -48,11 +48,11 @@
<li <?php echo $page == 'receiveds' ? 'class="active"' : ''; ?>>
<a href="<?php echo \descartes\Router::url('Received', 'list'); ?>"><i class="fa fa-fw fa-download"></i> SMS reçus</a>
</li>
<li <?php echo $page == 'receiveds_unread' ? 'class="active"' : ''; ?>>
<a href="<?php echo \descartes\Router::url('Received', 'list_unread'); ?>"><i class="fa fa-fw fa-eye-slash"></i> SMS non lus</a>
</li>
</ul>
</li>
<li <?php echo $page == 'commands' ? 'class="active"' : ''; ?>>
<a href="<?php echo \descartes\Router::url('Command', 'list'); ?>"><i class="fa fa-fw fa-terminal"></i> Commandes</a>
</li>
<li>
<a href="javascript:;" data-toggle="collapse" data-target="#repertoire"><i class="fa fa-fw fa-book"></i> Répertoire <i class="fa fa-fw fa-caret-down"></i></a>
<ul id="repertoire" class="collapse <?php echo in_array($page, array('contacts', 'groupes', 'conditional_groupes')) ? 'in' : ''; ?>">
@ -80,6 +80,9 @@
</li>
</ul>
</li>
<li <?php echo $page == 'commands' ? 'class="active"' : ''; ?>>
<a href="<?php echo \descartes\Router::url('Command', 'list'); ?>"><i class="fa fa-fw fa-terminal"></i> Commandes</a>
</li>
<li <?php echo $page == 'phones' ? 'class="active"' : ''; ?>>
<a href="<?php echo \descartes\Router::url('Phone', 'list'); ?>"><i class="fa fa-fw fa-phone"></i> Téléphones</a>
</li>

View file

@ -47,6 +47,7 @@
<th>À</th>
<th>Message</th>
<th>Date</th>
<th>Status</th>
<th>Commande</th>
<?php if ($_SESSION['user']['admin']) { ?><th>Sélectionner</th><?php } ?>
</tr>
@ -59,6 +60,7 @@
<td><?php echo(\controllers\internals\Tool::phone_link($received['destination'])); ?></td>
<td><?php $this->s($received['text']); ?></td>
<td><?php $this->s($received['at']); ?></td>
<td><?php echo ($received['status'] == 'read' ? 'Lu' : 'Non lu'); ?></td>
<td><?php echo $received['command'] ? 'Oui' : 'Non'; ?></td>
<?php if ($_SESSION['user']['admin']) { ?><td><input name="ids[]" type="checkbox" value="<?php $this->s($received['id']); ?>"></td><?php } ?>
</tr>

View file

@ -0,0 +1,81 @@
<?php
//Template dashboard
$this->render('incs/head', ['title' => 'Receiveds - Unread'])
?>
<div id="wrapper">
<?php
$this->render('incs/nav', ['page' => 'receiveds_unread'])
?>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Dashboard <small>SMS non lus</small>
</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-dashboard"></i> <a href="<?php echo \descartes\Router::url('Dashboard', 'show'); ?>">Dashboard</a>
</li>
<li class="active">
<i class="fa fa-eye-slash "></i> SMS non lus
</li>
</ol>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-eye-slash fa-fw"></i> Liste des SMS non lus</h3>
</div>
<div class="panel-body">
<form method="GET">
<?php if (!$receiveds) { ?>
<p>Aucun SMS non lu à afficher.</p>
<?php } else { ?>
<div class="table-receiveds">
<table class="table table-bordered table-hover table-striped" id="table-receiveds">
<thead>
<tr>
<th>#</th>
<th>De</th>
<th>À</th>
<th>Message</th>
<th>Date</th>
<th>Status</th>
<th>Commande</th>
<?php if ($_SESSION['user']['admin']) { ?><th>Sélectionner</th><?php } ?>
</tr>
</thead>
<tbody>
<?php foreach ($receiveds as $received) { ?>
<tr>
<td><?php $this->s($received['id']); ?></td>
<td><?php echo(\controllers\internals\Tool::phone_link($received['origin'])); ?></td>
<td><?php echo(\controllers\internals\Tool::phone_link($received['destination'])); ?></td>
<td><?php $this->s($received['text']); ?></td>
<td><?php $this->s($received['at']); ?></td>
<td><?php echo ($received['status'] == 'read' ? 'Lu' : 'Non lu'); ?></td>
<td><?php echo $received['command'] ? 'Oui' : 'Non'; ?></td>
<?php if ($_SESSION['user']['admin']) { ?><td><input name="ids[]" type="checkbox" value="<?php $this->s($received['id']); ?>"></td><?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php } ?>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
$this->render('incs/footer');