diff --git a/system/controllers/customers.php b/system/controllers/customers.php index 8fb4689c..7436b23d 100644 --- a/system/controllers/customers.php +++ b/system/controllers/customers.php @@ -459,6 +459,7 @@ switch ($action) { $phonenumber = Lang::phoneFormat(_post('phonenumber')); $service_type = _post('service_type'); $coordinates = _post('coordinates'); + $status = _post('status'); run_hook('edit_customer'); #HOOK $msg = ''; if (Validator::Length($username, 35, 2) == false) { @@ -517,6 +518,7 @@ switch ($action) { $d->email = $email; $d->account_type = $account_type; $d->address = $address; + $d->status = $status; $d->phonenumber = $phonenumber; $d->service_type = $service_type; $d->coordinates = $coordinates; @@ -606,19 +608,33 @@ switch ($action) { default: run_hook('list_customers'); #HOOK $search = _post('search'); + $order = _post('order', 'username'); + $orderby = _post('orderby', 'asc'); + $order_pos = [ + 'username' => 0, + 'created_at' => 8, + 'balance' => 3 + ]; + if ($search != '') { $query = ORM::for_table('tbl_customers') ->whereRaw("username LIKE '%$search%' OR fullname LIKE '%$search%' OR address LIKE '%$search%' ". - "OR phonenumber LIKE '%$search%' OR email LIKE '%$search%' ") - ->order_by_asc('username'); - $d = $query->findMany(); + "OR phonenumber LIKE '%$search%' OR email LIKE '%$search%' "); } else { - $query = ORM::for_table('tbl_customers')->order_by_asc('username'); + $query = ORM::for_table('tbl_customers'); + } + if($orderby=='asc'){ + $query->order_by_asc($order); + }else{ + $query->order_by_desc($order); } $d = $query->findMany(); $ui->assign('xheader', ''); $ui->assign('d', $d); $ui->assign('search', $search); + $ui->assign('order', $order); + $ui->assign('order_pos', $order_pos[$order]); + $ui->assign('orderby', $orderby); $ui->display('customers.tpl'); break; } diff --git a/system/lan/english.json b/system/lan/english.json index 430a0cc2..5f8ec277 100644 --- a/system/lan/english.json +++ b/system/lan/english.json @@ -586,5 +586,8 @@ "Banned": "Banned", "Customer_cannot_login_again": "Customer cannot login again", "Customer_can_login_but_cannot_buy_internet_plan__Admin_cannot_recharge_customer": "Customer can login but cannot buy internet plan, Admin cannot recharge customer", - "Don_t_forget_to_deactivate_all_active_plan_too": "Don't forget to deactivate all active plan too" + "Don_t_forget_to_deactivate_all_active_plan_too": "Don't forget to deactivate all active plan too", + "Ascending": "Ascending", + "Descending": "Descending", + "Created_Date": "Created Date" } \ No newline at end of file diff --git a/ui/ui/customers.tpl b/ui/ui/customers.tpl index 3c255bc0..081f86b9 100644 --- a/ui/ui/customers.tpl +++ b/ui/ui/customers.tpl @@ -16,18 +16,38 @@
{Lang::T('Contact')} | {Lang::T('Package')} | {Lang::T('Service Type')} | +{Lang::T('Status')} | {Lang::T('Created On')} | {Lang::T('Manage')} | {foreach $d as $ds} -||||
---|---|---|---|---|---|---|---|---|---|
{$ds['username']} | -{$ds['account_type']} | -{$ds['fullname']} | -{Lang::moneyFormat($ds['balance'])} | -- {if $ds['phonenumber']} - - {/if} - {if $ds['email']} - - {/if} - {if $ds['coordinates']} - - {/if} - | -- • - | -{$ds['service_type']} | -{Lang::dateTimeFormat($ds['created_at'])} | -- {Lang::T('View')} - {Lang::T('Edit')} - {Lang::T('Recharge')} - | -|
{$ds['username']} | +{$ds['account_type']} | +{$ds['fullname']} | +{Lang::moneyFormat($ds['balance'])} | ++ {if $ds['phonenumber']} + + {/if} + {if $ds['email']} + + {/if} + {if $ds['coordinates']} + + {/if} + | ++ • + | +{$ds['service_type']} | +{Lang::T($ds['status'])} | +{Lang::dateTimeFormat($ds['created_at'])} | ++ {Lang::T('View')} + {Lang::T('Edit')} + {Lang::T('Recharge')} + | +