Commit a1cd92fb by Alen Jose

Merge branch 'alen' into 'master'

july24 See merge request alen/CMC_revamp!19
parents 0f1d096e 69bdc4fc
......@@ -46,8 +46,8 @@ export class MyApp {
this.statusBar.styleDefault();
this.splashScreen.hide();
// this.enableLoc();
// this.initOnesignal()
this.enableLoc();
this.initOnesignal()
this.network.onDisconnect().subscribe(() => {
......
......@@ -194,7 +194,7 @@ export class MapPage {
dimage.rotation = heading;
marker.setIcon(dimage);
// if (google.maps.geometry.spherical.computeDistanceBetween(myLoc, destLoc) < 50){
if (google.maps.geometry.spherical.computeDistanceBetween(myLoc, destLoc) < 50){
var locRef = firebase.database().ref().child('/drivers/');
locRef.orderByChild("id").equalTo((This.driver.driverId)).on("value", function (snapshot) {
......@@ -210,7 +210,7 @@ export class MapPage {
This.navCtrl.setRoot('PaymentPage')
}
})
// }
}
This.calculateAndDisplayRoute(directionsService, This.directionsDisplay, myLoc, destLoc);
});
}
......
......@@ -81,7 +81,7 @@ export class PaymentPage {
if (this.ride.discount) {
if (this.ride.discount.slice(-1) == '%') {
var disc_amt = this.ride.discount.slice(0, -1)
this.ride.discount = Number(this.ride.amount) * (disc_amt / 100)
this.ride.discount = Number(this.ride.amount) * (Number(disc_amt) / 100)
}
}
else {
......
......@@ -9,8 +9,8 @@ import * as firebase from 'firebase';
declare var google;
@IonicPage()
@Component({
selector: 'page-ridesummary',
templateUrl: 'ridesummary.html',
selector: 'page-ridesummary',
templateUrl: 'ridesummary.html',
})
export class RidesummaryPage {
book: any;
......@@ -19,73 +19,80 @@ export class RidesummaryPage {
local: user
public unregisterBackButtonAction: any;
driver: any;
ride:any;
ride: any;
constructor(public navCtrl: NavController, public navParams: NavParams, private data: dataService, private zone: NgZone, private myservice: Myservice, private storage: Storage, public platform: Platform) {
}
ionViewDidEnter() {
this.driver = { 'name': 'asd', 'rating': '1','ratingCount':'1','image':''}
this.ride = { 'km': 30, 'amount': '300','discount':'10%'}
if(this.ride.discount){
if(this.ride.discount.slice(-1) == '%'){
var disc_amt = this.ride.discount.slice(0, -1)
this.ride.discount = Number(this.ride.amount) * (disc_amt/100)
console.log()
}
}
// this.initializeBackButtonCustomHandler();
// this.storage.get('user_data').then(data => {
// if (data) {
// this.local = data
// this.book = this.data.getbookingData()
// console.log(this.book)
// this.driver = { 'name': 'asd', 'rating': '1','ratingCount':'1','image':''}
// this.ride = { 'km': 30, 'amount': '300','discount':'10%'}
// if(this.ride.discount){
// if(this.ride.discount.slice(-1) == '%'){
// var disc_amt = this.ride.discount.slice(0, -1)
// this.ride.discount = Number(this.ride.amount) * (disc_amt/100)
// console.log()
// }
// }
this.initializeBackButtonCustomHandler();
this.storage.get('user_data').then(data => {
if (data) {
this.local = data
this.book = this.data.getbookingData()
console.log(this.book)
// this.driver = this.data.getdriverData()
// console.log(this.driver)
this.driver = this.data.getdriverData()
console.log(this.driver)
// this.geocoder = new google.maps.Geocoder();
// for (let i = 0; i < 2; i++) {
// if (i == 0) {
// var lat = this.book.pickLat
// var lng = this.book.pickLng
// }
// else {
// var lat = this.book.dropLat
// var lng = this.book.dropLng
// }
// var latlng = new google.maps.LatLng(lat, lng);
// var This = this;
// This.geocoder.geocode({ 'latLng': latlng }, function (results, status) {
// if (status == google.maps.GeocoderStatus.OK) {
// if (results[0]) {
// if (i == 0) {
// var temp = This.book.pickArea.split(',')
// This.loc.from = temp[0]
// This.loc.fromAd = results[0].formatted_address
// }
// else {
// var temp = This.book.dropArea.split(',')
// This.loc.to = temp[0]
// This.loc.toAd = results[0].formatted_address
// This.zone.run(() => { });
// }
// }
// }
// else {
// console.log("Geocoder failed due to: " + status);
// }
// });
// }
// }
// })
this.geocoder = new google.maps.Geocoder();
for (let i = 0; i < 2; i++) {
if (i == 0) {
var lat = this.book.pickLat
var lng = this.book.pickLng
}
else {
var lat = this.book.dropLat
var lng = this.book.dropLng
}
var latlng = new google.maps.LatLng(lat, lng);
var This = this;
This.geocoder.geocode({ 'latLng': latlng }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[0]) {
if (i == 0) {
var temp = This.book.pickArea.split(',')
This.loc.from = temp[0]
This.loc.fromAd = results[0].formatted_address
}
else {
var temp = This.book.dropArea.split(',')
This.loc.to = temp[0]
This.loc.toAd = results[0].formatted_address
This.zone.run(() => { });
}
}
}
else {
console.log("Geocoder failed due to: " + status);
}
});
}
}
})
// this.myservice.load_post({ bookingId: this.book.bookingId},'getRideDetails').subscribe(resp=>{
// if(resp.status == 'success'){
// this.ride = resp.data
// }
// })
this.myservice.load_post({ bookingId: this.book.bookingId }, 'getRideDetails').subscribe(resp => {
if (resp.status == 'success') {
this.ride = resp.data
if (this.ride.discount) {
if (this.ride.discount.slice(-1) == '%') {
var disc_amt = this.ride.discount.slice(0, -1)
this.ride.discount = Number(this.ride.amount) * (Number(disc_amt) / 100)
}
}
}
})
}
public initializeBackButtonCustomHandler(): void {
......@@ -98,8 +105,8 @@ export class RidesummaryPage {
this.unregisterBackButtonAction && this.unregisterBackButtonAction();
}
close(){
this.navCtrl.push('RattingPage',{driver:this.driver})
close() {
this.navCtrl.push('RattingPage', { driver: this.driver })
}
}
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