Commit 70680685 by Alen Jose

Merge branch 'alen' into 'master'

july23 See merge request alen/CMC-driver!17
parents e84ac61e 4c478b59
...@@ -214,12 +214,12 @@ export class MyApp { ...@@ -214,12 +214,12 @@ export class MyApp {
} }
liveLoc(){ liveLoc(){
// this.locSubs = this.geolocation.watchPosition().filter((p) => p.coords !== undefined) //Filter Out Errors this.locSubs = this.geolocation.watchPosition().filter((p) => p.coords !== undefined) //Filter Out Errors
// .subscribe(position => { .subscribe(position => {
// firebase.database().ref("drivers/" + this.pushId + "/").update({ lat: Number(position.coords.latitude), lng: Number(position.coords.longitude) }) firebase.database().ref("drivers/" + this.pushId + "/").update({ lat: Number(position.coords.latitude), lng: Number(position.coords.longitude) })
firebase.database().ref("drivers/" + this.pushId + "/").update({ // firebase.database().ref("drivers/" + this.pushId + "/").update({
lat: 10.014638, lng: 76.364054}) // lat: 10.014638, lng: 76.364054})
// }) })
} }
} }
...@@ -67,7 +67,7 @@ export class DocupdatePage { ...@@ -67,7 +67,7 @@ export class DocupdatePage {
} }
} }
upload() { upload() {
if (this.filename) { if (this.filename) {
this.myservice.show_loader() this.myservice.show_loader()
this.formdata.append('data', JSON.stringify(this.myData)); this.formdata.append('data', JSON.stringify(this.myData));
......
...@@ -51,7 +51,7 @@ tab_swap(type) { ...@@ -51,7 +51,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'}) this.navCtrl.setRoot('QuickridePage', { id: '38'})
this.events.publish('driver:locOn','') // this.events.publish('driver:locOn','')
} }
} }
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular'; import { IonicPage, NavController, NavParams, ModalController, AlertController } from 'ionic-angular';
import { Myservice } from "../../providers/myservice"; import { Myservice } from "../../providers/myservice";
import { Storage } from "@ionic/storage"; import { Storage } from "@ionic/storage";
import { driver } from "../../models/mymodel"; import { driver } from "../../models/mymodel";
...@@ -13,23 +13,23 @@ import { Toast } from "@ionic-native/toast"; ...@@ -13,23 +13,23 @@ import { Toast } from "@ionic-native/toast";
}) })
export class QuickridePage { export class QuickridePage {
bookingId = this.navParams.get('id') bookingId = this.navParams.get('id')
rideDetail:any; rideDetail: any;
local:driver local: driver
baseUrl = this.myservice.base_url baseUrl = this.myservice.base_url
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private storage: Storage, private data: dataService, private toast:Toast) { constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private storage: Storage, private data: dataService, private toast: Toast, private modalCtrl: ModalController, public alertCtrl: AlertController) {
} }
ionViewDidEnter() { ionViewDidEnter() {
this.storage.get('driver_data').then(data=>{ this.storage.get('driver_data').then(data => {
if(data){ if (data) {
this.local = data; this.local = data;
} }
}) })
this.myservice.load_post({ id: this.bookingId },'getBookingDetails').subscribe(resp=>{ this.myservice.load_post({ id: this.bookingId }, 'getBookingDetails').subscribe(resp => {
if(resp.status == 'success'){ if (resp.status == 'success') {
this.rideDetail = resp.data this.rideDetail = resp.data
var tempf = this.rideDetail.pickup_area.split(',') var tempf = this.rideDetail.pickup_area.split(',')
...@@ -47,30 +47,49 @@ export class QuickridePage { ...@@ -47,30 +47,49 @@ export class QuickridePage {
}) })
} }
accept(){ accept() {
this.myservice.load_post({ bookingId: this.bookingId,driverId:this.local.id},'rideAccept').subscribe(resp=>{ this.myservice.load_post({ bookingId: this.bookingId, driverId: this.local.id }, 'rideAccept').subscribe(resp => {
if(resp.status == 'success'){ if (resp.status == 'success') {
this.toast.show(resp.message, '2000', 'center').subscribe(toast => { this.toast.show(resp.message, '2000', 'center').subscribe(toast => {
console.log(toast); console.log(toast);
}); });
this.navCtrl.pop() this.navCtrl.pop()
} }
else{ else {
this.myservice.show_alert('',resp.message) this.myservice.show_alert('', resp.message)
} }
}) })
} }
reject(){ reject() {
this.navCtrl.pop(); let modal = this.modalCtrl.create('RejectPage', { bookId: this.bookingId })
modal.onDidDismiss(data => {
if (data) {
const alert = this.alertCtrl.create({
title: 'Success',
message: data,
buttons: [
{
text: 'Ok',
handler: data => {
this.navCtrl.setRoot('HomePage')
}
}
]
});
alert.present();
}
})
modal.present();
// this.navCtrl.pop();
} }
pick(){ pick() {
this.myservice.show_loader() this.myservice.show_loader()
this.navCtrl.push('UserlocationPage') this.navCtrl.push('UserlocationPage')
} }
back(){ back() {
this.navCtrl.pop() this.navCtrl.pop()
} }
} }
<ion-content class="hm_theme_trans_bg">
<div class="hm_cancel_pop_div">
<div class="hm_cancel_pop_main">
<div class="hm_cancel_pop_upper">
<img src="assets/img/hm_ques_mark.png">
<p>Cancellation Reason</p>
</div>
<div class="hm_cancel_pop_lower">
<ul>
<ion-list radio-group [(ngModel)]="reason">
<li>
<div class="hm_cancel_radio">
<ion-radio value="Pickup location too far"></ion-radio>
</div>
<div class="hm_cancel_reason">
Pickup location too far
</div>
<div class="hm_clear"></div>
</li>
<li>
<div class="hm_cancel_radio">
<ion-radio value="Cannot serve at the requested time"></ion-radio>
</div>
<div class="hm_cancel_reason">
Cannot serve at the requested time
</div>
<div class="hm_clear"></div>
</li>
<li>
<div class="hm_cancel_radio">
<ion-radio value="Other"></ion-radio>
</div>
<div class="hm_cancel_reason">
Other
</div>
<div class="hm_clear"></div>
</li>
</ion-list>
</ul>
<div class="hm_cancel_bottom_bay">
<li class="hm_cancel_cancel" (click)="dismiss()">Cancel</li>
<li class="hm_cancel_submit" (click)="submit()">Submit</li>
</div>
</div>
</div>
</div>
</ion-content>
\ No newline at end of file
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { RejectPage } from './reject';
@NgModule({
declarations: [
RejectPage,
],
imports: [
IonicPageModule.forChild(RejectPage),
],
})
export class RejectPageModule {}
page-reject {
.hm_theme_trans_bg{background: rgba(0, 0, 0, 0.8) !important;}
.hm_cancel_pop_div{width:100%;height:100%;}
.hm_cancel_pop_main{width:300px;background:#ffffff;margin:0 auto;position:relative;top:100px;}
.hm_cancel_pop_upper{width:100%;background:#404041;text-align:center;padding: 30px;}
.hm_cancel_pop_upper img{width:50px;}
.hm_cancel_pop_upper p{color:#d2d4d6;font-size:18px;margin:0px;padding-top:10px;}
.hm_cancel_pop_lower{width:100%;padding:20px;}
.hm_cancel_pop_lower ul{width:100%;margin:0px;padding:0px;}
.hm_cancel_pop_lower ul li{width:100%;list-style:none;font-weight: 300;font-size: 15px;padding-bottom:15px;font-size:15px;}
.hm_cancel_reason{float:left;color:#888888;padding-left:10px;}
.hm_cancel_radio{float:left;}
.hm_cancel_bottom_bay{width:100%;text-align:center;padding-top: 15px;}
.hm_cancel_bottom_bay li{display:inline-block;list-style:none;padding:8px;padding-left:20px;padding-right:20px;font-size:18px;font-weight:500;border-radius:20px;}
.hm_cancel_cancel{color:#556067;}
.hm_cancel_submit{background-color:#404041 !important;color:#fff;background:url("../assets/img/hm_log_arw.png");background-repeat: no-repeat !important;background-position: right 10px top 13px !important;background-size: 13px;padding-right:40px !important;font-weight:300 !important;}
.hm_cancel_radio .radio-md .radio-checked{border-color:#faaf41 !important;}
.hm_cancel_radio .radio-inner{background:#faaf41 !important;}
.hm_theme_trans_bg{background: rgba(0, 0, 0, 0.8) !important;}
.hm_clear{clear:both;}
}
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams,ViewController } from 'ionic-angular';
import { Myservice } from '../../providers/myservice';
import { Storage } from "@ionic/storage";
import { driver } from "../../models/mymodel";
@IonicPage()
@Component({
selector: 'page-reject',
templateUrl: 'reject.html',
})
export class RejectPage {
reason:any;
local:driver
constructor(public navCtrl: NavController, public navParams: NavParams, public viewctrl: ViewController, private myservice: Myservice, private storage:Storage) {
}
ionViewDidEnter() {
this.storage.get('driver_data').then(data=>{
if(data)
this.local = data
})
}
dismiss(){
this.viewctrl.dismiss();
}
submit(){
var booking_id = this.navParams.get('bookId');
this.myservice.load_post({ booking_id: booking_id, driver_id: this.local.id, comment: this.reason }, 'rideReject').subscribe(response => {
if (response.status == 'success') {
this.viewctrl.dismiss(response.message);
}
else {
this.myservice.show_alert('Error', response.message)
}
})
}
}
...@@ -2,6 +2,8 @@ import { Component } from '@angular/core'; ...@@ -2,6 +2,8 @@ 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 { Storage } from "@ionic/storage";
import { driver } from "../../models/mymodel";
@IonicPage() @IonicPage()
@Component({ @Component({
...@@ -10,15 +12,20 @@ import { dataService } from "../../providers/common.service"; ...@@ -10,15 +12,20 @@ import { dataService } from "../../providers/common.service";
}) })
export class UploaddocPage { export class UploaddocPage {
docs:any; docs:any;
local:driver
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private comService:dataService) { constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private comService:dataService, private storage:Storage) {
} }
ionViewDidEnter(){ ionViewDidEnter(){
this.myservice.load_post({},'getAllDocument').subscribe(resp=>{ this.storage.get('driver_data').then(data=>{
if(resp.status == 'success'){ this.local = data
this.docs = resp.data
} this.myservice.load_post({id:this.local.id},'getAllDocument').subscribe(resp=>{
if(resp.status == 'success'){
this.docs = resp.data
}
})
}) })
} }
......
...@@ -215,6 +215,7 @@ export class UserlocationPage { ...@@ -215,6 +215,7 @@ export class UserlocationPage {
// var realTime = (1530183600000 - 1530182700000) / 1000 //in seconds // var realTime = (1530183600000 - 1530182700000) / 1000 //in seconds
// console.log('google time', calcTime); // console.log('google time', calcTime);
// console.log('time taken',realTime); // console.log('time taken',realTime);
console.log(realTime)
if (calcTime < realTime) { if (calcTime < realTime) {
var extraHr = Math.round(((realTime - calcTime) / 3600) * 100) / 100 //in hrs var extraHr = Math.round(((realTime - calcTime) / 3600) * 100) / 100 //in hrs
// console.log('extra time',extraHr) // console.log('extra time',extraHr)
......
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