Add phone limits to list

This commit is contained in:
osaajani 2023-02-04 01:45:59 +01:00
parent fb58802240
commit 6353d5115b
2 changed files with 59 additions and 0 deletions

View File

@ -55,6 +55,9 @@ class Phone extends \descartes\Controller
foreach ($phones as &$phone)
{
$limits = $this->internal_phone->get_limits($phone['id']);
$phone['limits'] = $limits;
$adapter = $adapters[$phone['adapter']] ?? false;
if (!$adapter)

View File

@ -43,6 +43,7 @@
<th>Nom</th>
<th>Type de téléphone</th>
<th>Callbacks</th>
<th>Limites</th>
<th class="checkcolumn"><input type="checkbox" id="check-all"/></th>
</tr>
</thead>
@ -124,6 +125,61 @@ jQuery(document).ready(function ()
return html;
},
},
{
data: 'limits',
render: function (limits) {
if (!limits.length)
{
return 'Pas de limites.';
}
var html = '';
for (limit of limits)
{
switch (limit.startpoint)
{
case "today" :
var startpoint = 'Par jour';
break;
case "-24 hours" :
var startpoint = '24 heures glissantes';
break;
case "this week midnight" :
var startpoint = 'Cette semaine';
break;
case "-7 days" :
var startpoint = '7 jours glissants';
break;
case "this week midnight -1 week" :
var startpoint = 'Ces deux dernières semaines';
break;
case "-14 days" :
var startpoint = '14 jours glissants';
break;
case "this month midnight" :
var startpoint = 'Ce mois';
break;
case "-1 month" :
var startpoint = '1 mois glissant';
break;
case "-28 days" :
var startpoint = '28 jours glissants';
break;
case "-30 days" :
var startpoint = '30 jours glissants';
break;
case "-31 days" :
var startpoint = '31 jours glissants';
break;
default :
var startpoint = 'Inconnu'
}
html += '<div><span class="bold">' + jQuery.fn.dataTable.render.text().display(startpoint) + ' : </span>' + jQuery.fn.dataTable.render.text().display(limit.volume) + '</div>';
}
return html;
},
},
{
data: 'id',
render: function (data, type, row, meta) {