Commit 55dcbc33 by Alen Jose

Merge branch 'alen' into 'master'

jun7 See merge request !4
parents 212d4c0f e2b32dfe
...@@ -83,22 +83,23 @@ ...@@ -83,22 +83,23 @@
<splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" /> <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
</platform> </platform>
<engine name="android" spec="^7.1.0" /> <engine name="android" spec="^7.1.0" />
<plugin name="cordova-plugin-datepicker" spec="^0.9.3" />
<plugin name="cordova-plugin-device" spec="^1.1.4" /> <plugin name="cordova-plugin-device" spec="^1.1.4" />
<plugin name="cordova-plugin-facebook4" spec="^1.9.1"> <plugin name="cordova-plugin-facebook4" spec="^1.9.1">
<variable name="APP_ID" value="223991774869277" /> <variable name="APP_ID" value="223991774869277" />
<variable name="APP_NAME" value="CMC" /> <variable name="APP_NAME" value="CMC" />
</plugin> </plugin>
<plugin name="cordova-plugin-geolocation" spec="^4.0.1">
<variable name="GEOLOCATION_USAGE_DESCRIPTION" value="To locate you" />
</plugin>
<plugin name="cordova-plugin-googleplus" spec="^5.3.0">
<variable name="REVERSED_CLIENT_ID" value="151146703576-dr7il48km7elnm2f8cfj6ru8g0adpgi6.apps.googleusercontent.com" />
</plugin>
<plugin name="cordova-plugin-network-information" spec="^2.0.1" />
<plugin name="cordova-plugin-request-location-accuracy" spec="^2.2.3" />
<plugin name="cordova-plugin-splashscreen" spec="^4.0.3" /> <plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
<plugin name="cordova-plugin-statusbar" spec="^2.2.2" /> <plugin name="cordova-plugin-statusbar" spec="^2.2.2" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.1" /> <plugin name="cordova-plugin-whitelist" spec="^1.3.1" />
<plugin name="cordova-plugin-x-toast" spec="^2.6.2" /> <plugin name="cordova-plugin-x-toast" spec="^2.6.2" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" /> <plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="cordova-plugin-googleplus" spec="^5.3.0">
<variable name="REVERSED_CLIENT_ID" value="151146703576-dr7il48km7elnm2f8cfj6ru8g0adpgi6.apps.googleusercontent.com" />
</plugin>
<plugin name="cordova-plugin-geolocation" spec="^4.0.1">
<variable name="GEOLOCATION_USAGE_DESCRIPTION" value="To locate you" />
</plugin>
<plugin name="cordova-plugin-datepicker" spec="^0.9.3" />
<plugin name="cordova-plugin-request-location-accuracy" spec="^2.2.3" />
</widget> </widget>
...@@ -321,6 +321,11 @@ ...@@ -321,6 +321,11 @@
"resolved": "https://registry.npmjs.org/@ionic-native/location-accuracy/-/location-accuracy-4.7.0.tgz", "resolved": "https://registry.npmjs.org/@ionic-native/location-accuracy/-/location-accuracy-4.7.0.tgz",
"integrity": "sha512-WGMyuy8hZaemvEHFpoix1gmCHEKU5/7axu0XY+2cLOKgaFGI/N3idEBqVxARGPuT5oBuay+dE9mMtNNBT/kndQ==" "integrity": "sha512-WGMyuy8hZaemvEHFpoix1gmCHEKU5/7axu0XY+2cLOKgaFGI/N3idEBqVxARGPuT5oBuay+dE9mMtNNBT/kndQ=="
}, },
"@ionic-native/network": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/@ionic-native/network/-/network-4.7.0.tgz",
"integrity": "sha512-d3c5iuv22Mhd6HH5ZVsz3Y6jvE3iEO3AFGpOLUbDzqp+jFzqxnr6HShwCfD1rPbLusNnKvan3J10R39UsGEYLA=="
},
"@ionic-native/splash-screen": { "@ionic-native/splash-screen": {
"version": "3.12.1", "version": "3.12.1",
"resolved": "https://registry.npmjs.org/@ionic-native/splash-screen/-/splash-screen-3.12.1.tgz", "resolved": "https://registry.npmjs.org/@ionic-native/splash-screen/-/splash-screen-3.12.1.tgz",
...@@ -1687,6 +1692,11 @@ ...@@ -1687,6 +1692,11 @@
"resolved": "https://registry.npmjs.org/cordova-plugin-googleplus/-/cordova-plugin-googleplus-5.3.0.tgz", "resolved": "https://registry.npmjs.org/cordova-plugin-googleplus/-/cordova-plugin-googleplus-5.3.0.tgz",
"integrity": "sha1-fvQYIF9pMBii0G0suGXenXy3Ico=" "integrity": "sha1-fvQYIF9pMBii0G0suGXenXy3Ico="
}, },
"cordova-plugin-network-information": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/cordova-plugin-network-information/-/cordova-plugin-network-information-2.0.1.tgz",
"integrity": "sha1-6QQh9DDGq3bUCSI/Jfzvu7zhdpA="
},
"cordova-plugin-request-location-accuracy": { "cordova-plugin-request-location-accuracy": {
"version": "2.2.3", "version": "2.2.3",
"resolved": "https://registry.npmjs.org/cordova-plugin-request-location-accuracy/-/cordova-plugin-request-location-accuracy-2.2.3.tgz", "resolved": "https://registry.npmjs.org/cordova-plugin-request-location-accuracy/-/cordova-plugin-request-location-accuracy-2.2.3.tgz",
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
"@ionic-native/geolocation": "^4.7.0", "@ionic-native/geolocation": "^4.7.0",
"@ionic-native/google-plus": "^4.7.0", "@ionic-native/google-plus": "^4.7.0",
"@ionic-native/location-accuracy": "^4.7.0", "@ionic-native/location-accuracy": "^4.7.0",
"@ionic-native/network": "^4.7.0",
"@ionic-native/splash-screen": "3.12.1", "@ionic-native/splash-screen": "3.12.1",
"@ionic-native/status-bar": "3.12.1", "@ionic-native/status-bar": "3.12.1",
"@ionic-native/toast": "^4.7.0", "@ionic-native/toast": "^4.7.0",
...@@ -37,6 +38,7 @@ ...@@ -37,6 +38,7 @@
"cordova-plugin-facebook4": "^1.9.1", "cordova-plugin-facebook4": "^1.9.1",
"cordova-plugin-geolocation": "^4.0.1", "cordova-plugin-geolocation": "^4.0.1",
"cordova-plugin-googleplus": "^5.3.0", "cordova-plugin-googleplus": "^5.3.0",
"cordova-plugin-network-information": "^2.0.1",
"cordova-plugin-request-location-accuracy": "^2.2.3", "cordova-plugin-request-location-accuracy": "^2.2.3",
"cordova-plugin-splashscreen": "^4.0.3", "cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.2", "cordova-plugin-statusbar": "^2.2.2",
...@@ -75,7 +77,8 @@ ...@@ -75,7 +77,8 @@
"GEOLOCATION_USAGE_DESCRIPTION": "To locate you" "GEOLOCATION_USAGE_DESCRIPTION": "To locate you"
}, },
"cordova-plugin-datepicker": {}, "cordova-plugin-datepicker": {},
"cordova-plugin-request-location-accuracy": {} "cordova-plugin-request-location-accuracy": {},
"cordova-plugin-network-information": {}
}, },
"platforms": [ "platforms": [
"android" "android"
......
import { Component, ViewChild } from '@angular/core'; import { Component, ViewChild } from '@angular/core';
import { Nav, Platform, Events } from 'ionic-angular'; import { Nav, Platform, Events, AlertController } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar'; import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen'; import { SplashScreen } from '@ionic-native/splash-screen';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import { user } from '../models/mymodel' import { user } from '../models/mymodel'
import { Myservice } from "../providers/myservice"; import { Myservice } from "../providers/myservice";
import { LocationAccuracy } from '@ionic-native/location-accuracy'; import { LocationAccuracy } from '@ionic-native/location-accuracy';
import { Network } from '@ionic-native/network';
@Component({ @Component({
templateUrl: 'app.html' templateUrl: 'app.html'
...@@ -16,7 +17,7 @@ export class MyApp { ...@@ -16,7 +17,7 @@ export class MyApp {
rootPage: string ; rootPage: string ;
local:user; local:user;
constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen, public storage: Storage, public events: Events, private myservice: Myservice, private locationAccuracy: LocationAccuracy) { constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen, public storage: Storage, public events: Events, private myservice: Myservice, private locationAccuracy: LocationAccuracy, private network: Network, public alertCtrl: AlertController) {
this.initializeApp(); this.initializeApp();
} }
...@@ -46,6 +47,27 @@ export class MyApp { ...@@ -46,6 +47,27 @@ export class MyApp {
this.splashScreen.hide(); this.splashScreen.hide();
// this.enableLoc(); // this.enableLoc();
this.network.onDisconnect().subscribe(() => {
const alert = this.alertCtrl.create({
title: 'Network Error',
message: 'No Internet Connection',
buttons: [
{
text: 'Quit',
handler: data => {
this.platform.exitApp();
}
}, {
text: 'Cancel',
role: 'cancel'
}
]
});
alert.present();
});
}); });
} }
......
...@@ -20,6 +20,7 @@ import { DatePicker } from '@ionic-native/date-picker'; ...@@ -20,6 +20,7 @@ import { DatePicker } from '@ionic-native/date-picker';
import { LocationAccuracy } from '@ionic-native/location-accuracy'; import { LocationAccuracy } from '@ionic-native/location-accuracy';
import { SubjectService } from "../providers/subject.service"; import { SubjectService } from "../providers/subject.service";
import { dataService } from "../providers/common.service"; import { dataService } from "../providers/common.service";
import { Network } from '@ionic-native/network';
export const firebaseConfig = { export const firebaseConfig = {
apiKey: "AIzaSyDLrbLd4RCCh86xuTVu7-cfJ28We_cG1sU", apiKey: "AIzaSyDLrbLd4RCCh86xuTVu7-cfJ28We_cG1sU",
...@@ -60,6 +61,7 @@ export const firebaseConfig = { ...@@ -60,6 +61,7 @@ export const firebaseConfig = {
LocationAccuracy, LocationAccuracy,
SubjectService, SubjectService,
dataService, dataService,
Network,
] ]
}) })
export class AppModule {} export class AppModule {}
...@@ -186,4 +186,8 @@ ...@@ -186,4 +186,8 @@
.edit_circle ion-icon{position: absolute;top: 6px;right: 8px;} .edit_circle ion-icon{position: absolute;top: 6px;right: 8px;}
.picker-wrapper{background: #ff9000 !important;} .picker-wrapper{background: #ff9000 !important;}
.picker-toolbar{background: #ff9000 !important;} .picker-toolbar{background: #ff9000 !important;}
.single_btn{width: 100% !important} .single_btn{width: 100% !important}
\ No newline at end of file .txt_cntr{text-align: center}
.clr_wht{color: #fff}
.rate_est{font-size: 15px;padding-top: 5px}
.estim_li{padding-top: 5px !important;}
\ No newline at end of file
...@@ -8,29 +8,32 @@ ...@@ -8,29 +8,32 @@
<ion-content padding class="cab_coupon_bg"> <ion-content padding class="cab_coupon_bg">
<div class="cab_coupon_wrapper"> <div class="cab_coupon_wrapper">
<form [formGroup]="promoForm">
<div class="cab_coupon_box"> <div class="cab_coupon_box">
<input class="cab_coupon_input" placeholder="Enter Coupon Code"> <input class="cab_coupon_input" placeholder="Enter Coupon Code" formControlName="promocode">
</div> </div>
<p>You don’t seem to have any valid coupons.<br> </form>
Invite your friends. Unlock free ride coupons</p> <p *ngIf="">You don’t seem to have any valid coupons.<br>
<!-- Invite your friends. Unlock free ride coupons</p> -->
<div class="cab_coupon_box"> <div class="cab_coupon_box">
<button ion-button class="cab_coupon_apply">Apply</button> <button ion-button class="cab_coupon_apply" (click)="checkCode()">Apply</button>
</div> </div>
<div class="cab_coupon_content"> <div class="cab_coupon_content">
<p>Payment Details</p> <p>Payment Details</p>
<li> <li>
<div class="child textLeft">Total</div> <div class="child textLeft">Total</div>
<div class="child textRight">$ 150</div> <div class="child textRight">₹ {{rate[0]}}</div>
<div class="clear"></div> <div class="clear"></div>
</li> </li>
<li> <li>
<div class="child textLeft">Discount</div> <div class="child textLeft">Discount</div>
<div class="child textRight">$ 25</div> <div class="child textRight" *ngIf="promo.discount.slice(-1)=='%'">{{promo.discount}}</div>
<div class="child textRight" *ngIf="promo.discount.slice(-1)!='%'">₹ {{promo.discount}}</div>
<div class="clear"></div> <div class="clear"></div>
</li> </li>
<li> <li>
<div class="child textLeft">Due after service</div> <div class="child textLeft">Due after service</div>
<div class="child textRight">$ 125</div> <div class="child textRight">₹ {{promo.amount}}</div>
<div class="clear"></div> <div class="clear"></div>
</li> </li>
...@@ -39,7 +42,7 @@ ...@@ -39,7 +42,7 @@
</ion-content> </ion-content>
<ion-footer> <ion-footer>
<div class="cab_footer_btn_bay"> <div class="cab_footer_btn_bay">
<button ion-button class="cab_footer_btn floatRight"(click)="pay()">PAY</button> <button ion-button class="cab_footer_btn floatRight"(click)="pay()">CONTINUE</button>
<button ion-button class="cab_footer_btn floatLeft" (click)="goBack()">CANCEL</button> <button ion-button class="cab_footer_btn floatLeft" (click)="goBack()">CANCEL</button>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
......
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams,ModalController } from 'ionic-angular'; import { IonicPage, NavController, NavParams, ModalController } from 'ionic-angular';
import { Validators, FormBuilder, FormGroup } from "@angular/forms";
import { Myservice } from "../../providers/myservice";
import { dataService } from "../../providers/common.service";
@IonicPage() @IonicPage()
@Component({ @Component({
...@@ -8,21 +10,48 @@ import { IonicPage, NavController, NavParams,ModalController } from 'ionic-angul ...@@ -8,21 +10,48 @@ import { IonicPage, NavController, NavParams,ModalController } from 'ionic-angul
templateUrl: 'addcoupon.html', templateUrl: 'addcoupon.html',
}) })
export class AddcouponPage { export class AddcouponPage {
promoForm: FormGroup
rate = this.navParams.get('rate').split(' to ');
promo = { 'amount': Number(this.rate[0]), discount: '0' }
constructor(public navCtrl: NavController, public navParams: NavParams,public modalCtrl: ModalController) { constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController, private formBuilder: FormBuilder, private myservice: Myservice, private data: dataService) {
this.promoForm = this.formBuilder.group({
promocode: [''],
amount: ['']
})
} }
ionViewDidLoad() { ionViewDidLoad() {
console.log(this.rate)
console.log('ionViewDidLoad AddcouponPage'); console.log('ionViewDidLoad AddcouponPage');
} }
goBack(){ goBack() {
this.navCtrl.pop(); this.navCtrl.pop();
} }
pay() { pay() {
let modal = this.modalCtrl.create('ConfirmridePage'); // let modal = this.modalCtrl.create('ConfirmridePage');
modal.present(); // modal.present();
var booking = this.data.getbookingData()
if (booking.type == 'later')
this.navCtrl.push('ConfirmridePage');
else
this.navCtrl.push('');
} }
checkCode() {
this.myservice.show_loader();
this.promoForm.controls['amount'].setValue(this.rate)
this.myservice.load_post(this.promoForm.value, 'checkPromocode').subscribe(response => {
this.myservice.hide_loader()
if (response.status == 'success') {
this.promo = response.data
}
else {
this.myservice.show_alert('Error', response.message)
}
})
}
} }
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
<div class="cab_logo" style="padding-bottom: 20%;"> <div class="cab_logo" style="padding-bottom: 20%;">
<img src="assets/img/booking.png"> <img src="assets/img/booking.png">
</div> </div>
<p class="text_white textCenter cab_confirm_p">Your booking has been confirmed.<br> <p class="text_white textCenter cab_confirm_p">Your booking has been confirmed<br>
Driver will pick you in 5 minute(s)</p> on </p>
</ion-content> </ion-content>
<ion-footer> <ion-footer>
<button ion-button class="cab_footer_btn width100 theme_bgcolor text_white" (click)="payment()">OKAY</button> <button ion-button class="cab_footer_btn width100 theme_bgcolor text_white" (click)="payment()">OKAY</button>
......
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams,ViewController,ModalController } from 'ionic-angular'; import { IonicPage, NavController, NavParams,ViewController,ModalController } from 'ionic-angular';
import { Myservice } from "../../providers/myservice";
import { dataService } from "../../providers/common.service";
@IonicPage() @IonicPage()
...@@ -9,12 +10,15 @@ import { IonicPage, NavController, NavParams,ViewController,ModalController } fr ...@@ -9,12 +10,15 @@ import { IonicPage, NavController, NavParams,ViewController,ModalController } fr
templateUrl: 'confirmride.html', templateUrl: 'confirmride.html',
}) })
export class ConfirmridePage { export class ConfirmridePage {
type = this.navParams.get('type')
constructor(public navCtrl: NavController, public navParams: NavParams,public viewCtrl: ViewController,public modalCtrl: ModalController) { constructor(public navCtrl: NavController, public navParams: NavParams,public viewCtrl: ViewController,public modalCtrl: ModalController, private myservice:Myservice, private data:dataService) {
} }
ionViewDidLoad() { ionViewDidEnter() {
console.log('ionViewDidLoad ConfirmridePage'); var book = this.data.getbookingData()
console.log(book)
this.myservice.load_post({ book_date:book.date,},'')
} }
dismiss() dismiss()
......
...@@ -94,6 +94,7 @@ export class HomePage { ...@@ -94,6 +94,7 @@ export class HomePage {
this.markers[0].setMap(null); this.markers[0].setMap(null);
} }
var place = autocomplete.getPlace(); var place = autocomplete.getPlace();
console.log(place)
var lat = place.geometry.location.lat(); var lat = place.geometry.location.lat();
var lng = place.geometry.location.lng(); var lng = place.geometry.location.lng();
...@@ -106,11 +107,13 @@ export class HomePage { ...@@ -106,11 +107,13 @@ export class HomePage {
this.p_lat = lat this.p_lat = lat
this.p_lng = lng this.p_lng = lng
this.markers[1] = marker this.markers[1] = marker
this.locForm.controls['pickLoc'].setValue(place.formatted_address)
} }
else if (type == 1) { else if (type == 1) {
this.d_lat = lat this.d_lat = lat
this.d_lng = lng this.d_lng = lng
this.markers[2] = marker this.markers[2] = marker
this.locForm.controls['dropLoc'].setValue(place.formatted_address)
} }
if (this.p_lat && this.d_lat) { if (this.p_lat && this.d_lat) {
...@@ -171,9 +174,15 @@ export class HomePage { ...@@ -171,9 +174,15 @@ export class HomePage {
} }
ridemore() { ridemore() {
var data={pickLat:this.p_lat,pickLng:this.p_lng, dropLat:this.d_lat, dropLng:this.d_lng} var data = { 'pickLat': this.p_lat, 'pickLng': this.p_lng, 'dropLat': this.d_lat, 'dropLng': this.d_lng, 'pickArea': this.locForm.value.pickLoc, 'dropArea': this.locForm.value.dropLoc}
this.data.setbookingData(data) this.data.setbookingData(data)
let modal = this.modalCtrl.create('RidepopPage'); let modal = this.modalCtrl.create('RidepopPage');
modal.onDidDismiss(data=>{
if(data){
let modal1 = this.modalCtrl.create('RidenowPage',{type:data});
modal1.present();
}
})
modal.present(); modal.present();
} }
......
...@@ -6,27 +6,30 @@ ...@@ -6,27 +6,30 @@
<ion-icon name="ios-arrow-down-outline"(click)="dismiss()"></ion-icon> <ion-icon name="ios-arrow-down-outline"(click)="dismiss()"></ion-icon>
</div> </div>
<p>Sedan</p> <p>{{rates[0].cartype}}</p>
<h6>Toyota Etios, Ford Fiesta</h6> <!-- <h6>Toyota Etios, Ford Fiesta</h6> -->
<div class="cab_ride_fare_break">Fare Breakup</div> <div class="cab_ride_fare_break">Fare Breakup</div>
<ion-grid> <ion-grid>
<div *ngFor="let rate of rates" class="txt_cntr">
<span class="clr_wht">For {{rate.timetype}} time ride</span>
<ion-row class="textCenter"> <ion-row class="textCenter">
<ion-col col-4> <ion-col col-4>
<strong>100</strong> <strong>{{rate.intailrate}}</strong>
<h5>First 4km</h5> <h5>First {{rate.intialkm}}km</h5>
</ion-col> </ion-col>
<ion-col col-4> <ion-col col-4>
<strong>12/km</strong> <strong>{{rate.standardrate}}/km</strong>
<h5>After 4km</h5> <h5>After {{rate.intialkm}}km</h5>
</ion-col> </ion-col>
<ion-col col-4> <ion-col col-4>
<strong>1/min</strong> <strong>{{rate.extrahour}}/hr</strong>
<h5>Ride time Rate</h5> <h5>Ride time Rate</h5>
</ion-col> </ion-col>
</ion-row> </ion-row>
</div>
</ion-grid> </ion-grid>
<h6 class="bottom0">Peak time charges may apply.</h6> <h6 class="bottom0">Peak time charges may apply.</h6>
<div class="cab_trip_detail_wrapper"> <!-- <div class="cab_trip_detail_wrapper">
<h4 class="text_white">Pickup Point</h4> <h4 class="text_white">Pickup Point</h4>
<p class="floatLeft textLeft width50">North Sarovar Road,E City</p> <p class="floatLeft textLeft width50">North Sarovar Road,E City</p>
<p class="floatRight textRight width50">11 :23 am, 02-08-2017</p> <p class="floatRight textRight width50">11 :23 am, 02-08-2017</p>
...@@ -38,7 +41,7 @@ ...@@ -38,7 +41,7 @@
<div class="clear"></div> <div class="clear"></div>
<br> <br>
<br> <br>
</div> </div> -->
</div> </div>
</div> </div>
</ion-content> </ion-content>
......
...@@ -26,7 +26,9 @@ ...@@ -26,7 +26,9 @@
</ion-grid> </ion-grid>
<div class="cab_ride_offer"> <div class="cab_ride_offer">
<li (click)="ratecard()">Rate Card</li> <li (click)="ratecard()">Rate Card</li>
<li>Rate Estimate</li> <li class="estim_li">Rate Estimate
<div class="rate_est">₹ {{totRate}}</div>
</li>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
</div> </div>
......
import { Component } from '@angular/core'; import { Component,NgZone } from '@angular/core';
import { IonicPage, NavController, NavParams,ViewController,ModalController } from 'ionic-angular'; import { IonicPage, NavController, NavParams,ViewController,ModalController } from 'ionic-angular';
import { dataService } from "../../providers/common.service"; import { dataService } from "../../providers/common.service";
import { Myservice } from "../../providers/myservice"; import { Myservice } from "../../providers/myservice";
declare var google;
@IonicPage() @IonicPage()
@Component({ @Component({
selector: 'page-ridenow', selector: 'page-ridenow',
...@@ -10,8 +13,9 @@ import { Myservice } from "../../providers/myservice"; ...@@ -10,8 +13,9 @@ import { Myservice } from "../../providers/myservice";
export class RidenowPage { export class RidenowPage {
details:any; details:any;
rates:any; rates:any;
totRate:string;
constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, public modalCtrl: ModalController, private data: dataService, private myservice:Myservice) { constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, public modalCtrl: ModalController, private data: dataService, private myservice:Myservice,private zone:NgZone) {
} }
ionViewDidEnter() { ionViewDidEnter() {
...@@ -22,6 +26,30 @@ export class RidenowPage { ...@@ -22,6 +26,30 @@ export class RidenowPage {
this.rates = response.data this.rates = response.data
} }
}) })
var origin = new google.maps.LatLng(this.details.pickLat, this.details.pickLng)
var destination = new google.maps.LatLng(this.details.dropLat, this.details.dropLng)
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] != '') {
console.log(response.rows[0].elements[0])
This.myservice.load_post({ gdata: response.rows[0].elements[0], car: This.details.carDetails},'getEstimateRate').subscribe(response=>{
if(response.status == 'success'){
This.totRate = response.data
This.zone.run(() => { });
}
})
}
});
} }
confirm() { confirm() {
...@@ -35,8 +63,9 @@ export class RidenowPage { ...@@ -35,8 +63,9 @@ export class RidenowPage {
} }
addcoupon() { addcoupon() {
let modal = this.modalCtrl.create('AddcouponPage'); this.navCtrl.push('AddcouponPage',{rate:this.totRate});
modal.present(); // let modal = this.modalCtrl.create('AddcouponPage');
// modal.present();
} }
ratecard() { ratecard() {
......
...@@ -52,10 +52,10 @@ export class RidepopPage { ...@@ -52,10 +52,10 @@ export class RidepopPage {
this.locData = this.data.getbookingData() this.locData = this.data.getbookingData()
this.locData.date = new Date()//date this.locData.date = new Date()//date
this.locData.carDetails = this.carTypes[this.carIndex] this.locData.carDetails = this.carTypes[this.carIndex]
this.locData.type = 'ride'
this.data.setbookingData(this.locData); this.data.setbookingData(this.locData);
let modal = this.modalCtrl.create('RidenowPage'); this.viewCtrl.dismiss('later');
modal.present();
// } // }
// }, // },
// err => console.log('Error occurred while getting date: ', err) // err => console.log('Error occurred while getting date: ', err)
...@@ -63,7 +63,12 @@ export class RidepopPage { ...@@ -63,7 +63,12 @@ export class RidepopPage {
} }
bookNow(){ bookNow(){
this.locData = this.data.getbookingData()
this.locData.date = new Date()
this.locData.carDetails = this.carTypes[this.carIndex]
this.locData.type = 'later'
this.data.setbookingData(this.locData);
this.viewCtrl.dismiss('ride');
} }
dismiss() dismiss()
......
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