diff --git a/system/controllers/customers.php b/system/controllers/customers.php index 2300af01..151ace8a 100644 --- a/system/controllers/customers.php +++ b/system/controllers/customers.php @@ -130,7 +130,7 @@ switch ($action) { $ui->assign('using', 'cash'); $ui->assign('plan', $plan); $ui->display('recharge-confirm.tpl'); - }else{ + } else { r2(U . 'customers/view/' . $id_customer, 'e', 'Cannot find active plan'); } break; @@ -191,7 +191,7 @@ switch ($action) { } } } - r2(U . 'customers/view/' . $id_customer, 's', 'Sync success to '.implode(", ",$routers)); + r2(U . 'customers/view/' . $id_customer, 's', 'Sync success to ' . implode(", ", $routers)); } r2(U . 'customers/view/' . $id_customer, 'e', 'Cannot find active plan'); break; @@ -212,7 +212,7 @@ switch ($action) { ->find_many(); $v = $routes['3']; - if(empty($v)){ + if (empty($v)) { $v = 'activation'; } if ($v == 'order') { @@ -328,6 +328,7 @@ switch ($action) { $address = _post('address'); $phonenumber = _post('phonenumber'); $service_type = _post('service_type'); + $coordinates = _post('coordinates'); //post Customers Attributes $custom_field_names = (array) $_POST['custom_field_name']; $custom_field_values = (array) $_POST['custom_field_value']; @@ -360,6 +361,7 @@ switch ($action) { $d->created_by = $admin['id']; $d->phonenumber = Lang::phoneFormat($phonenumber); $d->service_type = $service_type; + $d->coordinates = $coordinates; $d->save(); // Retrieve the customer ID of the newly created customer @@ -395,6 +397,7 @@ switch ($action) { $address = _post('address'); $phonenumber = Lang::phoneFormat(_post('phonenumber')); $service_type = _post('service_type'); + $coordinates = _post('coordinates'); run_hook('edit_customer'); #HOOK $msg = ''; if (Validator::Length($username, 35, 2) == false) { @@ -454,6 +457,7 @@ switch ($action) { $d->address = $address; $d->phonenumber = $phonenumber; $d->service_type = $service_type; + $d->coordinates = $coordinates; $d->save(); diff --git a/system/controllers/map.php b/system/controllers/map.php new file mode 100644 index 00000000..053019f4 --- /dev/null +++ b/system/controllers/map.php @@ -0,0 +1,45 @@ +assign('_system_menu', 'map'); + +$action = $routes['1']; +$ui->assign('_admin', $admin); + +if (empty($action)) { + $action = 'customer'; +} + +switch ($action) { + case 'customer': + + $c = ORM::for_table('tbl_customers')->find_many(); + $customerData = []; + + foreach ($c as $customer) { + $customerData[] = [ + 'id' => $customer->id, + 'name' => $customer->fullname, + 'balance' => $customer->balance, + 'address' => $customer->address, + 'info' => Lang::T("Username") . ": " . $customer->username . " - " . Lang::T("Full Name") . ": " . $customer->fullname . " - " . Lang::T("Email") . ": " . $customer->email . " - " . Lang::T("Phone") . ": " . $customer->phonenumber . " - " . Lang::T("Service Type") . ": " . $customer->service_type, + 'coordinates' => '[' . $customer->coordinates . ']', + ]; + } + + $ui->assign('customers', $customerData); + $ui->assign('xheader', ''); + $ui->assign('_title', Lang::T('Customer Geo Location Information')); + $ui->assign('xfooter', ''); + $ui->display('map-customer.tpl'); + break; + + default: + r2(U . 'map/customer', 'e', 'action not defined'); + break; +} diff --git a/system/updates.json b/system/updates.json index 29f3282a..9a25dbb5 100644 --- a/system/updates.json +++ b/system/updates.json @@ -78,5 +78,10 @@ ], "2024.3.14" : [ "ALTER TABLE `tbl_transactions` ADD `note` VARCHAR(256) NOT NULL DEFAULT '' COMMENT 'for note' AFTER `type`;" + ], + "2024.3.19" : [ + "ALTER TABLE `tbl_customers` ADD `coordinates` VARCHAR(50) NOT NULL DEFAULT '6.465422, 3.406448' COMMENT 'Latitude and Longitude coordinates' AFTER `email`;" ] + + } \ No newline at end of file diff --git a/ui/ui/customers-add.tpl b/ui/ui/customers-add.tpl index acef5cfe..0ff75696 100644 --- a/ui/ui/customers-add.tpl +++ b/ui/ui/customers-add.tpl @@ -11,10 +11,10 @@