Show Offline routers in the dashboard

This commit is contained in:
Ibnu Maksum 2024-08-28 14:18:19 +07:00
parent 7963c2f388
commit 11ec4185e7
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
3 changed files with 76 additions and 45 deletions

View File

@ -209,6 +209,12 @@ if (file_exists($cacheMSfile) && time() - filemtime($cacheMSfile) < 43200) {
file_put_contents($cacheMSfile, json_encode($monthlySales));
}
if ($config['router_check']) {
$routeroffs = ORM::for_table('tbl_routers')->selects(['id', 'name', 'last_seen'])->where('status', 'Offline')->order_by_desc('name')->find_array();
print_r($routeroffs);
$ui->assign('routeroffs', $routeroffs);
}
// Assign the monthly sales data to Smarty
$ui->assign('start_date', $start_date);
$ui->assign('current_date', $current_date);

View File

@ -175,6 +175,25 @@
<div class="col-md-5">
{if $_c['router_check']}
<div class="panel panel-danger">
<div class="panel-heading text-bold">{Lang::T('Routers Offline')}</div>
<div class="table-responsive">
<table class="table table-condensed">
<tbody>
{foreach $routeroffs as $ros}
<tr>
<td><a href="{$_url}routers/edit/{$ros['id']}" class="text-bold text-red">{$ros['name']}</a></td>
<td data-toggle="tooltip" data-placement="top" class="text-red"
title="{Lang::dateTimeFormat($ros['last_seen'])}">{Lang::timeElapsed($ros['last_seen'])}
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
{/if}
{if $_c['hide_pg'] != 'yes'}
<div class="panel panel-success panel-hovered mb20 activities">
<div class="panel-heading">{Lang::T('Payment Gateway')}: {str_replace(',',', ',$_c['payment_gateway'])}

View File

@ -28,8 +28,8 @@
</form>
</div>
<div class="col-md-4">
<a href="{$_url}routers/add" class="btn btn-primary btn-block"><i
class="ion ion-android-add"> </i> {Lang::T('New Router')}</a>
<a href="{$_url}routers/add" class="btn btn-primary btn-block"><i class="ion ion-android-add">
</i> {Lang::T('New Router')}</a>
</div>&nbsp;
</div>
<div class="table-responsive">
@ -40,10 +40,10 @@
<th>{Lang::T('IP Address')}</th>
<th>{Lang::T('Username')}</th>
<th>{Lang::T('Description')}</th>
{if $config['router_check']}
{if $_c['router_check']}
<th>{Lang::T('Online Status')}</th>
{/if}
<th>{Lang::T('Last Seen')}</th>
{/if}
<th>{Lang::T('Status')}</th>
<th>{Lang::T('Manage')}</th>
<th>ID</th>
@ -67,13 +67,19 @@
onmouseleave="this.style.backgroundColor = 'black';"
onmouseenter="this.style.backgroundColor = 'white';">{$ds['username']}</td>
<td>{$ds['description']}</td>
{if $config['router_check']}
<td><span
class="label {if $ds['status'] == 'Online'}label-success {else}label-danger {/if}">{if
$ds['status'] == 'Online'}{Lang::T('Online')}{else}{Lang::T('Offline')}{/if}</span>
</td>
{if $_c['router_check']}
<td>
<span
class="label {if $ds['status'] == 'Online'}label-success {else}label-danger {/if}">
{if $ds['status'] == 'Online'}
{Lang::T('Online')}
{else}
{Lang::T('Offline')}
{/if}
</span>
</td>
<td>{$ds['last_seen']}</td>
{/if}
<td>{if $ds['enabled'] == 1}{Lang::T('Enabled')}{else}{Lang::T('Disabled')}{/if}</td>
<td>
<a href="{$_url}routers/edit/{$ds['id']}"