Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
Callmycab-Driverapp
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kevin
Callmycab-Driverapp
Commits
e84ac61e
Commit
e84ac61e
authored
Jul 23, 2018
by
Alen Jose
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'alen' into 'master'
july20 See merge request alen/CMC-driver!16
parents
791f17d0
e0cd7a51
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
20 deletions
+48
-20
app.component.ts
src/app/app.component.ts
+6
-6
home.ts
src/pages/home/home.ts
+3
-2
userlocation.ts
src/pages/userlocation/userlocation.ts
+39
-12
No files found.
src/app/app.component.ts
View file @
e84ac61e
...
...
@@ -214,12 +214,12 @@ export class MyApp {
}
liveLoc
(){
this
.
locSubs
=
this
.
geolocation
.
watchPosition
().
filter
((
p
)
=>
p
.
coords
!==
undefined
)
//Filter Out Errors
.
subscribe
(
position
=>
{
firebase
.
database
().
ref
(
"drivers/"
+
this
.
pushId
+
"/"
).
update
({
lat
:
Number
(
position
.
coords
.
latitude
),
lng
:
Number
(
position
.
coords
.
longitude
)
})
//
firebase.database().ref("drivers/" + this.pushId + "/").update({
// lat: 10.014907, lng: 76.363020
})
})
//
this.locSubs = this.geolocation.watchPosition().filter((p) => p.coords !== undefined) //Filter Out Errors
//
.subscribe(position => {
//
firebase.database().ref("drivers/" + this.pushId + "/").update({ lat: Number(position.coords.latitude), lng: Number(position.coords.longitude) })
firebase
.
database
().
ref
(
"drivers/"
+
this
.
pushId
+
"/"
).
update
({
lat
:
10.014638
,
lng
:
76.364054
})
//
})
}
}
src/pages/home/home.ts
View file @
e84ac61e
...
...
@@ -49,8 +49,9 @@ tab_swap(type) {
}
rideDetails
(
data
){
this
.
data
.
setrideData
(
data
)
this
.
navCtrl
.
push
(
'RidedetailsPage'
)
//
this.data.setrideData(data)
//
this.navCtrl.push('RidedetailsPage')
// this.navCtrl.setRoot('QuickridePage', { id: '38'})
this
.
events
.
publish
(
'driver:locOn'
,
''
)
}
}
src/pages/userlocation/userlocation.ts
View file @
e84ac61e
...
...
@@ -29,7 +29,11 @@ export class UserlocationPage {
started
:
boolean
=
false
;
myloc
=
[]
waypoints
=
[]
ride
:
any
;
ride
:
any
;
markers
:
any
;
lastPos
:
any
;
count
:
number
=
0
;
tempPos
:
any
;
constructor
(
public
navCtrl
:
NavController
,
public
navParams
:
NavParams
,
private
geolocation
:
Geolocation
,
private
db
:
AngularFireDatabase
,
private
storage
:
Storage
,
private
myservice
:
Myservice
,
private
menu
:
MenuController
,
private
data
:
dataService
,
public
events
:
Events
)
{
this
.
loadMap
()
...
...
@@ -61,7 +65,7 @@ export class UserlocationPage {
This
.
gotoDirection
(
pick
,
This
.
myloc
)
else
{
This
.
gotoDirection
(
drop
,
This
.
myloc
)
This
.
waypoints
.
push
({
location
:
new
google
.
maps
.
LatLng
(
position
.
coords
.
latitude
,
position
.
coords
.
longitude
)})
This
.
waypoints
.
push
({
location
:
new
google
.
maps
.
LatLng
(
position
.
coords
.
latitude
,
position
.
coords
.
longitude
)
})
}
})
}
...
...
@@ -90,7 +94,15 @@ export class UserlocationPage {
}
gotoDirection
(
dest
,
myloc
)
{
console
.
log
(
'gtd'
)
if
(
this
.
count
==
0
)
this
.
lastPos
=
myloc
//initially last and curnt postn is same
else
if
(
this
.
count
>
1
)
{
//count == 1 means last postn is same as initial postn so dont want to check
this
.
lastPos
=
this
.
tempPos
}
this
.
tempPos
=
[
myloc
[
0
],
myloc
[
1
]]
var
This
=
this
;
var
directionsService
=
new
google
.
maps
.
DirectionsService
;
...
...
@@ -101,18 +113,32 @@ export class UserlocationPage {
var
driverLoc
=
new
google
.
maps
.
LatLng
(
Number
(
myloc
[
0
]),
Number
(
myloc
[
1
]));
var
dimage
=
{
url
:
'assets/img/map_label.png'
,
scaledSize
:
new
google
.
maps
.
Size
(
50
,
22
),
origin
:
new
google
.
maps
.
Point
(
0
,
0
),
anchor
:
new
google
.
maps
.
Point
(
25
,
12
)
path
:
"M17.402,0H5.643C2.526,0,0,3.467,0,6.584v34.804c0,3.116,2.526,5.644,5.643,5.644h11.759c3.116,0,5.644-2.527,5.644-5.644 V6.584C23.044,3.467,20.518,0,17.402,0z M22.057,14.188v11.665l-2.729,0.351v-4.806L22.057,14.188z M20.625,10.773 c-1.016,3.9-2.219,8.51-2.219,8.51H4.638l-2.222-8.51C2.417,10.773,11.3,7.755,20.625,10.773z M3.748,21.713v4.492l-2.73-0.349 V14.502L3.748,21.713z M1.018,37.938V27.579l2.73,0.343v8.196L1.018,37.938z M2.575,40.882l2.218-3.336h13.771l2.219,3.336H2.575z M19.328,35.805v-7.872l2.729-0.355v10.048L19.328,35.805z"
,
//svg image for car
fillColor
:
'#000'
,
fillOpacity
:
.
6
,
anchor
:
new
google
.
maps
.
Point
(
10
,
25
),
strokeWeight
:
0
,
scale
:
1
,
rotation
:
0
};
new
google
.
maps
.
Marker
({
if
(
This
.
markers
)
This
.
markers
.
setMap
(
null
)
var
marker
=
new
google
.
maps
.
Marker
({
position
:
driverLoc
,
map
:
This
.
map
,
icon
:
dimage
});
This
.
markers
=
marker
var
cur
=
new
google
.
maps
.
LatLng
(
myloc
[
0
],
myloc
[
0
])
var
lastPosn
=
new
google
.
maps
.
LatLng
(
This
.
lastPos
[
0
],
This
.
lastPos
[
0
])
var
heading
=
google
.
maps
.
geometry
.
spherical
.
computeHeading
(
lastPosn
,
cur
)
dimage
.
rotation
=
heading
;
marker
.
setIcon
(
dimage
);
// if (google.maps.geometry.spherical.computeDistanceBetween(destLoc, driverLoc) < 100) {
This
.
loc
.
to
=
This
.
details
.
drop_area
This
.
loc
.
from
=
This
.
details
.
pickup_area
...
...
@@ -139,6 +165,7 @@ export class UserlocationPage {
var
bounds
=
response
.
routes
[
0
].
bounds
;
This
.
map
.
fitBounds
(
bounds
);
This
.
map
.
setCenter
(
bounds
.
getCenter
());
This
.
count
++
}
else
{
window
.
alert
(
'Directions request failed due to '
+
status
);
}
...
...
@@ -146,7 +173,7 @@ export class UserlocationPage {
}
startRide
()
{
this
.
myservice
.
load_post
({
status
:
'Started'
,
id
:
this
.
details
.
id
},
'changeStatus'
)
this
.
myservice
.
load_post
({
status
:
'Started'
,
id
:
this
.
details
.
id
},
'changeStatus'
)
this
.
details
.
actualPick
=
new
Date
().
getTime
()
this
.
started
=
true
;
...
...
@@ -188,7 +215,7 @@ export class UserlocationPage {
// var realTime = (1530183600000 - 1530182700000) / 1000 //in seconds
// console.log('google time', calcTime);
// console.log('time taken',realTime);
if
(
calcTime
<
realTime
){
if
(
calcTime
<
realTime
)
{
var
extraHr
=
Math
.
round
(((
realTime
-
calcTime
)
/
3600
)
*
100
)
/
100
//in hrs
// console.log('extra time',extraHr)
This
.
details
.
timeAmount
=
Math
.
round
(
This
.
details
.
extrahour
*
extraHr
)
...
...
@@ -218,8 +245,8 @@ export class UserlocationPage {
This
.
pushId
=
snapshot
.
val
().
push_id
console
.
log
(
This
.
pushId
)
});
This
.
myservice
.
load_post
({
id
:
data
.
id
,
timetype
:
This
.
ride
.
timetype
},
'getRateCard'
).
subscribe
(
response
=>
{
if
(
response
.
status
==
'success'
)
{
This
.
myservice
.
load_post
({
id
:
data
.
id
,
timetype
:
This
.
ride
.
timetype
},
'getRateCard'
).
subscribe
(
response
=>
{
if
(
response
.
status
==
'success'
)
{
This
.
ride
=
response
.
data
This
.
data
.
setrateData
(
This
.
ride
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment