Clear rider and hub when destination coordinates change. #424
This commit is contained in:
parent
be52d089d2
commit
87db4f4a4f
1 changed files with 31 additions and 1 deletions
|
|
@ -750,6 +750,7 @@ $(function() {
|
|||
{% if mode in ['onestep'] %}
|
||||
// get nearest hubs ajax
|
||||
var hub_table = '';
|
||||
var rider_table = '';
|
||||
$.getJSON("{{ url('hub_nearest') }}?lat=" + lat + "&long=" + lng, function(data) {
|
||||
var hubs = data['hubs'];
|
||||
for (i in hubs) {
|
||||
|
|
@ -768,11 +769,23 @@ $(function() {
|
|||
$('#nearest_hubs').html(hub_table);
|
||||
|
||||
});
|
||||
|
||||
// clear rider table
|
||||
rider_table += '<tr>';
|
||||
rider_table += '<td>' + '</td>';
|
||||
rider_table += '<td>' + '</td>';
|
||||
rider_table += '<td>' + '</td>';
|
||||
rider_table += '<td>' + '</td>';
|
||||
rider_table += '</tr>';
|
||||
|
||||
$('#riders').html(rider_table);
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if mode in ['onestep-edit'] %}
|
||||
// get nearest hubs ajax
|
||||
var hub_table = '';
|
||||
var rider_table = '';
|
||||
$.getJSON("{{ url('hub_nearest') }}?lat=" + lat + "&long=" + lng, function(data) {
|
||||
var hubs = data['hubs'];
|
||||
for (i in hubs) {
|
||||
|
|
@ -794,8 +807,22 @@ $(function() {
|
|||
|
||||
}
|
||||
|
||||
$('#nearest_hubs').html(hub_table);
|
||||
$('#nearest_hubs').html(hub_table);
|
||||
|
||||
});
|
||||
|
||||
if (selected_rider == '') {
|
||||
// clear rider table
|
||||
rider_table += '<tr>';
|
||||
rider_table += '<td>' + '</td>';
|
||||
rider_table += '<td>' + '</td>';
|
||||
rider_table += '<td>' + '</td>';
|
||||
rider_table += '<td>' + '</td>';
|
||||
rider_table += '</tr>';
|
||||
|
||||
$('#riders').html(rider_table);
|
||||
}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if mode in ['view-all', 'update-fulfillment'] %}
|
||||
|
|
@ -849,6 +876,9 @@ $(function() {
|
|||
});
|
||||
|
||||
osm_map.on('click', function(e) {
|
||||
// clear selected hub and riders
|
||||
selected_hub = '';
|
||||
selected_rider = '';
|
||||
selectPoint(e.latlng.lat, e.latlng.lng);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue