You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HelenaExpressApp/www/assets/js/serviceareamap.js

185 lines
9.0 KiB
JavaScript

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
function loadServiceAreaMap() {
if (MapControl.supported()) {
if (serviceAreaMap == null) {
var mapboxel = document.getElementById("mapbox-servicearea");
serviceAreaMap = new MapControl(mapboxel, true);
serviceAreaMap.reloadMap();
serviceAreaMap.mapObj.on('load', function () {
serviceAreaMap.mapObj.jumpTo({center: [-112.005, 46.589], zoom: 9});
serviceAreaMap.mapObj.addSource('servicearea', {
'type': 'geojson',
'data': {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"label": "Notary"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-111.94158554077148,
46.75621029973824
],
[
-112.09058761596678,
46.73880181507399
],
[
-112.11393356323242,
46.594849313729064
],
[
-112.13109970092773,
46.53135096527468
],
[
-112.05350875854492,
46.51410624997797
],
[
-111.92647933959961,
46.50819926727706
],
[
-111.83721542358398,
46.537491596723235
],
[
-111.79738998413086,
46.63800459887636
],
[
-111.86948776245116,
46.738095947110935
],
[
-111.94158554077148,
46.75621029973824
]
]
]
}
},
{
"type": "Feature",
"properties": {
"label": "Courier"
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-111.40274047851562,
46.2957133089894
],
[
-111.42059326171874,
46.49082901981415
],
[
-111.62109375,
46.64755071082884
],
[
-111.80923461914062,
46.800999519926314
],
[
-111.92184448242188,
46.991494313050424
],
[
-111.90261840820312,
47.09537035351024
],
[
-112.02346801757812,
47.15236927446393
],
[
-112.24456787109375,
47.09163058564968
],
[
-112.38704681396484,
46.93901161506044
],
[
-112.39013671875,
46.72856582519053
],
[
-112.36953735351562,
46.53052428878426
],
[
-112.16285705566406,
46.430285240839964
],
[
-112.02896118164061,
46.35522171093644
],
[
-111.6815185546875,
46.31089291474789
],
[
-111.47415161132812,
46.29761098988109
],
[
-111.40274047851562,
46.2957133089894
]
]
]
}
}
]
}
});
serviceAreaMap.mapObj.addLayer({
'id': 'courierservicearea',
'type': 'fill',
'source': 'servicearea',
'paint': {
'fill-color': '#005387',
'fill-opacity': 0.4
},
'filter': ['==', 'label', 'Courier']
});
serviceAreaMap.mapObj.addLayer({
'id': 'notaryservicearea',
'type': 'fill',
'source': 'servicearea',
'paint': {
'fill-color': '#008733',
'fill-opacity': 0.4
},
'filter': ['==', 'label', 'Notary']
});
});
}
} else {
showWebGLErrorMessage();
}
}
function openServiceAreaExtraChargeInfo() {
app.dialog.alert("If you need a notary outside the green zone, the travel fee will be calculated \n\
using the current IRS mileage rate. If you need courier service outside the blue zone, we can accomodate \n\
but our delivery window guarantees will not apply.", "Info");
}