Add highlight to selected hub and rider when loading onestepedit form. #312

This commit is contained in:
Korina Cordero 2020-01-25 10:42:26 +00:00
parent 6468954316
commit 96bed8a49e

View file

@ -666,6 +666,18 @@ $(function() {
});
{% endif %}
{% if mode in ['onestep-edit'] %}
// get nearest hubs ajax
$.getJSON("{{ url('hub_nearest') }}?lat=" + lat + "&long=" + lng, function(data) {
var hubs = data['hubs'];
for (i in hubs) {
var hub = hubs[i];
var hub_marker = L.marker([hub['lat'], hub['long']], { icon: icon_hub });
hubLayerGroup.addLayer(hub_marker);
}
});
{% endif %}
// add marker to layer group
markerLayerGroup.addLayer(marker);
@ -729,7 +741,14 @@ $(function() {
});
$(function() {
var selected_hub = "";
{% if mode in ['onestep-edit'] %}
var selected_hub = '{{ obj.getHub ? obj.getHub.getID: "" }}';
$('#hub-field').val(selected_hub);
{% endif %}
{% if mode in ['onestep'] %}
var selected_hub = '';
{% endif %}
$('#hubs-table').on('click', 'tr', function() {
var id = $(this).data('id');
@ -781,7 +800,13 @@ $(function() {
});
$(function() {
{% if mode in ['onestep-edit'] %}
var selected_rider = '{{ obj.getRider ? obj.getRider.getID: "" }}';
$('#rider-field').val(selected_rider);
{% endif %}
{% if mode in ['onestep'] %}
var selected_rider = '';
{% endif %}
$('#rider-table').on('click', 'tr', function() {
var id = $(this).data('id');