#204 Show customer their location when submitting
This commit is contained in:
parent
73264a6af0
commit
cbdb8e9f12
15
index.php
15
index.php
@ -961,10 +961,23 @@ if ( ! isset($_SESSION['c_category']) && ! $hesk_settings['select_cat'])
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($modsForHesk_settings['request_location']):
|
||||
?>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="location" class="col-md-3 control-label"><?php echo $hesklang['location_colon']; ?></label>
|
||||
<div class="col-sm-9">
|
||||
<p id="console"><?php echo $hesklang['requesting_location_ellipsis']; ?></p>
|
||||
<div id="map" style="height: 300px">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Submit -->
|
||||
<?php
|
||||
endif;
|
||||
|
||||
if ($hesk_settings['submit_notice'])
|
||||
{
|
||||
?>
|
||||
@ -1032,7 +1045,7 @@ if ($modsForHesk_settings['request_location'])
|
||||
{
|
||||
echo '
|
||||
<script>
|
||||
requestUserLocation();
|
||||
requestUserLocation("'.$hesklang['your_current_location'].'", "'.$hesklang['unable_to_determine_location'].'");
|
||||
</script>
|
||||
';
|
||||
}
|
||||
|
@ -106,11 +106,17 @@ function changeText(id, checkedValue, uncheckedValue, object) {
|
||||
}
|
||||
}
|
||||
|
||||
function requestUserLocation() {
|
||||
function requestUserLocation(yourLocationText, unableToDetermineText) {
|
||||
if (navigator.geolocation) {
|
||||
navigator.geolocation.getCurrentPosition(function(position) {
|
||||
setLatLon(position.coords.latitude, position.coords.longitude);
|
||||
var latitude = position.coords.latitude;
|
||||
var longitude = position.coords.longitude;
|
||||
setLatLon(latitude, longitude);
|
||||
$('#console').hide();
|
||||
initializeMapForCustomer(latitude, longitude, yourLocationText);
|
||||
}, function(error) {
|
||||
$('#map').hide();
|
||||
$('#console').text(unableToDetermineText).show();
|
||||
switch(error.code) {
|
||||
case error.PERMISSION_DENIED:
|
||||
setLatLon('E-1','E-1');
|
||||
@ -149,6 +155,20 @@ function closeAndReset(lat, lon) {
|
||||
resetLatLon(lat, lon);
|
||||
}
|
||||
|
||||
function initializeMapForCustomer(latitude, longitude, yourLocationText) {
|
||||
map = L.map('map').setView([latitude, longitude], 15);
|
||||
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
|
||||
}).addTo(map);
|
||||
marker = L.marker([latitude, longitude], {draggable: true})
|
||||
.addTo(map)
|
||||
.bindPopup(yourLocationText);
|
||||
|
||||
marker.on('dragend', function(event) {
|
||||
setLatLon(event.target.getLatLng().lat, event.target.getLatLng().lng);
|
||||
});
|
||||
}
|
||||
|
||||
function initializeMapForStaff(latitude, longitude, usersLocationText) {
|
||||
map = L.map('map').setView([latitude, longitude], 15);
|
||||
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
|
||||
|
@ -61,6 +61,10 @@ requirements for tracking their location when the ticket was submitted.";
|
||||
$hesklang['save_location'] = 'Save Location';
|
||||
$hesklang['close_modal_without_saving'] = 'Close without saving';
|
||||
$hesklang['ticket_location_updated'] = 'Ticket location has been updated!';
|
||||
$hesklang['location_colon'] = 'Location:';
|
||||
$hesklang['your_current_location'] = 'Your location';
|
||||
$hesklang['requesting_location_ellipsis'] = 'Requesting location...';
|
||||
$hesklang['unable_to_determine_location'] = 'Unable to determine your location, or you declined to share it.';
|
||||
|
||||
// ADDED OR MODIFIED IN Mods for HESK 2.2.1
|
||||
$hesklang['popart_no_colon']='Top Knowledgebase Articles'; // same as $hesklang['popart'] but without a colon (:)
|
||||
|
Loading…
x
Reference in New Issue
Block a user