Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
Callmycab-Userapp
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-Userapp
Commits
ec14c3b7
Commit
ec14c3b7
authored
Jun 14, 2018
by
Alen Jose
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'alen' into 'master'
ridenow map See merge request alen/CMC_revamp!8
parents
3870b18c
f48319b3
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
210 additions
and
40 deletions
+210
-40
confirmride.ts
src/pages/confirmride/confirmride.ts
+1
-1
home.ts
src/pages/home/home.ts
+10
-8
map.html
src/pages/map/map.html
+5
-5
map.ts
src/pages/map/map.ts
+70
-6
ridedetail.html
src/pages/ridedetail/ridedetail.html
+9
-6
ridedetail.ts
src/pages/ridedetail/ridedetail.ts
+106
-14
common.service.ts
src/providers/common.service.ts
+9
-0
No files found.
src/pages/confirmride/confirmride.ts
View file @
ec14c3b7
...
@@ -27,7 +27,7 @@ export class ConfirmridePage {
...
@@ -27,7 +27,7 @@ export class ConfirmridePage {
this
.
book
=
this
.
data
.
getbookingData
()
this
.
book
=
this
.
data
.
getbookingData
()
console
.
log
(
this
.
book
)
console
.
log
(
this
.
book
)
var
bdata
=
{
'book_date'
:
this
.
book
.
date
,
'drop_area'
:
this
.
book
.
dropArea
,
'pickup_area'
:
this
.
book
.
pickArea
,
'taxi_type'
:
this
.
book
.
carDetails
.
car_type
,
'amount'
:
''
,
'km'
:
''
,
'promocode'
:
this
.
book
.
promocode
,
'token'
:
this
.
local
.
token
,
'userid'
:
this
.
local
.
id
,
'type'
:
'later'
}
var
bdata
=
{
'book_date'
:
this
.
book
.
date
,
'drop_area'
:
this
.
book
.
dropArea
,
'pickup_area'
:
this
.
book
.
pickArea
,
'taxi_type'
:
this
.
book
.
carDetails
.
car_type
,
'amount'
:
''
,
'km'
:
''
,
'promocode'
:
this
.
book
.
promocode
,
'token'
:
this
.
local
.
token
,
'userid'
:
this
.
local
.
id
,
'type'
:
'later'
,
'drivers'
:
[]
}
this
.
myservice
.
load_post
(
bdata
,
'book_cab'
).
subscribe
(
response
=>
{
this
.
myservice
.
load_post
(
bdata
,
'book_cab'
).
subscribe
(
response
=>
{
this
.
myservice
.
hide_loader
()
this
.
myservice
.
hide_loader
()
...
...
src/pages/home/home.ts
View file @
ec14c3b7
...
@@ -30,6 +30,7 @@ export class HomePage {
...
@@ -30,6 +30,7 @@ export class HomePage {
locForm
:
FormGroup
locForm
:
FormGroup
geocoder
:
any
;
geocoder
:
any
;
local
:
user
local
:
user
directionsDisplay
:
any
;
constructor
(
public
navCtrl
:
NavController
,
public
navParams
:
NavParams
,
public
modalCtrl
:
ModalController
,
public
storage
:
Storage
,
private
geolocation
:
Geolocation
,
private
firebase
:
fireService
,
private
db
:
AngularFireDatabase
,
private
formBuilder
:
FormBuilder
,
private
data
:
dataService
,
private
myservice
:
Myservice
)
{
constructor
(
public
navCtrl
:
NavController
,
public
navParams
:
NavParams
,
public
modalCtrl
:
ModalController
,
public
storage
:
Storage
,
private
geolocation
:
Geolocation
,
private
firebase
:
fireService
,
private
db
:
AngularFireDatabase
,
private
formBuilder
:
FormBuilder
,
private
data
:
dataService
,
private
myservice
:
Myservice
)
{
...
@@ -40,9 +41,6 @@ export class HomePage {
...
@@ -40,9 +41,6 @@ export class HomePage {
}
}
ionViewDidEnter
()
{
ionViewDidEnter
()
{
this
.
myservice
.
load_post
({},
'test'
).
subscribe
(
response
=>
{
})
this
.
data
.
setbookingData
(
''
)
this
.
data
.
setbookingData
(
''
)
this
.
storage
.
get
(
'user_data'
).
then
(
data
=>
{
this
.
storage
.
get
(
'user_data'
).
then
(
data
=>
{
...
@@ -109,7 +107,6 @@ export class HomePage {
...
@@ -109,7 +107,6 @@ export class HomePage {
this
.
markers
[
0
].
setMap
(
null
);
this
.
markers
[
0
].
setMap
(
null
);
}
}
var
place
=
autocomplete
.
getPlace
();
var
place
=
autocomplete
.
getPlace
();
console
.
log
(
place
)
var
lat
=
place
.
geometry
.
location
.
lat
();
var
lat
=
place
.
geometry
.
location
.
lat
();
var
lng
=
place
.
geometry
.
location
.
lng
();
var
lng
=
place
.
geometry
.
location
.
lng
();
...
@@ -126,25 +123,27 @@ export class HomePage {
...
@@ -126,25 +123,27 @@ export class HomePage {
if
(
type
==
0
)
{
if
(
type
==
0
)
{
this
.
p_lat
=
lat
this
.
p_lat
=
lat
this
.
p_lng
=
lng
this
.
p_lng
=
lng
this
.
markers
[
1
]
=
marker
this
.
markers
[
1
]
=
marker
this
.
locForm
.
controls
[
'pickLoc'
].
setValue
(
place
.
name
)
this
.
locForm
.
controls
[
'pickLoc'
].
setValue
(
place
.
name
)
}
}
else
if
(
type
==
1
)
{
else
if
(
type
==
1
)
{
this
.
d_lat
=
lat
this
.
d_lat
=
lat
this
.
d_lng
=
lng
this
.
d_lng
=
lng
this
.
markers
[
2
]
=
marker
this
.
markers
[
2
]
=
marker
this
.
locForm
.
controls
[
'dropLoc'
].
setValue
(
place
.
name
)
this
.
locForm
.
controls
[
'dropLoc'
].
setValue
(
place
.
name
)
}
}
if
(
this
.
p_lat
&&
this
.
d_lat
)
{
if
(
this
.
p_lat
&&
this
.
d_lat
)
{
var
directionsService
=
new
google
.
maps
.
DirectionsService
;
var
directionsService
=
new
google
.
maps
.
DirectionsService
;
var
directionsDisplay
=
new
google
.
maps
.
DirectionsRenderer
;
directionsDisplay
.
setMap
(
this
.
map
);
this
.
directionsDisplay
.
setMap
(
this
.
map
);
var
start
=
new
google
.
maps
.
LatLng
(
this
.
p_lat
,
this
.
p_lng
);
var
start
=
new
google
.
maps
.
LatLng
(
this
.
p_lat
,
this
.
p_lng
);
var
dest
=
new
google
.
maps
.
LatLng
(
this
.
d_lat
,
this
.
d_lng
);
var
dest
=
new
google
.
maps
.
LatLng
(
this
.
d_lat
,
this
.
d_lng
);
this
.
calculateAndDisplayRoute
(
directionsService
,
directionsDisplay
,
start
,
dest
);
this
.
calculateAndDisplayRoute
(
directionsService
,
this
.
directionsDisplay
,
start
,
dest
);
}
}
else
{
else
{
this
.
loadMap
(
lat
,
lng
)
this
.
loadMap
(
lat
,
lng
)
...
@@ -167,14 +166,17 @@ export class HomePage {
...
@@ -167,14 +166,17 @@ export class HomePage {
this
.
markers
.
push
(
marker
)
this
.
markers
.
push
(
marker
)
this
.
map
=
new
google
.
maps
.
Map
(
this
.
mapElement
.
nativeElement
,
mapOptions
);
this
.
map
=
new
google
.
maps
.
Map
(
this
.
mapElement
.
nativeElement
,
mapOptions
);
marker
.
setMap
(
this
.
map
);
marker
.
setMap
(
this
.
map
);
for
(
var
i
=
0
;
i
<
this
.
driverMarkers
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
driverMarkers
.
length
;
i
++
)
{
this
.
driverMarkers
[
i
].
setMap
(
this
.
map
);
this
.
driverMarkers
[
i
].
setMap
(
this
.
map
);
}
}
this
.
directionsDisplay
=
new
google
.
maps
.
DirectionsRenderer
}
}
calculateAndDisplayRoute
(
directionsService
,
directionsDisplay
,
start
,
dest
)
{
calculateAndDisplayRoute
(
directionsService
,
directionsDisplay
,
start
,
dest
)
{
console
.
log
(
this
.
markers
)
for
(
var
i
=
0
;
i
<
this
.
markers
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
markers
.
length
;
i
++
)
{
if
(
this
.
markers
[
i
])
if
(
this
.
markers
[
i
])
this
.
markers
[
i
].
setMap
(
null
);
this
.
markers
[
i
].
setMap
(
null
);
...
...
src/pages/map/map.html
View file @
ec14c3b7
<ion-header
class=
"jr_theme_color jr_header"
>
<ion-header
class=
"jr_theme_color jr_header"
>
<
button
ion-button
class=
"jr_left jr_header_btn jr_back_icon"
(
click
)="
goBack
()"
></button
>
<
!-- <button ion-button class="jr_left jr_header_btn jr_back_icon" (click)="goBack()"></button> --
>
<div
class=
"jr_header_title"
>
<div
class=
"jr_header_title"
>
<h4>
Map
</h4>
<h4>
Map
</h4>
</div>
</div>
...
@@ -9,16 +9,16 @@
...
@@ -9,16 +9,16 @@
<ion-content>
<ion-content>
<div
#
map
id=
"map"
></div>
<div
#
map
id=
"map"
></div>
<div
class=
"jr_bottom_distance_card"
>
<
!-- <
div class="jr_bottom_distance_card">
<div class="jr_bottom_inside">
<div class="jr_bottom_inside">
<input
class=
"jr_dest_input from"
placeholder=
"HSR Layout, Kormangala,Bengalure"
>
<input class="jr_dest_input from" placeholder="HSR Layout, Kormangala,Bengalure"
[(ngModel)]="bookData."
>
<input class="jr_dest_input to" placeholder="Jalihalli, Outercity, Bengaluru">
<input class="jr_dest_input to" placeholder="Jalihalli, Outercity, Bengaluru">
</div>
</div>
</div>
</div>
-->
</ion-content>
</ion-content>
<ion-footer>
<ion-footer>
<div
class=
"jr_bottom_button_bay"
>
<div
class=
"jr_bottom_button_bay"
>
<button
ion-button
class=
"jr_offer_ride2"
>
Cancel
</button>
<button
ion-button
class=
"jr_offer_ride2"
(
click
)="
cancel
()"
>
Cancel
</button>
</div>
</div>
</ion-footer>
</ion-footer>
src/pages/map/map.ts
View file @
ec14c3b7
import
{
Component
,
ViewChild
,
ElementRef
}
from
'@angular/core'
;
import
{
Component
,
ViewChild
,
ElementRef
}
from
'@angular/core'
;
import
{
IonicPage
,
NavController
,
NavParams
}
from
'ionic-angular'
;
import
{
IonicPage
,
NavController
,
NavParams
}
from
'ionic-angular'
;
import
{
dataService
}
from
"../../providers/common.service"
;
import
*
as
firebase
from
'firebase'
;
import
{
Geolocation
}
from
'@ionic-native/geolocation'
;
declare
var
google
;
declare
var
google
;
@
IonicPage
()
@
IonicPage
()
@
Component
({
@
Component
({
...
@@ -9,16 +13,51 @@ declare var google;
...
@@ -9,16 +13,51 @@ declare var google;
export
class
MapPage
{
export
class
MapPage
{
@
ViewChild
(
'map'
)
mapElement
:
ElementRef
;
@
ViewChild
(
'map'
)
mapElement
:
ElementRef
;
map
:
any
;
map
:
any
;
constructor
(
public
navCtrl
:
NavController
,
public
navParams
:
NavParams
)
{
directionsDisplay
:
any
;
bookData
:
any
;
constructor
(
public
navCtrl
:
NavController
,
public
navParams
:
NavParams
,
private
data
:
dataService
,
private
geolocation
:
Geolocation
)
{
}
ionViewWillEnter
(){
this
.
geolocation
.
getCurrentPosition
().
then
((
resp
)
=>
{
this
.
loadMap
(
resp
.
coords
.
latitude
,
resp
.
coords
.
longitude
);
}).
catch
((
error
)
=>
{
console
.
log
(
'Error getting location'
,
error
);
});
}
}
ionViewDidLoad
()
{
ionViewDidEnter
(){
this
.
loadMap
();
var
driver
=
this
.
data
.
getdriverData
();
this
.
bookData
=
this
.
data
.
getbookingData
();
console
.
log
(
this
.
bookData
)
var
This
=
this
;
firebase
.
database
().
ref
().
child
(
'/drivers/'
).
orderByChild
(
"id"
).
equalTo
(
Number
(
driver
.
driverId
)).
on
(
"value"
,
function
(
snapshot
)
{
var
res_arr
=
(
<
any
>
Object
).
entries
(
snapshot
.
val
()).
map
(
e
=>
Object
.
assign
(
e
[
1
],
{
key
:
e
[
0
]
}));
console
.
log
(
res_arr
[
0
])
var
directionsService
=
new
google
.
maps
.
DirectionsService
;
This
.
directionsDisplay
.
setMap
(
This
.
map
);
var
pickLoc
=
new
google
.
maps
.
LatLng
(
This
.
bookData
.
pickLat
,
This
.
bookData
.
pickLng
);
var
driverLoc
=
new
google
.
maps
.
LatLng
(
res_arr
[
0
].
lat
,
res_arr
[
0
].
lng
);
// if (google.maps.geometry.spherical.computeDistanceBetween(driverLoc, pickLoc) < 50) {
// }
This
.
calculateAndDisplayRoute
(
directionsService
,
This
.
directionsDisplay
,
pickLoc
,
driverLoc
);
});
}
}
loadMap
(){
// ionViewDidLoad() {
// this.loadMap();
// }
loadMap
(
lat
,
lng
){
let
latLng
=
new
google
.
maps
.
LatLng
(
-
34.9290
,
138.6010
);
let
latLng
=
new
google
.
maps
.
LatLng
(
lat
,
lng
);
let
mapOptions
=
{
let
mapOptions
=
{
center
:
latLng
,
center
:
latLng
,
...
@@ -27,7 +66,32 @@ export class MapPage {
...
@@ -27,7 +66,32 @@ export class MapPage {
}
}
this
.
map
=
new
google
.
maps
.
Map
(
this
.
mapElement
.
nativeElement
,
mapOptions
);
this
.
map
=
new
google
.
maps
.
Map
(
this
.
mapElement
.
nativeElement
,
mapOptions
);
this
.
directionsDisplay
=
new
google
.
maps
.
DirectionsRenderer
({
map
:
this
.
map
,
preserveViewport
:
true
});
}
}
calculateAndDisplayRoute
(
directionsService
,
directionsDisplay
,
start
,
dest
)
{
var
This
=
this
directionsService
.
route
({
origin
:
start
,
destination
:
dest
,
travelMode
:
'DRIVING'
},
function
(
response
,
status
)
{
if
(
status
===
'OK'
)
{
directionsDisplay
.
setDirections
(
response
);
var
bounds
=
response
.
routes
[
0
].
bounds
;
This
.
map
.
fitBounds
(
bounds
);
This
.
map
.
setCenter
(
bounds
.
getCenter
());
}
else
{
window
.
alert
(
'Directions request failed due to '
+
status
);
}
});
}
cancel
(){
this
.
navCtrl
.
pop
();
}
}
}
src/pages/ridedetail/ridedetail.html
View file @
ec14c3b7
...
@@ -39,19 +39,21 @@
...
@@ -39,19 +39,21 @@
<!-- <div class="jr_search_bottom_bay jr_padding0">
<!-- <div class="jr_search_bottom_bay jr_padding0">
<div class="loader"></div>
<div class="loader"></div>
</div> -->
</div> -->
<!-- <div class="jr_search_bottom_bay jr_padding0">
<span
*
ngIf=
"driver"
>
<div
class=
"jr_search_bottom_bay jr_padding0"
>
<div
class=
"jr_search_profile"
>
<div
class=
"jr_search_profile"
>
<img
src="assets/img/e_img14.png"
>
<img
[
src
]=
driver
.
image
>
</div>
</div>
<div
class=
"jr_search_profile_detail"
>
<div
class=
"jr_search_profile_detail"
>
<br>
<br>
<h6>
MARIA LORENZA 37
Y/O</h6>
<h6>
{{driver.name}}
{{driver.age}}
Y/O
</h6>
<span class="jr_star_ratting"><img src="assets/img/jr_star.png"><strong>
3/5</strong>1 Rat
tings</span><br>
<span
class=
"jr_star_ratting"
><img
src=
"assets/img/jr_star.png"
><strong>
{{driver.rating}}/5
</strong>
{{driver.ratingCount}} Ra
tings
</span><br>
</div>
</div>
<div
class=
"jr_clear"
></div>
<div
class=
"jr_clear"
></div>
</div>
</div>
<br>
<br>
<hr>
</span>
<!-- <hr>
<div class="jr_car_info">
<div class="jr_car_info">
<div class="">
<div class="">
<ion-grid class="jr_padding0">
<ion-grid class="jr_padding0">
...
@@ -86,8 +88,9 @@
...
@@ -86,8 +88,9 @@
</div>
</div>
<div class="jr_clear"></div>
<div class="jr_clear"></div>
</div> -->
</div> -->
<div
class=
"jr_bottom_button_bay"
>
<div
class=
"jr_bottom_button_bay"
>
<button
ion-button
class=
"jr_offer_ride2"
>
Track Driver
</button>
<button
ion-button
class=
"jr_offer_ride2"
(
click
)="
track
()"
>
Track Driver
</button>
</div>
</div>
</div>
</div>
...
...
src/pages/ridedetail/ridedetail.ts
View file @
ec14c3b7
import
{
Component
,
NgZone
}
from
'@angular/core'
;
import
{
Component
,
NgZone
}
from
'@angular/core'
;
import
{
IonicPage
,
NavController
,
NavParams
,
Platform
}
from
'ionic-angular'
;
import
{
IonicPage
,
NavController
,
NavParams
,
Platform
,
LoadingController
,
AlertController
}
from
'ionic-angular'
;
import
{
dataService
}
from
"../../providers/common.service"
;
import
{
dataService
}
from
"../../providers/common.service"
;
import
{
Myservice
}
from
"../../providers/myservice"
;
import
{
Myservice
}
from
"../../providers/myservice"
;
import
{
Storage
}
from
"@ionic/storage"
;
import
{
Storage
}
from
"@ionic/storage"
;
import
{
user
}
from
"../../models/mymodel"
;
import
{
user
}
from
"../../models/mymodel"
;
import
*
as
firebase
from
'firebase'
;
declare
var
google
;
declare
var
google
;
@
IonicPage
()
@
IonicPage
()
...
@@ -17,29 +18,45 @@ export class RidedetailPage {
...
@@ -17,29 +18,45 @@ export class RidedetailPage {
loc
=
{
from
:
''
,
to
:
''
,
fromAd
:
''
,
toAd
:
''
}
loc
=
{
from
:
''
,
to
:
''
,
fromAd
:
''
,
toAd
:
''
}
local
:
user
local
:
user
public
unregisterBackButtonAction
:
any
;
public
unregisterBackButtonAction
:
any
;
count
:
number
=
0
;
loader
:
any
;
driver
:
any
;
bkid
:
any
=
10
;
drivers
=
[]
constructor
(
public
navCtrl
:
NavController
,
public
navParams
:
NavParams
,
private
data
:
dataService
,
private
zone
:
NgZone
,
private
myservice
:
Myservice
,
private
storage
:
Storage
,
public
platform
:
Platform
)
{
constructor
(
public
navCtrl
:
NavController
,
public
navParams
:
NavParams
,
private
data
:
dataService
,
private
zone
:
NgZone
,
private
myservice
:
Myservice
,
private
storage
:
Storage
,
public
platform
:
Platform
,
public
loadingCtrl
:
LoadingController
,
private
alertCtrl
:
AlertController
)
{
}
}
ionViewDidEnter
()
{
ionViewDidEnter
()
{
// this.myservice.show_loader()
this
.
initializeBackButtonCustomHandler
();
this
.
initializeBackButtonCustomHandler
();
this
.
storage
.
get
(
'user_data'
).
then
(
data
=>
{
this
.
storage
.
get
(
'user_data'
).
then
(
data
=>
{
if
(
data
)
{
if
(
data
)
{
this
.
local
=
data
this
.
local
=
data
this
.
book
=
this
.
data
.
getbookingData
()
this
.
book
=
this
.
data
.
getbookingData
()
console
.
log
(
this
.
book
)
console
.
log
(
this
.
book
)
var
bdata
=
{
'book_date'
:
this
.
book
.
date
,
'drop_area'
:
this
.
book
.
dropArea
,
'pickup_area'
:
this
.
book
.
pickArea
,
'taxi_type'
:
this
.
book
.
carDetails
.
car_type
,
'amount'
:
''
,
'km'
:
''
,
'promocode'
:
this
.
book
.
promocode
,
'token'
:
this
.
local
.
token
,
'userid'
:
this
.
local
.
id
,
'type'
:
'now'
}
this
.
findDrivers
()
this
.
myservice
.
load_post
(
bdata
,
'book_cab'
).
subscribe
(
response
=>
{
this
.
myservice
.
hide_loader
()
var
bdata
=
{
'book_date'
:
this
.
book
.
date
,
'drop_area'
:
this
.
book
.
dropArea
,
'pickup_area'
:
this
.
book
.
pickArea
,
'taxi_type'
:
this
.
book
.
carDetails
.
car_type
,
'amount'
:
''
,
'km'
:
''
,
'promocode'
:
this
.
book
.
promocode
,
'token'
:
this
.
local
.
token
,
'userid'
:
this
.
local
.
id
,
'type'
:
'now'
,
'drivers'
:[]
}
if
(
response
.
status
==
'success'
)
{
this
.
myservice
.
load_post
({},
'checkBookingStatus'
)
this
.
loader
=
this
.
loadingCtrl
.
create
({
}
content
:
"Searching for driver"
else
{
});
this
.
myservice
.
show_alert
(
'Failed'
,
'Please try again'
)
this
.
loader
.
present
();
this
.
navCtrl
.
pop
()
}
})
bdata
.
drivers
=
this
.
drivers
;
console
.
log
(
bdata
)
// this.myservice.load_post(bdata, 'book_cab').subscribe(response => {
// if (response.status == 'success') {
// this.bkid = response.data
this
.
checkResp
();
// }
// else {
// this.myservice.show_alert('Failed', 'Please try again')
// this.navCtrl.pop()
// }
// })
this
.
geocoder
=
new
google
.
maps
.
Geocoder
();
this
.
geocoder
=
new
google
.
maps
.
Geocoder
();
for
(
let
i
=
0
;
i
<
2
;
i
++
)
{
for
(
let
i
=
0
;
i
<
2
;
i
++
)
{
...
@@ -76,6 +93,76 @@ export class RidedetailPage {
...
@@ -76,6 +93,76 @@ export class RidedetailPage {
})
})
}
}
findDrivers
(){
var
This
=
this
firebase
.
database
().
ref
().
child
(
'/drivers/'
).
orderByChild
(
"status"
).
equalTo
(
'online'
).
once
(
"value"
,
function
(
snapshot
)
{
var
res_arr
=
(
<
any
>
Object
).
entries
(
snapshot
.
val
()).
map
(
e
=>
Object
.
assign
(
e
[
1
],
{
key
:
e
[
0
]
}));
console
.
log
(
res_arr
)
This
.
drivers
=
[];
for
(
let
i
=
0
;
i
<
res_arr
.
length
;
i
++
)
{
var
mypos
=
new
google
.
maps
.
LatLng
(
This
.
book
.
pickLat
,
This
.
book
.
pickLng
);
let
driverLoc
=
new
google
.
maps
.
LatLng
(
res_arr
[
i
].
lat
,
res_arr
[
i
].
lng
)
if
(
google
.
maps
.
geometry
.
spherical
.
computeDistanceBetween
(
driverLoc
,
mypos
)
<
5000
)
{
This
.
drivers
.
push
(
res_arr
[
i
].
id
)
}
}
});
}
showAlert
(){
let
alert
=
this
.
alertCtrl
.
create
({
title
:
'No drivers found'
,
message
:
'Please search again.'
,
buttons
:
[
{
text
:
'Cancel'
,
role
:
'cancel'
,
handler
:
()
=>
{
}
},
{
text
:
'Search'
,
handler
:
()
=>
{
this
.
loader
=
this
.
loadingCtrl
.
create
({
content
:
"Searching for driver"
});
this
.
loader
.
present
();
this
.
findDrivers
()
var
This
=
this
;
setTimeout
(()
=>
{
This
.
myservice
.
load_post
({
taxiType
:
This
.
book
.
carDetails
.
car_type
,
type
:
'now'
,
driversid
:
This
.
drivers
},
'driverPush'
).
subscribe
(
data
=>
{
if
(
data
.
status
==
'success'
)
This
.
checkResp
();
})
},
500
);
}
}
]
});
alert
.
present
();
}
checkResp
(){
var
This
=
this
;
var
intrvl
=
setInterval
(
function
()
{
This
.
count
++
;
This
.
myservice
.
load_post
({
bkid
:
This
.
bkid
},
'checkBookingStatus'
).
subscribe
(
resp
=>
{
console
.
log
(
resp
.
data
.
assigned_for
)
if
(
resp
.
data
.
assigned_for
)
{
This
.
driver
=
resp
.
data
clearInterval
(
intrvl
)
This
.
loader
.
dismissAll
();
}
})
if
(
This
.
count
==
12
)
{
clearInterval
(
intrvl
)
This
.
loader
.
dismissAll
();
This
.
showAlert
();
}
},
5000
)
}
public
initializeBackButtonCustomHandler
():
void
{
public
initializeBackButtonCustomHandler
():
void
{
this
.
unregisterBackButtonAction
=
this
.
platform
.
registerBackButtonAction
(()
=>
{
this
.
unregisterBackButtonAction
=
this
.
platform
.
registerBackButtonAction
(()
=>
{
// this.customHandleBackButton();
// this.customHandleBackButton();
...
@@ -85,4 +172,9 @@ export class RidedetailPage {
...
@@ -85,4 +172,9 @@ export class RidedetailPage {
ionViewWillLeave
()
{
ionViewWillLeave
()
{
this
.
unregisterBackButtonAction
&&
this
.
unregisterBackButtonAction
();
this
.
unregisterBackButtonAction
&&
this
.
unregisterBackButtonAction
();
}
}
track
(){
this
.
data
.
setdriverData
(
this
.
driver
)
this
.
navCtrl
.
push
(
'MapPage'
)
}
}
}
src/providers/common.service.ts
View file @
ec14c3b7
...
@@ -5,6 +5,7 @@ export class dataService {
...
@@ -5,6 +5,7 @@ export class dataService {
bookingData
:
any
;
bookingData
:
any
;
rateData
:
any
;
rateData
:
any
;
driverData
:
any
;
constructor
()
{
}
constructor
()
{
}
...
@@ -23,6 +24,13 @@ rateData:any;
...
@@ -23,6 +24,13 @@ rateData:any;
public
getrateData
(){
public
getrateData
(){
return
this
.
rateData
;
return
this
.
rateData
;
}
}
public
setdriverData
(
val
){
this
.
driverData
=
val
;
}
public
getdriverData
(){
return
this
.
driverData
;
}
}
}
\ No newline at end of file
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