From 13aabeea8e8cc77dd91dddd02d142ae0829114c6 Mon Sep 17 00:00:00 2001 From: Focuslinkstech <45756999+Focuslinkstech@users.noreply.github.com> Date: Mon, 9 Sep 2024 20:45:13 +0100 Subject: [PATCH 1/5] add styles to some tables --- ui/ui/hotspot.tpl | 107 ++++++++++++++++++++++++---------------------- ui/ui/plan.tpl | 92 ++++++++++++++++++++------------------- ui/ui/pppoe.tpl | 99 +++++++++++++++++++++--------------------- ui/ui/voucher.tpl | 84 +++++++++++++++++++----------------- 4 files changed, 197 insertions(+), 185 deletions(-) diff --git a/ui/ui/hotspot.tpl b/ui/ui/hotspot.tpl index d083d0b8..3df4710d 100644 --- a/ui/ui/hotspot.tpl +++ b/ui/ui/hotspot.tpl @@ -35,8 +35,8 @@ <select class="form-control" id="type2" name="type2"> <option value="">{Lang::T('Type')}</option> {foreach $type2s as $t} - <option value="{$t}" {if $type2 eq $t }selected{/if}>{Lang::T($t)} - </option> + <option value="{$t}" {if $type2 eq $t }selected{/if}>{Lang::T($t)} + </option> {/foreach} </select> </div> @@ -44,9 +44,9 @@ <select class="form-control" id="bandwidth" name="bandwidth"> <option value="">Bandwidth</option> {foreach $bws as $b} - <option value="{$b['id']}" {if $bandwidth eq $b['id'] }selected{/if}> - {$b['name_bw']} - </option> + <option value="{$b['id']}" {if $bandwidth eq $b['id'] }selected{/if}> + {$b['name_bw']} + </option> {/foreach} </select> </div> @@ -54,8 +54,8 @@ <select class="form-control" id="type3" name="type3"> <option value="">{Lang::T('Category')}</option> {foreach $type3s as $t} - <option value="{$t}" {if $type3 eq $t }selected{/if}>{$t} - </option> + <option value="{$t}" {if $type3 eq $t }selected{/if}>{$t} + </option> {/foreach} </select> </div> @@ -63,8 +63,8 @@ <select class="form-control" id="valid" name="valid"> <option value="">{Lang::T('Validity')}</option> {foreach $valids as $v} - <option value="{$v}" {if $valid eq $v }selected{/if}>{$v} - </option> + <option value="{$v}" {if $valid eq $v }selected{/if}>{$v} + </option> {/foreach} </select> </div> @@ -72,7 +72,7 @@ <select class="form-control" id="router" name="router"> <option value="">{Lang::T('Location')}</option> {foreach $routers as $r} - <option value="{$r}" {if $router eq $r }selected{/if}>{$r}</option> + <option value="{$r}" {if $router eq $r }selected{/if}>{$r}</option> {/foreach} <option value="radius" {if $router eq 'radius' }selected{/if}>Radius</option> </select> @@ -81,7 +81,7 @@ <select class="form-control" id="device" name="device"> <option value="">{Lang::T('Device')}</option> {foreach $devices as $r} - <option value="{$r}" {if $device eq $r }selected{/if}>{$r}</option> + <option value="{$r}" {if $device eq $r }selected{/if}>{$r}</option> {/foreach} </select> </div> @@ -104,38 +104,40 @@ </div> </form> <div class="table-responsive"> - <table class="table table-bordered table-striped table-condensed"> - <thead> - <tr> - <th></th> - <th colspan="5" class="text-center">{Lang::T('Internet Package')}</th> - <th colspan="2" class="text-center" style="background-color: rgb(246, 244, 244);">{Lang::T('Limit')}</th> - <th colspan="2"></th> - <th colspan="2" class="text-center" style="background-color: rgb(243, 241, 172);"> - {Lang::T('Expired')}</th> - <th colspan="3"></th> - </tr> - <tr> - <th>{Lang::T('Name')}</th> - <th>{Lang::T('Type')}</th> - <th><a href="{$_url}bandwidth/list">Bandwidth</a></th> - <th>{Lang::T('Category')}</th> - <th>{Lang::T('Price')}</th> - <th>{Lang::T('Validity')}</th> - <th style="background-color: rgb(246, 244, 244);">{Lang::T('Time')}</th> - <th style="background-color: rgb(246, 244, 244);">{Lang::T('Data')}</th> - <th><a href="{$_url}routers/list">{Lang::T('Location')}</a></th> - <th>{Lang::T('Device')}</th> - <th style="background-color: rgb(243, 241, 172);">{Lang::T('Internet Package')}</th> - <th style="background-color: rgb(243, 241, 172);">{Lang::T('Date')}</th> - <th>{Lang::T('ID')}</th> - <th>{Lang::T('Manage')}</th> - </tr> - </thead> - <tbody> - {foreach $d as $ds} + <div style="margin-left: 5px; margin-right: 5px;"> + <table class="table table-bordered table-striped table-condensed"> + <thead> + <tr> + <th></th> + <th colspan="5" class="text-center">{Lang::T('Internet Package')}</th> + <th colspan="2" class="text-center" style="background-color: rgb(246, 244, 244);"> + {Lang::T('Limit')}</th> + <th colspan="2"></th> + <th colspan="2" class="text-center" style="background-color: rgb(243, 241, 172);"> + {Lang::T('Expired')}</th> + <th colspan="3"></th> + </tr> + <tr> + <th>{Lang::T('Name')}</th> + <th>{Lang::T('Type')}</th> + <th><a href="{$_url}bandwidth/list">Bandwidth</a></th> + <th>{Lang::T('Category')}</th> + <th>{Lang::T('Price')}</th> + <th>{Lang::T('Validity')}</th> + <th style="background-color: rgb(246, 244, 244);">{Lang::T('Time')}</th> + <th style="background-color: rgb(246, 244, 244);">{Lang::T('Data')}</th> + <th><a href="{$_url}routers/list">{Lang::T('Location')}</a></th> + <th>{Lang::T('Device')}</th> + <th style="background-color: rgb(243, 241, 172);">{Lang::T('Internet Package')}</th> + <th style="background-color: rgb(243, 241, 172);">{Lang::T('Date')}</th> + <th>{Lang::T('ID')}</th> + <th>{Lang::T('Manage')}</th> + </tr> + </thead> + <tbody> + {foreach $d as $ds} <tr {if $ds['enabled'] !=1}class="danger" title="disabled" {elseif $ds['prepaid'] !='yes' - }class="warning" title="Postpaid" {/if}> + }class="warning" title="Postpaid" {/if}> <td class="headcol">{$ds['name_plan']}</td> <td>{if $ds['prepaid'] == no}<b>Postpaid</b>{else}Prepaid{/if} {$ds['plan_type']}</td> <td>{$ds['name_bw']}</td> @@ -146,11 +148,11 @@ <td>{$ds['data_limit']} {$ds['data_unit']}</td> <td> {if $ds['is_radius']} - <span class="label label-primary">RADIUS</span> + <span class="label label-primary">RADIUS</span> {else} - {if $ds['routers']!=''} - <a href="{$_url}routers/edit/0&name={$ds['routers']}">{$ds['routers']}</a> - {/if} + {if $ds['routers']!=''} + <a href="{$_url}routers/edit/0&name={$ds['routers']}">{$ds['routers']}</a> + {/if} {/if} </td> <td>{$ds['device']}</td> @@ -163,13 +165,14 @@ <a href="{$_url}services/edit/{$ds['id']}" class="btn btn-info btn-xs">{Lang::T('Edit')}</a> <a href="{$_url}services/delete/{$ds['id']}" id="{$ds['id']}" - onclick="return confirm('{Lang::T('Delete')}?')" class="btn btn-danger btn-xs"><i - class="glyphicon glyphicon-trash"></i></a> + onclick="return confirm('{Lang::T('Delete')}?')" + class="btn btn-danger btn-xs"><i class="glyphicon glyphicon-trash"></i></a> </td> </tr> - {/foreach} - </tbody> - </table> + {/foreach} + </tbody> + </table> + </div> </div> <div class="panel-footer"> {include file="pagination.tpl"} @@ -182,4 +185,4 @@ </div> </div> -{include file="sections/footer.tpl"} +{include file="sections/footer.tpl"} \ No newline at end of file diff --git a/ui/ui/plan.tpl b/ui/ui/plan.tpl index 4cf71280..3cca5861 100644 --- a/ui/ui/plan.tpl +++ b/ui/ui/plan.tpl @@ -5,19 +5,19 @@ <div class="panel panel-hovered mb20 panel-primary"> <div class="panel-heading"> {if in_array($_admin['user_type'],['SuperAdmin','Admin'])} - <div class="btn-group pull-right"> - <a class="btn btn-primary btn-xs" title="save" href="{$_url}plan/sync" - onclick="return confirm('This will sync/send Caustomer active plan to Mikrotik?')"><span - class="glyphicon glyphicon-refresh" aria-hidden="true"></span> sync</a> - </div> - {* <div class="btn-group pull-right"> - <a class="btn btn-info btn-xs" title="save" href="{$_url}plan/csv{$append_url}" - onclick="return confirm('This will export to CSV?')"><span class="glyphicon glyphicon-download" - aria-hidden="true"></span> CSV</a> - </div> *} + <div class="btn-group pull-right"> + <a class="btn btn-primary btn-xs" title="save" href="{$_url}plan/sync" + onclick="return confirm('This will sync/send Caustomer active plan to Mikrotik?')"><span + class="glyphicon glyphicon-refresh" aria-hidden="true"></span> sync</a> + </div> + {* <div class="btn-group pull-right"> + <a class="btn btn-info btn-xs" title="save" href="{$_url}plan/csv{$append_url}" + onclick="return confirm('This will export to CSV?')"><span class="glyphicon glyphicon-download" + aria-hidden="true"></span> CSV</a> + </div> *} {/if} -{Lang::T('Active Customers')} + {Lang::T('Active Customers')} </div> <form id="site-search" method="post" action="{$_url}plan/list/"> <div class="panel-body"> @@ -36,8 +36,8 @@ <select class="form-control" id="router" name="router"> <option value="">{Lang::T('Location')}</option> {foreach $routers as $r} - <option value="{$r}" {if $router eq $r }selected{/if}>{$r} - </option> + <option value="{$r}" {if $router eq $r }selected{/if}>{$r} + </option> {/foreach} </select> </div> @@ -45,8 +45,8 @@ <select class="form-control" id="plan" name="plan"> <option value="">{Lang::T('Plan Name')}</option> {foreach $plans as $p} - <option value="{$p['id']}" {if $plan eq $p['id'] }selected{/if}>{$p['name_plan']} - </option> + <option value="{$p['id']}" {if $plan eq $p['id'] }selected{/if}>{$p['name_plan']} + </option> {/foreach} </select> </div> @@ -70,33 +70,34 @@ </div> </form> <div class="table-responsive"> - <table id="datatable" class="table table-bordered table-striped table-condensed"> - <thead> - <tr> - <th>{Lang::T('Username')}</th> - <th>{Lang::T('Plan Name')}</th> - <th>{Lang::T('Type')}</th> - <th>{Lang::T('Created On')}</th> - <th>{Lang::T('Expires On')}</th> - <th>{Lang::T('Method')}</th> - <th><a href="{$_url}routers/list">{Lang::T('Location')}</a></th> - <th>{Lang::T('Manage')}</th> - </tr> - </thead> - <tbody> - {foreach $d as $ds} - <tr {if $ds['status']=='off'}class="danger" {/if}> + <div style="margin-left: 5px; margin-right: 5px;"> + <table id="datatable" class="table table-bordered table-striped table-condensed"> + <thead> + <tr> + <th>{Lang::T('Username')}</th> + <th>{Lang::T('Plan Name')}</th> + <th>{Lang::T('Type')}</th> + <th>{Lang::T('Created On')}</th> + <th>{Lang::T('Expires On')}</th> + <th>{Lang::T('Method')}</th> + <th><a href="{$_url}routers/list">{Lang::T('Location')}</a></th> + <th>{Lang::T('Manage')}</th> + </tr> + </thead> + <tbody> + {foreach $d as $ds} + <tr {if $ds['status']=='off' }class="danger" {/if}> <td> {if $ds['customer_id'] == '0'} - <a href="{$_url}plan/voucher/&search={$ds['username']}">{$ds['username']}</a> + <a href="{$_url}plan/voucher/&search={$ds['username']}">{$ds['username']}</a> {else} - <a href="{$_url}customers/viewu/{$ds['username']}">{$ds['username']}</a> + <a href="{$_url}customers/viewu/{$ds['username']}">{$ds['username']}</a> {/if} </td> {if $ds['type'] == 'Hotspot'} - <td><a href="{$_url}services/edit/{$ds['plan_id']}">{$ds['namebp']}</a></td> + <td><a href="{$_url}services/edit/{$ds['plan_id']}">{$ds['namebp']}</a></td> {else} - <td><a href="{$_url}services/pppoe-edit/{$ds['plan_id']}">{$ds['namebp']}</a></td> + <td><a href="{$_url}services/pppoe-edit/{$ds['plan_id']}">{$ds['namebp']}</a></td> {/if} <td>{$ds['type']}</td> <td>{Lang::dateAndTimeFormat($ds['recharged_on'],$ds['recharged_time'])}</td> @@ -107,19 +108,20 @@ <a href="{$_url}plan/edit/{$ds['id']}" class="btn btn-warning btn-xs" style="color: black;">{Lang::T('Edit')}</a> {if in_array($_admin['user_type'],['SuperAdmin','Admin'])} - <a href="{$_url}plan/delete/{$ds['id']}" id="{$ds['id']}" - onclick="return confirm('{Lang::T('Delete')}?')" class="btn btn-danger btn-xs"><i - class="glyphicon glyphicon-trash"></i></a> + <a href="{$_url}plan/delete/{$ds['id']}" id="{$ds['id']}" + onclick="return confirm('{Lang::T('Delete')}?')" + class="btn btn-danger btn-xs"><i class="glyphicon glyphicon-trash"></i></a> {/if} {if $ds['status']=='off' && $_c['extend_expired']} - <a href="javascript:extend('{$ds['id']}')" - class="btn btn-info btn-xs">{Lang::T('Extend')}</a> + <a href="javascript:extend('{$ds['id']}')" + class="btn btn-info btn-xs">{Lang::T('Extend')}</a> {/if} </td> </tr> - {/foreach} - </tbody> - </table> + {/foreach} + </tbody> + </table> + </div> </div> {include file="pagination.tpl"} </div> @@ -131,10 +133,10 @@ var res = prompt("Extend for many days?", "3"); if (res) { if (confirm("Extend for " + res + " days?")) { - window.location.href = "{$_url}plan/extend/"+idP+"/"+res+"&stoken={App::getToken()}"; + window.location.href = "{$_url}plan/extend/" + idP + "/" + res + "&stoken={App::getToken()}"; } } } </script> -{include file="sections/footer.tpl"} +{include file="sections/footer.tpl"} \ No newline at end of file diff --git a/ui/ui/pppoe.tpl b/ui/ui/pppoe.tpl index 3c17d6b1..9dfc8711 100644 --- a/ui/ui/pppoe.tpl +++ b/ui/ui/pppoe.tpl @@ -35,8 +35,8 @@ <select class="form-control" id="type2" name="type2"> <option value="">{Lang::T('Type')}</option> {foreach $type2s as $t} - <option value="{$t}" {if $type2 eq $t }selected{/if}>{Lang::T($t)} - </option> + <option value="{$t}" {if $type2 eq $t }selected{/if}>{Lang::T($t)} + </option> {/foreach} </select> </div> @@ -44,9 +44,9 @@ <select class="form-control" id="bandwidth" name="bandwidth"> <option value="">Bandwidth</option> {foreach $bws as $b} - <option value="{$b['id']}" {if $bandwidth eq $b['id'] }selected{/if}> - {$b['name_bw']} - </option> + <option value="{$b['id']}" {if $bandwidth eq $b['id'] }selected{/if}> + {$b['name_bw']} + </option> {/foreach} </select> </div> @@ -54,8 +54,8 @@ <select class="form-control" id="type3" name="type3"> <option value="">{Lang::T('Category')}</option> {foreach $type3s as $t} - <option value="{$t}" {if $type3 eq $t }selected{/if}>{$t} - </option> + <option value="{$t}" {if $type3 eq $t }selected{/if}>{$t} + </option> {/foreach} </select> </div> @@ -63,8 +63,8 @@ <select class="form-control" id="valid" name="valid"> <option value="">{Lang::T('Validity')}</option> {foreach $valids as $v} - <option value="{$v}" {if $valid eq $v }selected{/if}>{$v} - </option> + <option value="{$v}" {if $valid eq $v }selected{/if}>{$v} + </option> {/foreach} </select> </div> @@ -72,7 +72,7 @@ <select class="form-control" id="router" name="router"> <option value="">{Lang::T('Location')}</option> {foreach $routers as $r} - <option value="{$r}" {if $router eq $r }selected{/if}>{$r}</option> + <option value="{$r}" {if $router eq $r }selected{/if}>{$r}</option> {/foreach} <option value="radius" {if $router eq 'radius' }selected{/if}>Radius</option> </select> @@ -81,7 +81,7 @@ <select class="form-control" id="device" name="device"> <option value="">{Lang::T('Device')}</option> {foreach $devices as $r} - <option value="{$r}" {if $device eq $r }selected{/if}>{$r}</option> + <option value="{$r}" {if $device eq $r }selected{/if}>{$r}</option> {/foreach} </select> </div> @@ -104,36 +104,38 @@ </div> </form> <div class="table-responsive"> - <table class="table table-bordered table-striped table-condensed"> - <thead> - <tr> - <th></th> - <th colspan="4" class="text-center">{Lang::T('Internet Plan')}</th> - <th></th> - <th colspan="2" class="text-center" style="background-color: rgb(243, 241, 172);"> - {Lang::T('Expired')}</th> - <th colspan="4"></th> - </tr> - <tr> - <th>{Lang::T('Name')}</th> - <th>{Lang::T('Type')}</th> - <th><a href="{$_url}bandwidth/list">{Lang::T('Bandwidth')}</a></th> - <th>{Lang::T('Price')}</th> - <th>{Lang::T('Validity')}</th> - <th><a href="{$_url}pool/list">{Lang::T('IP Pool')}</a></th> - <th style="background-color: rgb(243, 241, 172);">{Lang::T('Internet Plan')}</th> - <th style="background-color: rgb(243, 241, 172);">{Lang::T('Date')}</th> - <th><a href="{$_url}routers/list">{Lang::T('Location')}</a></th> - <th>{Lang::T('Device')}</th> - <th>{Lang::T('Manage')}</th> - <th>ID</th> - </tr> - </thead> - <tbody> - {foreach $d as $ds} - <tr {if $ds['enabled'] != 1}class="danger" title="disabled" {/if}> + <div style="margin-left: 5px; margin-right: 5px;"> + <table class="table table-bordered table-striped table-condensed"> + <thead> + <tr> + <th></th> + <th colspan="4" class="text-center">{Lang::T('Internet Plan')}</th> + <th></th> + <th colspan="2" class="text-center" style="background-color: rgb(243, 241, 172);"> + {Lang::T('Expired')}</th> + <th colspan="4"></th> + </tr> + <tr> + <th>{Lang::T('Name')}</th> + <th>{Lang::T('Type')}</th> + <th><a href="{$_url}bandwidth/list">{Lang::T('Bandwidth')}</a></th> + <th>{Lang::T('Price')}</th> + <th>{Lang::T('Validity')}</th> + <th><a href="{$_url}pool/list">{Lang::T('IP Pool')}</a></th> + <th style="background-color: rgb(243, 241, 172);">{Lang::T('Internet Plan')}</th> + <th style="background-color: rgb(243, 241, 172);">{Lang::T('Date')}</th> + <th><a href="{$_url}routers/list">{Lang::T('Location')}</a></th> + <th>{Lang::T('Device')}</th> + <th>{Lang::T('Manage')}</th> + <th>ID</th> + </tr> + </thead> + <tbody> + {foreach $d as $ds} + <tr {if $ds['enabled'] !=1}class="danger" title="disabled" {/if}> <td>{$ds['name_plan']}</td> - <td>{$ds['plan_type']} {if $ds['prepaid'] != 'yes'}<b>{Lang::T('Postpaid')}</b>{else}{Lang::T('Prepaid')}{/if}</td> + <td>{$ds['plan_type']} {if $ds['prepaid'] != + 'yes'}<b>{Lang::T('Postpaid')}</b>{else}{Lang::T('Prepaid')}{/if}</td> <td>{$ds['name_bw']}</td> <td>{Lang::moneyFormat($ds['price'])}</td> <td>{$ds['validity']} {$ds['validity_unit']}</td> @@ -144,11 +146,11 @@ <td>{if $ds['prepaid'] == no}{$ds['expired_date']}{/if}</td> <td> {if $ds['is_radius']} - <span class="label label-primary">RADIUS</span> + <span class="label label-primary">RADIUS</span> {else} - {if $ds['routers']!=''} - <a href="{$_url}routers/edit/0&name={$ds['routers']}">{$ds['routers']}</a> - {/if} + {if $ds['routers']!=''} + <a href="{$_url}routers/edit/0&name={$ds['routers']}">{$ds['routers']}</a> + {/if} {/if} </td> <td>{$ds['device']}</td> @@ -161,9 +163,10 @@ </td> <td>{$ds['id']}</td> </tr> - {/foreach} - </tbody> - </table> + {/foreach} + </tbody> + </table> + </div> </div> <div class="panel-footer"> {include file="pagination.tpl"} @@ -176,4 +179,4 @@ </div> </div> -{include file="sections/footer.tpl"} +{include file="sections/footer.tpl"} \ No newline at end of file diff --git a/ui/ui/voucher.tpl b/ui/ui/voucher.tpl index 6f357b48..abf652f0 100644 --- a/ui/ui/voucher.tpl +++ b/ui/ui/voucher.tpl @@ -17,11 +17,12 @@ <div class="panel panel-hovered mb20 panel-primary"> <div class="panel-heading"> {if in_array($_admin['user_type'],['SuperAdmin','Admin'])} - <div class="btn-group pull-right"> - <a class="btn btn-danger btn-xs" title="Remove used Voucher" href="{$_url}plan/remove-voucher" - onclick="return confirm('Delete all used voucher code more than 3 months?')"><span class="glyphicon glyphicon-trash" - aria-hidden="true"></span> {Lang::T('Delete')} > {Lang::T('3 Months')}</a> - </div> + <div class="btn-group pull-right"> + <a class="btn btn-danger btn-xs" title="Remove used Voucher" href="{$_url}plan/remove-voucher" + onclick="return confirm('Delete all used voucher code more than 3 months?')"><span + class="glyphicon glyphicon-trash" aria-hidden="true"></span> {Lang::T('Delete')} > {Lang::T('3 + Months')}</a> + </div> {/if} </div> @@ -41,8 +42,8 @@ <select class="form-control" id="router" name="router"> <option value="">{Lang::T('Location')}</option> {foreach $routers as $r} - <option value="{$r}" {if $router eq $r }selected{/if}>{$r} - </option> + <option value="{$r}" {if $router eq $r }selected{/if}>{$r} + </option> {/foreach} </select> </div> @@ -50,7 +51,7 @@ <select class="form-control" id="plan" name="plan"> <option value="">{Lang::T('Plan Name')}</option> {foreach $plans as $p} - <option value="{$p['id']}" {if $plan eq $p['id'] }selected{/if}>{$p['name_plan']}</option> + <option value="{$p['id']}" {if $plan eq $p['id'] }selected{/if}>{$p['name_plan']}</option> {/foreach} </select> </div> @@ -65,7 +66,7 @@ <select class="form-control" id="customer" name="customer"> <option value="">{Lang::T('Customer')}</option> {foreach $customers as $c} - <option value="{$c['user']}" {if $customer eq $c['user'] }selected{/if}>{$c['user']}</option> + <option value="{$c['user']}" {if $customer eq $c['user'] }selected{/if}>{$c['user']}</option> {/foreach} </select> </div> @@ -76,8 +77,8 @@ class="fa fa-search"></span></button> </div> <div class="btn-group" role="group"> - <a class="btn btn-warning btn-block" title="Clear Search Query" href="{$_url}plan/voucher/"><span - class="glyphicon glyphicon-remove-circle"></span></a> + <a class="btn btn-warning btn-block" title="Clear Search Query" + href="{$_url}plan/voucher/"><span class="glyphicon glyphicon-remove-circle"></span></a> </div> </div> </div> @@ -85,24 +86,25 @@ </form> </div> <div class="table-responsive"> - <table id="datatable" class="table table-bordered table-striped table-condensed"> - <thead> - <tr> - <th>ID</th> - <th>{Lang::T('Type')}</th> - <th>{Lang::T('Routers')}</th> - <th>{Lang::T('Plan Name')}</th> - <th>{Lang::T('Code Voucher')}</th> - <th>{Lang::T('Status Voucher')}</th> - <th>{Lang::T('Customer')}</th> - <th>{Lang::T('Used Date')}</th> - <th>{Lang::T('Generated By')}</th> - <th>{Lang::T('Manage')}</th> - </tr> - </thead> - <tbody> - {foreach $d as $ds} - <tr {if $ds['status'] eq '1'}class="danger" {/if}> + <div style="margin-left: 5px; margin-right: 5px;"> + <table id="datatable" class="table table-bordered table-striped table-condensed"> + <thead> + <tr> + <th>ID</th> + <th>{Lang::T('Type')}</th> + <th>{Lang::T('Routers')}</th> + <th>{Lang::T('Plan Name')}</th> + <th>{Lang::T('Code Voucher')}</th> + <th>{Lang::T('Status Voucher')}</th> + <th>{Lang::T('Customer')}</th> + <th>{Lang::T('Used Date')}</th> + <th>{Lang::T('Generated By')}</th> + <th>{Lang::T('Manage')}</th> + </tr> + </thead> + <tbody> + {foreach $d as $ds} + <tr {if $ds['status'] eq '1' }class="danger" {/if}> <td>{$ds['id']}</td> <td>{$ds['type']}</td> <td>{$ds['routers']}</td> @@ -112,33 +114,35 @@ onmouseenter="this.style.backgroundColor = 'white';"> {$ds['code']}</td> <td>{if $ds['status'] eq '0'} <label class="btn-tag btn-tag-success"> Not Use - </label> {else} <label class="btn-tag btn-tag-danger">Used</label> + </label> {else} <label class="btn-tag btn-tag-danger">Used</label> {/if}</td> <td>{if $ds['user'] eq '0'} - {else}<a href="{$_url}customers/viewu/{$ds['user']}">{$ds['user']}</a> {/if}</td> <td>{if $ds['used_date']}{Lang::dateTimeFormat($ds['used_date'])}{/if}</td> <td>{if $ds['generated_by']} - <a href="{$_url}settings/users-view/{$ds['generated_by']}">{$admins[$ds['generated_by']]}</a> + <a + href="{$_url}settings/users-view/{$ds['generated_by']}">{$admins[$ds['generated_by']]}</a> {else} - {/if} </td> <td> {if $ds['status'] neq '1'} - <a href="{$_url}plan/voucher-view/{$ds['id']}" id="{$ds['id']}" style="margin: 0px;" - class="btn btn-success btn-xs"> {Lang::T('View')} </a> + <a href="{$_url}plan/voucher-view/{$ds['id']}" id="{$ds['id']}" style="margin: 0px;" + class="btn btn-success btn-xs"> {Lang::T('View')} </a> {/if} {if in_array($_admin['user_type'],['SuperAdmin','Admin'])} - <a href="{$_url}plan/voucher-delete/{$ds['id']}" id="{$ds['id']}" class="btn btn-danger btn-xs" - onclick="return confirm('{Lang::T('Delete')}?')"><i - class="glyphicon glyphicon-trash"></i></a> + <a href="{$_url}plan/voucher-delete/{$ds['id']}" id="{$ds['id']}" + class="btn btn-danger btn-xs" onclick="return confirm('{Lang::T('Delete')}?')"><i + class="glyphicon glyphicon-trash"></i></a> {/if} </td> </tr> - {/foreach} - </tbody> - </table> + {/foreach} + </tbody> + </table> + </div> </div> {include file="pagination.tpl"} </div> -{include file="sections/footer.tpl"} +{include file="sections/footer.tpl"} \ No newline at end of file From 723e99ebedc231e502707621ec169cd1da57aa57 Mon Sep 17 00:00:00 2001 From: Focuslinkstech <45756999+Focuslinkstech@users.noreply.github.com> Date: Wed, 11 Sep 2024 14:19:13 +0100 Subject: [PATCH 2/5] fix panel headers in css, add cron job monitor to check if cron is running, has run, or not setup --- system/controllers/dashboard.php | 6 +++ system/cron.php | 69 ++++++++++++++++++-------------- ui/ui/dashboard.tpl | 17 ++++++++ ui/ui/sections/header.tpl | 30 ++++++++++++-- 4 files changed, 87 insertions(+), 35 deletions(-) diff --git a/system/controllers/dashboard.php b/system/controllers/dashboard.php index 4d1c9849..9f1185b0 100644 --- a/system/controllers/dashboard.php +++ b/system/controllers/dashboard.php @@ -214,6 +214,12 @@ if ($config['router_check']) { $ui->assign('routeroffs', $routeroffs); } +$timestampFile = "$UPLOAD_PATH/cron_last_run.txt"; +if (file_exists($timestampFile)) { + $lastRunTime = file_get_contents($timestampFile); + $ui->assign('run_date', date('Y-m-d h:i:s A', $lastRunTime)); +} + // Assign the monthly sales data to Smarty $ui->assign('start_date', $start_date); $ui->assign('current_date', $current_date); diff --git a/system/cron.php b/system/cron.php index e4e6719c..81d9f423 100644 --- a/system/cron.php +++ b/system/cron.php @@ -1,6 +1,27 @@ <?php include "../init.php"; +$lockFile = "$CACHE_PATH/router_monitor.lock"; + +if (!is_dir($CACHE_PATH)) { + echo "Directory '$CACHE_PATH' does not exist. Exiting...\n"; + exit; +} + +$lock = fopen($lockFile, 'c'); + +if ($lock === false) { + echo "Failed to open lock file. Exiting...\n"; + exit; +} + +if (!flock($lock, LOCK_EX | LOCK_NB)) { + echo "Script is already running. Exiting...\n"; + fclose($lock); + exit; +} + + $isCli = true; if (php_sapi_name() !== 'cli') { $isCli = false; @@ -81,27 +102,7 @@ foreach ($d as $ds) { if ($config['router_check']) { - - $lockFile = $CACHE_PATH . '/router_monitor.lock'; - - if (!is_dir($CACHE_PATH)) { - echo "Directory '$CACHE_PATH' does not exist. Exiting...\n"; - exit; - } - - $lock = fopen($lockFile, 'c'); - - if ($lock === false) { - echo "Failed to open lock file. Exiting...\n"; - exit; - } - - if (!flock($lock, LOCK_EX | LOCK_NB)) { - echo "Script is already running. Exiting...\n"; - fclose($lock); - exit; - } - + echo "Checking router status...\n"; $routers = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many(); if (!$routers) { echo "No active routers found in the database.\n"; @@ -186,14 +187,20 @@ if ($config['router_check']) { Message::SendEmail($adminEmail, $subject, $message); sendTelegram($message); } - - if (defined('PHP_SAPI') && PHP_SAPI === 'cli') { - echo "Cronjob finished\n"; - } else { - echo "</pre>"; - } - - flock($lock, LOCK_UN); - fclose($lock); - unlink($lockFile); + echo "Router monitoring finished\n"; } + + +if (defined('PHP_SAPI') && PHP_SAPI === 'cli') { + echo "Cronjob finished\n"; +} else { + echo "</pre>"; +} + +flock($lock, LOCK_UN); +fclose($lock); +unlink($lockFile); + +$timestampFile = "$UPLOAD_PATH/cron_last_run.txt"; +file_put_contents($timestampFile, time()); + diff --git a/ui/ui/dashboard.tpl b/ui/ui/dashboard.tpl index eb6788da..7a998ba8 100644 --- a/ui/ui/dashboard.tpl +++ b/ui/ui/dashboard.tpl @@ -194,6 +194,23 @@ </div> </div> {/if} + {if $run_date} + {if $current_time - $run_time > 3600} + <div class="panel panel-warning panel-hovered mb20 activities"> + <div class="panel-heading"><i class="fa fa-clock-o"></i> {Lang::T('Cron has not run for over 1 hour. Please + check your setup.')}</div> + </div> + {else} + <div class="panel panel-success panel-hovered mb20 activities"> + <div class="panel-heading">{Lang::T('Cron Job last ran on')}: {$run_date}</div> + </div> + {/if} + {else} + <div class="panel panel-danger panel-hovered mb20 activities"> + <div class="panel-heading"><i class="fa fa-warning"></i> {Lang::T('Cron appear not been setup, please check + your cron setup.')}</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'])} diff --git a/ui/ui/sections/header.tpl b/ui/ui/sections/header.tpl index bba3dbce..34b7f1e9 100644 --- a/ui/ui/sections/header.tpl +++ b/ui/ui/sections/header.tpl @@ -148,12 +148,26 @@ color: inherit; background-color: transparent; border-color: transparent; + border-bottom-right-radius: 21px; + border-bottom-left-radius: 21px; } - .panel-primary>.panel-heading { - color: inherit; - background-color: transparent; - border-color: transparent; + .panel-success>.panel-heading { + border-bottom-right-radius: 21px; + border-bottom-left-radius: 21px; + } + + .panel-warning>.panel-heading { + border-bottom-right-radius: 21px; + border-bottom-left-radius: 21px; + } + + .panel-danger>.panel-heading { + color: #a94442; + background-color: #f2dede; + border-color: #ebccd1; + border-bottom-right-radius: 21px; + border-bottom-left-radius: 21px; } .panel-heading { @@ -656,6 +670,9 @@ } .toggle-container { + position: absolute; + top: 17px; + right: 15px; cursor: pointer; } @@ -666,6 +683,11 @@ } @media (max-width: 600px) { + .toggle-container { + top: 15px; + right: 60px; + } + .toggle-container .toggle-icon { font-size: 20px; color: rgb(100 116 139); From 05b681df47fb12f84725091f3831b0199a96a545 Mon Sep 17 00:00:00 2001 From: Focuslinkstech <45756999+Focuslinkstech@users.noreply.github.com> Date: Wed, 11 Sep 2024 14:38:54 +0100 Subject: [PATCH 3/5] change current_time to current_date --- ui/ui/dashboard.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/ui/dashboard.tpl b/ui/ui/dashboard.tpl index 7a998ba8..78955672 100644 --- a/ui/ui/dashboard.tpl +++ b/ui/ui/dashboard.tpl @@ -195,7 +195,7 @@ </div> {/if} {if $run_date} - {if $current_time - $run_time > 3600} + {if $current_date - $run_time > 3600} <div class="panel panel-warning panel-hovered mb20 activities"> <div class="panel-heading"><i class="fa fa-clock-o"></i> {Lang::T('Cron has not run for over 1 hour. Please check your setup.')}</div> From fe532a62386a5b588d65cb8fdd1b5d9097153fac Mon Sep 17 00:00:00 2001 From: Focuslinkstech <45756999+Focuslinkstech@users.noreply.github.com> Date: Wed, 11 Sep 2024 16:52:34 +0100 Subject: [PATCH 4/5] change the time calculation logic --- ui/ui/dashboard.tpl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/ui/dashboard.tpl b/ui/ui/dashboard.tpl index 78955672..f0432982 100644 --- a/ui/ui/dashboard.tpl +++ b/ui/ui/dashboard.tpl @@ -195,7 +195,9 @@ </div> {/if} {if $run_date} - {if $current_date - $run_time > 3600} + {assign var="current_time" value=$smarty.now} + {assign var="run_time" value=strtotime($run_date)} + {if $current_time - $run_time > 3600} <div class="panel panel-warning panel-hovered mb20 activities"> <div class="panel-heading"><i class="fa fa-clock-o"></i> {Lang::T('Cron has not run for over 1 hour. Please check your setup.')}</div> From 68de3a71b930f55c0713197c745263e088601b0b Mon Sep 17 00:00:00 2001 From: Focuslinkstech <45756999+Focuslinkstech@users.noreply.github.com> Date: Thu, 12 Sep 2024 11:39:45 +0100 Subject: [PATCH 5/5] if admin session time error, it logout admin out whether admin are online or not, once time reach it logout you out --- system/autoload/Admin.php | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/system/autoload/Admin.php b/system/autoload/Admin.php index 66052cda..18d016c6 100644 --- a/system/autoload/Admin.php +++ b/system/autoload/Admin.php @@ -13,25 +13,27 @@ class Admin { global $db_pass, $config; $enable_session_timeout = $config['enable_session_timeout']; - if ($enable_session_timeout) { - $timeout = 60; - if ($config['session_timeout_duration']) { - $timeout = intval($config['session_timeout_duration']); + $session_timeout_duration = $config['session_timeout_duration'] ? intval($config['session_timeout_duration'] * 60) : intval(60 * 60); // Convert minutes to seconds + + // Check if the session is active and valid + if (isset($_SESSION['aid']) && isset($_SESSION['aid_expiration'])) { + if ($_SESSION['aid_expiration'] > time()) { + if ($enable_session_timeout) { + $_SESSION['aid_expiration'] = time() + $session_timeout_duration; + } + return $_SESSION['aid']; + } + // Session expired, log out the user + elseif ($enable_session_timeout && $_SESSION['aid_expiration'] <= time()) { + self::removeCookie(); + session_destroy(); + _alert(Lang::T('Session has expired. Please log in again.'), 'danger', "admin"); + return 0; } - $session_timeout_duration = $timeout * 60; // Convert minutes to seconds } - if (isset($_SESSION['aid']) && isset($_SESSION['aid_expiration']) && $_SESSION['aid_expiration'] > time()) { - return $_SESSION['aid']; - } elseif ($enable_session_timeout && isset($_SESSION['aid']) && isset($_SESSION['aid_expiration']) && $_SESSION['aid_expiration'] <= time()) { - self::removeCookie(); - session_destroy(); - _alert(Lang::T('Session has expired. Please log in again.'), 'danger', "admin"); - return 0; - } - // Check if cookie is set and valid + // Check if the cookie is set and valid elseif (isset($_COOKIE['aid'])) { - // id.time.sha1 $tmp = explode('.', $_COOKIE['aid']); if (sha1($tmp[0] . '.' . $tmp[1] . '.' . $db_pass) == $tmp[2]) { if (time() - $tmp[1] < 86400 * 7) {