From c57bbeace30343e0be6505801d0dde2ccfe7fbb6 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Thu, 7 Sep 2023 10:54:20 +0700 Subject: [PATCH] show user active --- CHANGELOG.md | 6 +++ system/controllers/autoload.php | 11 ++++ system/controllers/customers.php | 6 +-- system/controllers/dashboard.php | 65 ++++++++++++++---------- ui/ui/customers.tpl | 23 +++++---- ui/ui/dashboard.tpl | 4 +- ui/ui/sections/footer.tpl | 7 +++ ui/ui/sections/user-footer.tpl | 87 ++++++++++++++++++-------------- version.json | 2 +- 9 files changed, 129 insertions(+), 82 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b20d0e0..df4bf251 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ # CHANGELOG +## 2023.9.7 + +- Fix PPPOE Delete Customer +- Remove active Customer before deleting +- Show IP and Mac even if it not Hotspot + ## 2023.9.6 - Expired Pool diff --git a/system/controllers/autoload.php b/system/controllers/autoload.php index e3b782eb..79b10383 100644 --- a/system/controllers/autoload.php +++ b/system/controllers/autoload.php @@ -36,6 +36,17 @@ switch ($action) { $ui->display('autoload.tpl'); break; + case 'customer_is_active': + $d = ORM::for_table('tbl_user_recharges')->where('customer_id', $routes['2'])->findOne(); + if ($d) { + if ($d['status'] == 'on') { + die('on'); + } else { + die('off'); + } + } else { + die('off'); + } case 'customer_select2': $s = addslashes(_get('s')); diff --git a/system/controllers/customers.php b/system/controllers/customers.php index c6dbc358..1434a84b 100644 --- a/system/controllers/customers.php +++ b/system/controllers/customers.php @@ -12,9 +12,6 @@ $action = $routes['1']; $admin = Admin::_info(); $ui->assign('_admin', $admin); -use PEAR2\Net\RouterOS; - -require_once 'system/autoload/PEAR2/Autoload.php'; if ($admin['user_type'] != 'Admin' and $admin['user_type'] != 'Sales') { r2(U . "dashboard", 'e', $_L['Do_Not_Access']); @@ -34,7 +31,8 @@ switch ($action) { ->order_by_desc('id')->find_many(); } else { $paginator = Paginator::bootstrap('tbl_customers'); - $d = ORM::for_table('tbl_customers')->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many(); + $d = ORM::for_table('tbl_customers') + ->offset($paginator['startpoint'])->limit($paginator['limit'])->order_by_desc('id')->find_many(); } $ui->assign('search', htmlspecialchars($search)); diff --git a/system/controllers/dashboard.php b/system/controllers/dashboard.php index 320ac76e..471828c7 100644 --- a/system/controllers/dashboard.php +++ b/system/controllers/dashboard.php @@ -1,13 +1,14 @@ assign('_title', $_L['Dashboard']); $admin = Admin::_info(); $ui->assign('_admin', $admin); -if(!in_array($admin['user_type'],['Admin','Sales'])){ - r2(U."home",'e',$_L['Do_Not_Access']); +if (!in_array($admin['user_type'], ['Admin', 'Sales'])) { + r2(U . "home", 'e', $_L['Do_Not_Access']); } $fdate = date('Y-m-01'); @@ -17,59 +18,67 @@ $first_day_month = date('Y-m-01'); $mdate = date('Y-m-d'); $month_n = date('n'); -$iday = ORM::for_table('tbl_transactions')->where('recharged_on',$mdate)->sum('price'); -if($iday == ''){ +$iday = ORM::for_table('tbl_transactions')->where('recharged_on', $mdate)->sum('price'); +if ($iday == '') { $iday = '0.00'; } -$ui->assign('iday',$iday); +$ui->assign('iday', $iday); -$imonth = ORM::for_table('tbl_transactions')->where_gte('recharged_on',$first_day_month)->where_lte('recharged_on',$mdate)->sum('price'); -if($imonth == ''){ +$imonth = ORM::for_table('tbl_transactions')->where_gte('recharged_on', $first_day_month)->where_lte('recharged_on', $mdate)->sum('price'); +if ($imonth == '') { $imonth = '0.00'; } -$ui->assign('imonth',$imonth); +$ui->assign('imonth', $imonth); -$u_act = ORM::for_table('tbl_user_recharges')->where('status','on')->count(); -if($u_act == ''){ +$u_act = ORM::for_table('tbl_user_recharges')->where('status', 'on')->count(); +if ($u_act == '') { $u_act = '0'; } -$ui->assign('u_act',$u_act); +$ui->assign('u_act', $u_act); $u_all = ORM::for_table('tbl_user_recharges')->count(); -if($u_all == ''){ +if ($u_all == '') { $u_all = '0'; } -$ui->assign('u_all',$u_all); +$ui->assign('u_all', $u_all); + + +$c_all = ORM::for_table('tbl_customers')->count(); +if ($u_all == '') { + $c_all = '0'; +} +$ui->assign('c_all', $u_all); + //user expire -$expire = ORM::for_table('tbl_user_recharges')->where('expiration',$mdate)->order_by_desc('id')->find_many(); -$ui->assign('expire',$expire); +$expire = ORM::for_table('tbl_user_recharges')->where('expiration', $mdate)->order_by_desc('id')->find_many(); +$ui->assign('expire', $expire); //activity log $dlog = ORM::for_table('tbl_logs')->limit(5)->order_by_desc('id')->find_many(); -$ui->assign('dlog',$dlog); +$ui->assign('dlog', $dlog); $log = ORM::for_table('tbl_logs')->count(); -$ui->assign('log',$log); +$ui->assign('log', $log); // Count stock $tmp = $v = ORM::for_table('tbl_plans')->select('id')->select('name_plan')->find_many(); $plans = array(); -$stocks = array("used"=>0,"unused"=>0); +$stocks = array("used" => 0, "unused" => 0); $n = 0; -foreach($tmp as $plan){ +foreach ($tmp as $plan) { $plans[$n]['name_plan'] = $plan['name_plan']; $plans[$n]['unused'] = ORM::for_table('tbl_voucher') - ->where('id_plan',$plan['id']) - ->where('status',0)->count();; + ->where('id_plan', $plan['id']) + ->where('status', 0)->count();; $stocks["unused"] += $plans[$n]['unused']; $plans[$n]['used'] = ORM::for_table('tbl_voucher') - ->where('id_plan',$plan['id']) - ->where('status',1)->count();; + ->where('id_plan', $plan['id']) + ->where('status', 1)->count();; $stocks["used"] += $plans[$n]['used']; $n++; } -$ui->assign('stocks',$stocks); -$ui->assign('plans',$plans); +$ui->assign('stocks', $stocks); +$ui->assign('plans', $plans); run_hook('view_dashboard'); #HOOK -$ui->display('dashboard.tpl'); \ No newline at end of file +$ui->display('dashboard.tpl'); diff --git a/ui/ui/customers.tpl b/ui/ui/customers.tpl index 38cd5d4e..35b44d4d 100644 --- a/ui/ui/customers.tpl +++ b/ui/ui/customers.tpl @@ -24,34 +24,37 @@  
- +
- + - + {foreach $d as $ds} - - - + + - + {/foreach} diff --git a/ui/ui/dashboard.tpl b/ui/ui/dashboard.tpl index 873d4ee0..e89078a1 100644 --- a/ui/ui/dashboard.tpl +++ b/ui/ui/dashboard.tpl @@ -33,7 +33,7 @@
-

