-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
107 lines (98 loc) · 5.67 KB
/
index.html
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>DOPL Data</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<style type="text/css">
body { margin-top: 30px; }
table { font-size: 13px; margin-top: 50px; }
</style>
</head>
<body>
<!-- Search -->
<div class="container">
<h3>Utah Business License Search</h3>
<div class="form" style="width: 500px;">
<div class="form-group row">
<label class="col-sm-2 col-form-label">Name</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="name" value="Boyd">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">City</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="city" value="Park City">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">Profession</label>
<div class="col-sm-10">
<select class="form-control" id="profession">
<option>-- All --</option>
<option>ACCOUNTANCY</option><option>ACUPUNCTURE</option><option>ARCHITECT</option><option>ATHLETE AGENTS</option><option>ATHLETIC TRAINER</option><option>BUILDING INSPECTOR</option><option>BURGLAR ALARM</option><option>CHIROPRACTIC</option><option>CLINICAL MENTAL HEALTH</option><option>COMMERCIAL INTERIOR DESIGN</option><option>CONTRACTOR</option><option>COSMETOLOGY</option><option>COURT REPORTER</option><option>CS PRECURSOR</option><option>DECEPTION DETECTION</option><option>DENTAL</option><option>DIETITIAN</option><option>DIRECT-ENTRY MIDWIFE</option><option>ELECTRICIAN</option><option>ELEVATOR MECHANIC</option><option>ENGINEER/LAND SURVEYOR</option><option>ENVIRONMENTAL HEALTH SCIENTIST</option><option>FACTORY BUILT HOUSING</option><option>FUNERAL SERVICE</option><option>GENETIC COUNSELOR</option><option>GEOLOGIST</option><option>HANDYMAN</option><option>HEALTH FACILITY ADMINISTRATOR</option><option>HEARING INSTRUMENT</option><option>HUNTING GUIDES/OUTFITTERS</option><option>LANDSCAPE ARCHITECT</option><option>LIEN RECOVERY FUND MEMBER</option><option>MARRIAGE & FAMILY THERAPY</option><option>MASSAGE</option><option>MEDICAL LANGUAGE INTERPRETER</option><option>MEDICATION AIDE - CERTIFIED</option><option>MUSIC THERAPY</option><option>NATUROPATHIC</option><option>NURSE</option><option>OCCUPATIONAL THERAPY</option><option>ONLINE INTERNET FACILITATOR</option><option>OPTOMETRIST</option><option>OSTEOPATHIC PHYSICIAN</option><option>PHARMACY</option><option>PHYSICAL THERAPIST</option><option>PHYSICIAN</option><option>PHYSICIAN ASSISTANT</option><option>PLUMBER</option><option>PODIATRIC PHYSICIAN</option><option>PRENEED</option><option>PRIVATE PROBATION PROVIDER</option><option>PSYCHOLOGIST</option><option>RADIOLOGY</option><option>RECREATIONAL THERAPY</option><option>RESPIRATORY CARE</option><option>SECURITY COMPANIES & GUARDS</option><option>SOCIAL WORK</option><option>SPEECH/AUDIOLOGY</option><option>SUBSTANCE USE DISORDER</option><option>VETERINARIAN</option><option>VOCATIONAL REHAB COUNSELOR</option>
</select>
</div>
</div>
<div class="form-group row">
<div class="col-sm-10">
<button type="submit" class="btn btn-primary" onclick="search()">Search</button>
</div>
</div>
</div>
<!-- Results -->
<table class="table table-hover table-sm">
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">City</th>
<th scope="col">Profession</th>
<th scope="col">Type</th>
<th scope="col">License #</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody id="table"></tbody>
</table>
</div>
<script type="text/javascript">
function search() {
const sheetId = "1_J-LBNfY5sbomBx8k4Lg58rmzJcwFSfI4dm64dR0Rx4";
const name = document.getElementById("name").value.toUpperCase();
const city = document.getElementById("city").value.toUpperCase();
let e = document.getElementById("profession");
const profession = e.options[e.selectedIndex].text;
// Marshall query
let query = "where B contains '"+name+"'";
if (city.length > 0) query = query+" and C = '"+city+"'";
if (profession != "-- All --") query = query+" and D = '"+profession+"'";
query = encodeURIComponent(query+" limit 50");
// Clear results table
document.getElementById("table").innerHTML = "";
// query the database
fetch('https://docs.google.com/a/google.com/spreadsheets/d/'+sheetId+'/gviz/tq?tq='+query)
.then(function(rsp) { return rsp.text() })
.then(function(text) {
// Convert JSONP response to object
let tmp = text.replace('/*O_o*/\ngoogle.visualization.Query.setResponse(','')
let obj = JSON.parse(tmp.substring(0, tmp.length - 2));
// No search results
if (obj.table.rows.length == 0) alert("Nothing found");
// Populate row
for (var row = 0; row < obj.table.rows.length; row++) {
let table = document.getElementById("table");
let newRow = table.insertRow(-1);
let newCell = null;
// Populate cells in row
for (var i = 1; i < 7; i++) {
newCell = newRow.insertCell(-1);
if (i == 1) newCell.innerHTML = '<a href="https://secure.utah.gov/llv/search/detail.html?license_id='+obj.table.rows[row].c[0].v+'" target="_blank">'+obj.table.rows[row].c[1].v+'</a>';
else newCell.innerHTML = obj.table.rows[row].c[i].v;
}
}
});
}
</script>
</body>
</html>