-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinformation.js
More file actions
81 lines (62 loc) · 2.35 KB
/
information.js
File metadata and controls
81 lines (62 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
$( document ).ready(function() {
$('#dateOfBirth').datepicker();
let currentForm = 'personal-info';
$('#personal-info-next').click((e) => {
e.preventDefault();
$('#personal-info').addClass('hideForm');
$('#address-info').removeClass('hideForm');
currentForm = 'address-info';
});
$('#address-info-next').click((e) => {
e.preventDefault();
$('#address-info').addClass('hideForm');
$('#other-info').removeClass('hideForm');
currentForm = 'other-info';
});
$('#mailingSameAsResidence').click(function(){
if (this.checked) {
$('#mailingAddressFields').addClass('hideForm');
} else if (!this.checked) {
$('#mailingAddressFields').removeClass('hideForm');
}
});
$('#prefConMeth').change(function() {
if (this.value === 'email') {
$('#preferred-time-to-call-input').addClass('hideForm');
} else if (this.value === 'phone') {
$('#preferred-time-to-call-input').removeClass('hideForm');
}
// initiate invisivle map
var map = L.map('queryPrecinctMap');
// get feature layer from honolulu gis map of precincts
var precincts = L.esri.featureLayer({
url:'http://webserverholis.honolulugis.org/arcgis/rest/services/Public/Administrative_Political/MapServer/9',
});
//variables for functions
var latlng;
var precinctID;
var residenceAddress = /*String value from form of the user's address*/
// function used to geo-code user's address into lat-lng object
function geoCodeAddress(address, fn) {
L.esri.Geocoding.geocode().text(residenceAddress).run(function(err, results, response){
console.log(results);
fn(results);
});
}
// function used to query precinct locations by lat-lng
function precinctSite(precinct, fn){
precincts.query().contains(latlng).run(function(error, featureCollection){
//console.log(featureCollection.features[0].properties.PRECINCTID);
fn(featureCollection.features[0].properties.PRECINCTID);
});
};
geoCodeAddress("address", function(latLng) {
//console.log("this is lat lng", latLng.results[0].latlng);
latlng = L.latLng(latLng.results[0].latlng);
precinctSite("precinct", function(location){
//console.log("precinct id",location);
precinctID = location;
/*precinctID should be passed to the user database.Value can then be used to query poll locations*/
});
});
});