Commit 1bb6dcf9 by Alen Jose

Merge branch 'alen' into 'master'

aug-2 See merge request alen/CMC-driver!23
parents 34fa9446 a1536d27
...@@ -21,5 +21,59 @@ ...@@ -21,5 +21,59 @@
"ridedetail":{ "ridedetail":{
"Ride Details":"Ride Details", "Ride Details":"Ride Details",
"Pick Up":"Pick Up" "Pick Up":"Pick Up"
},
"quickride":{
"Quick Ride":"Quick Ride",
"You have a ride request":"You have a ride request",
"Date":"Date",
"Accept":"Accept",
"Reject":"Reject",
"Secret key miss match":"Secret key miss match",
"Please try again":"Please try again",
"Successfully Accepted" : "Successfully Accepted",
"Sorry, The ride is gone":"Sorry, The ride is gone"
},
"reject":{
"Cancellation Reason":"Cancellation Reason",
"Pickup location too far":"Pickup location too far",
"Cannot serve at the requested time":"Cannot serve at the requested time",
"Other":"Other",
"Cancel":"Cancel",
"Submit":"Submit",
"Cancelled Successfully":"Cancelled Successfully",
"Please try again":"Please try again",
"Secret key miss match":"Secret key miss match"
},
"userloc":{
"User Location":"User Location",
"From":"From",
"To":"To",
"Start Ride":"Start Ride",
"Finish Ride":"Finish Ride",
"Please try again":"Please try again",
"Secret key miss match":"Secret key miss match"
},
"profile":{
"Profile":"Profile",
"My Profile":"My Profile",
"Name":"Name",
"Enter a valid Name":"Enter a valid Name",
"Username":"Username",
"Enter a valid Username":"Enter a valid Username",
"Mobile Number":"Mobile Number",
"Enter a valid Mobile":"Enter a valid Mobile",
"Email":"Email",
"Enter a valid Email":"Enter a valid Email",
"Date of Birth":"Date of Birth",
"Select your DOB":"Select your DOB",
"Male":"Male",
"Female":"Female",
"License Number":"License Number",
"Enter a valid License Number":"Enter a valid License Number",
"Car Type":"Car Type",
"Select a valid Car Type":"Select a valid Car Type",
"Car Number":"Car Number",
"Enter a valid Car Number":"Enter a valid Car Number",
"SAVE":"SAVE"
} }
} }
\ No newline at end of file
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<ul> <ul>
<li *ngFor="let up of upcoming" (click)="rideDetails(up)"> <li *ngFor="let up of upcoming" (click)="rideDetails(up)">
<div class="home_content_circle"> <div class="home_content_circle">
<img [src]=baseurl+up.image /> <img [src]=up.image />
</div> </div>
<div class="home_content_detail"> <div class="home_content_detail">
<h5>{{up.username}}</h5> <h5>{{up.username}}</h5>
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<ul> <ul>
<li *ngFor="let comp of completed" (click)="rideDetails(comp)"> <li *ngFor="let comp of completed" (click)="rideDetails(comp)">
<div class="home_content_circle"> <div class="home_content_circle">
<img [src]=baseurl+comp.image /> <img [src]=comp.image />
</div> </div>
<div class="home_content_detail"> <div class="home_content_detail">
<h5>{{comp.username}}</h5> <h5>{{comp.username}}</h5>
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
<ion-icon name="menu"></ion-icon> <ion-icon name="menu"></ion-icon>
</button> </button>
<div class="nav_header_title floatLeft"> <div class="nav_header_title floatLeft">
Profile {{'profile.Profile'|translate}}
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</ion-header> </ion-header>
<ion-content padding> <ion-content padding>
<div class="myprofile_wrapper"> <div class="myprofile_wrapper">
<h4>My Profile</h4> <h4>{{'profile.My Profile'|translate}}</h4>
<hr> <hr>
<br> <br>
<form [formGroup]="editForm"> <form [formGroup]="editForm">
...@@ -22,50 +22,50 @@ ...@@ -22,50 +22,50 @@
</div> </div>
<div class="signup_form_content"> <div class="signup_form_content">
<ion-item> <ion-item>
<ion-input type="text" placeholder="Name" formControlName="name"></ion-input> <ion-input type="text" placeholder="{{'profile.Name'|translate}}" formControlName="name"></ion-input>
</ion-item> </ion-item>
<div class="er_req textCenter" *ngIf="editForm.controls.name.invalid && (editForm.get('name').dirty || editForm.get('name').touched)"> <div class="er_req textCenter" *ngIf="editForm.controls.name.invalid && (editForm.get('name').dirty || editForm.get('name').touched)">
Enter a valid Name {{'profile.Enter a valid Name'|translate}}
</div> </div>
<ion-item> <ion-item>
<ion-input type="text" placeholder="Username" formControlName="username"></ion-input> <ion-input type="text" placeholder="{{'profile.Username'|translate}}" formControlName="username"></ion-input>
</ion-item> </ion-item>
<div class="er_req textCenter" *ngIf="editForm.controls.username.invalid && (editForm.get('username').dirty || editForm.get('username').touched)"> <div class="er_req textCenter" *ngIf="editForm.controls.username.invalid && (editForm.get('username').dirty || editForm.get('username').touched)">
Enter a valid Username {{'profile.Enter a valid Username'|translate}}
</div> </div>
<ion-item> <ion-item>
<ion-input type="number" placeholder="Mobile Number" formControlName="phone"></ion-input> <ion-input type="number" placeholder="{{'profile.Mobile Number'|translate}}" formControlName="phone"></ion-input>
</ion-item> </ion-item>
<div class="er_req textCenter" *ngIf="editForm.controls.phone.invalid && (editForm.get('phone').dirty || editForm.get('phone').touched)"> <div class="er_req textCenter" *ngIf="editForm.controls.phone.invalid && (editForm.get('phone').dirty || editForm.get('phone').touched)">
Enter a valid Mobile {{'profile.Enter a valid Mobile'|translate}}
</div> </div>
<ion-item> <ion-item>
<ion-input type="email" placeholder="Email" formControlName="email"></ion-input> <ion-input type="email" placeholder="{{'profile.Email'|translate}}" formControlName="email"></ion-input>
</ion-item> </ion-item>
<div class="er_req textCenter" *ngIf="editForm.controls.email.invalid && (editForm.get('email').dirty || editForm.get('email').touched)"> <div class="er_req textCenter" *ngIf="editForm.controls.email.invalid && (editForm.get('email').dirty || editForm.get('email').touched)">
Enter a valid Email {{'profile.Enter a valid Email'|translate}}
</div> </div>
<ion-item> <ion-item>
<ion-datetime displayFormat="DD MMM YYYY" placeholder="Date of Birth" min="1950" max={{maxDate}} formControlName="dob"> <ion-datetime displayFormat="DD MMM YYYY" placeholder="{{'profile.Date of Birth'|translate}}" min="1950" max={{maxDate}} formControlName="dob">
</ion-datetime> </ion-datetime>
</ion-item> </ion-item>
<div class="er_req textCenter" *ngIf="editForm.controls.dob.invalid && (editForm.get('dob').dirty || editForm.get('dob').touched)"> <div class="er_req textCenter" *ngIf="editForm.controls.dob.invalid && (editForm.get('dob').dirty || editForm.get('dob').touched)">
Select your DOB {{'profile.Select your DOB'|translate}}
</div> </div>
<div radio-group formControlName="gender" class="gender_radio"> <div radio-group formControlName="gender" class="gender_radio">
<div class="floatLeft"> <div class="floatLeft">
<ion-radio value="male" checked class="floatLeft"></ion-radio> <ion-radio value="male" checked class="floatLeft"></ion-radio>
<ion-label class="floatLeft">Male</ion-label> <ion-label class="floatLeft">{{'profile.Male'|translate}}</ion-label>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="floatLeft"> <div class="floatLeft">
<ion-radio value="female" class="floatLeft"></ion-radio> <ion-radio value="female" class="floatLeft"></ion-radio>
<ion-label class="floatLeft">Female</ion-label> <ion-label class="floatLeft">{{'profile.Female'|translate}}</ion-label>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
...@@ -73,32 +73,32 @@ ...@@ -73,32 +73,32 @@
<ion-item> <ion-item>
<ion-input type="text" placeholder="License Number" formControlName="license"></ion-input> <ion-input type="text" placeholder="{{'profile.License Number'|translate}}" formControlName="license"></ion-input>
</ion-item> </ion-item>
<div class="er_req textCenter" *ngIf="editForm.controls.license.invalid && (editForm.get('license').dirty || editForm.get('license').touched)"> <div class="er_req textCenter" *ngIf="editForm.controls.license.invalid && (editForm.get('license').dirty || editForm.get('license').touched)">
Enter a valid License Number {{'profile.Enter a valid License Number'|translate}}
</div> </div>
<ion-item> <ion-item>
<ion-select formControlName="cartype" placeholder="Car Type"> <ion-select formControlName="cartype" placeholder="{{'profile.Car Type'|translate}}">
<ion-option value={{car.car_type}} *ngFor="let car of cars">{{car.car_type}}</ion-option> <ion-option value={{car.car_type}} *ngFor="let car of cars">{{car.car_type}}</ion-option>
</ion-select> </ion-select>
</ion-item> </ion-item>
<div class="er_req textCenter" *ngIf="editForm.controls.cartype.invalid && (editForm.get('cartype').dirty || editForm.get('cartype').touched)"> <div class="er_req textCenter" *ngIf="editForm.controls.cartype.invalid && (editForm.get('cartype').dirty || editForm.get('cartype').touched)">
Select a valid Car Type {{'profile.Select a valid Car Type'|translate}}
</div> </div>
<ion-item> <ion-item>
<ion-input type="text" placeholder="Car Number" formControlName="car_no"></ion-input> <ion-input type="text" placeholder="{{'profile.Car Number'|translate}}" formControlName="car_no"></ion-input>
</ion-item> </ion-item>
<div class="er_req textCenter" *ngIf="editForm.controls.car_no.invalid && (editForm.get('car_no').dirty || editForm.get('car_no').touched)"> <div class="er_req textCenter" *ngIf="editForm.controls.car_no.invalid && (editForm.get('car_no').dirty || editForm.get('car_no').touched)">
Enter a valid Car Number {{'profile.Enter a valid Car Number'|translate}}
</div> </div>
<br> <br>
<!-- <button ion-button class="primary theme_dark_bg" (click)="updateProfile()">SAVE</button> --> <!-- <button ion-button class="primary theme_dark_bg" (click)="updateProfile()">SAVE</button> -->
<div class="jr_bottom_button_bay"> <div class="jr_bottom_button_bay">
<button ion-button class="cab_footer_btn" (click)="updateProfile()">SAVE</button> <button ion-button class="cab_footer_btn" (click)="updateProfile()">{{'profile.SAVE'|translate}}</button>
</div> </div>
</div> </div>
</form> </form>
......
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular'; import { IonicPageModule } from 'ionic-angular';
import { MyprofilePage } from './myprofile'; import { MyprofilePage } from './myprofile';
import { TranslateModule } from "@ngx-translate/core";
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -8,6 +9,7 @@ import { MyprofilePage } from './myprofile'; ...@@ -8,6 +9,7 @@ import { MyprofilePage } from './myprofile';
], ],
imports: [ imports: [
IonicPageModule.forChild(MyprofilePage), IonicPageModule.forChild(MyprofilePage),
TranslateModule
], ],
}) })
export class MyprofilePageModule {} export class MyprofilePageModule {}
...@@ -8,6 +8,7 @@ import { Myservice } from "../../providers/myservice"; ...@@ -8,6 +8,7 @@ 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";
import { Toast } from '@ionic-native/toast'; import { Toast } from '@ionic-native/toast';
import { TranslateService } from "@ngx-translate/core";
@IonicPage() @IonicPage()
@Component({ @Component({
...@@ -23,8 +24,9 @@ export class MyprofilePage { ...@@ -23,8 +24,9 @@ export class MyprofilePage {
codes: Array<dialcode>; codes: Array<dialcode>;
cars:any; cars:any;
maxDate:any; maxDate:any;
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private formBuilder: FormBuilder, private http: Http, private orderbyPipe: OrderbyPipe, private myservice: Myservice, private storage: Storage, public events: Events, private toast: Toast) { constructor(public navCtrl: NavController, public navParams: NavParams, private formBuilder: FormBuilder, private http: Http, private orderbyPipe: OrderbyPipe, private myservice: Myservice, private storage: Storage, public events: Events, private toast: Toast, private translate: TranslateService) {
this.maxDate = new Date().getFullYear() this.maxDate = new Date().getFullYear()
...@@ -51,6 +53,7 @@ export class MyprofilePage { ...@@ -51,6 +53,7 @@ export class MyprofilePage {
} }
ionViewDidEnter() { ionViewDidEnter() {
this.langTrans()
this.storage.get('driver_data').then(data=>{ this.storage.get('driver_data').then(data=>{
if(data){ if(data){
this.local = data; this.local = data;
...@@ -80,6 +83,18 @@ export class MyprofilePage { ...@@ -80,6 +83,18 @@ export class MyprofilePage {
}) })
} }
langTrans() {
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
this.lang = lang;
}
else {
this.translate.use('en')
}
})
}
fileChange(event) { fileChange(event) {
let fileList: FileList = event.target.files; let fileList: FileList = event.target.files;
if (fileList.length > 0) { if (fileList.length > 0) {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<ion-icon name="ios-arrow-back" (click)="back()"></ion-icon> <ion-icon name="ios-arrow-back" (click)="back()"></ion-icon>
</button> </button>
<div class="nav_header_title floatLeft"> <div class="nav_header_title floatLeft">
Quick Ride {{'quickride.Quick Ride'|translate}}
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</ion-header> </ion-header>
...@@ -11,10 +11,10 @@ ...@@ -11,10 +11,10 @@
<div class="jr_profile_content1"> <div class="jr_profile_content1">
<div class="jr_search_bottom_bay jr_padding0" > <div class="jr_search_bottom_bay jr_padding0" >
<h5>You have a ride request</h5> <h5>{{'quickride.You have a ride request'|translate}}</h5>
<hr> <hr>
<div class="jr_search_profile"> <div class="jr_search_profile">
<img [src]=baseUrl+rideDetail?.image > <img [src]=rideDetail?.image >
</div> </div>
<div class="jr_search_profile_detail"> <div class="jr_search_profile_detail">
<br> <br>
...@@ -39,12 +39,12 @@ ...@@ -39,12 +39,12 @@
<div class="jr_clear"></div> <div class="jr_clear"></div>
</li> </li>
</div> </div>
<p class="time">Day : <strong>{{rideDetail?.pickup_date| date:'dd/MM/yy'}} - {{rideDetail?.pickup_time}}</strong></p> <p class="time">{{'quickride.Date'|translate}} : <strong>{{rideDetail?.pickup_date| date:'dd/MM/yy'}} - {{rideDetail?.pickup_time}}</strong></p>
<div class="jr_bottom_button_bay"> <div class="jr_bottom_button_bay">
<button ion-button class="cab_footer_btn floatLeft accept" (click)="accept()">Accept</button> <button ion-button class="cab_footer_btn floatLeft accept" (click)="accept()">{{'quickride.Accept'|translate}}</button>
<button ion-button class="cab_footer_btn floatRight reject" (click)="reject()">Reject</button> <button ion-button class="cab_footer_btn floatRight reject" (click)="reject()">{{'quickride.Reject'|translate}}</button>
<!-- <button ion-button class="cab_footer_btn width100" (click)="pick()" *ngIf="pickUp">Pick Up</button> --> <!-- <button ion-button class="cab_footer_btn width100" (click)="pick()" *ngIf="pickUp">Pick Up</button> -->
</div> </div>
</div> </div>
......
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular'; import { IonicPageModule } from 'ionic-angular';
import { QuickridePage } from './quickride'; import { QuickridePage } from './quickride';
import { TranslateModule } from "@ngx-translate/core";
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -8,6 +9,7 @@ import { QuickridePage } from './quickride'; ...@@ -8,6 +9,7 @@ import { QuickridePage } from './quickride';
], ],
imports: [ imports: [
IonicPageModule.forChild(QuickridePage), IonicPageModule.forChild(QuickridePage),
TranslateModule
], ],
}) })
export class QuickridePageModule {} export class QuickridePageModule {}
...@@ -5,6 +5,7 @@ import { Storage } from "@ionic/storage"; ...@@ -5,6 +5,7 @@ import { Storage } from "@ionic/storage";
import { driver } from "../../models/mymodel"; import { driver } from "../../models/mymodel";
import { dataService } from "../../providers/common.service"; import { dataService } from "../../providers/common.service";
import { Toast } from "@ionic-native/toast"; import { Toast } from "@ionic-native/toast";
import { TranslateService } from "@ngx-translate/core";
@IonicPage() @IonicPage()
@Component({ @Component({
...@@ -16,12 +17,15 @@ export class QuickridePage { ...@@ -16,12 +17,15 @@ export class QuickridePage {
rideDetail: any; rideDetail: any;
local: driver local: driver
baseUrl = this.myservice.base_url baseUrl = this.myservice.base_url
lang: string = 'en';
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) { 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, private translate: TranslateService) {
} }
ionViewDidEnter() { ionViewDidEnter() {
this.langTrans()
this.storage.get('driver_data').then(data => { this.storage.get('driver_data').then(data => {
if (data) { if (data) {
this.local = data; this.local = data;
...@@ -44,21 +48,40 @@ export class QuickridePage { ...@@ -44,21 +48,40 @@ export class QuickridePage {
this.data.setrideData(this.rideDetail) this.data.setrideData(this.rideDetail)
} }
else else{
this.myservice.show_alert('',resp.message) this.translate.get(['quickride.' + resp.message]).subscribe(value => {
this.myservice.show_alert('', value['quickride.' + resp.message])
})
}
})
}
langTrans() {
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
this.lang = lang;
}
else {
this.translate.use('en')
}
}) })
} }
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.translate.get(['quickride.' + resp.message]).subscribe(value => {
this.toast.show(value['quickride.'+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.translate.get(['quickride.' + resp.message]).subscribe(value => {
this.myservice.show_alert('', value['quickride.' + resp.message])
})
} }
}) })
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="hm_cancel_pop_main"> <div class="hm_cancel_pop_main">
<div class="hm_cancel_pop_upper"> <div class="hm_cancel_pop_upper">
<img src="assets/img/hm_ques_mark.png"> <img src="assets/img/hm_ques_mark.png">
<p>Cancellation Reason</p> <p>{{'reject.Cancellation Reason'|translate}}</p>
</div> </div>
<div class="hm_cancel_pop_lower"> <div class="hm_cancel_pop_lower">
<ul> <ul>
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<ion-radio value="Pickup location too far"></ion-radio> <ion-radio value="Pickup location too far"></ion-radio>
</div> </div>
<div class="hm_cancel_reason"> <div class="hm_cancel_reason">
Pickup location too far {{'reject.Pickup location too far'|translate}}
</div> </div>
<div class="hm_clear"></div> <div class="hm_clear"></div>
</li> </li>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<ion-radio value="Cannot serve at the requested time"></ion-radio> <ion-radio value="Cannot serve at the requested time"></ion-radio>
</div> </div>
<div class="hm_cancel_reason"> <div class="hm_cancel_reason">
Cannot serve at the requested time {{'reject.Cannot serve at the requested time'|translate}}
</div> </div>
<div class="hm_clear"></div> <div class="hm_clear"></div>
</li> </li>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<ion-radio value="Other"></ion-radio> <ion-radio value="Other"></ion-radio>
</div> </div>
<div class="hm_cancel_reason"> <div class="hm_cancel_reason">
Other {{'reject.Other'|translate}}
</div> </div>
<div class="hm_clear"></div> <div class="hm_clear"></div>
</li> </li>
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
</ion-list> </ion-list>
</ul> </ul>
<div class="hm_cancel_bottom_bay"> <div class="hm_cancel_bottom_bay">
<li class="hm_cancel_cancel" (click)="dismiss()">Cancel</li> <li class="hm_cancel_cancel" (click)="dismiss()">{{'reject.Cancel'|translate}}</li>
<li class="hm_cancel_submit" (click)="submit()">Submit</li> <li class="hm_cancel_submit" (click)="submit()">{{'reject.Submit'|translate}}</li>
</div> </div>
</div> </div>
</div> </div>
......
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular'; import { IonicPageModule } from 'ionic-angular';
import { RejectPage } from './reject'; import { RejectPage } from './reject';
import { TranslateModule } from "@ngx-translate/core";
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -8,6 +9,7 @@ import { RejectPage } from './reject'; ...@@ -8,6 +9,7 @@ import { RejectPage } from './reject';
], ],
imports: [ imports: [
IonicPageModule.forChild(RejectPage), IonicPageModule.forChild(RejectPage),
TranslateModule
], ],
}) })
export class RejectPageModule {} export class RejectPageModule {}
...@@ -3,6 +3,7 @@ import { IonicPage, NavController, NavParams,ViewController } from 'ionic-angula ...@@ -3,6 +3,7 @@ import { IonicPage, NavController, NavParams,ViewController } from 'ionic-angula
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";
import { TranslateService } from "@ngx-translate/core";
@IonicPage() @IonicPage()
@Component({ @Component({
...@@ -12,17 +13,32 @@ import { driver } from "../../models/mymodel"; ...@@ -12,17 +13,32 @@ import { driver } from "../../models/mymodel";
export class RejectPage { export class RejectPage {
reason:any; reason:any;
local:driver local:driver
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, public viewctrl: ViewController, private myservice: Myservice, private storage:Storage) { constructor(public navCtrl: NavController, public navParams: NavParams, public viewctrl: ViewController, private myservice: Myservice, private storage: Storage, private translate: TranslateService) {
} }
ionViewDidEnter() { ionViewDidEnter() {
this.langTrans()
this.storage.get('driver_data').then(data=>{ this.storage.get('driver_data').then(data=>{
if(data) if(data)
this.local = data this.local = data
}) })
} }
langTrans() {
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
this.lang = lang;
}
else {
this.translate.use('en')
}
})
}
dismiss(){ dismiss(){
this.viewctrl.dismiss(); this.viewctrl.dismiss();
} }
...@@ -35,7 +51,9 @@ export class RejectPage { ...@@ -35,7 +51,9 @@ export class RejectPage {
this.viewctrl.dismiss(response.message); this.viewctrl.dismiss(response.message);
} }
else { else {
this.myservice.show_alert('Error', response.message) this.translate.get(['reject.' + response.message]).subscribe(value => {
this.myservice.show_alert('', value['reject.' + response.message])
})
} }
}) })
......
...@@ -2,23 +2,23 @@ ...@@ -2,23 +2,23 @@
<button ion-button class="nav_btn theme_color floatLeft" (click)="back()"> <button ion-button class="nav_btn theme_color floatLeft" (click)="back()">
<ion-icon name="ios-arrow-back"></ion-icon> <ion-icon name="ios-arrow-back"></ion-icon>
</button> </button>
<div class="nav_header_title floatLeft">User Location</div> <div class="nav_header_title floatLeft">{{'userloc.User Location'|translate}}</div>
<div class="clear"></div> <div class="clear"></div>
</ion-header> </ion-header>
<ion-content> <ion-content>
<div #map id="map"></div> <div #map id="map"></div>
<div class="jr_bottom_distance_card" *ngIf="temp"> <div class="jr_bottom_distance_card" *ngIf="temp">
<div class="jr_bottom_inside"> <div class="jr_bottom_inside">
<input class="jr_dest_input from" placeholder="From" [(ngModel)]="loc.from" [readonly]="true"> <input class="jr_dest_input from" placeholder="{{'userloc.From'|translate}}" [(ngModel)]="loc.from" [readonly]="true">
<input class="jr_dest_input to" placeholder="To" [(ngModel)]="loc.to" [readonly]="true"> <input class="jr_dest_input to" placeholder="{{'userloc.To'|translate}}" [(ngModel)]="loc.to" [readonly]="true">
</div> </div>
</div> </div>
</ion-content> </ion-content>
<ion-footer> <ion-footer>
<div class="jr_bottom_button_bay" *ngIf="!started"> <div class="jr_bottom_button_bay" *ngIf="!started">
<button ion-button class="cab_footer_btn" (click)="startRide()">Start Ride</button> <button ion-button class="cab_footer_btn" (click)="startRide()">{{'userloc.Start Ride'|translate}}</button>
</div> </div>
<div class="jr_bottom_button_bay" *ngIf="temp && started"> <div class="jr_bottom_button_bay" *ngIf="temp && started">
<button ion-button class="cab_footer_btn" (click)="complete()">Finish Ride</button> <button ion-button class="cab_footer_btn" (click)="complete()">{{'userloc.Finish Ride'|translate}}</button>
</div> </div>
</ion-footer> </ion-footer>
\ No newline at end of file
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular'; import { IonicPageModule } from 'ionic-angular';
import { UserlocationPage } from './userlocation'; import { UserlocationPage } from './userlocation';
import { TranslateModule } from "@ngx-translate/core";
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -8,6 +9,7 @@ import { UserlocationPage } from './userlocation'; ...@@ -8,6 +9,7 @@ import { UserlocationPage } from './userlocation';
], ],
imports: [ imports: [
IonicPageModule.forChild(UserlocationPage), IonicPageModule.forChild(UserlocationPage),
TranslateModule
], ],
}) })
export class UserlocationPageModule {} export class UserlocationPageModule {}
...@@ -7,6 +7,7 @@ import { driver } from "../../models/mymodel"; ...@@ -7,6 +7,7 @@ import { driver } from "../../models/mymodel";
import { Storage } from "@ionic/storage"; import { Storage } from "@ionic/storage";
import { Myservice } from "../../providers/myservice"; import { Myservice } from "../../providers/myservice";
import { dataService } from "../../providers/common.service"; import { dataService } from "../../providers/common.service";
import { TranslateService } from "@ngx-translate/core";
declare var google; declare var google;
...@@ -35,12 +36,14 @@ export class UserlocationPage { ...@@ -35,12 +36,14 @@ export class UserlocationPage {
count: number = 0; count: number = 0;
tempPos: any; tempPos: any;
destmarker: any; destmarker: any;
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private geolocation: Geolocation, private db: AngularFireDatabase, private storage: Storage, private myservice: Myservice, private menu: MenuController, private data: dataService, public events: Events) { constructor(public navCtrl: NavController, public navParams: NavParams, private geolocation: Geolocation, private db: AngularFireDatabase, private storage: Storage, private myservice: Myservice, private menu: MenuController, private data: dataService, public events: Events, private translate: TranslateService) {
this.loadMap() this.loadMap()
} }
ionViewDidEnter() { ionViewDidEnter() {
this.langTrans()
this.events.publish('driver:locOff', ''); this.events.publish('driver:locOff', '');
...@@ -70,6 +73,18 @@ export class UserlocationPage { ...@@ -70,6 +73,18 @@ export class UserlocationPage {
}) })
} }
langTrans() {
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
this.lang = lang;
}
else {
this.translate.use('en')
}
})
}
loadMap() { loadMap() {
this.geolocation.getCurrentPosition().then((resp) => { this.geolocation.getCurrentPosition().then((resp) => {
...@@ -260,8 +275,11 @@ export class UserlocationPage { ...@@ -260,8 +275,11 @@ export class UserlocationPage {
This.ride = response.data This.ride = response.data
This.data.setrateData(This.ride) This.data.setrateData(This.ride)
} }
else else{
this.myservice.show_alert('',response.message) this.translate.get(['userloc.' + response.message]).subscribe(value => {
this.myservice.show_alert('', value['userloc.' + response.message])
})
}
}) })
} }
}) })
......
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