{$u_act}

+

{$u_act}/{$u_all}

{$_L['Users_Active']}

@@ -47,7 +47,7 @@
-

{$u_all}

+

{$c_all}

{$_L['Total_Users']}

diff --git a/ui/ui/sections/footer.tpl b/ui/ui/sections/footer.tpl index daca93fe..88a9020d 100644 --- a/ui/ui/sections/footer.tpl +++ b/ui/ui/sections/footer.tpl @@ -22,6 +22,13 @@ $(document).ready(function() { $('.select2').select2({theme: "bootstrap"}); }); + +var listAtts = document.querySelectorAll(`[api-get-text]`); +listAtts.forEach(function(el) { + $.get(el.getAttribute('api-get-text'), function(data) { + el.innerHTML = data; + }); +}); {/literal} diff --git a/ui/ui/sections/user-footer.tpl b/ui/ui/sections/user-footer.tpl index 80701398..7c690beb 100644 --- a/ui/ui/sections/user-footer.tpl +++ b/ui/ui/sections/user-footer.tpl @@ -1,45 +1,58 @@ -
- {if isset($_c['CompanyFooter'])} -
- {$_c['CompanyFooter']} -
- {else} - - {/if} -
+
+ {if isset($_c['CompanyFooter'])} +
+ {$_c['CompanyFooter']} +
+ {else} + + {/if} +
- - - + + + - - + + -{if isset($xfooter)} - {$xfooter} -{/if} + {if isset($xfooter)} + {$xfooter} + {/if} -{if $_c['tawkto'] != ''} - - - -{/if} + {if $_c['tawkto'] != ''} + + + + {/if} - + {literal} + + {/literal} + + \ No newline at end of file diff --git a/version.json b/version.json index 24be7054..1b9e5272 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "2023.9.6" + "version": "2023.9.7" } \ No newline at end of file
{$_L['Manage']} {$_L['Username']} {$_L['Full_Name']} {Lang::T('Balance')} {$_L['Phone_Number']} {$_L['Email']} {$_L['Created_On']}{$_L['Recharge']}{$_L['Manage']}
- {Lang::T('View')} + + - {$ds['username']}{$ds['fullname']}{$ds['username']}{$ds['fullname']} {Lang::moneyFormat($ds['balance'])} {$ds['phonenumber']} {$ds['email']} {Lang::dateTimeFormat($ds['created_at'])}{$_L['Recharge']} +   {Lang::T('View')}   + {$_L['Recharge']} +