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>
|
</tr>
|
||||||
|
|
||||||
{% for outlet in outlets %}
|
{% 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.getName }}</td>
|
||||||
<td>{{ outlet.outlet.getAddress }}</td>
|
<td>{{ outlet.outlet.getAddress }}</td>
|
||||||
<td>{{ outlet.outlet.getContactNumbers }}</td>
|
<td>{{ outlet.outlet.getContactNumbers }}</td>
|
||||||
|
|
@ -974,6 +974,8 @@ $(function() {
|
||||||
|
|
||||||
$("#outlets-table tbody tr").click(function() {
|
$("#outlets-table tbody tr").click(function() {
|
||||||
var id = $(this).data('id');
|
var id = $(this).data('id');
|
||||||
|
var lat = $(this).data('lat');
|
||||||
|
var lng = $(this).data('lng');
|
||||||
|
|
||||||
if (id != selectedOutlet) {
|
if (id != selectedOutlet) {
|
||||||
// highlight this row, set outlet value
|
// highlight this row, set outlet value
|
||||||
|
|
@ -983,6 +985,9 @@ $(function() {
|
||||||
|
|
||||||
// set value
|
// set value
|
||||||
selectedOutlet = id;
|
selectedOutlet = id;
|
||||||
|
|
||||||
|
// center the map
|
||||||
|
omap.setCenter(lat, lng);
|
||||||
} else {
|
} else {
|
||||||
// unhighlight this row
|
// unhighlight this row
|
||||||
$(this).removeClass('m-table__row--primary');
|
$(this).removeClass('m-table__row--primary');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue