diff --git a/system/autoload/User.php b/system/autoload/User.php index c8b09197..86d42c31 100644 --- a/system/autoload/User.php +++ b/system/autoload/User.php @@ -56,6 +56,22 @@ class User return [$bills, $addcost]; } + public static function getBillNames($id = 0) + { + if (!$id) { + $id = User::getID(); + if (!$id) { + return []; + } + } + $bills = []; + $attrs = User::getAttributes('Bill', $id); + foreach ($attrs as $k => $v) { + $bills[] = str_replace(' Bill', '', $k); + } + return $bills; + } + public static function billsPaid($bills, $id = 0) { if (!$id) { diff --git a/system/controllers/autoload_user.php b/system/controllers/autoload_user.php index 5fabf893..78c2b2ab 100644 --- a/system/controllers/autoload_user.php +++ b/system/controllers/autoload_user.php @@ -29,7 +29,7 @@ switch ($action) { if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) { die('<a href="' . U . 'home&mikrotik=login&id=' . $bill['id'] . '" onclick="return confirm(\'' . Lang::T('Connect to Internet?') . '\')" class="btn btn-danger btn-xs btn-block">' . Lang::T('Not Online, Login now?') . '</a>'); } else { - die(Lang::T('Your account not connected to internet')); + die(Lang::T('-')); } } } else { diff --git a/system/controllers/home.php b/system/controllers/home.php index 7971f43a..71c7645d 100644 --- a/system/controllers/home.php +++ b/system/controllers/home.php @@ -291,5 +291,9 @@ $ui->assign('unpaid', ORM::for_table('tbl_payment_gateway') ->where('status', 1) ->find_one()); $ui->assign('code', alphanumeric(_get('code'), "-")); + +$abills = User::getAttributes("Bill"); +$ui->assign('abills', $abills); + run_hook('view_customer_dashboard'); #HOOK $ui->display('user-dashboard.tpl'); diff --git a/system/lan/english.json b/system/lan/english.json index a8dfe950..77eebd2e 100644 --- a/system/lan/english.json +++ b/system/lan/english.json @@ -658,6 +658,8 @@ "Activate_Voucher": "Activate Voucher", "Voucher_invalid": "Voucher invalid", "Account_Not_Found": "Account Not Found", - "Voucher_activation_success__now_you_can_login": "Voucher activation success, now you can login", - "Internet_Voucher_Expired": "Internet Voucher Expired" + "Internet_Voucher_Expired": "Internet Voucher Expired", + "": "", + "Additional_Billing": "Additional Billing", + "_": "-" } \ No newline at end of file diff --git a/ui/ui/user-dashboard.tpl b/ui/ui/user-dashboard.tpl index 158a4803..34c12fbc 100644 --- a/ui/ui/user-dashboard.tpl +++ b/ui/ui/user-dashboard.tpl @@ -106,6 +106,36 @@ </tr> {/if} </table> + {if $abills && count($abills)>0} + <div class="box-header"> + <h3 class="box-title">{Lang::T('Additional Billing')}</h3> + </div> + <table class="table table-bordered table-striped table-bordered table-hover mb-0" + style="margin-bottom: 0px;"> + {assign var="total" value=0} + {foreach $abills as $k => $v} + <tr> + <td class="small text-success text-uppercase text-normal">{str_replace(' Bill', '', $k)}</td> + <td class="small mb15"> + {if strpos($v, ':') === false} + {Lang::moneyFormat($v)} + <sup title="recurring">∞</sup> + {assign var="total" value=$v+$total} + {else} + {assign var="exp" value=explode(':',$v)} + {Lang::moneyFormat($exp[0])} + <sup title="{$exp[1]} more times">{$exp[1]}x</sup> + {assign var="total" value=$exp[0]+$total} + {/if} + </td> + </tr> + {/foreach} + <tr> + <td class="small text-success text-uppercase text-normal"><b>{Lang::T('Total')}</b></td> + <td class="small mb15"><b>{Lang::moneyFormat($total)}</b></td> + </tr> + </table> + {/if} </div> {if $_bills} <div class="box box-primary box-solid"> @@ -179,13 +209,15 @@ <tr> <td class="small text-primary text-uppercase text-normal">{Lang::T('Login Status')}</td> <td class="small mb15"> - {if $logged == '1'} - <a href="http://{$hostname}/status" class="btn btn-success btn-xs btn-block">{Lang::T('You are Online, Check Status')}</a> - {else} - <a href="{$_url}home&mikrotik=login" - onclick="return confirm('{Lang::T('Connect to Internet')}')" class="btn btn-danger btn-xs btn-block">{Lang::T('Not Online, Login now?')}</a> - {/if} - </td> + {if $logged == '1'} + <a href="http://{$hostname}/status" + class="btn btn-success btn-xs btn-block">{Lang::T('You are Online, Check Status')}</a> + {else} + <a href="{$_url}home&mikrotik=login" + onclick="return confirm('{Lang::T('Connect to Internet')}')" + class="btn btn-danger btn-xs btn-block">{Lang::T('Not Online, Login now?')}</a> + {/if} + </td> </tr> {/if} <tr> @@ -334,16 +366,16 @@ </div> </div> {if isset($hostname) && $hchap == 'true' && $_c['hs_auth_method'] == 'hchap'} -<script type="text/javascript" src="/ui/ui/scripts/md5.js"></script> -<script type="text/javascript"> - var hostname = "http://{$hostname}/login"; - var user = "{$_user['username']}"; - var pass = "{$_user['password']}"; - var dst = "{$apkurl}"; - var authdly = "2"; - var key = hexMD5('{$key1}' + pass + '{$key2}'); - var auth = hostname + '?username=' + user + '&dst=' + dst + '&password=' + key; - document.write('<meta http-equiv="refresh" target="_blank" content="'+authdly+'; url='+auth+'">'); -</script> + <script type="text/javascript" src="/ui/ui/scripts/md5.js"></script> + <script type="text/javascript"> + var hostname = "http://{$hostname}/login"; + var user = "{$_user['username']}"; + var pass = "{$_user['password']}"; + var dst = "{$apkurl}"; + var authdly = "2"; + var key = hexMD5('{$key1}' + pass + '{$key2}'); + var auth = hostname + '?username=' + user + '&dst=' + dst + '&password=' + key; + document.write('<meta http-equiv="refresh" target="_blank" content="' + authdly + '; url=' + auth + '">'); + </script> {/if} {include file="sections/user-footer.tpl"} \ No newline at end of file