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
a1cd92fb
Commit
a1cd92fb
authored
Jul 25, 2018
by
Alen Jose
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'alen' into 'master'
july24 See merge request alen/CMC_revamp!19
parents
0f1d096e
69bdc4fc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
67 deletions
+74
-67
app.component.ts
src/app/app.component.ts
+2
-2
map.ts
src/pages/map/map.ts
+2
-2
payment.ts
src/pages/payment/payment.ts
+1
-1
ridesummary.ts
src/pages/ridesummary/ridesummary.ts
+69
-62
No files found.
src/app/app.component.ts
View file @
a1cd92fb
...
...
@@ -46,8 +46,8 @@ export class MyApp {
this
.
statusBar
.
styleDefault
();
this
.
splashScreen
.
hide
();
//
this.enableLoc();
//
this.initOnesignal()
this
.
enableLoc
();
this
.
initOnesignal
()
this
.
network
.
onDisconnect
().
subscribe
(()
=>
{
...
...
src/pages/map/map.ts
View file @
a1cd92fb
...
...
@@ -194,7 +194,7 @@ export class MapPage {
dimage
.
rotation
=
heading
;
marker
.
setIcon
(
dimage
);
//
if (google.maps.geometry.spherical.computeDistanceBetween(myLoc, destLoc) < 50){
if
(
google
.
maps
.
geometry
.
spherical
.
computeDistanceBetween
(
myLoc
,
destLoc
)
<
50
){
var
locRef
=
firebase
.
database
().
ref
().
child
(
'/drivers/'
);
locRef
.
orderByChild
(
"id"
).
equalTo
((
This
.
driver
.
driverId
)).
on
(
"value"
,
function
(
snapshot
)
{
...
...
@@ -210,7 +210,7 @@ export class MapPage {
This
.
navCtrl
.
setRoot
(
'PaymentPage'
)
}
})
//
}
}
This
.
calculateAndDisplayRoute
(
directionsService
,
This
.
directionsDisplay
,
myLoc
,
destLoc
);
});
}
...
...
src/pages/payment/payment.ts
View file @
a1cd92fb
...
...
@@ -81,7 +81,7 @@ export class PaymentPage {
if
(
this
.
ride
.
discount
)
{
if
(
this
.
ride
.
discount
.
slice
(
-
1
)
==
'%'
)
{
var
disc_amt
=
this
.
ride
.
discount
.
slice
(
0
,
-
1
)
this
.
ride
.
discount
=
Number
(
this
.
ride
.
amount
)
*
(
disc_amt
/
100
)
this
.
ride
.
discount
=
Number
(
this
.
ride
.
amount
)
*
(
Number
(
disc_amt
)
/
100
)
}
}
else
{
...
...
src/pages/ridesummary/ridesummary.ts
View file @
a1cd92fb
...
...
@@ -9,8 +9,8 @@ import * as firebase from 'firebase';
declare
var
google
;
@
IonicPage
()
@
Component
({
selector
:
'page-ridesummary'
,
templateUrl
:
'ridesummary.html'
,
selector
:
'page-ridesummary'
,
templateUrl
:
'ridesummary.html'
,
})
export
class
RidesummaryPage
{
book
:
any
;
...
...
@@ -19,73 +19,80 @@ export class RidesummaryPage {
local
:
user
public
unregisterBackButtonAction
:
any
;
driver
:
any
;
ride
:
any
;
ride
:
any
;
constructor
(
public
navCtrl
:
NavController
,
public
navParams
:
NavParams
,
private
data
:
dataService
,
private
zone
:
NgZone
,
private
myservice
:
Myservice
,
private
storage
:
Storage
,
public
platform
:
Platform
)
{
}
ionViewDidEnter
()
{
this
.
driver
=
{
'name'
:
'asd'
,
'rating'
:
'1'
,
'ratingCount'
:
'1'
,
'image'
:
''
}
this
.
ride
=
{
'km'
:
30
,
'amount'
:
'300'
,
'discount'
:
'10%'
}
if
(
this
.
ride
.
discount
){
if
(
this
.
ride
.
discount
.
slice
(
-
1
)
==
'%'
){
var
disc_amt
=
this
.
ride
.
discount
.
slice
(
0
,
-
1
)
this
.
ride
.
discount
=
Number
(
this
.
ride
.
amount
)
*
(
disc_amt
/
100
)
console
.
log
()
}
}
//
this.initializeBackButtonCustomHandler();
//
this.storage.get('user_data').then(data => {
//
if (data) {
//
this.local = data
//
this.book = this.data.getbookingData()
//
console.log(this.book)
//
this.driver = { 'name': 'asd', 'rating': '1','ratingCount':'1','image':''}
//
this.ride = { 'km': 30, 'amount': '300','discount':'10%'}
//
if(this.ride.discount){
//
if(this.ride.discount.slice(-1) == '%'){
//
var disc_amt = this.ride.discount.slice(0, -1)
//
this.ride.discount = Number(this.ride.amount) * (disc_amt/100)
//
console.log()
//
}
//
}
this
.
initializeBackButtonCustomHandler
();
this
.
storage
.
get
(
'user_data'
).
then
(
data
=>
{
if
(
data
)
{
this
.
local
=
data
this
.
book
=
this
.
data
.
getbookingData
()
console
.
log
(
this
.
book
)
//
this.driver = this.data.getdriverData()
//
console.log(this.driver)
this
.
driver
=
this
.
data
.
getdriverData
()
console
.
log
(
this
.
driver
)
//
this.geocoder = new google.maps.Geocoder();
//
for (let i = 0; i < 2; i++) {
//
if (i == 0) {
//
var lat = this.book.pickLat
//
var lng = this.book.pickLng
//
}
//
else {
//
var lat = this.book.dropLat
//
var lng = this.book.dropLng
//
}
//
var latlng = new google.maps.LatLng(lat, lng);
//
var This = this;
//
This.geocoder.geocode({ 'latLng': latlng }, function (results, status) {
//
if (status == google.maps.GeocoderStatus.OK) {
//
if (results[0]) {
//
if (i == 0) {
//
var temp = This.book.pickArea.split(',')
//
This.loc.from = temp[0]
//
This.loc.fromAd = results[0].formatted_address
//
}
//
else {
//
var temp = This.book.dropArea.split(',')
//
This.loc.to = temp[0]
//
This.loc.toAd = results[0].formatted_address
//
This.zone.run(() => { });
//
}
//
}
//
}
//
else {
//
console.log("Geocoder failed due to: " + status);
//
}
//
});
//
}
//
}
//
})
this
.
geocoder
=
new
google
.
maps
.
Geocoder
();
for
(
let
i
=
0
;
i
<
2
;
i
++
)
{
if
(
i
==
0
)
{
var
lat
=
this
.
book
.
pickLat
var
lng
=
this
.
book
.
pickLng
}
else
{
var
lat
=
this
.
book
.
dropLat
var
lng
=
this
.
book
.
dropLng
}
var
latlng
=
new
google
.
maps
.
LatLng
(
lat
,
lng
);
var
This
=
this
;
This
.
geocoder
.
geocode
({
'latLng'
:
latlng
},
function
(
results
,
status
)
{
if
(
status
==
google
.
maps
.
GeocoderStatus
.
OK
)
{
if
(
results
[
0
])
{
if
(
i
==
0
)
{
var
temp
=
This
.
book
.
pickArea
.
split
(
','
)
This
.
loc
.
from
=
temp
[
0
]
This
.
loc
.
fromAd
=
results
[
0
].
formatted_address
}
else
{
var
temp
=
This
.
book
.
dropArea
.
split
(
','
)
This
.
loc
.
to
=
temp
[
0
]
This
.
loc
.
toAd
=
results
[
0
].
formatted_address
This
.
zone
.
run
(()
=>
{
});
}
}
}
else
{
console
.
log
(
"Geocoder failed due to: "
+
status
);
}
});
}
}
})
// this.myservice.load_post({ bookingId: this.book.bookingId},'getRideDetails').subscribe(resp=>{
// if(resp.status == 'success'){
// this.ride = resp.data
// }
// })
this
.
myservice
.
load_post
({
bookingId
:
this
.
book
.
bookingId
},
'getRideDetails'
).
subscribe
(
resp
=>
{
if
(
resp
.
status
==
'success'
)
{
this
.
ride
=
resp
.
data
if
(
this
.
ride
.
discount
)
{
if
(
this
.
ride
.
discount
.
slice
(
-
1
)
==
'%'
)
{
var
disc_amt
=
this
.
ride
.
discount
.
slice
(
0
,
-
1
)
this
.
ride
.
discount
=
Number
(
this
.
ride
.
amount
)
*
(
Number
(
disc_amt
)
/
100
)
}
}
}
})
}
public
initializeBackButtonCustomHandler
():
void
{
...
...
@@ -98,8 +105,8 @@ export class RidesummaryPage {
this
.
unregisterBackButtonAction
&&
this
.
unregisterBackButtonAction
();
}
close
(){
this
.
navCtrl
.
push
(
'RattingPage'
,
{
driver
:
this
.
driver
})
close
()
{
this
.
navCtrl
.
push
(
'RattingPage'
,
{
driver
:
this
.
driver
})
}
}
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