Change all lists to use ajax data source and high perf datatable + improve all consuming listing queries + add indexes on numbers for perf improvment

This commit is contained in:
osaajani 2020-09-23 03:02:13 +02:00
parent 52ac5b459b
commit b98d5a22ef
34 changed files with 1238 additions and 767 deletions

View file

@ -35,43 +35,29 @@
</div>
<div class="panel-body">
<form method="GET">
<?php if (!$commands) { ?>
<p>Aucune commande n'a été créée pour le moment.</p>
<?php } else { ?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped datatable" id="table-commands">
<thead>
<tr>
<th>Nom</th>
<th>Script</th>
<th>Admin obligatoire</th>
<th class="checkcolumn">&#10003;</th>
</tr>
</thead>
<tbody>
<?php foreach ($commands as $command) { ?>
<tr>
<td><?php $this->s($command['name']); ?></td>
<td><?php $this->s($command['script']); ?></td>
<td><?php echo $command['admin'] ? 'Oui' : 'Non' ; ?></td>
<td><input type="checkbox" name="ids[]" value="<?php $this->s($command['id']); ?>"></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php } ?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped datatable" id="table-commands">
<thead>
<tr>
<th>Nom</th>
<th>Script</th>
<th>Admin obligatoire</th>
<th class="checkcolumn">&#10003;</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div>
<div class="col-xs-6 no-padding">
<a class="btn btn-success" href="<?php echo \descartes\Router::url('Command', 'add'); ?>"><span class="fa fa-plus"></span> Ajouter une commande</a>
</div>
<?php if ($commands) { ?>
<div class="text-right col-xs-6 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default" type="submit" formaction="<?php echo \descartes\Router::url('Command', 'edit'); ?>"><span class="fa fa-edit"></span> Modifier</button>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('Command', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
<?php } ?>
<div class="text-right col-xs-6 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default" type="submit" formaction="<?php echo \descartes\Router::url('Command', 'edit'); ?>"><span class="fa fa-edit"></span> Modifier</button>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('Command', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
</div>
</form>
</div>
@ -81,5 +67,44 @@
</div>
</div>
</div>
<script>
jQuery(document).ready(function ()
{
jQuery('.datatable').DataTable({
"pageLength": 25,
"bLengthChange": false,
"language": {
"url": HTTP_PWD + "/assets/js/datatables/french.json",
},
"columnDefs": [{
'targets': 'checkcolumn',
'orderable': false,
}],
"ajax": {
'url': '<?php echo \descartes\Router::url('Command', 'list_json'); ?>',
'dataSrc': 'data',
},
"columns" : [
{data: 'name', render: jQuery.fn.dataTable.render.text()},
{data: 'script', render: jQuery.fn.dataTable.render.text()},
{
data: 'admin',
render: function (data, type, row, meta) {
return data ? "Oui" : "Non";
},
},
{
data: 'id',
render: function (data, type, row, meta) {
return '<input name="ids[]" type="checkbox" value="' + data + '">';
},
},
],
"deferRender": true
});
});
</script>
<?php
$this->render('incs/footer');

View file

@ -81,20 +81,37 @@
</div>
</div>
<script>
jQuery(document).ready(function ()
{
jQuery('.action-dropdown a').on('click', function (e)
{
e.preventDefault();
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
var url = jQuery(this).attr('href');
jQuery(destination).find('input:checked').each(function ()
{
url += '/' + jQuery(this).val();
});
window.location = url;
});
});
jQuery(document).ready(function ()
{
jQuery('.datatable').DataTable({
"pageLength": 25,
"bLengthChange": false,
"language": {
"url": HTTP_PWD + "/assets/js/datatables/french.json",
},
"columnDefs": [{
'targets': 'checkcolumn',
'orderable': false,
}],
"ajax": {
'url': '<?php echo \descartes\Router::url('ConditionalGroup', 'list_json'); ?>',
'dataSrc': 'data',
},
"columns" : [
{data: 'name', render: jQuery.fn.dataTable.render.text()},
{data: 'condition', render: jQuery.fn.dataTable.render.text()},
{
data: 'id',
render: function (data, type, row, meta) {
return '<input name="ids[]" type="checkbox" value="' + data + '">';
},
},
],
"deferRender": true
});
});
</script>
<?php
$this->render('incs/footer');

View file

@ -37,42 +37,29 @@
</div>
<div class="panel-body">
<form method="GET">
<?php if (!$contacts) { ?>
<p>Aucun contact n'est enregistré pour le moment.</p>
<?php } else { ?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped datatable" id="table-contacts">
<thead>
<tr>
<th>Nom</th>
<th>Numéro</th>
<th class="checkcolumn">&#10003;</th>
</tr>
</thead>
<tbody>
<?php foreach ($contacts as $contact) { ?>
<tr>
<td><?php $this->s($contact['name']); ?></td>
<td><?php echo(\controllers\internals\Tool::phone_link($contact['number'])); ?></td>
<td><input type="checkbox" name="ids[]" value="<?php $this->s($contact['id']); ?>"></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php } ?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped datatable" id="table-contacts">
<thead>
<tr>
<th>Nom</th>
<th>Numéro</th>
<th class="checkcolumn">&#10003;</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div>
<div class="col-xs-6 no-padding">
<a class="btn btn-success" href="<?php echo \descartes\Router::url('Contact', 'add'); ?>"><span class="fa fa-plus"></span> Ajouter un contact</a>
</div>
<?php if ($contacts) { ?>
<div class="text-right col-xs-6 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default" type="submit" formaction="<?php echo \descartes\Router::url('Scheduled', 'add', ['prefilled' => 'contacts']); ?>"><span class="fa fa-send"></span> Envoyer un message</button>
<button class="btn btn-default" type="submit" formaction="<?php echo \descartes\Router::url('Contact', 'edit'); ?>"><span class="fa fa-edit"></span> Modifier</button>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('Contact', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
<?php } ?>
<div class="text-right col-xs-6 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default" type="submit" formaction="<?php echo \descartes\Router::url('Scheduled', 'add', ['prefilled' => 'contacts']); ?>"><span class="fa fa-send"></span> Envoyer un message</button>
<button class="btn btn-default" type="submit" formaction="<?php echo \descartes\Router::url('Contact', 'edit'); ?>"><span class="fa fa-edit"></span> Modifier</button>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('Contact', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
</div>
</form>
</div>
@ -124,18 +111,50 @@
</div>
</div>
<script>
jQuery(document).ready(function()
jQuery(document).ready(function()
{
//Import/export contacts
jQuery('body').on('click', '#btn-import', function ()
{
jQuery('body').on('click', '#btn-import', function ()
{
jQuery('#import-modal').modal({'keyboard': true});
});
jQuery('body').on('click', '#btn-export', function ()
{
jQuery('#export-modal').modal({'keyboard': true});
});
jQuery('#import-modal').modal({'keyboard': true});
});
jQuery('body').on('click', '#btn-export', function ()
{
jQuery('#export-modal').modal({'keyboard': true});
});
//Datatable
jQuery('.datatable').DataTable({
"pageLength": 25,
"bLengthChange": false,
"language": {
"url": HTTP_PWD + "/assets/js/datatables/french.json",
},
"columnDefs": [{
'targets': 'checkcolumn',
'orderable': false,
}],
"ajax": {
'url': '<?php echo \descartes\Router::url('Contact', 'list_json'); ?>',
'dataSrc': 'data',
},
"columns" : [
{data: 'name', render: jQuery.fn.dataTable.render.text()},
{data: 'number_formatted'},
{
data: 'id',
render: function (data, type, row, meta) {
return '<input name="ids[]" type="checkbox" value="' + data + '">';
},
},
],
"deferRender": true
});
});
</script>
<?php
$this->render('incs/footer');

View file

@ -34,28 +34,24 @@
<h3 class="panel-title"><i class="fa fa-comments-o fa-fw"></i> Liste des discussions</h3>
</div>
<div class="panel-body">
<?php if (!$discussions) { ?>
Aucune discussion n'est en cours actuellement.
<?php } else { ?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped datatable" id="table-discussions">
<thead>
<tr>
<th>Date du dernier message</th>
<th>Numéro</th>
</tr>
</thead>
<tbody>
<?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_format($discussion['number'])); ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php } ?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped datatable" id="table-discussions">
<thead>
<tr>
<th>Date du dernier message</th>
<th>Numéro</th>
</tr>
</thead>
<tbody>
<?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_format($discussion['number'])); ?></td>
</tr>
<?php } */?>
</tbody>
</table>
</div>
</div>
</div>
</div>
@ -63,5 +59,44 @@
</div>
</div>
</div>
<script>
jQuery(document).ready(function ()
{
jQuery('.datatable').DataTable({
"pageLength": 25,
"bLengthChange": false,
"language": {
"url": HTTP_PWD + "/assets/js/datatables/french.json",
},
"columnDefs": [{
'targets': 'checkcolumn',
'orderable': false,
}],
"ajax": {
'url': '<?php echo \descartes\Router::url('Discussion', 'list_json'); ?>',
'dataSrc': 'data',
},
"columns" : [
{data: 'at', render: jQuery.fn.dataTable.render.text()},
{
data: 'number',
render: function (data, type, row, meta) {
if (row.contact_name) {
return jQuery.fn.dataTable.render.text().display(row.contact_name) + ' (' + row.number_formatted + ')';
}
return row.number_formatted;
},
},
],
"createdRow": function (row, data, dataIndex) {
jQuery(row).addClass('goto').attr('url', data.link);
},
"deferRender": true
});
});
</script>
<?php
$this->render('incs/footer');

View file

@ -136,7 +136,10 @@
var messageInputContainer = jQuery('.message-input-container').outerHeight();
var footerHeight = jQuery('footer').outerHeight();
var containerHeight = Math.floor(windowHeight - (containerPosition.top + footerHeight * 2 + messageInputContainer));
console.log(windowHeight);
console.log(containerPosition.top);
var containerHeight = Math.floor(windowHeight - (containerPosition.top + messageInputContainer) - 20); //-20 px for aesthetic
jQuery('.discussion-container').outerHeight(containerHeight);
}

View file

@ -35,42 +35,29 @@
</div>
<div class="panel-body">
<form method="GET">
<?php if (!$events) { ?>
<p>Aucun évènement n'a été enregistré pour le moment.</p>
<?php } else { ?>
<div class="table-events">
<table class="table table-bordered table-hover table-striped datatable" id="table-events">
<thead>
<tr>
<th>Type</th>
<th>Date</th>
<th>Texte</th>
<div class="table-events">
<table class="table table-bordered table-hover table-striped datatable" id="table-events">
<thead>
<tr>
<th>Type</th>
<th>Date</th>
<th>Texte</th>
<?php if ($_SESSION['user']['admin']) { ?>
<th class="checkcolumn">&#10003;</th>
</tr>
</thead>
<tbody>
<?php foreach ($events as $event) { ?>
<tr>
<td><span class="fa fa-fw <?php echo \controllers\internals\Tool::event_type_to_icon($event['type']); ?>"></span></td>
<td><?php $this->s($event['at']); ?></td>
<td><?php $this->s($event['text']); ?></td>
<?php if ($_SESSION['user']['admin']) { ?>
<td><input name="ids[]" type="checkbox" value="<?php $this->s($event['id']); ?>"></td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div>
<?php if ($_SESSION['user']['admin']) { ?>
<div class="text-right col-xs-12 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('Event', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
<?php } ?>
</div>
<?php } ?>
<?php } ?>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<div>
<?php if ($_SESSION['user']['admin']) { ?>
<div class="text-right col-xs-12 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('Event', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
<?php } ?>
</div>
</form>
</div>
</div>
@ -80,20 +67,46 @@
</div>
</div>
<script>
jQuery(document).ready(function ()
{
jQuery('.action-dropdown a').on('click', function (e)
{
e.preventDefault();
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
var url = jQuery(this).attr('href');
jQuery(destination).find('input:checked').each(function ()
{
url += '/' + jQuery(this).val();
});
window.location = url;
});
});
jQuery(document).ready(function ()
{
jQuery('.datatable').DataTable({
"pageLength": 25,
"bLengthChange": false,
"language": {
"url": HTTP_PWD + "/assets/js/datatables/french.json",
},
"columnDefs": [{
'targets': 'checkcolumn',
'orderable': false,
}],
"ajax": {
'url': '<?php echo \descartes\Router::url('Event', 'list_json'); ?>',
'dataSrc': 'data',
},
"columns" : [
{
data: 'type',
render: function (data, type, row, meta) {
return '<span class="fa fa-fw ' + row.icon + '"></span>';
},
},
{data: 'at', render: jQuery.fn.dataTable.render.text()},
{data: 'text', render: jQuery.fn.dataTable.render.text()},
<?php if ($_SESSION['user']['admin']) { ?>
{
data: 'id',
render: function (data, type, row, meta) {
return '<input name="ids[]" type="checkbox" value="' + data + '">';
},
},
<?php } ?>
],
"deferRender": true
});
});
</script>
<?php
$this->render('incs/footer');

View file

@ -35,42 +35,36 @@
</div>
<div class="panel-body">
<form method="GET">
<?php if (!$groups) { ?>
<p>Aucun groupe n'a été formé pour le moment.</p>
<?php } else { ?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped datatable" id="table-groupes">
<thead>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped datatable" id="table-groupes">
<thead>
<tr>
<th>Nom</th>
<th>Nombre de contacts</th>
<th class="checkcolumn">&#10003;</th>
</tr>
</thead>
<tbody>
<?php foreach ($groups as $group) { ?>
<tr>
<th>Nom</th>
<th>Nombre de contacts</th>
<th class="checkcolumn">&#10003;</th>
<td><?php $this->s($group['name']); ?></td>
<td><?php $this->s($group['nb_contacts']); ?></td>
<td><input type="checkbox" name="ids[]" value="<?php $this->s($group['id']); ?>"></td>
</tr>
</thead>
<tbody>
<?php foreach ($groups as $group) { ?>
<tr>
<td><?php $this->s($group['name']); ?></td>
<td><?php $this->s($group['nb_contacts']); ?></td>
<td><input type="checkbox" name="ids[]" value="<?php $this->s($group['id']); ?>"></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php } ?>
<?php } ?>
</tbody>
</table>
</div>
<div>
<div class="col-xs-6 no-padding">
<a class="btn btn-success" href="<?php echo \descartes\Router::url('Group', 'add'); ?>"><span class="fa fa-plus"></span> Ajouter un groupe</a>
</div>
<?php if ($groups) { ?>
<div class="text-right col-xs-6 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default" type="submit" formaction="<?php echo \descartes\Router::url('Scheduled', 'add', ['prefilled' => 'groups']); ?>"><span class="fa fa-send"></span> Envoyer un message</button>
<button class="btn btn-default" type="submit" formaction="<?php echo \descartes\Router::url('Group', 'edit'); ?>"><span class="fa fa-edit"></span> Modifier</button>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('Group', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
<?php } ?>
<div class="text-right col-xs-6 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default" type="submit" formaction="<?php echo \descartes\Router::url('Scheduled', 'add', ['prefilled' => 'groups']); ?>"><span class="fa fa-send"></span> Envoyer un message</button>
<button class="btn btn-default" type="submit" formaction="<?php echo \descartes\Router::url('Group', 'edit'); ?>"><span class="fa fa-edit"></span> Modifier</button>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('Group', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
</div>
</form>
</div>
@ -81,20 +75,37 @@
</div>
</div>
<script>
jQuery(document).ready(function ()
{
jQuery('.action-dropdown a').on('click', function (e)
{
e.preventDefault();
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
var url = jQuery(this).attr('href');
jQuery(destination).find('input:checked').each(function ()
{
url += '/' + jQuery(this).val();
});
window.location = url;
});
});
jQuery(document).ready(function ()
{
jQuery('.datatable').DataTable({
"pageLength": 25,
"bLengthChange": false,
"language": {
"url": HTTP_PWD + "/assets/js/datatables/french.json",
},
"columnDefs": [{
'targets': 'checkcolumn',
'orderable': false,
}],
"ajax": {
'url': '<?php echo \descartes\Router::url('Group', 'list_json'); ?>',
'dataSrc': 'data',
},
"columns" : [
{data: 'name', render: jQuery.fn.dataTable.render.text()},
{data: 'nb_contact', render: jQuery.fn.dataTable.render.text()},
{
data: 'id',
render: function (data, type, row, meta) {
return '<input name="ids[]" type="checkbox" value="' + data + '">';
},
},
],
"deferRender": true
});
});
</script>
<?php
$this->render('incs/footer');

View file

@ -35,58 +35,28 @@
</div>
<div class="panel-body">
<form method="GET">
<?php if (!$phones) { ?>
<p>Aucun téléphone utilisable n'a été ajouté pour le moment.</p>
<?php } else { ?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped datatable" id="table-phones">
<thead>
<tr>
<th>ID</th>
<th>Nom</th>
<th>Adaptateur</th>
<th>Callbacks</th>
<th class="checkcolumn">&#10003;</th>
</tr>
</thead>
<tbody>
<?php foreach ($phones as $phone) { ?>
<tr>
<td><?php $this->s($phone['id']); ?></td>
<td><?php $this->s($phone['name']); ?></td>
<td><?php $this->s($phone['adapter']); ?></td>
<td>
<div class="bold">Reception d'un SMS : </div>
<?php if ($phone['callback_reception'] ?? false) { ?>
<div><code><?= $phone['callback_reception']; ?></code></div>
<?php } else { ?>
<div>Non disponible.</div>
<?php } ?>
<br/>
<div class="bold">Changement de statut d'un SMS : </div>
<?php if ($phone['callback_status'] ?? false) { ?>
<div><code><?= $phone['callback_status']; ?></code></div>
<?php } else { ?>
<div>Non disponible.</div>
<?php } ?>
</td>
<td><input type="checkbox" value="<?php $this->s($phone['id']); ?>" name="ids[]"></td>
</tr>
<?php } ?>
</tbody>
</table>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped datatable" id="table-phones">
<thead>
<tr>
<th>ID</th>
<th>Nom</th>
<th>Adaptateur</th>
<th>Callbacks</th>
<th class="checkcolumn">&#10003;</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div>
<div class="col-xs-6 no-padding">
<a class="btn btn-success" href="<?php echo \descartes\Router::url('Phone', 'add'); ?>"><span class="fa fa-plus"></span> Ajouter un téléphone</a>
</div>
<?php } ?>
<div>
<div class="col-xs-6 no-padding">
<a class="btn btn-success" href="<?php echo \descartes\Router::url('Phone', 'add'); ?>"><span class="fa fa-plus"></span> Ajouter un téléphone</a>
</div>
<?php if ($phones) { ?>
<div class="text-right col-xs-6 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('Phone', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
<?php } ?>
<div class="text-right col-xs-6 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('Phone', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
</div>
</form>
@ -98,20 +68,62 @@
</div>
</div>
<script>
jQuery(document).ready(function ()
{
jQuery('.action-dropdown a').on('click', function (e)
{
e.preventDefault();
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
var url = jQuery(this).attr('href');
jQuery(destination).find('input:checked').each(function ()
{
url += '/' + jQuery(this).val();
});
window.location = url;
});
});
jQuery(document).ready(function ()
{
jQuery('.datatable').DataTable({
"pageLength": 25,
"bLengthChange": false,
"language": {
"url": HTTP_PWD + "/assets/js/datatables/french.json",
},
"columnDefs": [{
'targets': 'checkcolumn',
'orderable': false,
}],
"ajax": {
'url': '<?php echo \descartes\Router::url('Phone', 'list_json'); ?>',
'dataSrc': 'data',
},
"columns" : [
{data: 'id', render: jQuery.fn.dataTable.render.text()},
{data: 'name', render: jQuery.fn.dataTable.render.text()},
{data: 'name', render: jQuery.fn.dataTable.render.text()},
{
data: '_',
render: function (data, type, row, meta) {
var html = '<div class="bold">Réception d\'un SMS : </div>';
if (row.callback_reception) {
html += '<div><code>' + row.callback_reception + '</code></div>';
} else {
html += '<div>Non disponible.</div>';
}
html += '<br/>';
html += '<div class="bold">Changement de statut d\'un SMS : </div>';
if (row.callback_status) {
html += '<div><code>' + row.callback_status + '</code></div>';
} else {
html += '<div>Non disponible.</div>';
}
return html;
},
},
{
data: 'id',
render: function (data, type, row, meta) {
return '<input name="ids[]" type="checkbox" value="' + data + '">';
},
},
],
"deferRender": true
});
});
</script>
<?php
$this->render('incs/footer');

View file

@ -1,11 +1,17 @@
<?php
//Template dashboard
$this->render('incs/head', ['title' => 'Receiveds - Show All'])
if ($is_unread)
{
$this->render('incs/head', ['title' => 'Receiveds - Unread']);
}
else
{
$this->render('incs/head', ['title' => 'Receiveds - Show All']);
}
?>
<div id="wrapper">
<?php
$this->render('incs/nav', ['page' => 'receiveds'])
$this->render('incs/nav', ['page' => ($is_unread ? 'receiveds_unread' : 'receiveds')])
?>
<div id="page-wrapper">
<div class="container-fluid">
@ -20,7 +26,7 @@
<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-download "></i> SMS reçus
<i class="fa <?= $is_unread ? 'fa-eye-slash' : 'fa-download' ?> "></i> <?= $is_unread ? 'SMS non lus' : 'SMS reçus' ?>
</li>
</ol>
</div>
@ -31,13 +37,10 @@
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-download fa-fw"></i> Liste des SMS reçus</h3>
<h3 class="panel-title"><i class="fa fa-fw <?= $is_unread ? 'fa-eye-slash' : 'fa-download' ?>"></i> <?= $is_unread ? 'Liste des SMS non lus' : 'Liste des SMS reçus' ?></h3>
</div>
<div class="panel-body">
<form method="GET">
<?php if (!$receiveds) { ?>
<p>Aucun SMS n'a été reçu pour le moment.</p>
<?php } else { ?>
<div class="table-receiveds">
<table class="table table-bordered table-hover table-striped datatable" id="table-receiveds">
<thead>
@ -48,39 +51,21 @@
<th>Date</th>
<th>Status</th>
<th>Commande</th>
<?php if ($_SESSION['user']['admin']) { ?><th class="checkcolumn">&#10003;</th><?php } ?>
<th class="checkcolumn">&#10003;</th>
</tr>
</thead>
<tbody>
<?php foreach ($receiveds as $received) { ?>
<tr>
<td class="no-wrap">
<?php if ($received['contact'] ?? false) { ?>
<?php echo \controllers\internals\Tool::phone_link($received['origin']) . ' (' . $received['contact'] . ')'; ?>
<?php } else { ?>
<?php echo \controllers\internals\Tool::phone_link($received['origin']); ?>
<?php } ?>
</td>
<td class="no-wrap"><?php $this->s($received['phone_name'] ?? 'Inconnu'); ?></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>
<div>
<?php if ($_SESSION['user']['admin']) { ?>
<div class="text-right col-xs-12 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('Received', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
<?php } ?>
<div class="text-right col-xs-12 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default" type="submit" formaction="<?php echo \descartes\Router::url('Received', 'mark_as', ['status' => \models\Received::STATUS_READ, 'csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-eye"></span> Marquer comme lu</button>
<button class="btn btn-default" type="submit" formaction="<?php echo \descartes\Router::url('Received', 'mark_as', ['status' => \models\Received::STATUS_UNREAD, 'csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-eye-slash"></span> Marquer comme non lu</button>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('Received', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
</div>
<?php } ?>
</form>
</div>
</div>
@ -90,20 +75,71 @@
</div>
</div>
<script>
jQuery(document).ready(function ()
{
jQuery('.action-dropdown a').on('click', function (e)
{
e.preventDefault();
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
var url = jQuery(this).attr('href');
jQuery(destination).find('input:checked').each(function ()
{
url += '/' + jQuery(this).val();
});
window.location = url;
});
});
jQuery(document).ready(function ()
{
jQuery('.datatable').DataTable({
"pageLength": 25,
"bLengthChange": false,
"language": {
"url": HTTP_PWD + "/assets/js/datatables/french.json",
},
"columnDefs": [{
'targets': 'checkcolumn',
'orderable': false,
}],
"ajax": {
'url': '<?php echo $is_unread ? \descartes\Router::url('Received', 'list_unread_json') : \descartes\Router::url('Received', 'list_json'); ?>',
'dataSrc': 'data',
},
"columns" : [
{
data: 'origin',
render: function (data, type, row, meta) {
if (row.contact_name) {
return row.origin_formatted + ' (' + jQuery.fn.dataTable.render.text().display(row.contact_name) + ')';
}
return row.origin_formatted;
},
},
{data: 'phone_name', render: jQuery.fn.dataTable.render.text()},
{data: 'text', render: jQuery.fn.dataTable.render.text()},
{data: 'at', render: jQuery.fn.dataTable.render.text()},
{
data: 'status',
render: function (data, type, row, meta) {
switch (data) {
case 'read':
return 'Lu';
break;
default:
return 'Non lu';
}
},
},
{
data: 'command',
render: function (data, type, row, meta) {
if (data == 0) {
return "Non";
} else {
return 'Oui';
}
},
},
{
data: 'id',
render: function (data, type, row, meta) {
return '<input name="ids[]" type="checkbox" value="' + data + '">';
},
},
],
"deferRender": true
});
});
</script>
<?php
$this->render('incs/footer');

View file

@ -1,85 +0,0 @@
<?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 datatable" id="table-receiveds">
<thead>
<tr>
<th>De</th>
<th>À</th>
<th>Message</th>
<th>Date</th>
<th>Status</th>
<th>Commande</th>
<?php if ($_SESSION['user']['admin']) { ?><th class="checkcolumn">&#10003;</th><?php } ?>
</tr>
</thead>
<tbody>
<?php foreach ($receiveds as $received) { ?>
<tr>
<td class="no-wrap">
<?php if ($received['contact'] ?? false) { ?>
<?php echo \controllers\internals\Tool::phone_link($received['origin']) . ' (' . $received['contact'] . ')'; ?>
<?php } else { ?>
<?php echo \controllers\internals\Tool::phone_link($received['origin']); ?>
<?php } ?>
</td>
<td class="no-wrap"><?php $this->s($received['phone_name'] ?? 'Inconnu'); ?></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');

View file

@ -35,41 +35,29 @@
</div>
<div class="panel-body">
<form method="GET">
<?php if (!$scheduleds) { ?>
<p>Aucun SMS n'est actuellement programmé.</p>
<?php } else { ?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped" id="table-scheduleds">
<thead>
<tr>
<th>Date</th>
<th>Contenu</th>
<th class="checkcolumn">&#10003;</th>
</tr>
</thead>
<tbody>
<?php foreach ($scheduleds as $scheduled) { ?>
<tr>
<td><?php $this->s($scheduled['at']); ?></td>
<td><?php $this->s($scheduled['text']); ?></td>
<td><input type="checkbox" name="ids[]" value="<?php $this->s($scheduled['id']); ?>"></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php } ?>
<div class="table-scheduleds">
<table class="table table-bordered table-hover table-striped datatable" id="table-scheduleds">
<thead>
<tr>
<th>Date</th>
<th>Contenu</th>
<th class="checkcolumn">&#10003;</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div>
<div class="col-xs-6 no-padding">
<a class="btn btn-success" href="<?php echo \descartes\Router::url('Scheduled', 'add'); ?>"><span class="fa fa-plus"></span> Créer un nouveau SMS</a>
</div>
<?php if ($scheduleds) { ?>
<div class="text-right col-xs-6 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default" type="submit" formaction="<?php echo \descartes\Router::url('Scheduled', 'edit'); ?>"><span class="fa fa-edit"></span> Modifier</button>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('Scheduled', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
<?php } ?>
</div>
</div>
</form>
</div>
@ -80,20 +68,37 @@
</div>
</div>
<script>
jQuery(document).ready(function ()
{
jQuery('.action-dropdown a').on('click', function (e)
{
e.preventDefault();
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
var url = jQuery(this).attr('href');
jQuery(destination).find('input:checked').each(function ()
{
url += '/' + jQuery(this).val();
});
window.location = url;
});
});
jQuery(document).ready(function ()
{
jQuery('.datatable').DataTable({
"pageLength": 25,
"bLengthChange": false,
"language": {
"url": HTTP_PWD + "/assets/js/datatables/french.json",
},
"columnDefs": [{
'targets': 'checkcolumn',
'orderable': false,
}],
"ajax": {
'url': '<?php echo \descartes\Router::url('Scheduled', 'list_json'); ?>',
'dataSrc': 'data',
},
"columns" : [
{data: 'at', render: jQuery.fn.dataTable.render.text()},
{data: 'text', render: jQuery.fn.dataTable.render.text()},
{
data: 'id',
render: function (data, type, row, meta) {
return '<input name="ids[]" type="checkbox" value="' + data + '">';
},
},
],
"deferRender": true
});
});
</script>
<?php
$this->render('incs/footer');

View file

@ -35,62 +35,27 @@
</div>
<div class="panel-body">
<form method="GET">
<?php if (!$sendeds) { ?>
<p>Aucun SMS n'a été envoyé pour le moment.</p>
<?php } else { ?>
<div class="table-sendeds">
<table class="table table-bordered table-hover table-striped datatable" id="table-sendeds">
<thead>
<tr>
<th>De</th>
<th>À</th>
<th>Message</th>
<th>Date</th>
<th>Statut</th>
<?php if ($_SESSION['user']['admin']) { ?>
<th class="checkcolumn">&#10003;</th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php foreach ($sendeds as $sended) { ?>
<tr>
<td class="no-wrap"><?php $this->s($sended['phone_name'] ?? 'Inconnu'); ?></td>
<td class="no-wrap">
<?php if ($sended['contact'] ?? false) { ?>
<?php echo \controllers\internals\Tool::phone_link($sended['destination']) . ' (' . $sended['contact'] . ')'; ?>
<?php } else { ?>
<?php echo \controllers\internals\Tool::phone_link($sended['destination']); ?>
<?php } ?>
</td>
<td><?php $this->s($sended['text']); ?></td>
<td><?php $this->s($sended['at']); ?></td>
<?php if ($sended['status'] == 'unknown') { ?>
<td>Inconnu</td>
<?php } elseif ($sended['status'] == 'delivered') { ?>
<td>Délivré</td>
<?php } elseif ($sended['status'] == 'failed') { ?>
<td>Échoué</td>
<?php } ?>
<?php if ($_SESSION['user']['admin']) { ?>
<td><input name="ids[]" type="checkbox" value="<?php $this->s($sended['id']); ?>"></td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
<div class="table-sendeds">
<table class="table table-bordered table-hover table-striped datatable" id="table-sendeds">
<thead>
<tr>
<th>De</th>
<th>À</th>
<th>Message</th>
<th>Date</th>
<th>Statut</th>
<th class="checkcolumn">&#10003;</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<div>
<div class="text-right col-xs-12 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('Sended', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
<div>
<?php if ($_SESSION['user']['admin']) { ?>
<div class="text-right col-xs-12 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('Sended', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
</div>
</form>
</div>
@ -100,21 +65,64 @@
</div>
</div>
<script>
jQuery(document).ready(function ()
{
jQuery('.action-dropdown a').on('click', function (e)
{
e.preventDefault();
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
var url = jQuery(this).attr('href');
jQuery(destination).find('input:checked').each(function ()
{
url += '/' + jQuery(this).val();
});
window.location = url;
});
jQuery(document).ready(function ()
{
jQuery('.datatable').DataTable({
"pageLength": 25,
"bLengthChange": false,
"language": {
"url": HTTP_PWD + "/assets/js/datatables/french.json",
},
"columnDefs": [{
'targets': 'checkcolumn',
'orderable': false,
}],
});
"ajax": {
'url': '<?php echo \descartes\Router::url('Sended', 'list_json'); ?>',
'dataSrc': 'data',
},
"columns" : [
{data: 'phone_name', render: jQuery.fn.dataTable.render.text()},
{
data: 'destination',
render: function (data, type, row, meta) {
if (row.contact_name) {
return row.destination_formatted + ' (' + jQuery.fn.dataTable.render.text().display(row.contact_name) + ')';
}
return row.destination_formatted;
},
},
{data: 'text', render: jQuery.fn.dataTable.render.text()},
{data: 'at', render: jQuery.fn.dataTable.render.text()},
{
data: 'status',
render: function (data, type, row, meta) {
switch (data) {
case 'failed':
return 'Échec';
break;
case 'delivered':
return 'Délivré';
default:
return 'Inconnu';
}
},
},
{
data: 'id',
render: function (data, type, row, meta) {
return '<input name="ids[]" type="checkbox" value="' + data + '">';
},
},
],
"deferRender": true
});
});
</script>
<?php
$this->render('incs/footer');

View file

@ -35,38 +35,28 @@
</div>
<div class="panel-body">
<form method="GET">
<?php if (!$smsstops) { ?>
<p>Aucun SMS STOP n'a été reçu pour le moment.</p>
<?php } else { ?>
<div class="table-events">
<table class="table table-bordered table-hover table-striped datatable" id="table-smsstop">
<thead>
<tr>
<th>Numéro</th>
<div class="table-events">
<table class="table table-bordered table-hover table-striped datatable" id="table-smsstop">
<thead>
<tr>
<th>Numéro</th>
<?php if ($_SESSION['user']['admin']) { ?>
<th class="checkcolumn">&#10003;</th>
</tr>
</thead>
<tbody>
<?php foreach ($smsstops as $smsstop) { ?>
<tr>
<td><?php echo(\controllers\internals\Tool::phone_link($smsstop['number'])); ?></td>
<?php if ($_SESSION['user']['admin']) { ?>
<td><input name="ids[]" type="checkbox" value="<?php $this->s($smsstop['id']); ?>"></td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div>
<?php if ($_SESSION['user']['admin']) { ?>
<div class="text-right col-xs-12 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('SmsStop', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
<?php } ?>
</div>
<?php } ?>
<?php } ?>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div>
<?php if ($_SESSION['user']['admin']) { ?>
<div class="text-right col-xs-12 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('SmsStop', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
<?php } ?>
</div>
</form>
</div>
</div>
@ -76,20 +66,38 @@
</div>
</div>
<script>
jQuery(document).ready(function ()
{
jQuery('.action-dropdown a').on('click', function (e)
{
e.preventDefault();
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
var url = jQuery(this).attr('href');
jQuery(destination).find('input:checked').each(function ()
{
url += '/' + jQuery(this).val();
});
window.location = url;
});
});
jQuery(document).ready(function ()
{
jQuery('.datatable').DataTable({
"pageLength": 25,
"bLengthChange": false,
"language": {
"url": HTTP_PWD + "/assets/js/datatables/french.json",
},
"columnDefs": [{
'targets': 'checkcolumn',
'orderable': false,
}],
"ajax": {
'url': '<?php echo \descartes\Router::url('SmsStop', 'list_json'); ?>',
'dataSrc': 'data',
},
"columns" : [
{
data: 'number_formatted',
},
{
data: 'id',
render: function (data, type, row, meta) {
return '<input name="ids[]" type="checkbox" value="' + data + '">';
},
},
],
"deferRender": true
});
});
</script>
<?php
$this->render('incs/footer');

View file

@ -41,19 +41,11 @@
<tr>
<th>Email</th>
<th>Admin</th>
<th>Status</th>
<th>Statut</th>
<th class="checkcolumn">&#10003;</th>
</tr>
</thead>
<tbody>
<?php foreach ($users as $user) { ?>
<tr>
<td><?php $this->s($user['email']); ?></td>
<td><?php $this->s($user['admin']); ?></td>
<td><?php $this->s($user['status']); ?></td>
<td><input type="checkbox" value="<?php $this->s($user['id']); ?>" name="ids[]"></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
@ -78,20 +70,38 @@
</div>
</div>
<script>
jQuery(document).ready(function ()
{
jQuery('.action-dropdown a').on('click', function (e)
{
e.preventDefault();
var destination = jQuery(this).parents('.action-dropdown').attr('destination');
var url = jQuery(this).attr('href');
jQuery(destination).find('input:checked').each(function ()
{
url += '/' + jQuery(this).val();
});
window.location = url;
});
});
jQuery(document).ready(function ()
{
jQuery('.datatable').DataTable({
"pageLength": 25,
"bLengthChange": false,
"language": {
"url": HTTP_PWD + "/assets/js/datatables/french.json",
},
"columnDefs": [{
'targets': 'checkcolumn',
'orderable': false,
}],
"ajax": {
'url': '<?php echo \descartes\Router::url('User', 'list_json'); ?>',
'dataSrc': 'data',
},
"columns" : [
{data: 'email', render: jQuery.fn.dataTable.render.text()},
{data: 'admin', render: jQuery.fn.dataTable.render.text()},
{data: 'status', render: jQuery.fn.dataTable.render.text()},
{
data: 'id',
render: function (data, type, row, meta) {
return '<input name="ids[]" type="checkbox" value="' + data + '">';
},
},
],
"deferRender": true
});
});
</script>
<?php
$this->render('incs/footer');

View file

@ -33,41 +33,28 @@
</div>
<div class="panel-body">
<form method="GET">
<?php if (!$webhooks) { ?>
<p>Aucun webhook n'a été créé pour le moment.</p>
<?php } else { ?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped datatable" id="table-webhooks">
<thead>
<tr>
<th>Url</th>
<th>Type de webhook</th>
<th class="checkcolumn">&#10003;</th>
</tr>
</thead>
<tbody>
<?php foreach ($webhooks as $webhook) { ?>
<tr>
<td><?php $this->s($webhook['url']); ?></td>
<td><?php $this->s($webhook['type'] == 'send_sms' ? 'Envoi de SMS' : 'Reception de SMS'); ?></td>
<td><input type="checkbox" name="ids[]" value="<?php $this->s($webhook['id']); ?>"></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php } ?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped datatable" id="table-webhooks">
<thead>
<tr>
<th>Url</th>
<th>Type de webhook</th>
<th class="checkcolumn">&#10003;</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div>
<div class="col-xs-6 no-padding">
<a class="btn btn-success" href="<?php echo \descartes\Router::url('Webhook', 'add'); ?>"><span class="fa fa-plus"></span> Ajouter un webhook</a>
</div>
<?php if ($webhooks) { ?>
<div class="text-right col-xs-6 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default" type="submit" formaction="<?php echo \descartes\Router::url('Webhook', 'edit'); ?>"><span class="fa fa-edit"></span> Modifier</button>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('Webhook', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
<?php } ?>
<div class="text-right col-xs-6 no-padding">
<strong>Action pour la séléction :</strong>
<button class="btn btn-default" type="submit" formaction="<?php echo \descartes\Router::url('Webhook', 'edit'); ?>"><span class="fa fa-edit"></span> Modifier</button>
<button class="btn btn-default btn-confirm" type="submit" formaction="<?php echo \descartes\Router::url('Webhook', 'delete', ['csrf' => $_SESSION['csrf']]); ?>"><span class="fa fa-trash-o"></span> Supprimer</button>
</div>
</div>
</form>
</div>
@ -77,5 +64,50 @@
</div>
</div>
</div>
<script>
jQuery(document).ready(function ()
{
jQuery('.datatable').DataTable({
"pageLength": 25,
"bLengthChange": false,
"language": {
"url": HTTP_PWD + "/assets/js/datatables/french.json",
},
"columnDefs": [{
'targets': 'checkcolumn',
'orderable': false,
}],
"ajax": {
'url': '<?php echo \descartes\Router::url('Webhook', 'list_json'); ?>',
'dataSrc': 'data',
},
"columns" : [
{data: 'url', render: jQuery.fn.dataTable.render.text()},
{
data: 'type',
render: function (data, type, row, meta) {
switch (data) {
case 'send_sms':
return 'Envoi de SMS';
case 'receive_sms':
return 'Réception de SMS';
default:
return 'Inconnu';
}
},
},
{
data: 'id',
render: function (data, type, row, meta) {
return '<input name="ids[]" type="checkbox" value="' + data + '">';
},
},
],
"deferRender": true
});
});
</script>
<?php
$this->render('incs/footer');