From 69ea0d0b7f4245fdbb2552569152d33a1ced4d39 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Wed, 15 Nov 2023 11:39:05 +0700 Subject: [PATCH] Customer Dashboard change --- system/autoload/User.php | 2 +- system/controllers/home.php | 8 +- ui/ui/user-dashboard.tpl | 158 +++++++++++++++++++----------------- 3 files changed, 90 insertions(+), 78 deletions(-) diff --git a/system/autoload/User.php b/system/autoload/User.php index 1520eb9f..85d9a73d 100644 --- a/system/autoload/User.php +++ b/system/autoload/User.php @@ -22,7 +22,7 @@ class User public static function _billing() { $id = $_SESSION['uid']; - $d = ORM::for_table('tbl_user_recharges')->where('customer_id', $id)->find_one(); + $d = ORM::for_table('tbl_user_recharges')->where('customer_id', $id)->find_many(); return $d; } } diff --git a/system/controllers/home.php b/system/controllers/home.php index cbe92eb6..434e797e 100644 --- a/system/controllers/home.php +++ b/system/controllers/home.php @@ -89,10 +89,10 @@ if (_post('send') == 'balance') { } //Client Page -$bill = User::_billing(); -$ui->assign('_bill', $bill); +$bills = User::_billing(); +$ui->assign('_bills', $bills); -if(isset($_GET['recharge']) && $_GET['recharge'] == 1){ +if(isset($_GET['recharge']) && !empty($_GET['recharge'])){ $router = ORM::for_table('tbl_routers')->where('name', $bill['routers'])->find_one(); if ($config['enable_balance'] == 'yes') { $plan = ORM::for_table('tbl_plans')->find_one($bill['plan_id']); @@ -104,7 +104,7 @@ if(isset($_GET['recharge']) && $_GET['recharge'] == 1){ }else{ r2(U . "order/buy/$router[id]/$bill[plan_id]", 'e', 'Order Plan'); } -}else if(isset($_GET['deactivate']) && $_GET['deactivate'] == 1){ +}else if(isset($_GET['deactivate']) && !empty($_GET['deactivate'])){ if ($bill) { $p = ORM::for_table('tbl_plans')->where('id', $bill['plan_id'])->find_one(); if($p['is_radius']){ diff --git a/ui/ui/user-dashboard.tpl b/ui/ui/user-dashboard.tpl index dc8b6fe1..8fceff5d 100644 --- a/ui/ui/user-dashboard.tpl +++ b/ui/ui/user-dashboard.tpl @@ -8,7 +8,7 @@

{Lang::T('Unpaid Order')}

- +
@@ -62,7 +62,8 @@

{$_L['Account_Information']}

-
{Lang::T('expired')}
+
@@ -88,84 +89,95 @@ {/if} - {if $_bill} +
{$_L['Username']} {$_user['username']}
+ {if $_bills} + {foreach $_bills as $_bill} {if $_bill['routers'] != 'radius'} - - {strtoupper(Lang::T('Location'))} - {$_bill['routers']} - +
+

{$_bill['routers']}

+
+ {else} +
+

{if $_c['radius_plan']==''}Radius Plan{else}{$_c['radius_plan']}{/if}

+
{/if} - - {$_L['Plan_Name']} - - {$_bill['namebp']} - {if $_bill['status'] == 'on'} - {Lang::T('Deactivate')} - {else} - {Lang::T('expired')} - {/if} - - - - {$_L['Created_On']} - - {if $_bill['time'] ne ''}{Lang::dateAndTimeFormat($_bill['recharged_on'],$_bill['recharged_time'])} - {/if}  - - - {$_L['Expires_On']} - - {if $_bill['time'] ne ''}{Lang::dateAndTimeFormat($_bill['expiration'],$_bill['time'])}{/if}  - {Lang::T('Recharge')} - - - {if $nux_ip} + - - - - {/if} - {if $nux_mac} - - - - - {/if} - {if $_bill['type'] == 'Hotspot' && $_bill['status'] == 'on' && $_bill['routers'] != 'radius'} - - - + - {/if} - {/if} -
{Lang::T('Current IP')}{$nux_ip}
{Lang::T('Current MAC')}{$nux_mac}
{Lang::T('Login Status')} - + {$_L['Plan_Name']} + {$_bill['namebp']} + {if $_bill['status'] == 'on'} + {Lang::T('Deactivate')} + {else} + {Lang::T('expired')} + {/if}
- {if $_c['disable_voucher'] == 'yes'} - + + {$_L['Created_On']} + + {if $_bill['time'] ne ''}{Lang::dateAndTimeFormat($_bill['recharged_on'],$_bill['recharged_time'])} + {/if}  + + + {$_L['Expires_On']} + + {if $_bill['time'] ne ''}{Lang::dateAndTimeFormat($_bill['expiration'],$_bill['time'])}{/if}  + {Lang::T('Recharge')} + + + {if $nux_ip} + + {Lang::T('Current IP')} + {$nux_ip} + + {/if} + {if $nux_mac} + + {Lang::T('Current MAC')} + {$nux_mac} + + {/if} + {if $_bill['type'] == 'Hotspot' && $_bill['status'] == 'on' && $_bill['routers'] != 'radius'} + + {Lang::T('Login Status')} + + + + + {/if} + + {/foreach} {/if} - {if $_bill['type'] == 'Hotspot' && $_bill['status'] == 'on'} - + {if $_c['disable_voucher'] == 'yes'} + + {/if} + {if $_bills} + {foreach $_bills as $_bill} + {if $_bill['type'] == 'Hotspot' && $_bill['status'] == 'on'} + + {/if} + {/foreach} {/if} {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes'}