Add Location Picker
This commit is contained in:
parent
ffe913cb8f
commit
177cdef1cd
@ -5,6 +5,7 @@
|
|||||||
## 2024.3.22
|
## 2024.3.22
|
||||||
|
|
||||||
- Fix Broadcast Message by @Focuslinkstech
|
- Fix Broadcast Message by @Focuslinkstech
|
||||||
|
- Add Location Picker
|
||||||
|
|
||||||
## 2024.3.20
|
## 2024.3.20
|
||||||
|
|
||||||
|
@ -16,6 +16,10 @@ if (empty ($action)) {
|
|||||||
$action = 'list';
|
$action = 'list';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$leafletpickerHeader = <<<EOT
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css">
|
||||||
|
EOT;
|
||||||
|
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'list':
|
case 'list':
|
||||||
$search = _post('search');
|
$search = _post('search');
|
||||||
@ -89,6 +93,7 @@ switch ($action) {
|
|||||||
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin', 'Agent', 'Sales'])) {
|
if (!in_array($admin['user_type'], ['SuperAdmin', 'Admin', 'Agent', 'Sales'])) {
|
||||||
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
|
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
|
||||||
}
|
}
|
||||||
|
$ui->assign('xheader', $leafletpickerHeader);
|
||||||
run_hook('view_add_customer'); #HOOK
|
run_hook('view_add_customer'); #HOOK
|
||||||
$ui->display('customers-add.tpl');
|
$ui->display('customers-add.tpl');
|
||||||
break;
|
break;
|
||||||
@ -210,7 +215,6 @@ switch ($action) {
|
|||||||
$customFields = ORM::for_table('tbl_customers_fields')
|
$customFields = ORM::for_table('tbl_customers_fields')
|
||||||
->where('customer_id', $customer['id'])
|
->where('customer_id', $customer['id'])
|
||||||
->find_many();
|
->find_many();
|
||||||
|
|
||||||
$v = $routes['3'];
|
$v = $routes['3'];
|
||||||
if (empty ($v)) {
|
if (empty ($v)) {
|
||||||
$v = 'activation';
|
$v = 'activation';
|
||||||
@ -260,6 +264,7 @@ switch ($action) {
|
|||||||
if ($d) {
|
if ($d) {
|
||||||
$ui->assign('d', $d);
|
$ui->assign('d', $d);
|
||||||
$ui->assign('customFields', $customFields);
|
$ui->assign('customFields', $customFields);
|
||||||
|
$ui->assign('xheader', $leafletpickerHeader);
|
||||||
$ui->display('customers-edit.tpl');
|
$ui->display('customers-edit.tpl');
|
||||||
} else {
|
} else {
|
||||||
r2(U . 'customers/list', 'e', $_L['Account_Not_Found']);
|
r2(U . 'customers/list', 'e', $_L['Account_Not_Found']);
|
||||||
|
@ -534,5 +534,6 @@
|
|||||||
"20_Seconds": "20 Seconds",
|
"20_Seconds": "20 Seconds",
|
||||||
"Use_at_least_5_secs_if_you_are_sending_to_all_customers_to_avoid_being_banned_by_your_message_provider": "Use at least 5 secs if you are sending to all customers to avoid being banned by your message provider",
|
"Use_at_least_5_secs_if_you_are_sending_to_all_customers_to_avoid_being_banned_by_your_message_provider": "Use at least 5 secs if you are sending to all customers to avoid being banned by your message provider",
|
||||||
"Testing__if_checked_no_real_message_is_sent_": "Testing [if checked no real message is sent]",
|
"Testing__if_checked_no_real_message_is_sent_": "Testing [if checked no real message is sent]",
|
||||||
"All_fields_are_required": "All fields are required"
|
"All_fields_are_required": "All fields are required",
|
||||||
|
"Personal": "Personal"
|
||||||
}
|
}
|
@ -73,17 +73,6 @@
|
|||||||
<textarea name="address" id="address" class="form-control"></textarea>
|
<textarea name="address" id="address" class="form-control"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-3 control-label">{Lang::T('Coordinates')}</label>
|
|
||||||
<div class="col-md-9">
|
|
||||||
<input name="coordinates" id="coordinates" class="form-control" value=""
|
|
||||||
placeholder="6.465422, 3.406448">
|
|
||||||
<span class="help-block">
|
|
||||||
<small>{Lang::T('Latitude and Longitude coordinates for map must be separate with comma
|
|
||||||
","')}</small>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-3 control-label">{Lang::T('Service Type')}</label>
|
<label class="col-md-3 control-label">{Lang::T('Service Type')}</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
@ -105,6 +94,14 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-3 control-label">{Lang::T('Coordinates')}</label>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<input name="coordinates" id="coordinates" class="form-control" value=""
|
||||||
|
placeholder="6.465422, 3.406448">
|
||||||
|
<div id="map" style="width: '100%'; height: 200px; min-height: 150px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -163,6 +160,42 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js"></script>
|
||||||
|
<script>
|
||||||
|
function getLocation() {
|
||||||
|
if (navigator.geolocation) {
|
||||||
|
navigator.geolocation.getCurrentPosition(showPosition);
|
||||||
|
} else {
|
||||||
|
setupMap(51.505, -0.09);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showPosition(position) {
|
||||||
|
setupMap(position.coords.latitude, position.coords.longitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupMap(lat, lon) {
|
||||||
|
var map = L.map('map').setView([lat, lon], 13);
|
||||||
|
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>',
|
||||||
|
subdomains: 'abcd',
|
||||||
|
maxZoom: 20
|
||||||
|
}).addTo(map);
|
||||||
|
var marker = L.marker([lat, lon]).addTo(map);
|
||||||
|
map.on('click', function(e){
|
||||||
|
var coord = e.latlng;
|
||||||
|
var lat = coord.lat;
|
||||||
|
var lng = coord.lng;
|
||||||
|
var newLatLng = new L.LatLng(lat, lng);
|
||||||
|
marker.setLatLng(newLatLng);
|
||||||
|
$('#coordinates').val(lat + ',' + lng);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
window.onload = function() {
|
||||||
|
getLocation();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
{/literal}
|
{/literal}
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,16 +77,6 @@
|
|||||||
<textarea name="address" id="address" class="form-control">{$d['address']}</textarea>
|
<textarea name="address" id="address" class="form-control">{$d['address']}</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-3 control-label">{Lang::T('Coordinates')}</label>
|
|
||||||
<div class="col-md-9">
|
|
||||||
<input name="coordinates" id="coordinates" class="form-control" value="{$d['coordinates']}">
|
|
||||||
<span class="help-block">
|
|
||||||
<small>{Lang::T('Latitude and Longitude coordinates for map must be separate with comma
|
|
||||||
","')}</small>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-3 control-label">{Lang::T('Service Type')}</label>
|
<label class="col-md-3 control-label">{Lang::T('Service Type')}</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
@ -98,17 +88,25 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-3 control-label">{Lang::T('Account Type')}</label>
|
<label class="col-md-3 control-label">{Lang::T('Account Type')}</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<select class="form-control" id="account_type" name="account_type">
|
<select class="form-control" id="account_type" name="account_type">
|
||||||
<option value="Personal" {if $d['account_type'] eq 'Personal' }selected{/if}>Personal
|
<option value="Personal" {if $d['account_type'] eq 'Personal' }selected{/if}>Personal
|
||||||
</option>
|
</option>
|
||||||
<option value="Business" {if $d['account_type'] eq 'Business' }selected{/if}>Business</option>
|
<option value="Business" {if $d['account_type'] eq 'Business' }selected{/if}>Business
|
||||||
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-md-3 control-label">{Lang::T('Coordinates')}</label>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<input name="coordinates" id="coordinates" class="form-control" value="{$d['coordinates']}"
|
||||||
|
placeholder="6.465422, 3.406448">
|
||||||
|
<div id="map" style="width: '100%'; height: 200px; min-height: 150px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -186,6 +184,47 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js"></script>
|
||||||
|
<script>
|
||||||
|
function getLocation() {
|
||||||
|
if (navigator.geolocation) {
|
||||||
|
navigator.geolocation.getCurrentPosition(showPosition);
|
||||||
|
} else {
|
||||||
|
setupMap(51.505, -0.09);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showPosition(position) {
|
||||||
|
setupMap(position.coords.latitude, position.coords.longitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupMap(lat, lon) {
|
||||||
|
var map = L.map('map').setView([lat, lon], 13);
|
||||||
|
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>',
|
||||||
|
subdomains: 'abcd',
|
||||||
|
maxZoom: 20
|
||||||
|
}).addTo(map);
|
||||||
|
var marker = L.marker([lat, lon]).addTo(map);
|
||||||
|
map.on('click', function(e) {
|
||||||
|
var coord = e.latlng;
|
||||||
|
var lat = coord.lat;
|
||||||
|
var lng = coord.lng;
|
||||||
|
var newLatLng = new L.LatLng(lat, lng);
|
||||||
|
marker.setLatLng(newLatLng);
|
||||||
|
$('#coordinates').val(lat + ',' + lng);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
window.onload = function() {
|
||||||
|
{/literal}{if $d['coordinates']}
|
||||||
|
setupMap({$d['coordinates']});
|
||||||
|
{else}
|
||||||
|
getLocation();
|
||||||
|
{/if}{literal}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
{/literal}
|
{/literal}
|
||||||
|
|
||||||
{include file="sections/footer.tpl"}
|
{include file="sections/footer.tpl"}
|
@ -38,7 +38,7 @@
|
|||||||
</li>
|
</li>
|
||||||
{/if}
|
{/if}
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<b>{Lang::T('Coordinates')}</b> <span class="pull-right">{Lang::T($d['coordinates'])}</span>
|
<b>{Lang::T('Coordinates')}</b> <span class="pull-right">{$d['coordinates']}</span>
|
||||||
</li>
|
</li>
|
||||||
<!--Customers Attributes view start -->
|
<!--Customers Attributes view start -->
|
||||||
{if $customFields}
|
{if $customFields}
|
||||||
|
@ -5,14 +5,27 @@
|
|||||||
|
|
||||||
{literal}
|
{literal}
|
||||||
<script>
|
<script>
|
||||||
window.onload = function() {
|
function getLocation() {
|
||||||
var map = L.map('map').setView([51.505, -0.09], 13);
|
if (navigator.geolocation) {
|
||||||
|
navigator.geolocation.getCurrentPosition(showPosition);
|
||||||
|
} else {
|
||||||
|
setupMap(51.505, -0.09);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showPosition(position) {
|
||||||
|
setupMap(position.coords.latitude, position.coords.longitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupMap(lat, lon) {
|
||||||
|
var map = L.map('map').setView([lat, lon], 13);
|
||||||
var group = L.featureGroup().addTo(map);
|
var group = L.featureGroup().addTo(map);
|
||||||
|
|
||||||
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);
|
||||||
@ -40,6 +53,9 @@
|
|||||||
|
|
||||||
map.fitBounds(group.getBounds());
|
map.fitBounds(group.getBounds());
|
||||||
}
|
}
|
||||||
|
window.onload = function() {
|
||||||
|
getLocation();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
{/literal}
|
{/literal}
|
||||||
{include file="sections/footer.tpl"}
|
{include file="sections/footer.tpl"}
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"version": "2024.3.22"
|
"version": "2024.3.22.1"
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user