Changes Implemented on the Customer Map Page #305
carlos0424
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary of Changes:
customers-map.tpl
{include file="sections/header.tpl"}
{literal}
<script>
function getLocation() {
if (window.location.protocol == "https:" && navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
setupMap(51.505, -0.09);
}
}
{/literal}
{include file="sections/footer.tpl"}
map.php
assign('_system_menu', 'map'); $action = $routes['1']; $ui->assign('_admin', $admin); if (empty($action)) { $action = 'customer'; } switch ($action) { case 'customer': // Obtener la lista de ciudades distintas $cities = ORM::for_table('tbl_customers') ->select('city') ->distinct() ->where_not_equal('city', '') ->where_not_null('city') ->find_array(); $ui->assign('cities', $cities); // Manejo de búsqueda y filtrado $search = _req('search'); $selected_city = _req('city'); $query = ORM::for_table('tbl_customers')->where_not_equal('coordinates', ''); // Filtrar por ciudad si se selecciona if (!empty($selected_city)) { $query->where('city', $selected_city); } // Filtrar por búsqueda si se proporciona if (!empty($search)) { $query->whereRaw("fullname LIKE '%$search%' OR username LIKE '%$search%' OR email LIKE '%$search%' OR phonenumber LIKE '%$search%'"); } $c = $query->find_many(); $customerData = []; foreach ($c as $customer) { if (!empty($customer->coordinates)) { $customerData[] = [ 'id' => $customer->id, 'name' => $customer->fullname, 'balance' => $customer->balance, 'address' => $customer->address, 'direction' => $customer->coordinates, '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('search', $search); $ui->assign('selected_city', $selected_city); $ui->assign('customers', $customerData); $ui->assign('xheader', ''); $ui->assign('_title', Lang::T('Customer Geo Location Information')); $ui->assign('xfooter', '<script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js"></script>'); $ui->display('customers-map.tpl'); break; default: r2(U . 'map/customer', 'e', 'action not defined'); break; }Beta Was this translation helpful? Give feedback.
All reactions