Commit 94466005 by Alen Jose

july-2

parent a7587807
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>CMC_driver</name>
<name>CMC-Driver</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" />
......@@ -76,15 +76,12 @@
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
<splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
</platform>
<plugin name="cordova-plugin-whitelist" spec="1.3.3" />
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="1.1.19" />
<plugin name="cordova-plugin-ionic-keyboard" spec="2.0.5" />
<plugin name="cordova-plugin-network-information" spec="^2.0.1" />
<plugin name="onesignal-cordova-plugin" spec="^2.4.1" />
<plugin name="cordova-plugin-request-location-accuracy" spec="^2.2.3" />
<plugin name="cordova-plugin-geolocation" spec="^4.0.1">
<variable name="GEOLOCATION_USAGE_DESCRIPTION" value="To locate you" />
</plugin>
<engine name="android" spec="^6.2.3" />
<plugin name="cordova-plugin-app-event" spec="^1.2.1" />
<plugin name="cordova-plugin-device" spec="^2.0.2" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
<plugin name="cordova-plugin-ionic-webview" spec="^1.1.19" />
<plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="de.appplant.cordova.plugin.local-notification" spec="^0.8.5" />
</widget>
{
"name": "CMC_driver",
"name": "myApp",
"app_id": "",
"type": "ionic-angular",
"integrations": {
......
{
"name": "CMC_driver",
"name": "myApp",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
......@@ -21,22 +21,28 @@
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"@ionic-native/core": "4.7.0",
"@ionic-native/geolocation": "^4.8.0",
"@ionic-native/location-accuracy": "^4.8.0",
"@ionic-native/network": "^4.8.0",
"@ionic-native/onesignal": "^4.8.0",
"@ionic-native/splash-screen": "4.7.0",
"@ionic-native/status-bar": "4.7.0",
"@ionic-native/core": "4.8.0",
"@ionic-native/device": "^4.9.0",
"@ionic-native/geolocation": "^4.9.0",
"@ionic-native/local-notifications": "^4.9.0",
"@ionic-native/location-accuracy": "^4.9.0",
"@ionic-native/network": "^4.9.0",
"@ionic-native/onesignal": "^4.9.0",
"@ionic-native/splash-screen": "4.8.0",
"@ionic-native/status-bar": "4.8.0",
"@ionic/storage": "2.1.3",
"angularfire2": "^5.0.0-rc.11",
"cordova-plugin-geolocation": "^4.0.1",
"cordova-plugin-network-information": "^2.0.1",
"cordova-plugin-request-location-accuracy": "^2.2.3",
"firebase": "^5.1.0",
"cordova-android": "^6.2.3",
"cordova-plugin-app-event": "^1.2.1",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-ionic-keyboard": "^2.0.5",
"cordova-plugin-ionic-webview": "^1.1.19",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-whitelist": "^1.3.3",
"de.appplant.cordova.plugin.local-notification": "^0.8.5",
"firebase": "^5.2.0",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"onesignal-cordova-plugin": "^2.4.1",
"promise-polyfill": "^8.0.0",
"rxjs": "5.5.11",
"sw-toolbox": "3.6.0",
......@@ -49,12 +55,16 @@
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-network-information": {},
"onesignal-cordova-plugin": {},
"cordova-plugin-request-location-accuracy": {},
"cordova-plugin-geolocation": {
"GEOLOCATION_USAGE_DESCRIPTION": "To locate you"
}
}
"cordova-plugin-device": {},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-app-event": {},
"de.appplant.cordova.plugin.local-notification": {}
},
"platforms": [
"android"
]
}
}
}
\ No newline at end of file
import { Component, ViewChild } from '@angular/core';
import { Nav, Platform,AlertController,Events } from 'ionic-angular';
import { Nav, Platform, AlertController, Events } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { Network } from '@ionic-native/network';
......@@ -8,21 +8,26 @@ import { LocationAccuracy } from '@ionic-native/location-accuracy';
import { Storage } from "@ionic/storage";
import { Myservice } from "../providers/myservice";
import { driver } from "../models/mymodel";
import * as firebase from 'firebase';
import { LocalNotifications } from '@ionic-native/local-notifications';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
@ViewChild(Nav) nav: Nav;
rootPage:string;
rootPage: string;
pages: Array<{title: string, component: any}>;
local:driver
pages: Array<{ title: string, component: any }>;
local: driver
status: boolean
pushId: string
constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen, private network: Network, private alertCtrl: AlertController, private oneSignal: OneSignal, private locationAccuracy: LocationAccuracy, private storage: Storage, private myservice: Myservice, public events: Events) {
constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen, private network: Network, private alertCtrl: AlertController, private oneSignal: OneSignal, private locationAccuracy: LocationAccuracy, private storage: Storage, private myservice: Myservice, public events: Events, private localNotifications: LocalNotifications) {
// , private localNotifications: LocalNotifications
this.initializeApp();
}
initializeApp() {
......@@ -59,23 +64,47 @@ export class MyApp {
}
})
this.storage.get('driver_data').then(data=>{
if(data!=null){
this.storage.get('driver_data').then(data => {
if (data != null) {
this.local = data
this.rootPage = 'HomePage'
// this.oneSignal.getIds().then((id) => {
// this.myservice.load_post({deviceid:id.userId,driverid:this.local.id},'updateDeviceid')
// this.myservice.load_post({deviceid:id.userId,driverid:this.local.id},'updateDeviceid')
// })
var This = this
var query = firebase.database().ref("drivers/").orderByChild("id").equalTo((data.id))
query.once("child_added", function (snapshot) {
This.pushId = snapshot.val().push_id
if (snapshot.val().status == 'online')
This.status = true
else
This.status = false
});
}
else{
else {
this.rootPage = 'LandingPage'
}
})
this.localNotifications.schedule({
text: 'Delayed ILocalNotification',
trigger: { at: new Date(new Date().getTime() + 3600) },
led: 'FF0000',
sound: null
});
});
}
statusChange() {
var This = this
if (This.status == true)
var stat = 'online'
else
var stat = 'offline'
firebase.database().ref("drivers/" + This.pushId + "/").update({ status: stat })
}
openPage(page) {
if (page == 'LandingPage'){
if (page == 'LandingPage') {
this.storage.clear()
}
this.nav.setRoot(page);
......@@ -89,7 +118,7 @@ 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')
......
......@@ -7,6 +7,14 @@
</div>
<p>{{local?.name}}</p>
<h6>{{local?.dial_code}} {{local?.phone}}</h6>
<ion-list>
<ion-item class="item_cstm">
<ion-label>Online</ion-label>
<ion-toggle [(ngModel)]="status" (ionChange)=statusChange()></ion-toggle>
</ion-item>
</ion-list>
</div>
<div class="cab_sidemenu_list">
<ul>
......
......@@ -20,6 +20,8 @@ import { AngularFireDatabase } from 'angularfire2/database';
import { AngularFireModule } from 'angularfire2';
import { dataService } from "../providers/common.service";
import { DatePipe } from '@angular/common';
import * as firebase from "firebase";
import { LocalNotifications } from '@ionic-native/local-notifications';
export const firebaseConfig = {
apiKey: "AIzaSyDLrbLd4RCCh86xuTVu7-cfJ28We_cG1sU",
......@@ -29,6 +31,8 @@ export const firebaseConfig = {
storageBucket: "callmycab-205809.appspot.com",
messagingSenderId: "151146703576"
};
firebase.initializeApp(firebaseConfig);
@NgModule({
declarations: [
MyApp
......@@ -58,6 +62,7 @@ export const firebaseConfig = {
AngularFireDatabase,
dataService,
DatePipe,
LocalNotifications,
]
})
export class AppModule {}
......@@ -177,4 +177,7 @@ ion-popover{background: rgba(0,0,0,0.6) !important;}
.cab_sidemenu_list{width:100%;padding-left:0px;padding-top:0px;}
.cab_sidemenu_list ul{width:100%;padding:0px;margin:0px;}
.cab_sidemenu_list ul li{list-style: none;color: #fff;font-size:16px;font-weight:300;padding-top:15px;padding-bottom:15px;background-position: left !important;background-repeat: no-repeat !important;padding-left:0px;background-size:23px !important;}
.item_cstm{background-color: transparent !important;color: #fff}
.toggle-md.toggle-checked .toggle-inner{background-color: #4CAF50 !important;}
.toggle-md.toggle-checked .toggle-icon{background-color: #dedede!important}
.toggle-md .toggle-inner{background-color: #dedede;}
......@@ -19,10 +19,11 @@ baseurl = this.myservice.base_url
}
ionViewDidEnter(){
this.myservice.show_loader()
this.storage.get('driver_data').then(data=>{
if(data){
this.myservice.load_post({id:data.id},'getMyRides').subscribe(response=>{
this.myservice.hide_loader()
if(response.status == 'success'){
this.upcoming = response.data.upcoming
this.completed = response.data.completed
......
......@@ -8,32 +8,47 @@
<ion-content padding class="cab_coupon_bg">
<div class="cab_trip_detail_wrapper">
<h4 class="text_white">Pickup Point</h4>
<!-- <p class="floatLeft textLeft width50">{{book.from}}</p> -->
<p class="floatLeft textLeft width50">{{book.from}}</p>
<!-- <p class="floatRight textRight width50">11 :23 am, 02-08-2017</p> -->
<div class="clear"></div>
<br>
<h4 class="text_white">Drop Point</h4>
<!-- <p class="floatLeft textLeft width50">{{book.to}}</p> -->
<p class="floatLeft textLeft width50">{{book.to}}</p>
<!-- <p class="floatRight textRight width50">12 :00 am, 02-08-2017</p> -->
<div class="clear"></div>
<br>
<br>
</div>
<div class="cab_coupon_content">
<p style="padding-top: 0px;margin-top: 0px;margin-bottom: 0px;">Ride Details</p>
<li>
<div class="child textLeft">Distance</div>
<div class="child textRight">Rs. {{details?.distance}}</div>
<div class="clear"></div>
</li>
<li>
<div class="child textLeft">Hours</div>
<div class="child textRight">Rs. {{details?.hours}}</div>
<div class="clear"></div>
</li>
</div>
<div class="cab_coupon_content">
<p style="padding-top: 0px;margin-top: 0px;margin-bottom: 0px;">Payment Details</p>
<li>
<div class="child textLeft">Total</div>
<!-- <div class="child textRight">Rs. {{ride.amount}}</div> -->
<div class="child textRight">Rs. {{details?.bfor_deduction}}</div>
<div class="clear"></div>
</li>
<li>
<div class="child textLeft">Discount</div>
<!-- <div class="child textRight">Rs. {{ride.discount}}</div> -->
<div class="child textRight">Rs. {{book?.discount}}</div>
<div class="clear"></div>
</li>
<li>
<div class="child textLeft">Due after service</div>
<!-- <div class="child textRight">Rs. {{ride.amount - ride.discount}}</div> -->
<div class="child textRight">Rs. {{details?.amount}}</div>
<div class="clear"></div>
</li>
</div>
......@@ -42,7 +57,7 @@
<ion-footer>
<div class="theme_bgcolor p10 text_white">
<p class="floatLeft text_size_18">Total</p>
<!-- <p class="floatRight text_size_18">Rs.{{ride.amount - ride.discount}}</p> -->
<p class="floatRight text_size_18">Rs.{{details?.amount}}</p>
<div class="clear"></div>
</div>
<button ion-button class="cab_footer_btn width100 text_white" (click)="done()">Completed</button>
......
......@@ -20,6 +20,7 @@ export class PaymentPage {
ride: any;
waypoints = this.data.getwaypointData()
rate = this.data.getrateData();
details:any;
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) {
}
......@@ -59,23 +60,34 @@ export class PaymentPage {
if (totalDist > This.rate.intialkm){
var extra = totalDist - This.rate.intialkm
var rate = ((extra * This.rate.standardrate) + (This.rate.intailrate)) + This.book.timeAmount
var amount = rate
rate = rate - This.book.discount
}
else{
var rate = This.rate.intailrate + This.book.timeAmount;
var amount = rate
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'){
var h = Math.floor(This.book.seconds / 3600);
var m = Math.floor(This.book.seconds % 3600 / 60);
var hDisplay = h > 0 ? h + "h" : "";
var mDisplay = m > 0 ? m + "min" : "";
var data = { 'id': This.book.id ,'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}
// }
// else
// This.myservice.show_alert('',response.message)
// })
console.log(data);
This.myservice.load_post({data},'updateRideDetails').subscribe(response=>{
This.myservice.hide_loader();
if(response.status == 'success'){
This.details = response.data;
This.details.bfor_deduction = amount;
This.details.hours = hDisplay + mDisplay;
}
else
This.myservice.show_alert('',response.message)
})
} else {
window.alert('Directions request failed due to ' + status);
}
......@@ -94,7 +106,11 @@ export class PaymentPage {
}
done() {
this.myservice.load_post({ status: 'Completed', id: this.book.id }, 'changeStatus')
this.myservice.load_post({ status: 'Completed', id: this.book.id }, 'changeStatus').subscribe(resp=>{
if(resp.status == 'success'){
this.navCtrl.setRoot('HomePage')
}
})
}
}
......@@ -22,8 +22,7 @@ export class RidedetailsPage {
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;
}
......
......@@ -42,8 +42,10 @@ export class SigninPage {
This.navCtrl.setRoot('HomePage')
}, 500);
}
else
this.myservice.show_alert('', response.message)
else{
This.myservice.hide_loader();
this.myservice.show_alert('', response.message)
}
})
}
......
......@@ -182,6 +182,7 @@ export class UserlocationPage {
var calcTime = response.rows[0].elements[0].duration.value
var realTime = (This.details.actualDrop - This.details.actualPick) / 1000//in seconds
This.details.seconds = realTime
// var realTime = (1530183600000 - 1530182700000) / 1000 //in seconds
// console.log('google time', calcTime);
// console.log('time taken',realTime);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment