Add highlight to selected hub and rider when loading onestepedit form. #312
This commit is contained in:
parent
6468954316
commit
96bed8a49e
1 changed files with 27 additions and 2 deletions
|
|
@ -666,6 +666,18 @@ $(function() {
|
||||||
});
|
});
|
||||||
{% endif %}
|
{% 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
|
// add marker to layer group
|
||||||
markerLayerGroup.addLayer(marker);
|
markerLayerGroup.addLayer(marker);
|
||||||
|
|
||||||
|
|
@ -729,7 +741,14 @@ $(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
$(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() {
|
$('#hubs-table').on('click', 'tr', function() {
|
||||||
var id = $(this).data('id');
|
var id = $(this).data('id');
|
||||||
|
|
||||||
|
|
@ -781,7 +800,13 @@ $(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
var selected_rider = '';
|
{% 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() {
|
$('#rider-table').on('click', 'tr', function() {
|
||||||
var id = $(this).data('id');
|
var id = $(this).data('id');
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue