Commit 6d1cb9c4 by Alen Jose

Merge branch 'alen' into 'master'

july-9 See merge request alen/CMC-driver!11
parents 3980622b b713fec9
...@@ -118,7 +118,7 @@ export class MyApp { ...@@ -118,7 +118,7 @@ export class MyApp {
} }
}) })
},20000) },20000)
This.setlocalNotification(); // This.setlocalNotification();
} }
openPage(page) { openPage(page) {
...@@ -135,11 +135,18 @@ export class MyApp { ...@@ -135,11 +135,18 @@ export class MyApp {
this.oneSignal.handleNotificationReceived().subscribe(() => { this.oneSignal.handleNotificationReceived().subscribe(() => {
// do something when notification is received // do something when notification is received
this.setlocalNotification();
}); });
this.oneSignal.handleNotificationOpened().subscribe(() => { this.oneSignal.handleNotificationOpened().subscribe((data) => {
// do something when a notification is opened // do something when a notification is opened
// this.nav.setRoot('QuickridePage') var additionalData = data.notification.payload.additionalData
this.storage.get('driver_data').then((user_data) => {
if(user_data)
this.nav.setRoot('QuickridePage', { id: additionalData.bookingId})
else
this.nav.setRoot('SigninPage', { id: additionalData.bookingId })
})
}); });
this.oneSignal.endInit(); this.oneSignal.endInit();
...@@ -192,7 +199,6 @@ export class MyApp { ...@@ -192,7 +199,6 @@ export class MyApp {
}) })
this.localNotifications.on('click').subscribe(rideData=>{ this.localNotifications.on('click').subscribe(rideData=>{
console.log(rideData)
this.data.setrideData(rideData.data) this.data.setrideData(rideData.data)
this.nav.push('RidedetailsPage') this.nav.push('RidedetailsPage')
}) })
......
...@@ -46,6 +46,7 @@ tab_swap(type) { ...@@ -46,6 +46,7 @@ tab_swap(type) {
rideDetails(data){ rideDetails(data){
this.data.setrideData(data) this.data.setrideData(data)
this.navCtrl.push('RidedetailsPage') // this.navCtrl.push('RidedetailsPage')
this.navCtrl.setRoot('QuickridePage', { id: '38'})
} }
} }
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
</div> </div>
<div class="jr_search_profile_detail"> <div class="jr_search_profile_detail">
<br> <br>
<h6>Lina Rhodes</h6> <h6>{{rideDetail?.username}}</h6>
</div> </div>
<div class="jr_clear"></div> <div class="jr_clear"></div>
</div> </div>
...@@ -28,22 +28,23 @@ ...@@ -28,22 +28,23 @@
<div class="jr_from_to"> <div class="jr_from_to">
<li> <li>
<div class="child1 from"><div class="jr_box1"></div></div> <div class="child1 from"><div class="jr_box1"></div></div>
<div class="child2 yellow"><strong>Electronic City</strong> <div class="child2 yellow"><strong>{{rideDetail?.from}}</strong>
<p>fdgsdgsdg</p></div> <p>{{rideDetail?.fromAd}}</p></div>
<div class="jr_clear"></div> <div class="jr_clear"></div>
</li> </li>
<li> <li>
<div class="child1 to"></div> <div class="child1 to"></div>
<div class="child2 grey"><strong>HSR Layout</strong> <div class="child2 grey"><strong>{{rideDetail?.to}}</strong>
<p>gfhdfgthj</p></div> <p>{{rideDetail?.toAd}}</p></div>
<div class="jr_clear"></div> <div class="jr_clear"></div>
</li> </li>
</div> </div>
<div class="jr_bottom_button_bay"> <div class="jr_bottom_button_bay">
<button ion-button class="cab_footer_btn floatLeft accept">Accept</button> <button ion-button class="cab_footer_btn floatLeft accept" (click)="accept()">Accept</button>
<button ion-button class="cab_footer_btn floatRight reject">Remove</button> <button ion-button class="cab_footer_btn floatRight reject" (click)="reject()">Reject</button>
<button ion-button class="cab_footer_btn width100" (click)="accept()">Pick Up</button>
</div> </div>
</div> </div>
......
...@@ -397,5 +397,6 @@ margin-top:10px; ...@@ -397,5 +397,6 @@ margin-top:10px;
} }
.grey{ .grey{
background: url("../assets/img/greydot.png"); background: url("../assets/img/greydot.png");
} }
.width100{width: 100% !important}
} }
import { Component } from '@angular/core'; 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 { Storage } from "@ionic/storage";
import { driver } from "../../models/mymodel";
@IonicPage() @IonicPage()
@Component({ @Component({
...@@ -8,12 +10,48 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular'; ...@@ -8,12 +10,48 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular';
templateUrl: 'quickride.html', templateUrl: 'quickride.html',
}) })
export class QuickridePage { export class QuickridePage {
bookingId = this.navParams.get('id')
rideDetail:any;
local:driver
constructor(public navCtrl: NavController, public navParams: NavParams) { constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private storage: Storage) {
} }
ionViewDidLoad() { ionViewDidEnter() {
console.log('ionViewDidLoad QuickridePage');
this.storage.get('driver_data').then(data=>{
if(data){
this.local = data;
}
})
this.myservice.load_post({ id: this.bookingId },'getBookingDetails').subscribe(resp=>{
if(resp.status == 'success'){
this.rideDetail = resp.data
var tempf = this.rideDetail.pickup_area.split(',')
this.rideDetail.from = tempf[0]
this.rideDetail.fromAd = this.rideDetail.pickup_area
this.rideDetail.timestamp = new Date(this.rideDetail.pickup_date + ' ' + this.rideDetail.pickup_time).getTime()
var temp = this.rideDetail.drop_area.split(',')
this.rideDetail.to = temp[0]
this.rideDetail.toAd = this.rideDetail.drop_area
}
})
}
accept(){
this.myservice.load_post({ bookingId: this.bookingId,driverId:this.local.id},'rideAccept').subscribe(resp=>{
if(resp.status == 'success'){
}
})
}
reject(){
} }
back(){ back(){
......
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams,Events } from 'ionic-angular'; import { IonicPage, NavController, NavParams, Events } from 'ionic-angular';
import { Validators, FormBuilder, FormGroup } from "@angular/forms"; import { Validators, FormBuilder, FormGroup } from "@angular/forms";
import { Http } from '@angular/http' import { Http } from '@angular/http'
import { dialcode } from "../../models/mymodel"; import { dialcode } from "../../models/mymodel";
...@@ -29,28 +29,32 @@ export class SigninPage { ...@@ -29,28 +29,32 @@ export class SigninPage {
}) })
} }
login(){ login() {
this.myservice.show_loader() this.myservice.show_loader()
this.myservice.load_post(this.signinForm.value,'driver_login').subscribe(response=>{ this.myservice.load_post(this.signinForm.value, 'driver_login').subscribe(response => {
if(response[0].status == 'success'){ if (response[0].status == 'success') {
response[0].data.image = response[0].data.image.startsWith("http") ? response[0].data.image : this.myservice.base_url + response[0].data.image; response[0].data.image = response[0].data.image.startsWith("http") ? response[0].data.image : this.myservice.base_url + response[0].data.image;
this.storage.set('driver_data',response[0].data) this.storage.set('driver_data', response[0].data)
var This = this; var This = this;
setTimeout(() => { setTimeout(() => {
This.myservice.hide_loader(); This.myservice.hide_loader();
This.events.publish('driver:profile', response[0].data); This.events.publish('driver:profile', response[0].data);
This.navCtrl.setRoot('HomePage') if (This.navParams.get('id')) {
this.navCtrl.setRoot('QuickridePage', { id: This.navParams.get('id') })
}
else
This.navCtrl.setRoot('HomePage')
}, 500); }, 500);
} }
else{ else {
this.myservice.hide_loader(); this.myservice.hide_loader();
this.myservice.show_alert('', response.message) this.myservice.show_alert('', response.message)
} }
}) })
} }
forgot(){ forgot() {
this.navCtrl.push("ForgotPage"); this.navCtrl.push("ForgotPage");
} }
} }
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