Fix map url
This commit is contained in:
parent
393a1195a5
commit
8f595af9a1
@ -5,7 +5,7 @@
|
|||||||
* by https://t.me/ibnux
|
* by https://t.me/ibnux
|
||||||
**/
|
**/
|
||||||
|
|
||||||
_admin();
|
_admin();
|
||||||
$ui->assign('_system_menu', 'map');
|
$ui->assign('_system_menu', 'map');
|
||||||
|
|
||||||
$action = $routes['1'];
|
$action = $routes['1'];
|
||||||
@ -22,6 +22,7 @@ switch ($action) {
|
|||||||
$customerData = [];
|
$customerData = [];
|
||||||
|
|
||||||
foreach ($c as $customer) {
|
foreach ($c as $customer) {
|
||||||
|
if (!empty($customer->coordinates)) {
|
||||||
$customerData[] = [
|
$customerData[] = [
|
||||||
'id' => $customer->id,
|
'id' => $customer->id,
|
||||||
'name' => $customer->fullname,
|
'name' => $customer->fullname,
|
||||||
@ -31,6 +32,7 @@ switch ($action) {
|
|||||||
'coordinates' => '[' . $customer->coordinates . ']',
|
'coordinates' => '[' . $customer->coordinates . ']',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$ui->assign('customers', $customerData);
|
$ui->assign('customers', $customerData);
|
||||||
$ui->assign('xheader', '<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css">');
|
$ui->assign('xheader', '<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css">');
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
{include file="sections/header.tpl"}
|
{include file="sections/header.tpl"}
|
||||||
|
|
||||||
<!-- Map container div -->
|
<!-- Map container div -->
|
||||||
<div id="map" style="width: 800px; height: 600px; margin: 20px auto"></div>
|
<div id="map" style="width: '100%'; height: 600px; margin: 20px auto"></div>
|
||||||
|
|
||||||
{literal}
|
{literal}
|
||||||
<script>
|
<script>
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
var map = L.map('map').setView([51.505, -0.09], 13);
|
var map = L.map('map').setView([51.505, -0.09], 13);
|
||||||
var group = L.featureGroup().addTo(map);
|
var group = L.featureGroup().addTo(map);
|
||||||
@ -12,7 +12,8 @@
|
|||||||
var customers = {/literal}{$customers|json_encode}{literal};
|
var customers = {/literal}{$customers|json_encode}{literal};
|
||||||
|
|
||||||
L.tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/light_all/{z}/{x}/{y}.png', {
|
L.tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/light_all/{z}/{x}/{y}.png', {
|
||||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors © <a href="https://carto.com/attributions">CARTO</a>',
|
attribution:
|
||||||
|
'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors © <a href="https://carto.com/attributions">CARTO</a>',
|
||||||
subdomains: 'abcd',
|
subdomains: 'abcd',
|
||||||
maxZoom: 20
|
maxZoom: 20
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
@ -31,7 +32,7 @@
|
|||||||
"<strong>Customer Balance</strong>: " + balance + "<br>" +
|
"<strong>Customer Balance</strong>: " + balance + "<br>" +
|
||||||
"<strong>Address</strong>: " + address + "<br>" +
|
"<strong>Address</strong>: " + address + "<br>" +
|
||||||
"<strong>Coordinates</strong>: " + coordinates + "<br>" +
|
"<strong>Coordinates</strong>: " + coordinates + "<br>" +
|
||||||
"<a href='{$_url}customers/view/"+ customer.id +"'>More Info</a><br>";
|
"<a href='{/literal}{$_url}{literal}customers/view/"+ customer.id +"'>More Info</a><br>";
|
||||||
|
|
||||||
// Add marker to map
|
// Add marker to map
|
||||||
var marker = L.marker(JSON.parse(coordinates)).addTo(group);
|
var marker = L.marker(JSON.parse(coordinates)).addTo(group);
|
||||||
@ -40,7 +41,7 @@
|
|||||||
|
|
||||||
map.fitBounds(group.getBounds());
|
map.fitBounds(group.getBounds());
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
{/literal}
|
{/literal}
|
||||||
|
|
||||||
{include file="sections/footer.tpl"}
|
{include file="sections/footer.tpl"}
|
Loading…
x
Reference in New Issue
Block a user