-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathincident report center.php
331 lines (250 loc) · 10.4 KB
/
incident report center.php
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
<!doctype html>
<html lang="en">
<head>
<title>DMS</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<!-- custom stylesheets -->
<link rel="stylesheet" href="/css/common-layout.css">
<link rel="stylesheet" href="/css/common-text.css">
<!-- fontawesome cdn -->
<script src="https://use.fontawesome.com/1cc2ffd043.js"></script>
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDjW-Cq9fUukw6QRyUEtsiSwQBiKDiZEjQ"></script>
<!-- offline stylesheets -->
<!-- Bootstrap library -->
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> -->
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- jQuery UI library -->
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<!-- Google JavaScript API -->
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDjW-Cq9fUukw6QRyUEtsiSwQBiKDiZEjQ"></script>
<script type="text/javascript">
var geocoder;
var map;
var marker;
/*
* Google Map with marker
*/
function initialize() {
var initialLat = $('.search_latitude').val();
var initialLong = $('.search_longitude').val();
initialLat = initialLat ? initialLat : 36.169648;
initialLong = initialLong ? initialLong : -115.141000;
var latlng = new google.maps.LatLng(initialLat, initialLong);
var options = {
zoom: 16,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("geomap"), options);
geocoder = new google.maps.Geocoder();
marker = new google.maps.Marker({
map: map,
draggable: true,
position: latlng
});
google.maps.event.addListener(marker, "dragend", function() {
var point = marker.getPosition();
map.panTo(point);
geocoder.geocode({
'latLng': marker.getPosition()
}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
marker.setPosition(results[0].geometry.location);
$('.search_addr').val(results[0].formatted_address);
$('.search_latitude').val(marker.getPosition().lat());
$('.search_longitude').val(marker.getPosition().lng());
}
});
});
}
$(document).ready(function() {
//load google map
initialize();
/*
* autocomplete location search
*/
var PostCodeid = '#search_location';
$(function() {
$(PostCodeid).autocomplete({
source: function(request, response) {
geocoder.geocode({
'address': request.term
}, function(results, status) {
response($.map(results, function(item) {
return {
label: item.formatted_address,
value: item.formatted_address,
lat: item.geometry.location.lat(),
lon: item.geometry.location.lng()
};
}));
});
},
select: function(event, ui) {
$('.search_addr').val(ui.item.value);
$('.search_latitude').val(ui.item.lat);
$('.search_longitude').val(ui.item.lon);
var latlng = new google.maps.LatLng(ui.item.lat, ui.item.lon);
marker.setPosition(latlng);
initialize();
}
});
});
/*
* Point location on google map
*/
$('.get_map').click(function(e) {
var address = $(PostCodeid).val();
geocoder.geocode({
'address': address
}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
marker.setPosition(results[0].geometry.location);
$('.search_addr').val(results[0].formatted_address);
$('.search_latitude').val(marker.getPosition().lat());
$('.search_longitude').val(marker.getPosition().lng());
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
e.preventDefault();
});
//Add listener to marker for reverse geocoding
google.maps.event.addListener(marker, 'drag', function() {
geocoder.geocode({
'latLng': marker.getPosition()
}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[0]) {
$('.search_addr').val(results[0].formatted_address);
$('.search_latitude').val(marker.getPosition().lat());
$('.search_longitude').val(marker.getPosition().lng());
}
}
});
});
});
</script>
<style>
#geomap {
width: 100%;
height: 400px;
}
</style>
</head>
<body>
<?php
include_once'header.php'
?>
<!-- nav end -->
<br>
<form action="report/incident report center.re.php" method="POST">
<div class="container">
<div class="card card-body">
<!-- National Identification Number -->
<div class="form-group">
<label for="exampleInputEmail1">National Identification Number</label>
<input type="input" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="NIC Number">
</div>
<!-- User Name -->
<div class="form-group">
<label for="exampleInputEmail1">User Name</label>
<input type="input" class="form-control" name="user_name" placeholder="User Name">
</div>
<!-- Email address -->
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" name="user_email" placeholder="Enter email">
</div>
<!-- Search Incident Location -->
<!-- map part -->
<br>
<div class="card card-body">
<h4>Search Incident Location</h4>
<!-- search input box -->
<form>
<div class="form-group input-group col-sm-6">
<input type="text" id="search_location" class="form-control" placeholder="Search location">
<div class="input-group-btn">
<button class="btn btn-danger get_map" type="submit">
Locate
</button>
</div>
</div>
</form>
<br>
<!-- display google map -->
<div id="geomap"></div>
<br><br>
<!-- display selected location information -->
<h4>Incident Location Details</h4><br>
<p>Address: <input type="text" class="search_addr" size="45"></p><br>
<p>Latitude: <input type="text" class="search_latitude" size="30"></p><br>
<p>Longitude: <input type="text" class="search_longitude" size="30"></p><br>
<!-- Address -->
<div class="form-group">
<small id="emailHelp" class="form-text text-muted">Copy your Incident location details & paste on Location input field*</small>
<label for="exampleInputEmail1">Address</label>
<input type="input" class="form-control" name="address" placeholder="Enter Address">
</div>
<!-- Latitude -->
<div class="form-group">
<label for="exampleInputEmail1">Latitude</label>
<input type="input" class="form-control" name="latitude" placeholder="Enter Latitude">
</div>
<!-- Longitude -->
<div class="form-group">
<label for="exampleInputEmail1">Longitude</label>
<input type="input" class="form-control" name="latitude" placeholder="Enter Longitude">
</div>
</div>
<!-- Incident Type -->
<br>
<div class="form-group">
<label for="exampleFormControlSelect1">Incident Type</label><br>
<select class="form-control" name="incident">
<option>Natural Disaster</option>
<option>Road Side Accident</option>
<option>Fire</option>
<option>Electric Breakdown</option>
<option>Leakages</option>
</select>
</div>
<br>
<!-- Explanation For The Incident -->
<div class="form-group">
<label for="exampleFormControlTextarea1">Explanation For The Incident</label>
<textarea class="form-control" name="explanation" rows="3"></textarea>
</div>
<br>
<button class="btn btn btn-warning btn-space my-2 my-sm-0" type="submit" name="submit">Submit</button>
<br>
</form>
</div>
</div>
</div>
<br>
</div>
<?php
include_once'footer.php'
?>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
<script src="libs/jquery-3.2.1.min.js"></script>
<script src="scripts/script.js">
</script>
</body>
</html>