From 0d0f59a9a0d37d2558542e224729d74335e4f082 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Wed, 9 Aug 2023 10:50:02 +0700 Subject: [PATCH] Add Customer Balance Settings --- system/controllers/settings.php | 24 ++++++ ui/ui/app-settings.tpl | 138 ++++++++++++++++++++++++++------ ui/ui/user-dashboard.tpl | 6 ++ 3 files changed, 145 insertions(+), 23 deletions(-) diff --git a/system/controllers/settings.php b/system/controllers/settings.php index 6a5625c6..8423c91b 100644 --- a/system/controllers/settings.php +++ b/system/controllers/settings.php @@ -206,6 +206,8 @@ switch ($action) { case 'app-post': $company = _post('company'); $footer = _post('footer'); + $enable_balance = _post('enable_balance'); + $allow_balance_transfer = _post('allow_balance_transfer'); $disable_voucher = _post('disable_voucher'); $telegram_bot = _post('telegram_bot'); $telegram_target_id = _post('telegram_target_id'); @@ -257,6 +259,28 @@ switch ($action) { $d->save(); } + $d = ORM::for_table('tbl_appconfig')->where('setting', 'enable_balance')->find_one(); + if($d){ + $d->value = $enable_balance; + $d->save(); + }else{ + $d = ORM::for_table('tbl_appconfig')->create(); + $d->setting = 'enable_balance'; + $d->value = $enable_balance; + $d->save(); + } + + $d = ORM::for_table('tbl_appconfig')->where('setting', 'allow_balance_transfer')->find_one(); + if($d){ + $d->value = $allow_balance_transfer; + $d->save(); + }else{ + $d = ORM::for_table('tbl_appconfig')->create(); + $d->setting = 'allow_balance_transfer'; + $d->value = $allow_balance_transfer; + $d->save(); + } + $d = ORM::for_table('tbl_appconfig')->where('setting', 'telegram_bot')->find_one(); if($d){ $d->value = $telegram_bot; diff --git a/ui/ui/app-settings.tpl b/ui/ui/app-settings.tpl index f8ffb419..4a9131d7 100644 --- a/ui/ui/app-settings.tpl +++ b/ui/ui/app-settings.tpl @@ -4,7 +4,13 @@
-
{$_L['General_Settings']}
+
+
+ +
+ {$_L['General_Settings']} +
@@ -19,7 +25,7 @@
- {Lang::T('Will show below user pages')} + {Lang::T('Will show below user pages')}
@@ -60,14 +66,55 @@

Voucher activation menu will be hidden

-
Telegram Notification
+
+
+ +
+ {Lang::T('Balance System')} +
+
+
+ +
+ +

Customer can deposit money to buy voucher

+
+
+
+ +
+ +

Allow balance transfer between customers

+
+
+
+
+
+ +
+ {Lang::T('Telegram Notification')} +
@@ -83,9 +130,16 @@ value="{$_c['telegram_target_id']}" placeholder="12345678">
- You will get Payment and Error notification + You will get Payment and Error + notification +
+
+
+ +
+ {Lang::T('SMS OTP Registration')}
-
SMS OTP Registration
@@ -96,9 +150,16 @@

- You can use WhatsApp in here too. Free Server + You can use WhatsApp in here too. Free Server +
+
+
+ +
+ {Lang::T('Whatsapp Notification')}
-
Whatsapp Notification
@@ -110,15 +171,24 @@
-
{Lang::T('User Notification')}
+
+
+ +
+ {Lang::T('User Notification')} +
- - - + +

{Lang::T('User will get notification when package expired')}

@@ -126,23 +196,38 @@
- -

{Lang::T('[[name]] will be replaced with Customer Name. [[package]] will be replaced with Package name.')}

+ +

+ {Lang::T('[[name]] will be replaced with Customer Name. [[package]] will be replaced with Package name.')} +

- - - + + -

{Lang::T('User will get invoice notification when buy package or package refilled')}

+

+ {Lang::T('User will get invoice notification when buy package or package refilled')}

-
Tawk.to Chat Widget
+
+
+ +
+ {Lang::T('Tawk.to Chat Widget')} +
@@ -156,12 +241,19 @@ add dst-host=*.tawk.to
-
Invoice
+
+
+ +
+ {Lang::T('Invoice')} +
- + {$_L['You_can_use_html_tag']}
@@ -173,7 +265,7 @@ add dst-host=*.tawk.to
- +
/ip hotspot walled-garden
             add dst-host={$_domain}
diff --git a/ui/ui/user-dashboard.tpl b/ui/ui/user-dashboard.tpl
index ed4a7858..71ec9908 100644
--- a/ui/ui/user-dashboard.tpl
+++ b/ui/ui/user-dashboard.tpl
@@ -62,6 +62,12 @@
                             style="background-color: black; color:black; width:100%; border: 0px;"
                             onclick="this.select()">
                 
+                {if $_c['enable_balance'] == 'yes'}
+                    
+                        {Lang::T('Balance')}
+                        {Lang::moneyFormat($_user['balance'])}
+                    
+                {/if}
                 
                     {$_L['Plan_Name']}
                     {$_bill['namebp']}