diff --git a/install/phpnuxbill.sql b/install/phpnuxbill.sql index 2f10779e..77d2bbfc 100644 --- a/install/phpnuxbill.sql +++ b/install/phpnuxbill.sql @@ -27,6 +27,7 @@ CREATE TABLE `tbl_customers` ( `phonenumber` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0', `email` varchar(128) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '1', `balance` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT 'For Money Deposit', + `service_type` ENUM('Hotspot','PPPoE','Others') DEFAULT 'Others' COMMENT 'For selecting user type', `auto_renewal` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Auto renewall using balance', `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `last_login` datetime DEFAULT NULL diff --git a/system/controllers/customers.php b/system/controllers/customers.php index 4f13f648..8638a271 100644 --- a/system/controllers/customers.php +++ b/system/controllers/customers.php @@ -28,7 +28,8 @@ switch ($action) { 'username' => '%' . $search . '%', 'fullname' => '%' . $search . '%', 'phonenumber' => '%' . $search . '%', - 'email' => '%' . $search . '%' + 'email' => '%' . $search . '%', + 'service_type' => '%' . $search . '%' ], $search); $d = ORM::for_table('tbl_customers') ->where_raw("(`username` LIKE '%$search%' OR `fullname` LIKE '%$search%' OR `phonenumber` LIKE '%$search%' OR `email` LIKE '%$search%')", [$search, $search, $search, $search]) @@ -225,8 +226,9 @@ switch ($action) { $password = _post('password'); $pppoe_password = _post('pppoe_password'); $email = _post('email'); - $address = _post('address'); + $address = _post('address'); $phonenumber = _post('phonenumber'); + $service_type = _post('service_type'); run_hook('add_customer'); #HOOK $msg = ''; if (Validator::Length($username, 35, 2) == false) { @@ -253,6 +255,7 @@ switch ($action) { $d->fullname = $fullname; $d->address = $address; $d->phonenumber = Lang::phoneFormat($phonenumber); + $d->service_type = $service_type; $d->save(); r2(U . 'customers/list', 's', $_L['account_created_successfully']); } else { @@ -268,6 +271,7 @@ switch ($action) { $email = _post('email'); $address = _post('address'); $phonenumber = Lang::phoneFormat(_post('phonenumber')); + $service_type = _post('service_type'); run_hook('edit_customer'); #HOOK $msg = ''; if (Validator::Length($username, 16, 2) == false) { @@ -320,6 +324,7 @@ switch ($action) { $d->email = $email; $d->address = $address; $d->phonenumber = $phonenumber; + $d->service_type = $service_type; $d->save(); if ($userDiff || $pppoeDiff || $passDiff) { $c = ORM::for_table('tbl_user_recharges')->where('username', ($userDiff) ? $oldusername : $username)->find_one(); diff --git a/system/updates.json b/system/updates.json index 86796d35..06e365a8 100644 --- a/system/updates.json +++ b/system/updates.json @@ -35,5 +35,8 @@ ], "2023.10.24" : [ "ALTER TABLE `nas` ADD `routers` VARCHAR(32) NOT NULL DEFAULT '' AFTER `description`;" + ], + "2023.12.15": [ + "ALTER TABLE `tbl_customers` ADD `service_type` ENUM('Hotspot','PPPoE','Others') DEFAULT 'Others' COMMENT 'For selecting user type' AFTER `balance`;" ] } \ No newline at end of file diff --git a/ui/ui/customers-add.tpl b/ui/ui/customers-add.tpl index c4bcf59c..6aaa44d1 100644 --- a/ui/ui/customers-add.tpl +++ b/ui/ui/customers-add.tpl @@ -72,6 +72,16 @@ +
+ +
+ +
+
diff --git a/ui/ui/customers-edit.tpl b/ui/ui/customers-edit.tpl index cdbca703..b1c13bd7 100644 --- a/ui/ui/customers-edit.tpl +++ b/ui/ui/customers-edit.tpl @@ -77,6 +77,16 @@
+
+ +
+ +
+
diff --git a/ui/ui/customers-view.tpl b/ui/ui/customers-view.tpl index e82b8a15..59fb0949 100644 --- a/ui/ui/customers-view.tpl +++ b/ui/ui/customers-view.tpl @@ -37,6 +37,9 @@ onclick="this.select()"> {/if} +
  • + {Lang::T('Service Type')} {Lang::T($d['service_type'])} +
  • {Lang::T('Balance')} {Lang::moneyFormat($d['balance'])}
  • diff --git a/ui/ui/customers.tpl b/ui/ui/customers.tpl index dd6d598c..852e590a 100644 --- a/ui/ui/customers.tpl +++ b/ui/ui/customers.tpl @@ -33,6 +33,7 @@ {$_L['Phone_Number']} {$_L['Email']} {$_L['Package']} + {Lang::T('Service Type')} {$_L['Created_On']} {$_L['Manage']} @@ -48,6 +49,7 @@ + {$ds['service_type']} {Lang::dateTimeFormat($ds['created_at'])}

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

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

    {$_L['Account_Information']}

    -
    {Lang::T('expired')}
    +
    @@ -73,6 +74,11 @@ style="width:100%; border: 0px;" onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'" onclick="this.select()"> + + + + + {if $_c['enable_balance'] == 'yes'} @@ -88,84 +94,95 @@ {/if} - {if $_bill} +
    {$_L['Username']} {$_user['username']}
    {Lang::T('Service Type')}{$_user['service_type']}
    {Lang::T('Balance')}
    + {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'}
    diff --git a/ui/ui/user-orderPlan.tpl b/ui/ui/user-orderPlan.tpl index 56893749..8a7aa3d1 100644 --- a/ui/ui/user-orderPlan.tpl +++ b/ui/ui/user-orderPlan.tpl @@ -6,218 +6,368 @@
    {Lang::T('Order Internet Package')}
    {if $_c['radius_enable']} - {if Lang::arrayCount($radius_hotspot)>0} - -
    - {foreach $radius_hotspot as $plan} -
    -
    -
    {$plan['name_plan']}
    -
    - - - - - - - - - - - - - - - -
    {Lang::T('Type')}{$plan['type']}
    {Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
    {Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
    -
    -
    -
    - Buy - {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Pay With Balance')} - {/if} -
    - {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Buy for friend')} - {/if} -
    -
    + {if $_user['service_type'] == 'PPPoE'} + {if Lang::arrayCount($radius_pppoe)>0} + +
    + {foreach $radius_pppoe as $plan} +
    +
    +
    {$plan['name_plan']}
    +
    + + + + + + + + + + + + + + + +
    {Lang::T('Type')}{$plan['type']}
    {Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
    {Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
    - {/foreach} -
    - {/if} - {if Lang::arrayCount($radius_pppoe)>0} - -
    - {foreach $radius_pppoe as $plan} -
    -
    -
    {$plan['name_plan']}
    -
    - - - - - - - - - - - - - - - -
    {Lang::T('Type')}{$plan['type']}
    {Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
    {Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
    -
    -
    -
    - Buy - {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Pay With Balance')} - {/if} -
    - {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Buy for friend')} - {/if} -
    -
    +
    +
    + Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if}
    - {/foreach} + {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
    +
    + {/foreach} +
    + {/if} + {elseif $_user['service_type'] == 'Hotspot'} + {if Lang::arrayCount($radius_hotspot)>0} + +
    + {foreach $radius_hotspot as $plan} +
    +
    +
    {$plan['name_plan']}
    +
    + + + + + + + + + + + + + + + +
    {Lang::T('Type')}{$plan['type']}
    {Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
    {Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
    +
    +
    +
    + Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if} +
    + {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
    +
    +
    + {/foreach} +
    + {/if} + {elseif $_user['service_type'] == 'Others' || $_user['service_type'] == '' && (Lang::arrayCount($radius_pppoe)>0 || Lang::arrayCount($radius_hotspot)>0)} + +
    + {if Lang::arrayCount($radius_pppoe)>0} + {foreach $radius_pppoe as $plan} +
    +
    +
    {$plan['name_plan']}
    +
    + + + + + + + + + + + + + + + +
    {Lang::T('Type')}{$plan['type']}
    {Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
    {Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
    +
    +
    +
    + Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if} +
    + {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
    +
    +
    + {/foreach} {/if} + + {if Lang::arrayCount($radius_hotspot)>0} + + {foreach $radius_hotspot as $plan} +
    +
    +
    {$plan['name_plan']}
    +
    + + + + + + + + + + + + + + + +
    {Lang::T('Type')}{$plan['type']}
    {Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
    {Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
    +
    +
    +
    + Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if} +
    + {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
    +
    +
    + {/foreach} + {/if} +
    + {/if} {/if} {foreach $routers as $router} - {if Validator::isRouterHasPlan($plans_hotspot, $router['name']) || Validator::isRouterHasPlan($plans_pppoe, $router['name'])} -
    -
    {$router['name']}
    - {if $router['description'] != ''} -
    - {$router['description']} -
    - {/if} - {if Validator::countRouterPlan($plans_hotspot, $router['name'])>0} -
    {if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if}
    -
    - {foreach $plans_hotspot as $plan} - {if $router['name'] eq $plan['routers']} -
    -
    -
    {$plan['name_plan']}
    -
    - - - - - - - - - - - - - - - -
    {Lang::T('Type')}{$plan['type']}
    {Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
    {Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
    -
    -
    -
    - Buy - {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Pay With Balance')} - {/if} -
    - {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Buy for friend')} - {/if} -
    -
    -
    - {/if} - {/foreach} -
    - {/if} - {if Validator::countRouterPlan($plans_pppoe,$router['name'])>0} -
    {if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}
    -
    - {foreach $plans_pppoe as $plan} - {if $router['name'] eq $plan['routers']} -
    -
    -
    {$plan['name_plan']}
    -
    - - - - - - - - - - - - - - - -
    {Lang::T('Type')}{$plan['type']}
    {Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
    {Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
    -
    -
    -
    - Buy - {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Pay With Balance')} - {/if} -
    - {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Buy for friend')} - {/if} -
    -
    -
    - {/if} - {/foreach} -
    - {/if} -
    + {if Validator::isRouterHasPlan($plans_hotspot, $router['name']) || Validator::isRouterHasPlan($plans_pppoe, $router['name'])} +
    +
    {$router['name']}
    + {if $router['description'] != ''} +
    + {$router['description']} +
    {/if} + {if $_user['service_type'] == 'Hotspot' && Validator::countRouterPlan($plans_hotspot, $router['name'])>0} +
    {if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if}
    +
    + {foreach $plans_hotspot as $plan} + {if $router['name'] eq $plan['routers']} +
    +
    +
    {$plan['name_plan']}
    +
    + + + + + + + + + + + + + + + +
    {Lang::T('Type')}{$plan['type']}
    {Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
    {Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
    +
    +
    +
    + Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if} +
    + {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
    +
    +
    + {/if} + {/foreach} +
    + {/if} + {if $_user['service_type'] == 'PPPoE' && Validator::countRouterPlan($plans_pppoe,$router['name'])>0} +
    {if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}
    +
    + {foreach $plans_pppoe as $plan} + {if $router['name'] eq $plan['routers']} +
    +
    +
    {$plan['name_plan']}
    +
    + + + + + + + + + + + + + + + +
    {Lang::T('Type')}{$plan['type']}
    {Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
    {Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
    +
    +
    +
    + Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if} +
    + {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
    +
    +
    + {/if} + {/foreach} +
    + {/if} + {if $_user['service_type'] == 'Others' || $_user['service_type'] == '' && (Validator::countRouterPlan($plans_hotspot, $router['name'])>0 || Validator::countRouterPlan($plans_pppoe, $router['name'])>0)} +
    {if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if}
    +
    + {foreach $plans_hotspot as $plan} + {if $router['name'] eq $plan['routers']} +
    +
    +
    {$plan['name_plan']}
    +
    + + + + + + + + + + + + + + + +
    {Lang::T('Type')}{$plan['type']}
    {Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
    {Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
    +
    +
    +
    + Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if} +
    + {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
    +
    +
    + {/if} + {/foreach} +
    +
    {if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}
    +
    + {foreach $plans_pppoe as $plan} + {if $router['name'] eq $plan['routers']} +
    +
    +
    {$plan['name_plan']}
    +
    + + + + + + + + + + + + + + + +
    {Lang::T('Type')}{$plan['type']}
    {Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
    {Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
    +
    +
    +
    + Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if} +
    + {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
    +
    +
    + {/if} + {/foreach} +
    + {/if} +
    + {/if} {/foreach}
    -
    {include file="sections/user-footer.tpl"} \ No newline at end of file