-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdriver_final.php
More file actions
227 lines (173 loc) · 6.84 KB
/
Copy pathdriver_final.php
File metadata and controls
227 lines (173 loc) · 6.84 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
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
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="icon" href="logo3.png" type="image/gif" sizes="16x16">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<title>Yo cabs-Driver</title>
<style type="text/css">
body{
background-image: url("img1.jpg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
opacity: 0.85;
}
.maincard{
margin: 50px;
}
.card-title{
font-style: italic;
text-decoration: underline;
}
p{
font-weight: bold;
font-size: 20px;
font-family: lato;
}
.btn{
border-radius: 0;
}
.mydiv {
background-color: white;
width: 700px;
height: 300px;
border: 1px dotted black;
overflow: scroll;
padding-left: 20px;
margin-left: 60px;
border-style: solid;
}
</style>
</head>
<body>
<div class="card maincard">
<div class="card-body">
<div class="row">
<div class="col-sm-6">
<div class="card">
<div class="card-body">
<h5 class="card-title">Customer Details</h5>
<br>
<p><img src="logo3.png" width="100" height="100" class="d-block " style="margin: auto;" ></p>
<p>Customer Name : </p>
<p>Time : </p>
<p>Date : </p>
<p>Fare : </p>
<br>
<button type="button" class="btn btn-primary btn-lg btn-block">Contact Customer</button>
<button type="button" class="btn btn-danger btn-lg btn-block">Cancel Ride</button>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="card">
<div class="card-body">
<!-- Maps Goes Here-->
<div id="dvMap" style="width: 480px; height: 490px;"> </div>
</div>
</div>
</div>
</div>
<div class="card" style="margin-top: 10px;">
<div class="card-body">
<!-- navigation Goes Here-->
<form>
<div class="form-row">
<div class="form-group col-md-12">
<label ><i class="fas fa-circle" style="color: green;"></i> Enter Pickup</label>
<input type="text" class="form-control" id="txtSource" placeholder="Pickup">
</div>
<div class="form-group col-md-12">
<label ><i class="fas fa-circle" style="color: red;"></i> Enter Destination</label>
<input type="text" class="form-control" id="txtDestination" placeholder="Destination">
</div>
</form>
<button type="button" class="btn btn-primary" value="Get Route" onclick="GetRoute()" id="calculate" style="height: 50px; width: 200px;">Check Navigation </button>
<div class="mydiv">
<div id="dvPanel" style="width: 500px; height: 500px; margin-top: 10px;"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyD1R5QWrqEMfU9qPpah3ufkQmeSWBEVtRo&libraries=places&callback=initMap"
async defer></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"></script> -->
<script type="text/javascript">
function initMap() {
var map = new google.maps.Map(document.getElementById('dvMap'), {
mapTypeControl: false,
center: {lat: 28.5621, lng: 77.2841},
zoom: 13
});
new AutocompleteDirectionsHandler(map);
}
var source, destination;
var directionsDisplay;
var directionsService = new google.maps.DirectionsService();
google.maps.event.addDomListener(window, 'load', function () {
new google.maps.places.SearchBox(document.getElementById('txtSource'));
new google.maps.places.SearchBox(document.getElementById('txtDestination'));
directionsDisplay = new google.maps.DirectionsRenderer({ 'draggable': true });
});
function GetRoute() {
var mumbai = new google.maps.LatLng(18.9750, 72.8258);
var mapOptions = {
zoom: 7,
center: mumbai
};
map = new google.maps.Map(document.getElementById('dvMap'), mapOptions);
directionsDisplay.setMap(map);
directionsDisplay.setPanel(document.getElementById('dvPanel'));
//*********DIRECTIONS AND ROUTE**********************//
source = document.getElementById("txtSource").value;
destination = document.getElementById("txtDestination").value;
var request = {
origin: source,
destination: destination,
travelMode: google.maps.TravelMode.DRIVING
};
directionsService.route(request, function (response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
//*********DISTANCE AND DURATION**********************//
var service = new google.maps.DistanceMatrixService();
service.getDistanceMatrix({
origins: [source],
destinations: [destination],
travelMode: google.maps.TravelMode.DRIVING,
unitSystem: google.maps.UnitSystem.METRIC,
avoidHighways: false,
avoidTolls: false
}, function (response, status) {
if (status == google.maps.DistanceMatrixStatus.OK && response.rows[0].elements[0].status != "ZERO_RESULTS") {
var distance = response.rows[0].elements[0].distance;
var duration = response.rows[0].elements[0].duration;
var dvDistance = document.getElementById("dvDistance");
dvDistance.innerHTML = "";
dvDistance.innerHTML += "Distance: " + distance + "<br />";
dvDistance.innerHTML += "Duration:" + duration + "<br />";
distance=to_float(distance);
var fare = distance*6;
dvDistance.innerHTML+= "Fare: Rs " + fare + "/-" ;
} else {
alert("Unable to find the distance via road.");
}
});
}
</script>
</body>
</html>