From c51f04747d95e5aa80c1b99278c05353431daa42 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Thu, 21 Sep 2023 16:04:18 +0700 Subject: [PATCH] User extend plan --- system/controllers/home.php | 14 +++++++++++++- ui/ui/sections/footer.tpl | 2 +- ui/ui/user-dashboard.tpl | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/system/controllers/home.php b/system/controllers/home.php index bd1f3a77..be779bc4 100644 --- a/system/controllers/home.php +++ b/system/controllers/home.php @@ -90,7 +90,19 @@ if (_post('send') == 'balance') { $bill = User::_billing(); $ui->assign('_bill', $bill); -if(isset($_GET['deactivate']) && $_GET['deactivate'] == 1){ +if(isset($_GET['recharge']) && $_GET['recharge'] == 1){ + $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']); + if($user['balance']>$plan['price']){ + r2(U . "order/pay/$router[id]/$bill[plan_id]", 'e', 'Order Plan'); + }else{ + r2(U . "order/buy/$router[id]/$bill[plan_id]", 'e', 'Order Plan'); + } + }else{ + r2(U . "order/buy/$router[id]/$bill[plan_id]", 'e', 'Order Plan'); + } +}else if(isset($_GET['deactivate']) && $_GET['deactivate'] == 1){ if ($bill) { $mikrotik = Mikrotik::info($bill['routers']); $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); diff --git a/ui/ui/sections/footer.tpl b/ui/ui/sections/footer.tpl index cefb25f0..185e11cd 100644 --- a/ui/ui/sections/footer.tpl +++ b/ui/ui/sections/footer.tpl @@ -1,7 +1,7 @@