Commit 3d5b34ba by Alen Jose

sidemenu lang change

parent 2687af45
......@@ -95,4 +95,4 @@
"android"
]
}
}
}
\ No newline at end of file
......@@ -47,7 +47,7 @@ export class MyApp {
// this.enableLoc()
this.languageTrans();
this.events.subscribe('user:lang', data => {
this.events.subscribe('driver:lang', data => {
this.languageTrans();
})
......@@ -144,7 +144,7 @@ export class MyApp {
}
})
}, 20000)
// This.setlocalNotification();
This.setlocalNotification();
}
openPage(page) {
......@@ -200,11 +200,13 @@ export class MyApp {
var arr = []
for (let i = 0; i < upcoming.length; i++) {
var t = new Date(upcoming[i].pickup_date + ' ' + upcoming[i].pickup_time).getTime()
// console.log(t-300000)
arr.push({
id: i,
text: 'Ride Notification',
title: 'CMC-Driver',
trigger: { at: new Date(upcoming[i].pickup_date + ' ' + upcoming[i].pickup_time) },
trigger: { at: new Date(t - 300000) },
led: 'FF0000',
sound: 'file://assets/sounds/request.mp3',
data: upcoming[i],
......@@ -234,17 +236,20 @@ export class MyApp {
}
languageTrans() {
this.storage.get('lang').then(data => {
console.log(data)
if (data) {
this.translate.use(data);
this.lang = data;
}
else {
this.translate.setDefaultLang('en');
}
this.lang_trans()
})
var This = this;
setTimeout(function () {
This.storage.get('lang').then(data => {
console.log(data)
if (data) {
This.translate.use(data);
This.lang = data;
}
else {
This.translate.setDefaultLang('en');
}
This.lang_trans()
})
}, 500)
}
lang_trans() {
......@@ -256,4 +261,9 @@ export class MyApp {
})
}
changeLang(lang) {
this.storage.set('lang', lang);
this.events.publish('driver:lang', lang);
}
}
<ion-menu [content]="content">
<ion-content class="theme_bgcolor">
<div class="cab_sidemenu_wrapper">
<select [(ngModel)]="lang" (change)="changeLang(lang)">
<option value="en">EN</option>
<option value="en2">EN2</option>
</select>
<div menuClose class="cab_profile_banner" (click)="openPage('MyprofilePage')">
<div class="cab_profile_picture">
<img [src]="local?.image">
......
......@@ -11,6 +11,19 @@
justify-content: center;
text-align: center;
padding-left: 30px;
position: relative;
select{
width: 75px;
height: 30px;
background: transparent;
border: 2px solid #fff;
border-radius: 20px;
position: absolute;
top: 30px;
right: 30px;
color: #fff;
padding-left: 10px;
}
}
.cab_sidemenu_wrapper hr{
......
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { IonicPage, NavController, NavParams,Events } from 'ionic-angular';
import { FormGroup, Validators, FormBuilder } from '@angular/forms'
import { Myservice } from '../../providers/myservice'
import { Storage } from '@ionic/storage'
......@@ -17,7 +17,7 @@ export class ChangepassPage {
local: driver
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, public storage: Storage, private formbuilder: FormBuilder, private toast: Toast, private translate: TranslateService) {
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, public storage: Storage, private formbuilder: FormBuilder, private toast: Toast, private translate: TranslateService, public events:Events) {
this.pswdForm = this.formbuilder.group({
current: ['', Validators.compose([Validators.required, Validators.minLength(6)])],
......@@ -25,6 +25,12 @@ export class ChangepassPage {
confirm: ['', Validators.compose([Validators.required]), this.MatchPassword.bind(this)],
id: ['']
})
this.events.subscribe('driver:lang', data => {
setTimeout(() => {
this.langTrans();
}, 500);
})
}
ionViewDidEnter() {
......
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { IonicPage, NavController, NavParams,MenuController } from 'ionic-angular';
import { Myservice } from "../../providers/myservice";
import { Storage } from "@ionic/storage";
import { driver } from "../../models/mymodel";
......@@ -27,10 +27,11 @@ export class DocupdatePage {
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, private translate: TranslateService) {
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,private menu:MenuController) {
}
ionViewDidEnter() {
this.menu.swipeEnable(false)
this.langTrans()
this.fileData = this.comService.getdocData();
......@@ -147,5 +148,8 @@ export class DocupdatePage {
this.navCtrl.pop();
}
ionViewWillLeave() {
this.menu.swipeEnable(true)
}
}
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { IonicPage, NavController, NavParams, MenuController } from 'ionic-angular';
import { FormGroup, Validators, FormBuilder } from '@angular/forms'
import { Myservice } from '../../providers/myservice'
import { TranslateService } from "@ngx-translate/core";
......@@ -14,7 +14,7 @@ export class ForgotPage {
forgotForm: FormGroup
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private formbuilder: FormBuilder, private myservice: Myservice, private translate: TranslateService, public storage:Storage) {
constructor(public navCtrl: NavController, public navParams: NavParams, private formbuilder: FormBuilder, private myservice: Myservice, private translate: TranslateService, public storage:Storage, private menu:MenuController) {
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,}")])],
from:['driver']
......@@ -22,6 +22,7 @@ export class ForgotPage {
}
ionViewDidEnter(){
this.menu.swipeEnable(false)
this.langTrans()
}
......@@ -61,4 +62,7 @@ export class ForgotPage {
this.navCtrl.pop();
}
ionViewWillLeave() {
this.menu.swipeEnable(true)
}
}
......@@ -18,6 +18,11 @@ export class HomePage {
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private storage: Storage, private myservice: Myservice, private data: dataService, public events: Events, private translate: TranslateService) {
this.events.subscribe('driver:lang',data=>{
setTimeout(() => {
this.langTrans();
}, 500);
})
}
ionViewDidEnter() {
......
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { IonicPage, NavController, NavParams,MenuController } from 'ionic-angular';
import { TranslateService } from "@ngx-translate/core";
import { Storage } from '@ionic/storage'
......@@ -11,7 +11,7 @@ import { Storage } from '@ionic/storage'
export class LandingPage {
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, public storage: Storage, private translate: TranslateService) {
constructor(public navCtrl: NavController, public navParams: NavParams, public storage: Storage, private translate: TranslateService, private menu:MenuController) {
}
open_page(page){
......@@ -19,6 +19,7 @@ export class LandingPage {
}
ionViewDidEnter() {
this.menu.swipeEnable(false)
this.langTrans()
}
......@@ -35,4 +36,8 @@ export class LandingPage {
})
}
ionViewWillLeave(){
this.menu.swipeEnable(true)
}
}
......@@ -50,6 +50,12 @@ export class MyprofilePage {
this.codes = response.json().dialCodes
this.codes = this.orderbyPipe.transform(this.codes, 'dialCode');
})
this.events.subscribe('driver:lang', data => {
setTimeout(() => {
this.langTrans();
}, 500);
})
}
ionViewDidEnter() {
......
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, Platform } from 'ionic-angular';
import { IonicPage, NavController, NavParams, Platform,MenuController } from 'ionic-angular';
import { dataService } from "../../providers/common.service";
import { Myservice } from "../../providers/myservice";
import * as firebase from 'firebase';
......@@ -24,7 +24,7 @@ export class PaymentPage {
details:any;
lang: string = 'en';
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) {
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, private menu:MenuController) {
}
langTrans() {
......@@ -40,6 +40,7 @@ export class PaymentPage {
}
ionViewDidEnter() {
this.menu.swipeEnable(false)
this.langTrans()
// this.myservice.hide_loader();
this.initializeBackButtonCustomHandler();
......@@ -121,6 +122,7 @@ export class PaymentPage {
ionViewWillLeave() {
this.unregisterBackButtonAction && this.unregisterBackButtonAction();
this.menu.swipeEnable(true)
}
done() {
......
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ModalController, AlertController } from 'ionic-angular';
import { IonicPage, NavController, NavParams, ModalController, AlertController, MenuController } from 'ionic-angular';
import { Myservice } from "../../providers/myservice";
import { Storage } from "@ionic/storage";
import { driver } from "../../models/mymodel";
......@@ -19,11 +19,11 @@ export class QuickridePage {
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, private translate: TranslateService) {
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, private menu: MenuController) {
}
ionViewDidEnter() {
this.menu.swipeEnable(false)
this.langTrans()
this.storage.get('driver_data').then(data => {
......@@ -48,7 +48,7 @@ export class QuickridePage {
this.data.setrideData(this.rideDetail)
}
else{
else {
this.translate.get(['quickride.' + resp.message]).subscribe(value => {
this.myservice.show_alert('', value['quickride.' + resp.message])
})
......@@ -72,7 +72,7 @@ export class QuickridePage {
this.myservice.load_post({ bookingId: this.bookingId, driverId: this.local.id }, 'rideAccept').subscribe(resp => {
if (resp.status == 'success') {
this.translate.get(['quickride.' + resp.message]).subscribe(value => {
this.toast.show(value['quickride.'+resp.message], '2000', 'center').subscribe(toast => {
this.toast.show(value['quickride.' + resp.message], '2000', 'center').subscribe(toast => {
console.log(toast);
});
})
......@@ -116,4 +116,8 @@ export class QuickridePage {
back() {
this.navCtrl.pop()
}
ionViewWillLeave() {
this.menu.swipeEnable(true)
}
}
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { IonicPage, NavController, NavParams,MenuController } from 'ionic-angular';
import { Myservice } from "../../providers/myservice";
import { dataService } from "../../providers/common.service";
import { DatePipe } from '@angular/common';
......@@ -19,12 +19,12 @@ export class RidedetailsPage {
temp:boolean = false;
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private data: dataService, private datePipe: DatePipe, private translate: TranslateService, private storage:Storage) {
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private data: dataService, private datePipe: DatePipe, private translate: TranslateService, private storage:Storage, private menu:MenuController) {
}
ionViewDidEnter(){
this.menu.swipeEnable(false)
this.langTrans()
this.now = this.datePipe.transform(new Date(), 'MM/dd/yyyy')
......@@ -71,4 +71,8 @@ export class RidedetailsPage {
})
}
ionViewWillLeave(){
this.menu.swipeEnable(true)
}
}
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, Events } from 'ionic-angular';
import { IonicPage, NavController, NavParams, Events,MenuController } from 'ionic-angular';
import { Validators, FormBuilder, FormGroup } from "@angular/forms";
import { Http } from '@angular/http'
import { dialcode } from "../../models/mymodel";
......@@ -18,7 +18,7 @@ export class SigninPage {
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, 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 translate: TranslateService, private menu: MenuController) {
this.signinForm = this.formBuilder.group({
mobile: ['', Validators.compose([Validators.required, this.myservice.checkLimit(10000000, 999999999999999)])],
dial_code: ['+91', Validators.required],
......@@ -45,6 +45,7 @@ export class SigninPage {
}
ionViewDidEnter() {
this.menu.swipeEnable(false);
this.langTrans()
}
......@@ -78,4 +79,8 @@ export class SigninPage {
this.navCtrl.push("ForgotPage");
}
ionViewWillLeave(){
this.menu.swipeEnable(true);
}
}
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { IonicPage, NavController, NavParams,MenuController } from 'ionic-angular';
import { Validators, FormBuilder, FormGroup } from "@angular/forms";
import { Http } from '@angular/http'
import { dialcode } from "../../models/mymodel";
......@@ -21,7 +21,7 @@ export class SignupPage {
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, private translate: TranslateService, private storage: Storage) {
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, private menu:MenuController) {
this.signupForm = this.formBuilder.group({
name: ['', Validators.compose([Validators.required, Validators.minLength(3)])],
......@@ -43,6 +43,7 @@ export class SignupPage {
}
ionViewDidEnter() {
this.menu.swipeEnable(false)
this.langTrans()
}
......@@ -91,6 +92,10 @@ export class SignupPage {
});
}
ionViewWillLeave(){
this.menu.swipeEnable(true)
}
MatchPassword(val) {
return new Promise(resolve => {
if (val.value == this.signupForm.value.password) {
......
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { IonicPage, NavController, NavParams,Events } from 'ionic-angular';
import { Myservice } from "../../providers/myservice";
import { dataService } from "../../providers/common.service";
import { Storage } from "@ionic/storage";
......@@ -16,7 +16,12 @@ export class UploaddocPage {
local:driver
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private comService: dataService, private storage: Storage, private translate: TranslateService) {
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private comService: dataService, private storage: Storage, private translate: TranslateService, public events:Events) {
this.events.subscribe('driver:lang', data => {
setTimeout(() => {
this.langTrans();
}, 500);
})
}
ionViewDidEnter(){
......
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