Maps always show Tooltip

This commit is contained in:
Ibnu Maksum 2024-03-23 12:38:23 +07:00
parent 273d98f3ad
commit 04a21d3eb2
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
3 changed files with 118 additions and 112 deletions

View File

@ -28,6 +28,7 @@ switch ($action) {
'name' => $customer->fullname, 'name' => $customer->fullname,
'balance' => $customer->balance, 'balance' => $customer->balance,
'address' => $customer->address, '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, '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 . ']', 'coordinates' => '[' . $customer->coordinates . ']',
]; ];

View File

@ -24,34 +24,35 @@
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: attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>', '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>',
subdomains: 'abcd', subdomains: 'abcd',
maxZoom: 20 maxZoom: 20
}).addTo(map); }).addTo(map);
customers.forEach(function(customer) { customers.forEach(function(customer) {
var name = customer.id; var name = customer.id;
var name = customer.name; var name = customer.name;
var info = customer.info; var info = customer.info;
var coordinates = customer.coordinates; var direction = customer.direction;
var balance = customer.balance; var coordinates = customer.coordinates;
var address = customer.address; var balance = customer.balance;
var address = customer.address;
// Create a popup for the marker // Create a popup for the marker
var popupContent = "<strong>Customer Name</strong>: " + name + "<br>" + var popupContent = "<strong>Name</strong>: " + name + "<br>" +
"<strong>Customer Info</strong>: " + info + "<br>" + "<strong>Info</strong>: " + info + "<br>" +
"<strong>Customer Balance</strong>: " + balance + "<br>" + "<strong>Balance</strong>: " + balance + "<br>" +
"<strong>Address</strong>: " + address + "<br>" + "<strong>Address</strong>: " + address + "<br>" +
"<strong>Coordinates</strong>: " + coordinates + "<br>" + "<a href='{/literal}{$_url}{literal}customers/view/"+ customer.id +"'>More Info</a> &bull; " +
"<a href='{/literal}{$_url}{literal}customers/view/"+ customer.id +"'>More Info</a><br>"; "<a href='https://www.google.com/maps/dir//" + direction + "' target='maps'>Get Direction</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);
marker.bindTooltip(name).bindPopup(popupContent); marker.bindTooltip(name, { permanent: true }).bindPopup(popupContent);
}); });
map.fitBounds(group.getBounds()); map.fitBounds(group.getBounds());
} }
window.onload = function() { window.onload = function() {
getLocation(); getLocation();

View File

@ -30,29 +30,34 @@
onclick="this.select()"> onclick="this.select()">
</li> </li>
{if $d['pppoe_password'] != ''} {if $d['pppoe_password'] != ''}
<li class="list-group-item"> <li class="list-group-item">
<b>PPPOE {Lang::T('Password')}</b> <input type="password" value="{$d['pppoe_password']}" <b>PPPOE {Lang::T('Password')}</b> <input type="password" value="{$d['pppoe_password']}"
style=" border: 0px; text-align: right;" class="pull-right" style=" border: 0px; text-align: right;" class="pull-right"
onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'" onmouseleave="this.type = 'password'" onmouseenter="this.type = 'text'"
onclick="this.select()"> onclick="this.select()">
</li> </li>
{/if}
{if $d['coordinates']}
<li class="list-group-item">
<b>{Lang::T('Coordinates')}</b> <span class="pull-right">
<a href="https://www.google.com/maps/dir//{$d['coordinates']}/" target="_blank">Get
Directions</a>
</span>
</li>
{/if} {/if}
<li class="list-group-item">
<b>{Lang::T('Coordinates')}</b> <span class="pull-right">{$d['coordinates']}</span>
</li>
<!--Customers Attributes view start --> <!--Customers Attributes view start -->
{if $customFields} {if $customFields}
{foreach $customFields as $customField} {foreach $customFields as $customField}
<li class="list-group-item"> <li class="list-group-item">
<b>{$customField.field_name}</b> <span class="pull-right"> <b>{$customField.field_name}</b> <span class="pull-right">
{if strpos($customField.field_value, ':0') === false} {if strpos($customField.field_value, ':0') === false}
{$customField.field_value} {$customField.field_value}
{else} {else}
<b>{Lang::T('Paid')}</b> <b>{Lang::T('Paid')}</b>
{/if} {/if}
</span> </span>
</li> </li>
{/foreach} {/foreach}
{/if} {/if}
<!--Customers Attributes view end --> <!--Customers Attributes view end -->
<li class="list-group-item"> <li class="list-group-item">
@ -92,12 +97,12 @@
</div> </div>
</div> </div>
{foreach $packages as $package} {foreach $packages as $package}
<div class="box box-{if $package['status']=='on'}success{else}danger{/if}"> <div class="box box-{if $package['status']=='on'}success{else}danger{/if}">
<div class="box-body box-profile"> <div class="box-body box-profile">
<h4 class="text-center">{$package['type']} - {$package['namebp']}</h4> <h4 class="text-center">{$package['type']} - {$package['namebp']}</h4>
<ul class="list-group list-group-unbordered"> <ul class="list-group list-group-unbordered">
<li class="list-group-item"> <li class="list-group-item">
{Lang::T('Active')} <span class="pull-right">{if {Lang::T('Active')} <span class="pull-right">{if
$package['status']=='on'}yes{else}no $package['status']=='on'}yes{else}no
{/if}</span> {/if}</span>
</li> </li>
@ -110,8 +115,7 @@
class="pull-right">{Lang::dateAndTimeFormat($package['recharged_on'],$package['recharged_time'])}</span> class="pull-right">{Lang::dateAndTimeFormat($package['recharged_on'],$package['recharged_time'])}</span>
</li> </li>
<li class="list-group-item"> <li class="list-group-item">
{Lang::T('Expires On')} <span {Lang::T('Expires On')} <span class="pull-right">{Lang::dateAndTimeFormat($package['expiration'],
class="pull-right">{Lang::dateAndTimeFormat($package['expiration'],
$package['time'])}</span> $package['time'])}</span>
</li> </li>
<li class="list-group-item"> <li class="list-group-item">
@ -157,68 +161,68 @@
<div class="table-responsive" style="background-color: white;"> <div class="table-responsive" style="background-color: white;">
<table id="datatable" class="table table-bordered table-striped"> <table id="datatable" class="table table-bordered table-striped">
{if Lang::arrayCount($activation)} {if Lang::arrayCount($activation)}
<thead> <thead>
<tr> <tr>
<th>{Lang::T('Invoice')}</th> <th>{Lang::T('Invoice')}</th>
<th>{Lang::T('Username')}</th> <th>{Lang::T('Username')}</th>
<th>{Lang::T('Plan Name')}</th> <th>{Lang::T('Plan Name')}</th>
<th>{Lang::T('Plan Price')}</th> <th>{Lang::T('Plan Price')}</th>
<th>{Lang::T('Type')}</th> <th>{Lang::T('Type')}</th>
<th>{Lang::T('Created On')}</th> <th>{Lang::T('Created On')}</th>
<th>{Lang::T('Expires On')}</th> <th>{Lang::T('Expires On')}</th>
<th>{Lang::T('Method')}</th> <th>{Lang::T('Method')}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{foreach $activation as $ds} {foreach $activation as $ds}
<tr onclick="window.location.href = '{$_url}plan/view/{$ds['id']}'" style="cursor:pointer;"> <tr onclick="window.location.href = '{$_url}plan/view/{$ds['id']}'" style="cursor:pointer;">
<td>{$ds['invoice']}</td> <td>{$ds['invoice']}</td>
<td>{$ds['username']}</td> <td>{$ds['username']}</td>
<td>{$ds['plan_name']}</td> <td>{$ds['plan_name']}</td>
<td>{Lang::moneyFormat($ds['price'])}</td> <td>{Lang::moneyFormat($ds['price'])}</td>
<td>{$ds['type']}</td> <td>{$ds['type']}</td>
<td class="text-success">{Lang::dateAndTimeFormat($ds['recharged_on'],$ds['recharged_time'])} <td class="text-success">{Lang::dateAndTimeFormat($ds['recharged_on'],$ds['recharged_time'])}
</td> </td>
<td class="text-danger">{Lang::dateAndTimeFormat($ds['expiration'],$ds['time'])}</td> <td class="text-danger">{Lang::dateAndTimeFormat($ds['expiration'],$ds['time'])}</td>
<td>{$ds['method']}</td> <td>{$ds['method']}</td>
</tr> </tr>
{/foreach} {/foreach}
</tbody> </tbody>
{/if} {/if}
{if Lang::arrayCount($order)} {if Lang::arrayCount($order)}
<thead> <thead>
<tr> <tr>
<th>{Lang::T('Plan Name')}</th> <th>{Lang::T('Plan Name')}</th>
<th>{Lang::T('Gateway')}</th> <th>{Lang::T('Gateway')}</th>
<th>{Lang::T('Routers')}</th> <th>{Lang::T('Routers')}</th>
<th>{Lang::T('Type')}</th> <th>{Lang::T('Type')}</th>
<th>{Lang::T('Plan Price')}</th> <th>{Lang::T('Plan Price')}</th>
<th>{Lang::T('Created On')}</th> <th>{Lang::T('Created On')}</th>
<th>{Lang::T('Expires On')}</th> <th>{Lang::T('Expires On')}</th>
<th>{Lang::T('Date Done')}</th> <th>{Lang::T('Date Done')}</th>
<th>{Lang::T('Method')}</th> <th>{Lang::T('Method')}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{foreach $order as $ds} {foreach $order as $ds}
<tr> <tr>
<td>{$ds['plan_name']}</td> <td>{$ds['plan_name']}</td>
<td>{$ds['gateway']}</td> <td>{$ds['gateway']}</td>
<td>{$ds['routers']}</td> <td>{$ds['routers']}</td>
<td>{$ds['payment_channel']}</td> <td>{$ds['payment_channel']}</td>
<td>{Lang::moneyFormat($ds['price'])}</td> <td>{Lang::moneyFormat($ds['price'])}</td>
<td class="text-primary">{Lang::dateTimeFormat($ds['created_date'])}</td> <td class="text-primary">{Lang::dateTimeFormat($ds['created_date'])}</td>
<td class="text-danger">{Lang::dateTimeFormat($ds['expired_date'])}</td> <td class="text-danger">{Lang::dateTimeFormat($ds['expired_date'])}</td>
<td class="text-success">{if $ds['status']!=1}{Lang::dateTimeFormat($ds['paid_date'])}{/if}</td> <td class="text-success">{if $ds['status']!=1}{Lang::dateTimeFormat($ds['paid_date'])}{/if}</td>
<td>{if $ds['status']==1}{Lang::T('UNPAID')} <td>{if $ds['status']==1}{Lang::T('UNPAID')}
{elseif $ds['status']==2}{Lang::T('PAID')} {elseif $ds['status']==2}{Lang::T('PAID')}
{elseif $ds['status']==3}{$_L['FAILED']} {elseif $ds['status']==3}{$_L['FAILED']}
{elseif $ds['status']==4}{Lang::T('CANCELED')} {elseif $ds['status']==4}{Lang::T('CANCELED')}
{elseif $ds['status']==5}{Lang::T('UNKNOWN')} {elseif $ds['status']==5}{Lang::T('UNKNOWN')}
{/if}</td> {/if}</td>
</tr> </tr>
{/foreach} {/foreach}
</tbody> </tbody>
{/if} {/if}
</table> </table>
</div> </div>