Center map when selecting a nearby outlet on job order form
This commit is contained in:
parent
d0d83531bb
commit
4dbdca870b
1 changed files with 6 additions and 1 deletions
|
|
@ -359,7 +359,7 @@
|
|||
</tr>
|
||||
|
||||
{% for outlet in outlets %}
|
||||
<tr data-id="{{ outlet.outlet.getID }}"{{ obj.getOutlet and obj.getOutlet.getID == outlet.outlet.getID ? ' class="m-table__row--primary"' }}>
|
||||
<tr data-lat="{{ outlet.outlet.getCoordinates.getLatitude }}" data-lng="{{ outlet.outlet.getCoordinates.getLongitude }}" data-id="{{ outlet.outlet.getID }}"{{ obj.getOutlet and obj.getOutlet.getID == outlet.outlet.getID ? ' class="m-table__row--primary"' }}>
|
||||
<td>{{ outlet.outlet.getName }}</td>
|
||||
<td>{{ outlet.outlet.getAddress }}</td>
|
||||
<td>{{ outlet.outlet.getContactNumbers }}</td>
|
||||
|
|
@ -974,6 +974,8 @@ $(function() {
|
|||
|
||||
$("#outlets-table tbody tr").click(function() {
|
||||
var id = $(this).data('id');
|
||||
var lat = $(this).data('lat');
|
||||
var lng = $(this).data('lng');
|
||||
|
||||
if (id != selectedOutlet) {
|
||||
// highlight this row, set outlet value
|
||||
|
|
@ -983,6 +985,9 @@ $(function() {
|
|||
|
||||
// set value
|
||||
selectedOutlet = id;
|
||||
|
||||
// center the map
|
||||
omap.setCenter(lat, lng);
|
||||
} else {
|
||||
// unhighlight this row
|
||||
$(this).removeClass('m-table__row--primary');
|
||||
|
|
|
|||
Loading…
Reference in a new issue