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
b2389697
Commit
b2389697
authored
Jun 29, 2018
by
Alen Jose
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'alen' into 'master'
amount calc See merge request alen/CMC-driver!3
parents
26911884
a7587807
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
104 additions
and
38 deletions
+104
-38
app.component.ts
src/app/app.component.ts
+3
-2
app.html
src/app/app.html
+1
-1
app.module.ts
src/app/app.module.ts
+2
-0
home.ts
src/pages/home/home.ts
+3
-1
payment.ts
src/pages/payment/payment.ts
+24
-9
ridedetails.html
src/pages/ridedetails/ridedetails.html
+1
-1
ridedetails.ts
src/pages/ridedetails/ridedetails.ts
+16
-1
userlocation.ts
src/pages/userlocation/userlocation.ts
+49
-2
common.service.ts
src/providers/common.service.ts
+5
-5
firebase.service.ts
src/providers/firebase.service.ts
+0
-16
No files found.
src/app/app.component.ts
View file @
b2389697
...
...
@@ -14,7 +14,7 @@ import { driver } from "../models/mymodel";
export
class
MyApp
{
@
ViewChild
(
Nav
)
nav
:
Nav
;
rootPage
:
any
=
"LandingPage"
;
rootPage
:
string
;
pages
:
Array
<
{
title
:
string
,
component
:
any
}
>
;
local
:
driver
...
...
@@ -89,9 +89,10 @@ export class MyApp {
this
.
oneSignal
.
handleNotificationReceived
().
subscribe
(()
=>
{
// do something when notification is received
});
this
.
oneSignal
.
handleNotificationOpened
().
subscribe
(()
=>
{
// do something when a notification is opened
// this.nav.setRoot('QuickridePage')
});
this
.
oneSignal
.
endInit
();
...
...
src/app/app.html
View file @
b2389697
...
...
@@ -10,7 +10,7 @@
</div>
<div
class=
"cab_sidemenu_list"
>
<ul>
<li
menuClose
>
Book Ride
</li>
<li
menuClose
(
click
)="
openPage
('
HomePage
')"
>
My Rides
</li>
<li
menuClose
>
My Trips
</li>
<li
menuClose
>
Settings
</li>
<li
menuClose
(
click
)="
openPage
('
LandingPage
')"
>
Logout
</li>
...
...
src/app/app.module.ts
View file @
b2389697
...
...
@@ -19,6 +19,7 @@ import { fireService } from "../providers/firebase.service";
import
{
AngularFireDatabase
}
from
'angularfire2/database'
;
import
{
AngularFireModule
}
from
'angularfire2'
;
import
{
dataService
}
from
"../providers/common.service"
;
import
{
DatePipe
}
from
'@angular/common'
;
export
const
firebaseConfig
=
{
apiKey
:
"AIzaSyDLrbLd4RCCh86xuTVu7-cfJ28We_cG1sU"
,
...
...
@@ -56,6 +57,7 @@ export const firebaseConfig = {
fireService
,
AngularFireDatabase
,
dataService
,
DatePipe
,
]
})
export
class
AppModule
{}
src/pages/home/home.ts
View file @
b2389697
...
...
@@ -3,6 +3,7 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular';
import
{
Storage
}
from
"@ionic/storage"
;
import
{
Myservice
}
from
"../../providers/myservice"
;
import
{
dataService
}
from
"../../providers/common.service"
;
@
IonicPage
()
@
Component
({
selector
:
'page-home'
,
...
...
@@ -14,10 +15,11 @@ upcoming:any;
completed
:
any
;
baseurl
=
this
.
myservice
.
base_url
constructor
(
public
navCtrl
:
NavController
,
public
navParams
:
NavParams
,
private
storage
:
Storage
,
private
myservice
:
Myservice
,
private
data
:
dataService
)
{
constructor
(
public
navCtrl
:
NavController
,
public
navParams
:
NavParams
,
private
storage
:
Storage
,
private
myservice
:
Myservice
,
private
data
:
dataService
)
{
}
ionViewDidEnter
(){
this
.
storage
.
get
(
'driver_data'
).
then
(
data
=>
{
if
(
data
){
this
.
myservice
.
load_post
({
id
:
data
.
id
},
'getMyRides'
).
subscribe
(
response
=>
{
...
...
src/pages/payment/payment.ts
View file @
b2389697
...
...
@@ -4,7 +4,7 @@ import { dataService } from "../../providers/common.service";
import
{
Myservice
}
from
"../../providers/myservice"
;
import
{
Storage
}
from
"@ionic/storage"
;
import
*
as
firebase
from
'firebase'
;
import
{
DatePipe
}
from
'@angular/common'
;
declare
var
google
;
@
IonicPage
()
...
...
@@ -19,8 +19,9 @@ export class PaymentPage {
public
unregisterBackButtonAction
:
any
;
ride
:
any
;
waypoints
=
this
.
data
.
getwaypointData
()
rate
=
this
.
data
.
getrateData
();
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
,
private
datePipe
:
DatePipe
)
{
}
ionViewDidEnter
()
{
...
...
@@ -54,13 +55,27 @@ export class PaymentPage {
}
totalDist
=
totalDist
/
1000
.
console
.
log
(
totalDist
)
This
.
myservice
.
load_post
({},
'updateRideDetails'
).
subscribe
(
response
=>
{
if
(
response
.
status
==
'success'
){
}
else
This
.
myservice
.
show_alert
(
''
,
response
.
message
)
})
if
(
totalDist
>
This
.
rate
.
intialkm
){
var
extra
=
totalDist
-
This
.
rate
.
intialkm
var
rate
=
((
extra
*
This
.
rate
.
standardrate
)
+
(
This
.
rate
.
intailrate
))
+
This
.
book
.
timeAmount
rate
=
rate
-
This
.
book
.
discount
}
else
{
var
rate
=
This
.
rate
.
intailrate
+
This
.
book
.
timeAmount
;
rate
=
rate
-
This
.
book
.
discount
}
var
data
=
{
'pickup_time'
:
This
.
datePipe
.
transform
(
This
.
book
.
actualPick
,
'h:mm a'
),
'drop_time'
:
This
.
datePipe
.
transform
(
This
.
book
.
actualDrop
,
'h:mm a'
),
'drop_date'
:
This
.
datePipe
.
transform
(
This
.
book
.
actualDrop
,
'MM/dd/yyyy'
),
'distance'
:
totalDist
,
'amount'
:
rate
,
'km'
:
totalDist
}
This
.
myservice
.
hide_loader
();
console
.
log
(
data
);
// This.myservice.load_post({},'updateRideDetails').subscribe(response=>{
// if(response.status == 'success'){
// }
// else
// This.myservice.show_alert('',response.message)
// })
}
else
{
window
.
alert
(
'Directions request failed due to '
+
status
);
}
...
...
@@ -79,7 +94,7 @@ export class PaymentPage {
}
done
()
{
this
.
myservice
.
load_post
({
status
:
'Completed'
,
id
:
this
.
book
.
id
},
'changeStatus'
)
}
}
src/pages/ridedetails/ridedetails.html
View file @
b2389697
...
...
@@ -42,7 +42,7 @@
<div
class=
"jr_clear"
></div>
</div>
<div
class=
"jr_bottom_button_bay"
*
ngIf=
"details.status=='Booking'"
>
<div
class=
"jr_bottom_button_bay"
*
ngIf=
"details.status=='Booking'
&& temp
"
>
<button
ion-button
class=
"cab_footer_btn"
(
click
)="
pick
()"
>
Pick Up
</button>
</div>
</div>
...
...
src/pages/ridedetails/ridedetails.ts
View file @
b2389697
...
...
@@ -2,6 +2,7 @@ import { Component } from '@angular/core';
import
{
IonicPage
,
NavController
,
NavParams
}
from
'ionic-angular'
;
import
{
Myservice
}
from
"../../providers/myservice"
;
import
{
dataService
}
from
"../../providers/common.service"
;
import
{
DatePipe
}
from
'@angular/common'
;
@
IonicPage
()
@
Component
({
...
...
@@ -11,11 +12,23 @@ import { dataService } from "../../providers/common.service";
export
class
RidedetailsPage
{
details
=
this
.
data
.
getrideData
()
baseurl
=
this
.
myservice
.
base_url
now
:
any
;
// rideDate:any
temp
:
boolean
=
false
;
constructor
(
public
navCtrl
:
NavController
,
public
navParams
:
NavParams
,
private
myservice
:
Myservice
,
private
data
:
dataServic
e
)
{
constructor
(
public
navCtrl
:
NavController
,
public
navParams
:
NavParams
,
private
myservice
:
Myservice
,
private
data
:
dataService
,
private
datePipe
:
DatePip
e
)
{
}
ionViewDidEnter
(){
this
.
now
=
this
.
datePipe
.
transform
(
new
Date
(),
'MM/dd/yyyy'
)
console
.
log
(
this
.
now
)
console
.
log
(
this
.
details
.
pickup_date
)
if
(
this
.
now
==
this
.
details
.
pickup_date
){
this
.
temp
=
true
;
}
}
ionViewDidLoad
()
{
var
tempf
=
this
.
details
.
pickup_area
.
split
(
','
)
this
.
details
.
from
=
tempf
[
0
]
...
...
@@ -27,6 +40,8 @@ export class RidedetailsPage {
this
.
details
.
toAd
=
this
.
details
.
drop_area
console
.
log
(
this
.
details
)
this
.
details
.
discount
=
Number
(
this
.
details
.
discount
)
this
.
data
.
setrideData
(
this
.
details
)
}
...
...
src/pages/userlocation/userlocation.ts
View file @
b2389697
...
...
@@ -29,6 +29,7 @@ export class UserlocationPage {
started
:
boolean
=
false
;
myloc
=
[]
waypoints
=
[]
ride
:
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
)
{
this
.
loadMap
()
...
...
@@ -143,6 +144,8 @@ export class UserlocationPage {
}
startRide
()
{
this
.
myservice
.
load_post
({
status
:
'Started'
,
id
:
this
.
details
.
id
},
'changeStatus'
)
this
.
details
.
actualPick
=
new
Date
().
getTime
()
this
.
started
=
true
;
this
.
temp
=
false
...
...
@@ -156,11 +159,49 @@ export class UserlocationPage {
}
complete
()
{
var
This
=
this
;
this
.
myservice
.
show_loader
()
this
.
details
.
actualDrop
=
new
Date
().
getTime
()
var
pick
=
this
.
details
.
pickup_latlng
.
split
(
','
)
var
drop
=
this
.
details
.
drop_latlng
.
split
(
','
)
var
origin
=
new
google
.
maps
.
LatLng
(
pick
[
0
],
pick
[
1
]);
var
destination
=
new
google
.
maps
.
LatLng
(
drop
[
0
],
drop
[
1
]);
var
service
=
new
google
.
maps
.
DistanceMatrixService
();
var
This
=
this
service
.
getDistanceMatrix
(
{
origins
:
[
origin
],
destinations
:
[
destination
],
travelMode
:
google
.
maps
.
DirectionsTravelMode
.
DRIVING
,
avoidHighways
:
true
,
avoidTolls
:
true
,
},
function
(
response
,
status
)
{
if
(
response
.
originAddresses
[
0
]
!=
''
)
{
var
calcTime
=
response
.
rows
[
0
].
elements
[
0
].
duration
.
value
var
realTime
=
(
This
.
details
.
actualDrop
-
This
.
details
.
actualPick
)
/
1000
//in seconds
// var realTime = (1530183600000 - 1530182700000) / 1000 //in seconds
// console.log('google time', calcTime);
// console.log('time taken',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
)
// console.log('amt', This.details.timeAmount)
}
else
This
.
details
.
timeAmount
=
0
;
}
});
This
.
data
.
setrideData
(
This
.
details
);
This
.
data
.
setwaypointData
(
This
.
waypoints
)
firebase
.
database
().
ref
(
"drivers/"
+
This
.
pushId
+
"/"
).
update
({
started
:
false
})
This
.
navCtrl
.
push
(
'PaymentPage'
)
// console.log(This.locSubs)
}
getStorage
()
{
...
...
@@ -174,6 +215,12 @@ 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
.
ride
=
response
.
data
This
.
data
.
setrateData
(
This
.
ride
)
}
})
}
})
}
...
...
src/providers/common.service.ts
View file @
b2389697
...
...
@@ -5,7 +5,7 @@ export class dataService {
rideData
:
any
;
waypointData
:
any
;
driver
Data
:
any
;
rate
Data
:
any
;
constructor
()
{
}
...
...
@@ -25,12 +25,12 @@ driverData:any;
return
this
.
waypointData
;
}
public
set
driver
Data
(
val
){
this
.
driver
Data
=
val
;
public
set
rate
Data
(
val
){
this
.
rate
Data
=
val
;
}
public
get
driver
Data
(){
return
this
.
driver
Data
;
public
get
rate
Data
(){
return
this
.
rate
Data
;
}
...
...
src/providers/firebase.service.ts
View file @
b2389697
...
...
@@ -42,21 +42,5 @@ export class fireService {
});
return
promise
;
}
removeItem
(
url
){
return
this
.
db
.
object
(
url
).
remove
();
}
listItem
(
url
){
return
this
.
db
.
list
(
url
);
}
listItemQuery
(
url
,
query
){
return
this
.
db
.
list
(
url
,
query
);
}
checkItem
(
url
){
return
this
.
db
.
list
(
url
);
}
}
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