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
a7587807
Commit
a7587807
authored
Jun 28, 2018
by
Alen Jose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
amount calc
parent
d4de1fab
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
102 additions
and
36 deletions
+102
-36
app.component.ts
src/app/app.component.ts
+2
-1
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
+23
-8
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 @
a7587807
...
@@ -14,7 +14,7 @@ import { driver } from "../models/mymodel";
...
@@ -14,7 +14,7 @@ import { driver } from "../models/mymodel";
export
class
MyApp
{
export
class
MyApp
{
@
ViewChild
(
Nav
)
nav
:
Nav
;
@
ViewChild
(
Nav
)
nav
:
Nav
;
rootPage
:
any
=
"LandingPage"
;
rootPage
:
string
;
pages
:
Array
<
{
title
:
string
,
component
:
any
}
>
;
pages
:
Array
<
{
title
:
string
,
component
:
any
}
>
;
local
:
driver
local
:
driver
...
@@ -92,6 +92,7 @@ export class MyApp {
...
@@ -92,6 +92,7 @@ export class MyApp {
this
.
oneSignal
.
handleNotificationOpened
().
subscribe
(()
=>
{
this
.
oneSignal
.
handleNotificationOpened
().
subscribe
(()
=>
{
// do something when a notification is opened
// do something when a notification is opened
// this.nav.setRoot('QuickridePage')
});
});
this
.
oneSignal
.
endInit
();
this
.
oneSignal
.
endInit
();
...
...
src/app/app.html
View file @
a7587807
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
</div>
</div>
<div
class=
"cab_sidemenu_list"
>
<div
class=
"cab_sidemenu_list"
>
<ul>
<ul>
<li
menuClose
>
Book Ride
</li>
<li
menuClose
(
click
)="
openPage
('
HomePage
')"
>
My Rides
</li>
<li
menuClose
>
My Trips
</li>
<li
menuClose
>
My Trips
</li>
<li
menuClose
>
Settings
</li>
<li
menuClose
>
Settings
</li>
<li
menuClose
(
click
)="
openPage
('
LandingPage
')"
>
Logout
</li>
<li
menuClose
(
click
)="
openPage
('
LandingPage
')"
>
Logout
</li>
...
...
src/app/app.module.ts
View file @
a7587807
...
@@ -19,6 +19,7 @@ import { fireService } from "../providers/firebase.service";
...
@@ -19,6 +19,7 @@ import { fireService } from "../providers/firebase.service";
import
{
AngularFireDatabase
}
from
'angularfire2/database'
;
import
{
AngularFireDatabase
}
from
'angularfire2/database'
;
import
{
AngularFireModule
}
from
'angularfire2'
;
import
{
AngularFireModule
}
from
'angularfire2'
;
import
{
dataService
}
from
"../providers/common.service"
;
import
{
dataService
}
from
"../providers/common.service"
;
import
{
DatePipe
}
from
'@angular/common'
;
export
const
firebaseConfig
=
{
export
const
firebaseConfig
=
{
apiKey
:
"AIzaSyDLrbLd4RCCh86xuTVu7-cfJ28We_cG1sU"
,
apiKey
:
"AIzaSyDLrbLd4RCCh86xuTVu7-cfJ28We_cG1sU"
,
...
@@ -56,6 +57,7 @@ export const firebaseConfig = {
...
@@ -56,6 +57,7 @@ export const firebaseConfig = {
fireService
,
fireService
,
AngularFireDatabase
,
AngularFireDatabase
,
dataService
,
dataService
,
DatePipe
,
]
]
})
})
export
class
AppModule
{}
export
class
AppModule
{}
src/pages/home/home.ts
View file @
a7587807
...
@@ -3,6 +3,7 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular';
...
@@ -3,6 +3,7 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular';
import
{
Storage
}
from
"@ionic/storage"
;
import
{
Storage
}
from
"@ionic/storage"
;
import
{
Myservice
}
from
"../../providers/myservice"
;
import
{
Myservice
}
from
"../../providers/myservice"
;
import
{
dataService
}
from
"../../providers/common.service"
;
import
{
dataService
}
from
"../../providers/common.service"
;
@
IonicPage
()
@
IonicPage
()
@
Component
({
@
Component
({
selector
:
'page-home'
,
selector
:
'page-home'
,
...
@@ -14,10 +15,11 @@ upcoming:any;
...
@@ -14,10 +15,11 @@ upcoming:any;
completed
:
any
;
completed
:
any
;
baseurl
=
this
.
myservice
.
base_url
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
(){
ionViewDidEnter
(){
this
.
storage
.
get
(
'driver_data'
).
then
(
data
=>
{
this
.
storage
.
get
(
'driver_data'
).
then
(
data
=>
{
if
(
data
){
if
(
data
){
this
.
myservice
.
load_post
({
id
:
data
.
id
},
'getMyRides'
).
subscribe
(
response
=>
{
this
.
myservice
.
load_post
({
id
:
data
.
id
},
'getMyRides'
).
subscribe
(
response
=>
{
...
...
src/pages/payment/payment.ts
View file @
a7587807
...
@@ -4,7 +4,7 @@ import { dataService } from "../../providers/common.service";
...
@@ -4,7 +4,7 @@ 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
*
as
firebase
from
'firebase'
;
import
*
as
firebase
from
'firebase'
;
import
{
DatePipe
}
from
'@angular/common'
;
declare
var
google
;
declare
var
google
;
@
IonicPage
()
@
IonicPage
()
...
@@ -19,8 +19,9 @@ export class PaymentPage {
...
@@ -19,8 +19,9 @@ export class PaymentPage {
public
unregisterBackButtonAction
:
any
;
public
unregisterBackButtonAction
:
any
;
ride
:
any
;
ride
:
any
;
waypoints
=
this
.
data
.
getwaypointData
()
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
()
{
ionViewDidEnter
()
{
...
@@ -54,13 +55,27 @@ export class PaymentPage {
...
@@ -54,13 +55,27 @@ export class PaymentPage {
}
}
totalDist
=
totalDist
/
1000
.
totalDist
=
totalDist
/
1000
.
console
.
log
(
totalDist
)
console
.
log
(
totalDist
)
This
.
myservice
.
load_post
({},
'updateRideDetails'
).
subscribe
(
response
=>
{
if
(
response
.
status
==
'success'
){
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
}
}
else
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
.
show_alert
(
''
,
response
.
message
)
})
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
{
}
else
{
window
.
alert
(
'Directions request failed due to '
+
status
);
window
.
alert
(
'Directions request failed due to '
+
status
);
}
}
...
@@ -79,7 +94,7 @@ export class PaymentPage {
...
@@ -79,7 +94,7 @@ export class PaymentPage {
}
}
done
()
{
done
()
{
this
.
myservice
.
load_post
({
status
:
'Completed'
,
id
:
this
.
book
.
id
},
'changeStatus'
)
}
}
}
}
src/pages/ridedetails/ridedetails.html
View file @
a7587807
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
<div
class=
"jr_clear"
></div>
<div
class=
"jr_clear"
></div>
</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>
<button
ion-button
class=
"cab_footer_btn"
(
click
)="
pick
()"
>
Pick Up
</button>
</div>
</div>
</div>
</div>
...
...
src/pages/ridedetails/ridedetails.ts
View file @
a7587807
...
@@ -2,6 +2,7 @@ import { Component } from '@angular/core';
...
@@ -2,6 +2,7 @@ import { Component } from '@angular/core';
import
{
IonicPage
,
NavController
,
NavParams
}
from
'ionic-angular'
;
import
{
IonicPage
,
NavController
,
NavParams
}
from
'ionic-angular'
;
import
{
Myservice
}
from
"../../providers/myservice"
;
import
{
Myservice
}
from
"../../providers/myservice"
;
import
{
dataService
}
from
"../../providers/common.service"
;
import
{
dataService
}
from
"../../providers/common.service"
;
import
{
DatePipe
}
from
'@angular/common'
;
@
IonicPage
()
@
IonicPage
()
@
Component
({
@
Component
({
...
@@ -11,11 +12,23 @@ import { dataService } from "../../providers/common.service";
...
@@ -11,11 +12,23 @@ import { dataService } from "../../providers/common.service";
export
class
RidedetailsPage
{
export
class
RidedetailsPage
{
details
=
this
.
data
.
getrideData
()
details
=
this
.
data
.
getrideData
()
baseurl
=
this
.
myservice
.
base_url
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
()
{
ionViewDidLoad
()
{
var
tempf
=
this
.
details
.
pickup_area
.
split
(
','
)
var
tempf
=
this
.
details
.
pickup_area
.
split
(
','
)
this
.
details
.
from
=
tempf
[
0
]
this
.
details
.
from
=
tempf
[
0
]
...
@@ -27,6 +40,8 @@ export class RidedetailsPage {
...
@@ -27,6 +40,8 @@ export class RidedetailsPage {
this
.
details
.
toAd
=
this
.
details
.
drop_area
this
.
details
.
toAd
=
this
.
details
.
drop_area
console
.
log
(
this
.
details
)
console
.
log
(
this
.
details
)
this
.
details
.
discount
=
Number
(
this
.
details
.
discount
)
this
.
data
.
setrideData
(
this
.
details
)
this
.
data
.
setrideData
(
this
.
details
)
}
}
...
...
src/pages/userlocation/userlocation.ts
View file @
a7587807
...
@@ -29,6 +29,7 @@ export class UserlocationPage {
...
@@ -29,6 +29,7 @@ export class UserlocationPage {
started
:
boolean
=
false
;
started
:
boolean
=
false
;
myloc
=
[]
myloc
=
[]
waypoints
=
[]
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
)
{
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
()
this
.
loadMap
()
...
@@ -143,6 +144,8 @@ export class UserlocationPage {
...
@@ -143,6 +144,8 @@ export class UserlocationPage {
}
}
startRide
()
{
startRide
()
{
this
.
myservice
.
load_post
({
status
:
'Started'
,
id
:
this
.
details
.
id
},
'changeStatus'
)
this
.
details
.
actualPick
=
new
Date
().
getTime
()
this
.
started
=
true
;
this
.
started
=
true
;
this
.
temp
=
false
this
.
temp
=
false
...
@@ -156,11 +159,49 @@ export class UserlocationPage {
...
@@ -156,11 +159,49 @@ export class UserlocationPage {
}
}
complete
()
{
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
)
This
.
data
.
setwaypointData
(
This
.
waypoints
)
firebase
.
database
().
ref
(
"drivers/"
+
This
.
pushId
+
"/"
).
update
({
started
:
false
})
firebase
.
database
().
ref
(
"drivers/"
+
This
.
pushId
+
"/"
).
update
({
started
:
false
})
This
.
navCtrl
.
push
(
'PaymentPage'
)
This
.
navCtrl
.
push
(
'PaymentPage'
)
// console.log(This.locSubs)
}
}
getStorage
()
{
getStorage
()
{
...
@@ -174,6 +215,12 @@ export class UserlocationPage {
...
@@ -174,6 +215,12 @@ export class UserlocationPage {
This
.
pushId
=
snapshot
.
val
().
push_id
This
.
pushId
=
snapshot
.
val
().
push_id
console
.
log
(
This
.
pushId
)
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 @
a7587807
...
@@ -5,7 +5,7 @@ export class dataService {
...
@@ -5,7 +5,7 @@ export class dataService {
rideData
:
any
;
rideData
:
any
;
waypointData
:
any
;
waypointData
:
any
;
driver
Data
:
any
;
rate
Data
:
any
;
constructor
()
{
}
constructor
()
{
}
...
@@ -25,12 +25,12 @@ driverData:any;
...
@@ -25,12 +25,12 @@ driverData:any;
return
this
.
waypointData
;
return
this
.
waypointData
;
}
}
public
set
driver
Data
(
val
){
public
set
rate
Data
(
val
){
this
.
driver
Data
=
val
;
this
.
rate
Data
=
val
;
}
}
public
get
driver
Data
(){
public
get
rate
Data
(){
return
this
.
driver
Data
;
return
this
.
rate
Data
;
}
}
...
...
src/providers/firebase.service.ts
View file @
a7587807
...
@@ -42,21 +42,5 @@ export class fireService {
...
@@ -42,21 +42,5 @@ export class fireService {
});
});
return
promise
;
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