Center map when selecting a nearby outlet on job order form

This commit is contained in:
Ramon Gutierrez 2018-01-31 15:40:29 +08:00
parent d0d83531bb
commit 4dbdca870b

View file

@ -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');