Commit 29517024 by Alen Jose

Merge branch 'alen' into 'master'

aug-3 See merge request alen/CMC-driver!24
parents 1bb6dcf9 2687af45
import { Component, ViewChild } from '@angular/core'; import { Component, ViewChild } from '@angular/core';
import { Nav, Platform, AlertController, Events,Toggle } from 'ionic-angular'; import { Nav, Platform, AlertController, Events, Toggle } 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 { Network } from '@ionic-native/network'; import { Network } from '@ionic-native/network';
...@@ -79,7 +79,7 @@ export class MyApp { ...@@ -79,7 +79,7 @@ export class MyApp {
} }
}) })
this.events.subscribe('driver:locOff',_=>{ this.events.subscribe('driver:locOff', _ => {
this.locSubs.unsubscribe(); this.locSubs.unsubscribe();
}) })
...@@ -129,21 +129,21 @@ export class MyApp { ...@@ -129,21 +129,21 @@ export class MyApp {
This.status = false This.status = false
}); });
var intr = setInterval(()=>{ var intr = setInterval(() => {
This.myservice.load_post({ id: This.local.id }, 'getMyStatus').subscribe(resp => { This.myservice.load_post({ id: This.local.id }, 'getMyStatus').subscribe(resp => {
if (resp.status == 'success') { if (resp.status == 'success') {
if (resp.data.user_status == "Active"){ if (resp.data.user_status == "Active") {
console.log('act') console.log('act')
This.ionToggle.disabled = false; This.ionToggle.disabled = false;
clearInterval(intr); clearInterval(intr);
} }
else{ else {
console.log('inact') console.log('inact')
This.ionToggle.disabled = true; This.ionToggle.disabled = true;
} }
} }
}) })
},20000) }, 20000)
// This.setlocalNotification(); // This.setlocalNotification();
} }
...@@ -157,7 +157,7 @@ export class MyApp { ...@@ -157,7 +157,7 @@ export class MyApp {
initOnesignal() { initOnesignal() {
this.oneSignal.startInit('ec007986-ae84-45fb-a770-f5be1e203acd', '151146703576'); this.oneSignal.startInit('ec007986-ae84-45fb-a770-f5be1e203acd', '151146703576');
this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.InAppAlert); this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.Notification);
this.oneSignal.handleNotificationReceived().subscribe(() => { this.oneSignal.handleNotificationReceived().subscribe(() => {
// do something when notification is received // do something when notification is received
...@@ -168,8 +168,8 @@ export class MyApp { ...@@ -168,8 +168,8 @@ export class MyApp {
// do something when a notification is opened // do something when a notification is opened
var additionalData = data.notification.payload.additionalData var additionalData = data.notification.payload.additionalData
this.storage.get('driver_data').then((user_data) => { this.storage.get('driver_data').then((user_data) => {
if(user_data) if (user_data)
this.nav.push('QuickridePage', { id: additionalData.bookingId, from: additionalData.from}) this.nav.push('QuickridePage', { id: additionalData.bookingId, from: additionalData.from })
else else
this.nav.setRoot('SigninPage', { id: additionalData.bookingId, from: additionalData.from }) this.nav.setRoot('SigninPage', { id: additionalData.bookingId, from: additionalData.from })
}) })
...@@ -192,7 +192,7 @@ export class MyApp { ...@@ -192,7 +192,7 @@ export class MyApp {
}); });
} }
setlocalNotification(){ setlocalNotification() {
this.myservice.load_post({ id: this.local.id }, 'getMyRides').subscribe(response => { this.myservice.load_post({ id: this.local.id }, 'getMyRides').subscribe(response => {
if (response.status == 'success') { if (response.status == 'success') {
...@@ -204,27 +204,27 @@ export class MyApp { ...@@ -204,27 +204,27 @@ export class MyApp {
id: i, id: i,
text: 'Ride Notification', text: 'Ride Notification',
title: 'CMC-Driver', title: 'CMC-Driver',
trigger: { at: new Date(upcoming[i].pickup_date + ' ' +upcoming[i].pickup_time) }, trigger: { at: new Date(upcoming[i].pickup_date + ' ' + upcoming[i].pickup_time) },
led: 'FF0000', led: 'FF0000',
sound: 'file://assets/sounds/request.mp3', sound: 'file://assets/sounds/request.mp3',
data: upcoming[i], data: upcoming[i],
vibrate:true, vibrate: true,
}) })
if(i == upcoming.length-1){ if (i == upcoming.length - 1) {
this.localNotifications.schedule(arr); this.localNotifications.schedule(arr);
} }
} }
} }
}) })
this.localNotifications.on('click').subscribe(rideData=>{ this.localNotifications.on('click').subscribe(rideData => {
this.data.setrideData(rideData.data) this.data.setrideData(rideData.data)
this.nav.push('RidedetailsPage') this.nav.push('RidedetailsPage')
}) })
} }
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) })
...@@ -235,6 +235,7 @@ export class MyApp { ...@@ -235,6 +235,7 @@ export class MyApp {
languageTrans() { languageTrans() {
this.storage.get('lang').then(data => { this.storage.get('lang').then(data => {
console.log(data)
if (data) { if (data) {
this.translate.use(data); this.translate.use(data);
this.lang = data; this.lang = data;
......
...@@ -4,76 +4,172 @@ ...@@ -4,76 +4,172 @@
"No Internet Connection": "No Internet Connection", "No Internet Connection": "No Internet Connection",
"Quit": "Quit", "Quit": "Quit",
"Cancel": "Cancel", "Cancel": "Cancel",
"Online":"Online", "Online": "Online",
"My Rides":"My Rides", "My Rides": "My Rides",
"Documents":"Documents", "Documents": "Documents",
"Change Password":"Change Password", "Change Password": "Change Password",
"Logout": "Logout" "Logout": "Logout"
}, },
"home":{ "home": {
"My Rides":"My Rides", "My Rides": "My Rides",
"Upcoming":"Upcoming", "Upcoming": "Upcoming",
"Completed":"Completed", "Completed": "Completed",
"No rides found":"No rides found", "No rides found": "No rides found",
"Please try again!":"Please try again!", "Please try again!": "Please try again!",
"Secret key miss match" :"Secret key miss match" "Secret key miss match": "Secret key miss match"
}, },
"ridedetail":{ "ridedetail": {
"Ride Details":"Ride Details", "Ride Details": "Ride Details",
"Pick Up":"Pick Up" "Pick Up": "Pick Up"
}, },
"quickride":{ "quickride": {
"Quick Ride":"Quick Ride", "Quick Ride": "Quick Ride",
"You have a ride request":"You have a ride request", "You have a ride request": "You have a ride request",
"Date":"Date", "Date": "Date",
"Accept":"Accept", "Accept": "Accept",
"Reject":"Reject", "Reject": "Reject",
"Secret key miss match":"Secret key miss match", "Secret key miss match": "Secret key miss match",
"Please try again":"Please try again", "Please try again": "Please try again",
"Successfully Accepted" : "Successfully Accepted", "Successfully Accepted": "Successfully Accepted",
"Sorry, The ride is gone":"Sorry, The ride is gone" "Sorry, The ride is gone": "Sorry, The ride is gone"
}, },
"reject":{ "reject": {
"Cancellation Reason":"Cancellation Reason", "Cancellation Reason": "Cancellation Reason",
"Pickup location too far":"Pickup location too far", "Pickup location too far": "Pickup location too far",
"Cannot serve at the requested time":"Cannot serve at the requested time", "Cannot serve at the requested time": "Cannot serve at the requested time",
"Other":"Other", "Other": "Other",
"Cancel":"Cancel", "Cancel": "Cancel",
"Submit":"Submit", "Submit": "Submit",
"Cancelled Successfully":"Cancelled Successfully", "Cancelled Successfully": "Cancelled Successfully",
"Please try again":"Please try again", "Please try again": "Please try again",
"Secret key miss match":"Secret key miss match" "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",
"Please try again": "Please try again",
"Secret key miss match": "Secret key miss match",
"Please choose image with .jpg/.jpeg/.png extension": "Please choose image with .jpg/.jpeg/.png extension",
"Profile Updated Successfully": "Profile Updated Successfully"
},
"uploaddoc": {
"Documents": "Documents",
"Upload Docs": "Upload Docs",
"Please upload your documents to get": "Please upload your documents to get",
"Approved": "Approved",
"Please try again": "Please try again",
"Secret key miss match": "Secret key miss match"
},
"docupdate": {
"Your documents must be readable": "Your documents must be readable",
"and clear": "and clear",
"Processing": "Processing",
"DONE": "DONE",
"VIEW": "VIEW",
"UPDATE": "UPDATE",
"UPLOAD": "UPLOAD",
"Please choose file with .jpg/.jpeg/.png/.pdf extension": "Please choose file with .jpg/.jpeg/.png/.pdf extension",
"Document Uploaded Successfully": "Document Uploaded Successfully",
"Please try again": "Please try again",
"Secret key miss match": "Secret key miss match",
"Please select a file to upload": "Please select a file to upload"
},
"forgot": {
"Forgot Password": "Forgot Password",
"Email": "Email",
"Enter a valid Email": "Enter a valid Email",
"Sent recovery password": "Sent recovery password",
"A temporary password has been sent to the email address you have provided": "A temporary password has been sent to the email address you have provided",
"Email ID doesnot exist": "Email ID doesnot exist",
"Secret key miss match": "Secret key miss match"
},
"changepass": {
"Change Password": "Change Password",
"Current password": "Current password",
"Minimum 6 characters": "Minimum 6 characters",
"New password": "New password",
"Confirm password": "Confirm password",
"Password mismatches": "Password mismatches",
"Proceed": "Proceed",
"Successfully Updated": "Successfully Updated",
"Incorrect Password": "Incorrect Password",
"Please try again": "Please try again",
"Secret key miss match": "Secret key miss match"
},
"landing": {
"New User ? Sign up now!": "New User ? Sign up now!",
"Sign in": "Sign in"
},
"payment": {
"Payment Details": "Payment Details",
"Pickup Point": "Pickup Point",
"Drop Point": "Drop Point",
"Ride Details": "Ride Details",
"Distance": "Distance",
"Hours": "Hours",
"Total": "Total",
"Discount": "Discount",
"Due after service": "Due after service",
"Completed": "Completed",
"Please try again": "Please try again",
"Secret key miss match": "Secret key miss match"
}, },
"userloc":{ "signin": {
"User Location":"User Location", "Login": "Login",
"From":"From", "Mobile Number": "Mobile Number",
"To":"To", "Enter a valid Mobile": "Enter a valid Mobile",
"Start Ride":"Start Ride", "Password": "Password",
"Finish Ride":"Finish Ride", "Minimum 6 characters": "Minimum 6 characters",
"Please try again":"Please try again", "Sign In": "Sign In",
"Secret key miss match":"Secret key miss match" "Forgot Password": "Forgot Password",
"Successfully Logged in": "Successfully Logged in",
"Unknown credential , please try again": "Unknown credential , please try again"
}, },
"profile":{ "signup": {
"Profile":"Profile", "Sign Up": "Sign Up",
"My Profile":"My Profile", "Name": "Name",
"Name":"Name", "Enter a valid Name": "Enter a valid Name",
"Enter a valid Name":"Enter a valid Name", "Username": "Username",
"Username":"Username", "Enter a valid Username": "Enter a valid Username",
"Enter a valid Username":"Enter a valid Username", "Mobile Number": "Mobile Number",
"Mobile Number":"Mobile Number", "Enter a valid Mobile": "Enter a valid Mobile",
"Enter a valid Mobile":"Enter a valid Mobile", "Email": "Email",
"Email":"Email", "Enter a valid Email": "Enter a valid Email",
"Enter a valid Email":"Enter a valid Email", "Password": "Password",
"Date of Birth":"Date of Birth", "Minimum 6 characters": "Minimum 6 characters",
"Select your DOB":"Select your DOB", "Confirm Password": "Confirm Password",
"Male":"Male", "Password mismatches": "Password mismatches",
"Female":"Female", "I accept terms & condition": "I accept terms & condition",
"License Number":"License Number", "Please accept terms & conditions": "Please accept terms & conditions",
"Enter a valid License Number":"Enter a valid License Number", "Successfully registered":"Successfully registered",
"Car Type":"Car Type", "User Name or Email id Already exists":"User Name or Email id Already exists"
"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
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<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">
Change Password {{'changepass.Change Password'|translate}}
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</ion-header> </ion-header>
...@@ -14,24 +14,24 @@ ...@@ -14,24 +14,24 @@
<form [formGroup]="pswdForm"> <form [formGroup]="pswdForm">
<ion-list> <ion-list>
<ion-item> <ion-item>
<ion-input type="password" placeholder="Current password" formControlName="current"></ion-input> <ion-input type="password" placeholder="{{'changepass.Current password'|translate}}" formControlName="current"></ion-input>
</ion-item> </ion-item>
<div class="er_req" *ngIf="pswdForm.controls.current.invalid && (pswdForm.get('current').dirty || pswdForm.get('current').touched)"> <div class="er_req" *ngIf="pswdForm.controls.current.invalid && (pswdForm.get('current').dirty || pswdForm.get('current').touched)">
Minimum 6 characters {{'changepass.Minimum 6 characters'|translate}}
</div> </div>
<ion-item> <ion-item>
<ion-input type="password" placeholder="New password" formControlName="new"></ion-input> <ion-input type="password" placeholder="{{'changepass.New password'|translate}}" formControlName="new"></ion-input>
</ion-item> </ion-item>
<div class="er_req" *ngIf="pswdForm.controls.new.invalid && (pswdForm.get('new').dirty || pswdForm.get('new').touched)"> <div class="er_req" *ngIf="pswdForm.controls.new.invalid && (pswdForm.get('new').dirty || pswdForm.get('new').touched)">
Minimum 6 characters {{'changepass.Minimum 6 characters'|translate}}
</div> </div>
<ion-item> <ion-item>
<ion-input type="password" placeholder="Confirm password" formControlName="confirm"></ion-input> <ion-input type="password" placeholder="{{'changepass.Confirm password'|translate}}" formControlName="confirm"></ion-input>
</ion-item> </ion-item>
<div class="er_req" *ngIf="pswdForm.controls.confirm.invalid && (pswdForm.get('confirm').dirty || pswdForm.get('confirm').touched)"> <div class="er_req" *ngIf="pswdForm.controls.confirm.invalid && (pswdForm.get('confirm').dirty || pswdForm.get('confirm').touched)">
Password mismatches {{'changepass.Password mismatches'|translate}}
</div> </div>
<button ion-button class="cab_sign_btn" (click)="change()">Proceed</button> <button ion-button class="cab_sign_btn" (click)="change()">{{'changepass.Proceed'|translate}}</button>
</ion-list> </ion-list>
</form> </form>
</ion-card-content> </ion-card-content>
......
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular'; import { IonicPageModule } from 'ionic-angular';
import { ChangepassPage } from './changepass'; import { ChangepassPage } from './changepass';
import { TranslateModule } from "@ngx-translate/core";
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -8,6 +9,7 @@ import { ChangepassPage } from './changepass'; ...@@ -8,6 +9,7 @@ import { ChangepassPage } from './changepass';
], ],
imports: [ imports: [
IonicPageModule.forChild(ChangepassPage), IonicPageModule.forChild(ChangepassPage),
TranslateModule
], ],
}) })
export class ChangepassPageModule {} export class ChangepassPageModule {}
...@@ -5,6 +5,7 @@ import { Myservice } from '../../providers/myservice' ...@@ -5,6 +5,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({
...@@ -14,8 +15,9 @@ import { Toast } from '@ionic-native/toast'; ...@@ -14,8 +15,9 @@ import { Toast } from '@ionic-native/toast';
export class ChangepassPage { export class ChangepassPage {
pswdForm: FormGroup pswdForm: FormGroup
local: driver local: driver
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, public storage: Storage, private formbuilder: FormBuilder, private toast: Toast) { constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, public storage: Storage, private formbuilder: FormBuilder, private toast: Toast, private translate: TranslateService) {
this.pswdForm = this.formbuilder.group({ this.pswdForm = this.formbuilder.group({
current: ['', Validators.compose([Validators.required, Validators.minLength(6)])], current: ['', Validators.compose([Validators.required, Validators.minLength(6)])],
...@@ -26,6 +28,7 @@ export class ChangepassPage { ...@@ -26,6 +28,7 @@ export class ChangepassPage {
} }
ionViewDidEnter() { ionViewDidEnter() {
this.langTrans()
this.storage.get('driver_data').then(data => { this.storage.get('driver_data').then(data => {
if (data != null) { if (data != null) {
...@@ -35,19 +38,35 @@ export class ChangepassPage { ...@@ -35,19 +38,35 @@ export class ChangepassPage {
}) })
} }
langTrans() {
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
this.lang = lang;
}
else {
this.translate.use('en')
}
})
}
change() { change() {
this.myservice.show_loader(); this.myservice.show_loader();
this.myservice.load_post(this.pswdForm.value, 'changePassword').subscribe(response => { this.myservice.load_post(this.pswdForm.value, 'changePassword').subscribe(response => {
this.myservice.hide_loader() this.myservice.hide_loader()
if (response.status == 'success') { if (response.status == 'success') {
this.pswdForm.reset(); this.pswdForm.reset();
this.toast.show(response.message, '2000', 'center').subscribe(toast => { this.translate.get(['changepass.' + response.message]).subscribe(value => {
this.toast.show(value['changepass.' + response.message], '2000', 'center').subscribe(toast => {
console.log(toast); console.log(toast);
}); });
})
} }
else { else {
this.pswdForm.reset(); this.pswdForm.reset();
this.myservice.show_alert('', response.message) this.translate.get(['changepass.' + response.message]).subscribe(value => {
this.myservice.show_alert('', value['changepass.' + response.message])
})
} }
}) })
} }
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
<h4>{{title}}</h4> <h4>{{title}}</h4>
<hr> <hr>
<br> <br>
<p>Your documents must be readable<br> <p>{{'docupdate.Your documents must be readable'|translate}}<br>
and clear</p> {{'docupdate.and clear'|translate}}</p>
<button ion-button class="upload_btn" id="upld_btn" *ngIf="fileData?.fileStatus=='0' || fileData?.fileStatus=='3'">{{butonName}} <button ion-button class="upload_btn" id="upld_btn" *ngIf="fileData?.fileStatus=='0' || fileData?.fileStatus=='3'">{{butonName}}
<input type="file" (change)="fileChange($event)" accept="application/pdf,image/*"> <input type="file" (change)="fileChange($event)" accept="application/pdf,image/*">
</button> </button>
...@@ -23,11 +23,11 @@ ...@@ -23,11 +23,11 @@
</div> </div>
<h6>{{filename}}</h6> <h6>{{filename}}</h6>
<h5 *ngIf="fileData?.fileStatus=='1'">Processing</h5> <h5 *ngIf="fileData?.fileStatus=='1'">{{'docupdate.Processing'|translate}}</h5>
</div> </div>
<div class="jr_bottom_button_bay"> <div class="jr_bottom_button_bay">
<button ion-button class="cab_footer_btn" (click)="upload()" *ngIf="fileData?.fileStatus=='0' || fileData?.fileStatus=='3'">DONE</button> <button ion-button class="cab_footer_btn" (click)="upload()" *ngIf="fileData?.fileStatus=='0' || fileData?.fileStatus=='3'">{{'docupdate.DONE'|translate}}</button>
<button ion-button class="cab_footer_btn" (click)="view()" *ngIf="fileData?.fileStatus!='0'">view</button> <button ion-button class="cab_footer_btn" (click)="view()" *ngIf="fileData?.fileStatus!='0'">{{'docupdate.VIEW'|translate}}</button>
</div> </div>
</ion-content> </ion-content>
<!-- <ion-footer padding> <!-- <ion-footer padding>
......
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular'; import { IonicPageModule } from 'ionic-angular';
import { DocupdatePage } from './docupdate'; import { DocupdatePage } from './docupdate';
import { TranslateModule } from "@ngx-translate/core";
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -8,6 +9,7 @@ import { DocupdatePage } from './docupdate'; ...@@ -8,6 +9,7 @@ import { DocupdatePage } from './docupdate';
], ],
imports: [ imports: [
IonicPageModule.forChild(DocupdatePage), IonicPageModule.forChild(DocupdatePage),
TranslateModule
], ],
}) })
export class DocupdatePageModule {} export class DocupdatePageModule {}
...@@ -9,6 +9,7 @@ import { PhotoViewer } from '@ionic-native/photo-viewer'; ...@@ -9,6 +9,7 @@ import { PhotoViewer } from '@ionic-native/photo-viewer';
import { FileOpener } from '@ionic-native/file-opener'; import { FileOpener } from '@ionic-native/file-opener';
import { FileTransfer, FileTransferObject } from '@ionic-native/file-transfer'; import { FileTransfer, FileTransferObject } from '@ionic-native/file-transfer';
import { File } from '@ionic-native/file'; import { File } from '@ionic-native/file';
import { TranslateService } from "@ngx-translate/core";
@IonicPage() @IonicPage()
@Component({ @Component({
...@@ -23,12 +24,14 @@ export class DocupdatePage { ...@@ -23,12 +24,14 @@ export class DocupdatePage {
fileData: any; fileData: any;
baseUrl: string = this.myservice.base_url baseUrl: string = this.myservice.base_url
myData = { 'secret_key': 'My_key' } myData = { 'secret_key': 'My_key' }
butonName:string; butonName: string;
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private storage: Storage, private toast: Toast, private comService: dataService, private photoViewer: PhotoViewer, private fileOpener: FileOpener, private transfer: FileTransfer, private file: File) { constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private storage: Storage, private toast: Toast, private comService: dataService, private photoViewer: PhotoViewer, private fileOpener: FileOpener, private transfer: FileTransfer, private file: File, private translate: TranslateService) {
} }
ionViewDidEnter() { ionViewDidEnter() {
this.langTrans()
this.fileData = this.comService.getdocData(); this.fileData = this.comService.getdocData();
console.log(this.fileData) console.log(this.fileData)
...@@ -38,11 +41,27 @@ export class DocupdatePage { ...@@ -38,11 +41,27 @@ export class DocupdatePage {
this.local = data this.local = data
if (this.fileData.fileStatus == '3') { if (this.fileData.fileStatus == '3') {
this.butonName = 'UPDATE' this.translate.get(['docupdate.UPDATE']).subscribe(value => {
this.butonName = value['docupdate.UPDATE']
})
} }
else if (this.fileData.fileStatus == '0') { else if (this.fileData.fileStatus == '0') {
this.butonName = 'UPLOAD' this.translate.get(['docupdate.UPLOAD']).subscribe(value => {
this.butonName = value['docupdate.UPLOAD']
})
}
}
})
}
langTrans() {
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
this.lang = lang;
} }
else {
this.translate.use('en')
} }
}) })
} }
...@@ -62,7 +81,9 @@ export class DocupdatePage { ...@@ -62,7 +81,9 @@ export class DocupdatePage {
this.formdata.append('image', file, file.name); this.formdata.append('image', file, file.name);
} }
else { else {
this.myservice.show_alert('', 'Please choose file with .jpg/.jpeg/.png/.pdf extension') this.translate.get(['docupdate.Please choose file with .jpg/.jpeg/.png/.pdf extension']).subscribe(value => {
this.myservice.show_alert('', value['docupdate.Please choose file with .jpg/.jpeg/.png/.pdf extension'])
})
} }
} }
} }
...@@ -78,16 +99,24 @@ export class DocupdatePage { ...@@ -78,16 +99,24 @@ export class DocupdatePage {
this.myservice.hide_loader() this.myservice.hide_loader()
if (resp.status == 'success') { if (resp.status == 'success') {
this.navCtrl.pop(); this.navCtrl.pop();
this.toast.show(resp.message, '2000', 'center').subscribe(toast => { this.translate.get(['docupdate.' + resp.message]).subscribe(value => {
this.toast.show(value['docupdate.' + resp.message], '2000', 'center').subscribe(toast => {
console.log(toast); console.log(toast);
}); });
})
}
else {
this.translate.get(['docupdate.' + resp.message]).subscribe(value => {
this.myservice.show_alert('', value['docupdate.' + resp.message])
})
}
})
} }
else else{
this.myservice.show_alert('', resp.message); this.translate.get(['docupdate.Please select a file to upload']).subscribe(value => {
this.myservice.show_alert('', value['docupdate.Please select a file to upload'])
}) })
} }
else
this.myservice.show_alert('','Please select a file to upload')
} }
view() { view() {
......
...@@ -5,17 +5,17 @@ ...@@ -5,17 +5,17 @@
</ion-header> </ion-header>
<ion-content padding class="themelogin_background"> <ion-content padding class="themelogin_background">
<div class="cab_login_wrapper"> <div class="cab_login_wrapper">
<h4>Forgot Password</h4> <h4>{{'forgot.Forgot Password'|translate}}</h4>
<hr> <hr>
<br> <br>
<div class="cab_form"> <div class="cab_form">
<form [formGroup]="forgotForm"> <form [formGroup]="forgotForm">
<div class="cab_form_row"> <div class="cab_form_row">
<div class="cab_phone_number"> <div class="cab_phone_number">
<input class="cab_phone_input floatRight cab_mail" type="email" placeholder="Email" formControlName="email"> <input class="cab_phone_input floatRight cab_mail" type="email" placeholder="{{'forgot.Email'|translate}}" formControlName="email">
<div class="clear"></div> <div class="clear"></div>
<div class="er_req textCenter" *ngIf="forgotForm.controls.email.invalid && (forgotForm.get('email').dirty || forgotForm.get('email').touched)"> <div class="er_req textCenter" *ngIf="forgotForm.controls.email.invalid && (forgotForm.get('email').dirty || forgotForm.get('email').touched)">
Enter a valid Email {{'forgot.Enter a valid Email'|translate}}
</div> </div>
</div> </div>
</div> </div>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<br> <br>
<br> <br>
<div class="cab_form_row"> <div class="cab_form_row">
<button ion-button class="cab_sign_btn" (click)="forgot()" [disabled]="forgotForm.invalid">Sent recovery password</button> <button ion-button class="cab_sign_btn" (click)="forgot()" [disabled]="forgotForm.invalid">{{'forgot.Sent recovery password'|translate}}</button>
</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 { ForgotPage } from './forgot'; import { ForgotPage } from './forgot';
import { TranslateModule } from "@ngx-translate/core";
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -8,6 +9,7 @@ import { ForgotPage } from './forgot'; ...@@ -8,6 +9,7 @@ import { ForgotPage } from './forgot';
], ],
imports: [ imports: [
IonicPageModule.forChild(ForgotPage), IonicPageModule.forChild(ForgotPage),
TranslateModule
], ],
}) })
export class ForgotPageModule {} export class ForgotPageModule {}
...@@ -2,7 +2,8 @@ import { Component } from '@angular/core'; ...@@ -2,7 +2,8 @@ import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular'; import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { FormGroup, Validators, FormBuilder } from '@angular/forms' import { FormGroup, Validators, FormBuilder } from '@angular/forms'
import { Myservice } from '../../providers/myservice' import { Myservice } from '../../providers/myservice'
import { TranslateService } from "@ngx-translate/core";
import { Storage } from "@ionic/storage";
@IonicPage() @IonicPage()
@Component({ @Component({
...@@ -11,24 +12,45 @@ import { Myservice } from '../../providers/myservice' ...@@ -11,24 +12,45 @@ import { Myservice } from '../../providers/myservice'
}) })
export class ForgotPage { export class ForgotPage {
forgotForm: FormGroup forgotForm: FormGroup
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private formbuilder: FormBuilder, private myservice: Myservice) { constructor(public navCtrl: NavController, public navParams: NavParams, private formbuilder: FormBuilder, private myservice: Myservice, private translate: TranslateService, public storage:Storage) {
this.forgotForm = this.formbuilder.group({ this.forgotForm = this.formbuilder.group({
email: ['', Validators.compose([Validators.required, Validators.pattern("[a-zA-Z0-9.-_]{1,}@[a-zA-Z.-]{2,}[.]{1}[a-zA-Z]{2,}")])], email: ['', Validators.compose([Validators.required, Validators.pattern("[a-zA-Z0-9.-_]{1,}@[a-zA-Z.-]{2,}[.]{1}[a-zA-Z]{2,}")])],
from:['driver'] from:['driver']
}) })
} }
ionViewDidEnter(){
this.langTrans()
}
langTrans() {
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
this.lang = lang;
}
else {
this.translate.use('en')
}
})
}
forgot() { forgot() {
this.myservice.show_loader() this.myservice.show_loader()
this.myservice.load_post(this.forgotForm.value, 'Forget_password').subscribe(response => { this.myservice.load_post(this.forgotForm.value, 'Forget_password').subscribe(response => {
this.myservice.hide_loader() this.myservice.hide_loader()
if (response.status == 'success') { if (response.status == 'success') {
this.myservice.show_alert('', response.message) this.translate.get(['forgot.' + response.message]).subscribe(value => {
this.myservice.show_alert('', value['forgot.' + response.message])
})
this.navCtrl.pop(); this.navCtrl.pop();
} }
else { else {
this.myservice.show_alert('', response.message) this.translate.get(['forgot.' + response.message]).subscribe(value => {
this.myservice.show_alert('', value['forgot.' + response.message])
})
} }
}) })
} }
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
</div> </div>
<div class="cab_form"> <div class="cab_form">
<div class="cab_form_row"> <div class="cab_form_row">
<button ion-button class="cab_sign_btn" (click)="open_page('SignupPage')">New User ? Sign up now!</button> <button ion-button class="cab_sign_btn" (click)="open_page('SignupPage')">{{'landing.New User ? Sign up now!'|translate}}</button>
</div> </div>
<div class="cab_form_row"> <div class="cab_form_row">
<button ion-button class="cab_sign_btn1" (click)="open_page('SigninPage')">Sign in</button> <button ion-button class="cab_sign_btn1" (click)="open_page('SigninPage')">{{'landing.Sign in'|translate}}</button>
</div> </div>
<!-- <div class="cab_form_row textCenter"> <!-- <div class="cab_form_row textCenter">
<p (click)="forgot()">Forgot Password</p> <p (click)="forgot()">Forgot Password</p>
......
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular'; import { IonicPageModule } from 'ionic-angular';
import { LandingPage } from './landing'; import { LandingPage } from './landing';
import { TranslateModule } from "@ngx-translate/core";
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -8,6 +9,7 @@ import { LandingPage } from './landing'; ...@@ -8,6 +9,7 @@ import { LandingPage } from './landing';
], ],
imports: [ imports: [
IonicPageModule.forChild(LandingPage), IonicPageModule.forChild(LandingPage),
TranslateModule
], ],
}) })
export class LandingPageModule {} export class LandingPageModule {}
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 { TranslateService } from "@ngx-translate/core";
import { Storage } from '@ionic/storage'
@IonicPage() @IonicPage()
@Component({ @Component({
...@@ -7,16 +9,30 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular'; ...@@ -7,16 +9,30 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular';
templateUrl: 'landing.html', templateUrl: 'landing.html',
}) })
export class LandingPage { export class LandingPage {
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams) { constructor(public navCtrl: NavController, public navParams: NavParams, public storage: Storage, private translate: TranslateService) {
} }
open_page(page){ open_page(page){
this.navCtrl.push(page); this.navCtrl.push(page);
} }
ionViewDidLoad() { ionViewDidEnter() {
console.log('ionViewDidLoad LandingPage'); this.langTrans()
}
langTrans() {
this.storage.get('lang').then(lang => {
// if (lang != null) {
// this.translate.use(lang)
// this.lang = lang;
// }
// else {
// this.translate.use('en')
// }
this.lang = 'ar'
})
} }
} }
<!--
Generated template for the ListPage page.
See http://ionicframework.com/docs/components/#navigation for more info on
Ionic pages and navigation.
-->
<ion-header>
<ion-navbar>
<ion-title>list</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
</ion-content>
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { ListPage } from './list';
@NgModule({
declarations: [
ListPage,
],
imports: [
IonicPageModule.forChild(ListPage),
],
})
export class ListPageModule {}
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
/**
* Generated class for the ListPage page.
*
* See https://ionicframework.com/docs/components/#navigation for more info on
* Ionic pages and navigation.
*/
@IonicPage()
@Component({
selector: 'page-list',
templateUrl: 'list.html',
})
export class ListPage {
constructor(public navCtrl: NavController, public navParams: NavParams) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad ListPage');
}
}
...@@ -19,11 +19,11 @@ export class MyprofilePage { ...@@ -19,11 +19,11 @@ export class MyprofilePage {
editForm: FormGroup editForm: FormGroup
imagechange: boolean = false; imagechange: boolean = false;
fileUri: any; fileUri: any;
local:driver; local: driver;
formdata = new FormData(); formdata = new FormData();
codes: Array<dialcode>; codes: Array<dialcode>;
cars:any; cars: any;
maxDate:any; maxDate: any;
lang: string = 'en'; 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, private translate: TranslateService) { 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) {
...@@ -36,13 +36,13 @@ export class MyprofilePage { ...@@ -36,13 +36,13 @@ export class MyprofilePage {
email: ['', Validators.compose([Validators.required, Validators.pattern("[a-zA-Z0-9.-_]{1,}@[a-zA-Z.-]{2,}[.]{1}[a-zA-Z]{2,}")])], email: ['', Validators.compose([Validators.required, Validators.pattern("[a-zA-Z0-9.-_]{1,}@[a-zA-Z.-]{2,}[.]{1}[a-zA-Z]{2,}")])],
dial_code: ['', Validators.required], dial_code: ['', Validators.required],
phone: ['', Validators.compose([Validators.required, this.myservice.checkLimit(10000000, 999999999999999)])], phone: ['', Validators.compose([Validators.required, this.myservice.checkLimit(10000000, 999999999999999)])],
image:[''], image: [''],
secret_key: ['My_key'], secret_key: ['My_key'],
license:['',Validators.required], license: ['', Validators.required],
cartype:['',Validators.required], cartype: ['', Validators.required],
car_no:['',Validators.required], car_no: ['', Validators.required],
dob:['',Validators.required], dob: ['', Validators.required],
gender:['',Validators.required], gender: ['', Validators.required],
}) })
this.http.get('dial-codes.json') this.http.get('dial-codes.json')
...@@ -54,30 +54,33 @@ export class MyprofilePage { ...@@ -54,30 +54,33 @@ export class MyprofilePage {
ionViewDidEnter() { ionViewDidEnter() {
this.langTrans() 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;
this.myservice.load_post({id:data.id}, 'getdriverDetails').subscribe(resp => { this.myservice.load_post({ id: data.id }, 'getdriverDetails').subscribe(resp => {
if (resp.status == 'success') { if (resp.status == 'success') {
this.editForm.controls['name'].setValue(resp.data.name) this.editForm.controls['name'].setValue(resp.data.name)
this.editForm.controls['username'].setValue(resp.data.user_name) this.editForm.controls['username'].setValue(resp.data.user_name)
this.editForm.controls['email'].setValue(resp.data.email) this.editForm.controls['email'].setValue(resp.data.email)
this.editForm.controls['dial_code'].setValue(resp.data.dial_code) this.editForm.controls['dial_code'].setValue(resp.data.dial_code)
this.editForm.controls['phone'].setValue(resp.data.phone) this.editForm.controls['phone'].setValue(resp.data.phone)
this.editForm.controls['image'].setValue(this.myservice.base_url+resp.data.image) this.editForm.controls['image'].setValue(this.myservice.base_url + resp.data.image)
this.editForm.controls['car_no'].setValue(resp.data.car_no) this.editForm.controls['car_no'].setValue(resp.data.car_no)
this.editForm.controls['cartype'].setValue(resp.data.car_type) this.editForm.controls['cartype'].setValue(resp.data.car_type)
this.editForm.controls['dob'].setValue(resp.data.dob) this.editForm.controls['dob'].setValue(resp.data.dob)
this.editForm.controls['gender'].setValue(resp.data.gender) this.editForm.controls['gender'].setValue(resp.data.gender)
this.editForm.controls['license'].setValue(resp.data.license_no) this.editForm.controls['license'].setValue(resp.data.license_no)
} }
else else {
this.myservice.show_alert('',resp.message) this.translate.get(['profile.' + resp.message]).subscribe(value => {
this.myservice.show_alert('', value['profile.' + resp.message])
})
}
}) })
} }
}) })
this.myservice.load_post({},'getCarTypes').subscribe(resp=>{ this.myservice.load_post({}, 'getCarTypes').subscribe(resp => {
if(resp.status == 'success'){ if (resp.status == 'success') {
this.cars = resp.data this.cars = resp.data
} }
}) })
...@@ -114,12 +117,14 @@ export class MyprofilePage { ...@@ -114,12 +117,14 @@ export class MyprofilePage {
this.imagechange = true; this.imagechange = true;
} }
else { else {
this.myservice.show_alert('','Please choose image with .jpg/.jpeg/.png extension') this.translate.get(['profile.Please choose image with .jpg/.jpeg/.png extension']).subscribe(value => {
this.myservice.show_alert('', value['profile.Please choose image with .jpg/.jpeg/.png extension'])
})
} }
} }
} }
updateProfile(){ updateProfile() {
this.myservice.show_loader() this.myservice.show_loader()
this.formdata.append('data', JSON.stringify(this.editForm.value)); this.formdata.append('data', JSON.stringify(this.editForm.value));
this.formdata.append('id', JSON.stringify(this.local.id)); this.formdata.append('id', JSON.stringify(this.local.id));
...@@ -127,19 +132,23 @@ export class MyprofilePage { ...@@ -127,19 +132,23 @@ export class MyprofilePage {
this.myservice.hide_loader() this.myservice.hide_loader()
if (response.status == 'success') { if (response.status == 'success') {
this.local = response.data this.local = response.data
if (this.imagechange == true){ if (this.imagechange == true) {
this.local.image = this.local.image.startsWith("http") ? this.local.image : this.myservice.base_url + this.local.image; this.local.image = this.local.image.startsWith("http") ? this.local.image : this.myservice.base_url + this.local.image;
} }
this.events.publish('driver:profile', this.local); this.events.publish('driver:profile', this.local);
this.toast.show(response.message, '2000', 'center').subscribe(toast => { this.translate.get(['profile.' + response.message]).subscribe(value => {
this.toast.show(value['profile.' + response.message], '2000', 'center').subscribe(toast => {
console.log(toast); console.log(toast);
}); });
})
} }
else { else {
this.myservice.show_alert('', response.message) this.translate.get(['profile.' + response.message]).subscribe(value => {
this.myservice.show_alert('', value['profile.' + response.message])
})
} }
}) })
} }
......
...@@ -2,17 +2,17 @@ ...@@ -2,17 +2,17 @@
<button ion-button class="nav_btn theme_color floatLeft"(click)="dismiss()"> <button ion-button class="nav_btn theme_color floatLeft"(click)="dismiss()">
<ion-icon name="ios-arrow-back"></ion-icon> <ion-icon name="ios-arrow-back"></ion-icon>
</button> </button>
<div class="nav_header_title floatLeft">Payment Details</div> <div class="nav_header_title floatLeft">{{'payment.Payment Details'|translate}}</div>
<div class="clear"></div> <div class="clear"></div>
</ion-header> </ion-header>
<ion-content padding class="cab_coupon_bg"> <ion-content padding class="cab_coupon_bg">
<div class="cab_trip_detail_wrapper"> <div class="cab_trip_detail_wrapper">
<h4 class="text_white">Pickup Point</h4> <h4 class="text_white">{{'payment.Pickup Point'|translate}}</h4>
<p class="floatLeft textLeft width50">{{book.from}}</p> <p class="floatLeft textLeft width50">{{book.from}}</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> -->
<div class="clear"></div> <div class="clear"></div>
<br> <br>
<h4 class="text_white">Drop Point</h4> <h4 class="text_white">{{'payment.Drop Point'translate}}</h4>
<p class="floatLeft textLeft width50">{{book.to}}</p> <p class="floatLeft textLeft width50">{{book.to}}</p>
<!-- <p class="floatRight textRight width50">12 :00 am, 02-08-2017</p> --> <!-- <p class="floatRight textRight width50">12 :00 am, 02-08-2017</p> -->
<div class="clear"></div> <div class="clear"></div>
...@@ -21,33 +21,33 @@ ...@@ -21,33 +21,33 @@
</div> </div>
<div class="cab_coupon_content"> <div class="cab_coupon_content">
<p style="padding-top: 0px;margin-top: 0px;margin-bottom: 0px;">Ride Details</p> <p style="padding-top: 0px;margin-top: 0px;margin-bottom: 0px;">{{'payment.Ride Details'|translate}}</p>
<li> <li>
<div class="child textLeft">Distance</div> <div class="child textLeft">{{'payment.Distance'|translate}}</div>
<div class="child textRight">Rs. {{details?.distance}}</div> <div class="child textRight">Rs. {{details?.distance}}</div>
<div class="clear"></div> <div class="clear"></div>
</li> </li>
<li> <li>
<div class="child textLeft">Hours</div> <div class="child textLeft">{{'payment.Hours'|translate}}</div>
<div class="child textRight">Rs. {{details?.hours}}</div> <div class="child textRight">Rs. {{details?.hours}}</div>
<div class="clear"></div> <div class="clear"></div>
</li> </li>
</div> </div>
<div class="cab_coupon_content"> <div class="cab_coupon_content">
<p style="padding-top: 0px;margin-top: 0px;margin-bottom: 0px;">Payment Details</p> <p style="padding-top: 0px;margin-top: 0px;margin-bottom: 0px;">{{'payment.Payment Details'|translate}}</p>
<li> <li>
<div class="child textLeft">Total</div> <div class="child textLeft">{{'payment.Total'|translate}}</div>
<div class="child textRight">Rs. {{details?.bfor_deduction}}</div> <div class="child textRight">Rs. {{details?.bfor_deduction}}</div>
<div class="clear"></div> <div class="clear"></div>
</li> </li>
<li> <li>
<div class="child textLeft">Discount</div> <div class="child textLeft">{{'payment.Discount'|translate}}</div>
<div class="child textRight">Rs. {{book?.discount}}</div> <div class="child textRight">Rs. {{book?.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">{{'payment.Due after service'|translate}}</div>
<div class="child textRight">Rs. {{details?.amount}}</div> <div class="child textRight">Rs. {{details?.amount}}</div>
<div class="clear"></div> <div class="clear"></div>
</li> </li>
...@@ -56,9 +56,9 @@ ...@@ -56,9 +56,9 @@
</ion-content> </ion-content>
<ion-footer> <ion-footer>
<div class="theme_bgcolor p10 text_white"> <div class="theme_bgcolor p10 text_white">
<p class="floatLeft text_size_18">Total</p> <p class="floatLeft text_size_18">{{'payment.Total'|translate}}</p>
<p class="floatRight text_size_18">Rs.{{details?.amount}}</p> <p class="floatRight text_size_18">Rs.{{details?.amount}}</p>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<button ion-button class="cab_footer_btn width100 text_white" (click)="done()">Completed</button> <button ion-button class="cab_footer_btn width100 text_white" (click)="done()">{{'payment.Completed'|translate}}</button>
</ion-footer> </ion-footer>
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular'; import { IonicPageModule } from 'ionic-angular';
import { PaymentPage } from './payment'; import { PaymentPage } from './payment';
import { TranslateModule } from "@ngx-translate/core";
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -8,6 +9,7 @@ import { PaymentPage } from './payment'; ...@@ -8,6 +9,7 @@ import { PaymentPage } from './payment';
], ],
imports: [ imports: [
IonicPageModule.forChild(PaymentPage), IonicPageModule.forChild(PaymentPage),
TranslateModule
], ],
}) })
export class PaymentPageModule {} export class PaymentPageModule {}
...@@ -4,6 +4,8 @@ import { dataService } from "../../providers/common.service"; ...@@ -4,6 +4,8 @@ import { dataService } from "../../providers/common.service";
import { Myservice } from "../../providers/myservice"; import { Myservice } from "../../providers/myservice";
import * as firebase from 'firebase'; import * as firebase from 'firebase';
import { DatePipe } from '@angular/common'; import { DatePipe } from '@angular/common';
import { TranslateService } from "@ngx-translate/core";
import { Storage } from '@ionic/storage'
declare var google; declare var google;
@IonicPage() @IonicPage()
...@@ -20,11 +22,25 @@ export class PaymentPage { ...@@ -20,11 +22,25 @@ export class PaymentPage {
waypoints = this.data.getwaypointData() waypoints = this.data.getwaypointData()
rate = this.data.getrateData(); rate = this.data.getrateData();
details:any; details:any;
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private data: dataService, private myservice: Myservice, public platform: Platform, private datePipe: DatePipe) { constructor(public navCtrl: NavController, public navParams: NavParams, private data: dataService, private myservice: Myservice, public platform: Platform, private datePipe: DatePipe, public storage: Storage, private translate: TranslateService) {
}
langTrans() {
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
this.lang = lang;
}
else {
this.translate.use('en')
}
})
} }
ionViewDidEnter() { ionViewDidEnter() {
this.langTrans()
// this.myservice.hide_loader(); // this.myservice.hide_loader();
this.initializeBackButtonCustomHandler(); this.initializeBackButtonCustomHandler();
...@@ -84,8 +100,11 @@ export class PaymentPage { ...@@ -84,8 +100,11 @@ export class PaymentPage {
This.details.bfor_deduction = amount; This.details.bfor_deduction = amount;
This.details.hours = hDisplay + mDisplay; This.details.hours = hDisplay + mDisplay;
} }
else else{
This.myservice.show_alert('',response.message) This.translate.get(['payment.' + response.message]).subscribe(value => {
This.myservice.show_alert('', value['payment.' + response.message])
})
}
}) })
} else { } else {
window.alert('Directions request failed due to ' + status); window.alert('Directions request failed due to ' + status);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="cab_logo"> <div class="cab_logo">
<img src="assets/img/cab_logo.png" style="width: 120px;"> <img src="assets/img/cab_logo.png" style="width: 120px;">
</div> </div>
<h4>Login</h4> <h4>{{'signin.Login'|translate}}</h4>
<hr> <hr>
<br> <br>
<div class="cab_form"> <div class="cab_form">
...@@ -14,20 +14,20 @@ ...@@ -14,20 +14,20 @@
<select class="cab_phone_code floatLeft" formControlName="dial_code"> <select class="cab_phone_code floatLeft" formControlName="dial_code">
<option *ngFor="let code of codes" value=+{{code.dialCode}}>+{{code.dialCode}}</option> <option *ngFor="let code of codes" value=+{{code.dialCode}}>+{{code.dialCode}}</option>
</select> </select>
<input class="cab_phone_input floatRight cab_call" placeholder="Mobile Number" formControlName="mobile" type="number"> <input class="cab_phone_input floatRight cab_call" placeholder="{{'signin.Mobile Number'|translate}}" formControlName="mobile" type="number">
<div class="clear"></div> <div class="clear"></div>
<div class="er_req textCenter" *ngIf="signinForm.controls.mobile.invalid && (signinForm.get('mobile').dirty || signinForm.get('mobile').touched)"> <div class="er_req textCenter" *ngIf="signinForm.controls.mobile.invalid && (signinForm.get('mobile').dirty || signinForm.get('mobile').touched)">
Enter a valid Mobile {{'signin.Enter a valid Mobile'|translate}}
</div> </div>
</div> </div>
</div> </div>
<br> <br>
<div class="cab_form_row"> <div class="cab_form_row">
<div class="cab_phone_number"> <div class="cab_phone_number">
<input class="cab_phone_input cab_pass width100" placeholder="Password" type="password" formControlName="password"> <input class="cab_phone_input cab_pass width100" placeholder="{{'signin.Password'|translate}}" type="password" formControlName="password">
<div class="clear"></div> <div class="clear"></div>
<div class="er_req textCenter" *ngIf="signinForm.controls.password.invalid && (signinForm.get('password').dirty || signinForm.get('password').touched)"> <div class="er_req textCenter" *ngIf="signinForm.controls.password.invalid && (signinForm.get('password').dirty || signinForm.get('password').touched)">
Minimum 6 characters {{'signin.Minimum 6 characters'|translate}}
</div> </div>
</div> </div>
</div> </div>
...@@ -35,11 +35,11 @@ ...@@ -35,11 +35,11 @@
<br> <br>
<br> <br>
<div class="cab_form_row"> <div class="cab_form_row">
<button ion-button class="cab_sign_btn" (click)="login()">Sign In</button> <button ion-button class="cab_sign_btn" (click)="login()">{{'signin.Sign In'|translate}}</button>
</div> </div>
<br> <br>
<div class="cab_form_row textCenter"> <div class="cab_form_row textCenter">
<p (click)="forgot()">Forgot Password</p> <p (click)="forgot()">{{'signin.Forgot Password'|translate}}</p>
</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 { SigninPage } from './signin'; import { SigninPage } from './signin';
import { TranslateModule } from "@ngx-translate/core";
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -8,6 +9,7 @@ import { SigninPage } from './signin'; ...@@ -8,6 +9,7 @@ import { SigninPage } from './signin';
], ],
imports: [ imports: [
IonicPageModule.forChild(SigninPage), IonicPageModule.forChild(SigninPage),
TranslateModule
], ],
}) })
export class SigninPageModule {} export class SigninPageModule {}
...@@ -6,6 +6,8 @@ import { dialcode } from "../../models/mymodel"; ...@@ -6,6 +6,8 @@ import { dialcode } from "../../models/mymodel";
import { OrderbyPipe } from '../../providers/sort-pipe'; import { OrderbyPipe } from '../../providers/sort-pipe';
import { Myservice } from "../../providers/myservice"; import { Myservice } from "../../providers/myservice";
import { Storage } from "@ionic/storage"; import { Storage } from "@ionic/storage";
import { TranslateService } from "@ngx-translate/core";
@IonicPage() @IonicPage()
@Component({ @Component({
selector: 'page-signin', selector: 'page-signin',
...@@ -14,8 +16,9 @@ import { Storage } from "@ionic/storage"; ...@@ -14,8 +16,9 @@ import { Storage } from "@ionic/storage";
export class SigninPage { export class SigninPage {
codes: Array<dialcode>; codes: Array<dialcode>;
signinForm: FormGroup signinForm: FormGroup
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) { 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 translate: TranslateService) {
this.signinForm = this.formBuilder.group({ this.signinForm = this.formBuilder.group({
mobile: ['', Validators.compose([Validators.required, this.myservice.checkLimit(10000000, 999999999999999)])], mobile: ['', Validators.compose([Validators.required, this.myservice.checkLimit(10000000, 999999999999999)])],
dial_code: ['+91', Validators.required], dial_code: ['+91', Validators.required],
...@@ -29,6 +32,22 @@ export class SigninPage { ...@@ -29,6 +32,22 @@ export class SigninPage {
}) })
} }
langTrans() {
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
this.lang = lang;
}
else {
this.translate.use('en')
}
})
}
ionViewDidEnter() {
this.langTrans()
}
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 => {
...@@ -48,7 +67,9 @@ export class SigninPage { ...@@ -48,7 +67,9 @@ export class SigninPage {
} }
else { else {
this.myservice.hide_loader(); this.myservice.hide_loader();
this.myservice.show_alert('', response[0].message) this.translate.get(['signin.' + response[0].message]).subscribe(value => {
this.myservice.show_alert('', value['signin.' + response[0].message])
})
} }
}) })
} }
......
...@@ -5,27 +5,27 @@ ...@@ -5,27 +5,27 @@
</ion-header> </ion-header>
<ion-content padding class="themelogin_background"> <ion-content padding class="themelogin_background">
<div class="cab_login_wrapper"> <div class="cab_login_wrapper">
<h4>Sign Up</h4> <h4>{{'signup.Sign Up'|translate}}</h4>
<hr> <hr>
<br> <br>
<div class="cab_form"> <div class="cab_form">
<form [formGroup]="signupForm"> <form [formGroup]="signupForm">
<div class="cab_form_row"> <div class="cab_form_row">
<div class="cab_phone_number"> <div class="cab_phone_number">
<input class="cab_phone_input cab_user width100" placeholder="Name" formControlName="name"> <input class="cab_phone_input cab_user width100" placeholder="{{'signup.Name'|translate}}" formControlName="name">
<div class="clear"></div> <div class="clear"></div>
<div class="er_req textCenter" *ngIf="signupForm.controls.name.invalid && (signupForm.get('name').dirty || signupForm.get('name').touched)"> <div class="er_req textCenter" *ngIf="signupForm.controls.name.invalid && (signupForm.get('name').dirty || signupForm.get('name').touched)">
Enter a valid Name {{'signup.Enter a valid Name'|translate}}
</div> </div>
</div> </div>
</div> </div>
<br> <br>
<div class="cab_form_row"> <div class="cab_form_row">
<div class="cab_phone_number"> <div class="cab_phone_number">
<input class="cab_phone_input cab_user width100" placeholder="Username" formControlName="username"> <input class="cab_phone_input cab_user width100" placeholder="{{'signup.Username'|translate}}" formControlName="username">
<div class="clear"></div> <div class="clear"></div>
<div class="er_req textCenter" *ngIf="signupForm.controls.username.invalid && (signupForm.get('username').dirty || signupForm.get('username').touched)"> <div class="er_req textCenter" *ngIf="signupForm.controls.username.invalid && (signupForm.get('username').dirty || signupForm.get('username').touched)">
Enter a valid Username {{'signup.Enter a valid Username'|translate}}
</div> </div>
</div> </div>
</div> </div>
...@@ -35,40 +35,40 @@ ...@@ -35,40 +35,40 @@
<select class="cab_phone_code floatLeft" formControlName="dial_code"> <select class="cab_phone_code floatLeft" formControlName="dial_code">
<option *ngFor="let code of codes" value=+{{code.dialCode}}>+{{code.dialCode}}</option> <option *ngFor="let code of codes" value=+{{code.dialCode}}>+{{code.dialCode}}</option>
</select> </select>
<input class="cab_phone_input floatRight cab_call" placeholder="Mobile Number" formControlName="phone" type="number"> <input class="cab_phone_input floatRight cab_call" placeholder="{{'signup.Mobile Number'|translate}}" formControlName="phone" type="number">
<div class="clear"></div> <div class="clear"></div>
<div class="er_req textCenter" *ngIf="signupForm.controls.phone.invalid && (signupForm.get('phone').dirty || signupForm.get('phone').touched)"> <div class="er_req textCenter" *ngIf="signupForm.controls.phone.invalid && (signupForm.get('phone').dirty || signupForm.get('phone').touched)">
Enter a valid Mobile {{'signup.Enter a valid Mobile'|translate}}
</div> </div>
</div> </div>
</div> </div>
<br> <br>
<div class="cab_form_row"> <div class="cab_form_row">
<div class="cab_phone_number"> <div class="cab_phone_number">
<input class="cab_phone_input cab_mail width100" placeholder="Email" formControlName="email" type="email"> <input class="cab_phone_input cab_mail width100" placeholder="{{'signup.Email'|translate}}" formControlName="email" type="email">
<div class="clear"></div> <div class="clear"></div>
<div class="er_req textCenter" *ngIf="signupForm.controls.email.invalid && (signupForm.get('email').dirty || signupForm.get('email').touched)"> <div class="er_req textCenter" *ngIf="signupForm.controls.email.invalid && (signupForm.get('email').dirty || signupForm.get('email').touched)">
Enter a valid Email {{'signup.Enter a valid Email'|translate}}
</div> </div>
</div> </div>
</div> </div>
<br> <br>
<div class="cab_form_row"> <div class="cab_form_row">
<div class="cab_phone_number"> <div class="cab_phone_number">
<input class="cab_phone_input cab_pass width100" placeholder="Password" formControlName="password" type="password"> <input class="cab_phone_input cab_pass width100" placeholder="{{'signup.Password'|translate}}" formControlName="password" type="password">
<div class="clear"></div> <div class="clear"></div>
<div class="er_req textCenter" *ngIf="signupForm.controls.password.invalid && (signupForm.get('password').dirty || signupForm.get('password').touched)"> <div class="er_req textCenter" *ngIf="signupForm.controls.password.invalid && (signupForm.get('password').dirty || signupForm.get('password').touched)">
Minimum 6 characters {{'signup.Minimum 6 characters'|translate}}
</div> </div>
</div> </div>
</div> </div>
<br> <br>
<div class="cab_form_row"> <div class="cab_form_row">
<div class="cab_phone_number"> <div class="cab_phone_number">
<input class="cab_phone_input cab_confirmpass width100" placeholder="Confirm Password" type="password" formControlName="confirm"> <input class="cab_phone_input cab_confirmpass width100" placeholder="{{'signup.Confirm Password'|translate}}" type="password" formControlName="confirm">
<div class="clear"></div> <div class="clear"></div>
<div class="er_req textCenter" *ngIf="signupForm.controls.confirm.invalid && (signupForm.get('confirm').dirty || signupForm.get('confirm').touched)"> <div class="er_req textCenter" *ngIf="signupForm.controls.confirm.invalid && (signupForm.get('confirm').dirty || signupForm.get('confirm').touched)">
Password mismatches {{'signup.Password mismatches'|translate}}
</div> </div>
</div> </div>
</div> </div>
...@@ -76,19 +76,19 @@ ...@@ -76,19 +76,19 @@
<div class="cab_form_row textCenter"> <div class="cab_form_row textCenter">
<ion-item style="width:100% !important;"> <ion-item style="width:100% !important;">
<ion-label> <ion-label>
<p>I accept terms & condition</p> <p>{{'signup.I accept terms & condition'|translate}}</p>
</ion-label> </ion-label>
<ion-checkbox formControlName="terms"></ion-checkbox> <ion-checkbox formControlName="terms"></ion-checkbox>
</ion-item> </ion-item>
<div class="er_req textCenter" *ngIf="signupForm.controls.terms.invalid && (signupForm.get('terms').dirty || signupForm.get('terms').touched)"> <div class="er_req textCenter" *ngIf="signupForm.controls.terms.invalid && (signupForm.get('terms').dirty || signupForm.get('terms').touched)">
Please accept terms & conditions {{'signup.Please accept terms & conditions'|translate}}
</div> </div>
</div> </div>
</form> </form>
<br> <br>
<div class="cab_form_row"> <div class="cab_form_row">
<button ion-button class="cab_sign_btn" (click)="register()" [disabled]="signupForm.invalid">Sign Up</button> <button ion-button class="cab_sign_btn" (click)="register()" [disabled]="signupForm.invalid">{{'signup.Sign Up'|translate}}</button>
</div> </div>
<br> <br>
</div> </div>
......
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular'; import { IonicPageModule } from 'ionic-angular';
import { SignupPage } from './signup'; import { SignupPage } from './signup';
import { TranslateModule } from "@ngx-translate/core";
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -8,6 +9,7 @@ import { SignupPage } from './signup'; ...@@ -8,6 +9,7 @@ import { SignupPage } from './signup';
], ],
imports: [ imports: [
IonicPageModule.forChild(SignupPage), IonicPageModule.forChild(SignupPage),
TranslateModule
], ],
}) })
export class SignupPageModule {} export class SignupPageModule {}
...@@ -8,6 +8,8 @@ import { Myservice } from "../../providers/myservice"; ...@@ -8,6 +8,8 @@ import { Myservice } from "../../providers/myservice";
import { OneSignal } from "@ionic-native/onesignal"; import { OneSignal } from "@ionic-native/onesignal";
import { fireService } from "../../providers/firebase.service"; import { fireService } from "../../providers/firebase.service";
import { Geolocation } from '@ionic-native/geolocation'; import { Geolocation } from '@ionic-native/geolocation';
import { TranslateService } from "@ngx-translate/core";
import { Storage } from "@ionic/storage";
@IonicPage() @IonicPage()
@Component({ @Component({
...@@ -17,8 +19,9 @@ import { Geolocation } from '@ionic-native/geolocation'; ...@@ -17,8 +19,9 @@ import { Geolocation } from '@ionic-native/geolocation';
export class SignupPage { export class SignupPage {
signupForm: FormGroup signupForm: FormGroup
codes: Array<dialcode>; codes: Array<dialcode>;
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private formBuilder: FormBuilder, private http: Http, private orderbyPipe: OrderbyPipe, private myservice: Myservice, private onesignal: OneSignal, private firebase: fireService, private geolocation: Geolocation) { constructor(public navCtrl: NavController, public navParams: NavParams, private formBuilder: FormBuilder, private http: Http, private orderbyPipe: OrderbyPipe, private myservice: Myservice, private onesignal: OneSignal, private firebase: fireService, private geolocation: Geolocation, private translate: TranslateService, private storage: Storage) {
this.signupForm = this.formBuilder.group({ this.signupForm = this.formBuilder.group({
name: ['', Validators.compose([Validators.required, Validators.minLength(3)])], name: ['', Validators.compose([Validators.required, Validators.minLength(3)])],
...@@ -39,8 +42,20 @@ export class SignupPage { ...@@ -39,8 +42,20 @@ export class SignupPage {
}) })
} }
ionViewDidLoad() { ionViewDidEnter() {
console.log('ionViewDidLoad SignupPage'); this.langTrans()
}
langTrans() {
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
this.lang = lang;
}
else {
this.translate.use('en')
}
})
} }
back() { back() {
...@@ -65,7 +80,9 @@ export class SignupPage { ...@@ -65,7 +80,9 @@ export class SignupPage {
this.navCtrl.setRoot("SigninPage"); this.navCtrl.setRoot("SigninPage");
} }
else { else {
this.myservice.show_alert('', response.message) this.translate.get(['signup.' + response.message]).subscribe(value => {
this.myservice.show_alert('', value['signup.' + response.message])
})
} }
}) })
}) })
......
...@@ -3,16 +3,16 @@ ...@@ -3,16 +3,16 @@
<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">
Documents {{'uploaddoc.Documents'|translate}}
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</ion-header> </ion-header>
<ion-content padding> <ion-content padding>
<div class="sign_up_wrapper"> <div class="sign_up_wrapper">
<h4>Upload Docs</h4> <h4>{{'uploaddoc.Upload Docs'|translate}}</h4>
<hr> <hr>
<p>Please upload your documents to get<br> <p>{{'uploaddoc.Please upload your documents to get'|translate}}<br>
Approved</p> {{'uploaddoc.Approved'|translate}}</p>
<div class="upload_doc_list"> <div class="upload_doc_list">
<ion-list radio-group> <ion-list radio-group>
<ion-item *ngFor="let doc of docs; let i = index;"> <ion-item *ngFor="let doc of docs; let i = index;">
......
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular'; import { IonicPageModule } from 'ionic-angular';
import { UploaddocPage } from './uploaddoc'; import { UploaddocPage } from './uploaddoc';
import { TranslateModule } from "@ngx-translate/core";
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -8,6 +9,7 @@ import { UploaddocPage } from './uploaddoc'; ...@@ -8,6 +9,7 @@ import { UploaddocPage } from './uploaddoc';
], ],
imports: [ imports: [
IonicPageModule.forChild(UploaddocPage), IonicPageModule.forChild(UploaddocPage),
TranslateModule
], ],
}) })
export class UploaddocPageModule {} export class UploaddocPageModule {}
...@@ -4,6 +4,7 @@ import { Myservice } from "../../providers/myservice"; ...@@ -4,6 +4,7 @@ import { Myservice } from "../../providers/myservice";
import { dataService } from "../../providers/common.service"; import { dataService } from "../../providers/common.service";
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({
...@@ -13,11 +14,14 @@ import { driver } from "../../models/mymodel"; ...@@ -13,11 +14,14 @@ import { driver } from "../../models/mymodel";
export class UploaddocPage { export class UploaddocPage {
docs:any; docs:any;
local:driver local:driver
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private comService:dataService, private storage:Storage) { constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private comService: dataService, private storage: Storage, private translate: TranslateService) {
} }
ionViewDidEnter(){ ionViewDidEnter(){
this.langTrans()
this.storage.get('driver_data').then(data=>{ this.storage.get('driver_data').then(data=>{
this.local = data this.local = data
...@@ -25,9 +29,24 @@ export class UploaddocPage { ...@@ -25,9 +29,24 @@ export class UploaddocPage {
if(resp.status == 'success'){ if(resp.status == 'success'){
this.docs = resp.data this.docs = resp.data
} }
else else{
this.myservice.show_alert('',resp.message) this.translate.get(['uploaddoc.' + resp.message]).subscribe(value => {
this.myservice.show_alert('', value['uploaddoc.' + resp.message])
})
}
})
}) })
}
langTrans() {
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
this.lang = lang;
}
else {
this.translate.use('en')
}
}) })
} }
......
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