Commit 9f18903f by Alen Jose

Merge branch 'alen' into 'master'

sidemenu lang change See merge request alen/CMC_revamp!26
parents a35b0b6b 023fe33b
......@@ -128,16 +128,19 @@ export class MyApp {
}
languageTrans() {
this.storage.get('lang').then(data => {
var This = this;
setTimeout(function () {
This.storage.get('lang').then(data => {
if (data) {
this.translate.use(data);
this.lang = data;
This.translate.use(data);
This.lang = data;
}
else {
this.translate.setDefaultLang('en');
This.translate.setDefaultLang('en');
}
this.lang_trans()
This.lang_trans()
})
}, 500)
}
lang_trans() {
......@@ -149,8 +152,8 @@ export class MyApp {
})
}
presentPopover() {
let popover = this.popoverCtrl.create('PopoverPage');
popover.present();
changeLang(lang) {
this.storage.set('lang', lang);
this.events.publish('driver:lang', lang);
}
}
\ No newline at end of file
<ion-menu [content]="content">
<ion-content class="cab_sidemenu_bg">
<div class="cab_sidemenu_wrapper">
<select [(ngModel)]="lang" (change)="changeLang(lang)">
<option value="en">EN</option>
</select>
<div menuClose class="cab_profile_banner" (click)="open_page('ProfilePage')" *ngIf="local">
<div class="cab_profile_picture">
<img [src]=local.image>
......@@ -14,7 +17,7 @@
<li menuClose class="trip" (click)="open_page('MytripsPage')">{{'sidemenu.My Trips'|translate}}</li>
<!-- <li menuClose class="settings" (click)="open_page('SettingsPage')">Settings</li> -->
<li menuClose class="logout" (click)="open_page('LandingPage')">{{'sidemenu.Logout'|translate}}</li>
<li menuClose class="langtr" (click)="presentPopover()">{{'sidemenu.Language'|translate}}</li>
<!-- <li menuClose class="langtr" (click)="presentPopover()">{{'sidemenu.Language'|translate}}</li> -->
</ul>
</div>
</div>
......
......@@ -8,7 +8,19 @@
//Essentail SCSS//
.cab_sidemenu_bg{background:#4d4d4d;background-size: cover !important;background-position: center !important;}
.cab_sidemenu_wrapper{width:100%;height:100%;}
.cab_sidemenu_wrapper{width:100%;height:100%; 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_profile_banner{width:100%;padding-top:80px;}
.cab_profile_picture{width:100px;height:100px;margin:0 auto;border:2px solid #f7941e;background-size: 25px !important;border-radius:50%;background: url("../assets/img/avatar.png");background-position: center;background-repeat: no-repeat;}
.cab_profile_banner h6{color:#fff;margin:0px;font-size:16px;font-weight: 400;padding-bottom: 7px;padding-top: 15px;padding-left:10px;padding-right:10px;text-align: center;}
......
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ModalController } from 'ionic-angular';
import { IonicPage, NavController, NavParams, ModalController,MenuController } from 'ionic-angular';
import { Validators, FormBuilder, FormGroup } from "@angular/forms";
import { Myservice } from "../../providers/myservice";
import { dataService } from "../../providers/common.service";
......@@ -21,7 +21,7 @@ export class AddcouponPage {
booking:any;
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController, private formBuilder: FormBuilder, private myservice: Myservice, private data: dataService, private storage: Storage, private translate: TranslateService) {
constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController, private formBuilder: FormBuilder, private myservice: Myservice, private data: dataService, private storage: Storage, private translate: TranslateService, private menu:MenuController) {
this.promoForm = this.formBuilder.group({
promocode: [''],
amount: [''],
......@@ -30,6 +30,7 @@ export class AddcouponPage {
}
ionViewDidEnter() {
this.menu.swipeEnable(false)
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
......@@ -85,4 +86,7 @@ export class AddcouponPage {
})
}
ionViewWillLeave() {
this.menu.swipeEnable(true)
}
}
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ViewController, ModalController, Platform } from 'ionic-angular';
import { IonicPage, NavController, NavParams, ViewController, ModalController, Platform, MenuController } from 'ionic-angular';
import { Myservice } from "../../providers/myservice";
import { dataService } from "../../providers/common.service";
import { Storage } from "@ionic/storage";
......@@ -18,10 +18,11 @@ export class ConfirmridePage {
public unregisterBackButtonAction: any;
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, public modalCtrl: ModalController, private myservice: Myservice, private data: dataService, private storage: Storage, public platform: Platform, private translate: TranslateService) {
constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, public modalCtrl: ModalController, private myservice: Myservice, private data: dataService, private storage: Storage, public platform: Platform, private translate: TranslateService, private menu:MenuController) {
}
ionViewDidEnter() {
this.menu.swipeEnable(false)
this.storage.get('user_data').then(data => {
if (data) {
this.local = data;
......@@ -67,6 +68,7 @@ export class ConfirmridePage {
ionViewWillLeave() {
this.unregisterBackButtonAction && this.unregisterBackButtonAction();
this.menu.swipeEnable(true)
}
dismiss() {
......
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';
......@@ -15,7 +15,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, private storage:Storage) {
constructor(public navCtrl: NavController, public navParams: NavParams, private formbuilder: FormBuilder, private myservice: Myservice, private translate: TranslateService, private 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,}")])],
......@@ -24,6 +24,7 @@ export class ForgotPage {
}
ionViewDidEnter(){
this.menu.swipeEnable(false)
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
......@@ -53,5 +54,8 @@ export class ForgotPage {
})
}
ionViewWillLeave(){
this.menu.swipeEnable(true)
}
}
import { Component, ViewChild, ElementRef } from '@angular/core';
import { IonicPage, NavController, NavParams, ModalController } from 'ionic-angular';
import { IonicPage, NavController, NavParams, ModalController,Events } from 'ionic-angular';
import { Storage } from "@ionic/storage";
import { Geolocation } from '@ionic-native/geolocation';
import { fireService } from "../../providers/firebase.service";
......@@ -37,15 +37,21 @@ export class HomePage {
temp: number = 0;
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController, public storage: Storage, private geolocation: Geolocation, private firebase: fireService, private db: AngularFireDatabase, private formBuilder: FormBuilder, private data: dataService, private myservice: Myservice, private translate: TranslateService) {
constructor(public navCtrl: NavController, public navParams: NavParams, public modalCtrl: ModalController, public storage: Storage, private geolocation: Geolocation, private firebase: fireService, private db: AngularFireDatabase, private formBuilder: FormBuilder, private data: dataService, private myservice: Myservice, private translate: TranslateService, private events:Events) {
this.locForm = this.formBuilder.group({
pickLoc: ['', Validators.required],
dropLoc: ['', Validators.required]
})
this.events.subscribe('user:lang', data => {
setTimeout(() => {
this.langTrans();
}, 500);
})
}
ionViewDidEnter() {
langTrans(){
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
......@@ -55,7 +61,10 @@ export class HomePage {
this.translate.use('en')
}
})
}
ionViewDidEnter() {
this.langTrans();
this.data.setbookingData('')
this.storage.get('user_data').then(data => {
......
import { Component, ViewChild, ElementRef } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { IonicPage, NavController, NavParams,MenuController } from 'ionic-angular';
import { dataService } from "../../providers/common.service";
import * as firebase from 'firebase';
import { Geolocation } from '@ionic-native/geolocation';
......@@ -29,10 +29,11 @@ export class MapPage {
userMarkers: any;
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private data: dataService, private geolocation: Geolocation, private myservice: Myservice, private translate: TranslateService, private storage:Storage) {
constructor(public navCtrl: NavController, public navParams: NavParams, private data: dataService, private geolocation: Geolocation, private myservice: Myservice, private translate: TranslateService, private storage:Storage, private menu :MenuController) {
}
ionViewDidEnter() {
this.menu.swipeEnable(false)
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
......@@ -247,5 +248,6 @@ export class MapPage {
ionViewWillLeave() {
this.locSubs.unsubscribe();
this.menu.swipeEnable(true)
}
}
import { Component,ViewChild } from '@angular/core';
import { IonicPage, NavController, NavParams,Content,Slides } from 'ionic-angular';
import { IonicPage, NavController, NavParams,Content,Slides,Events } from 'ionic-angular';
import { Myservice } from "../../providers/myservice";
import { Storage } from "@ionic/storage";
import { user } from "../../models/mymodel";
......@@ -26,7 +26,7 @@ export class MytripsPage {
@ViewChild(Content) content: Content;
@ViewChild('mySlider') slider: Slides;
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private storage: Storage, private translate: TranslateService) {
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private storage: Storage, private translate: TranslateService, private events:Events) {
let id = 0;
this.slidertab = id;
......@@ -35,9 +35,14 @@ export class MytripsPage {
}, 500)
this.slidertab = 0;
this.events.subscribe('user:lang', data => {
setTimeout(() => {
this.langTrans();
}, 500);
})
}
ionViewDidEnter() {
langTrans(){
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
......@@ -47,6 +52,10 @@ export class MytripsPage {
this.translate.use('en')
}
})
}
ionViewDidEnter() {
this.langTrans();
this.storage.get('user_data').then(data => {
if (data) {
......
import { Component, NgZone } 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 { Storage } from "@ionic/storage";
......@@ -25,10 +25,11 @@ export class PaymentPage {
ride: any;
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private data: dataService, private zone: NgZone, private myservice: Myservice, private storage: Storage, public platform: Platform, private translate: TranslateService) {
constructor(public navCtrl: NavController, public navParams: NavParams, private data: dataService, private zone: NgZone, private myservice: Myservice, private storage: Storage, public platform: Platform, private translate: TranslateService,private menu:MenuController) {
}
ionViewDidEnter() {
this.menu.swipeEnable(false)
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
......@@ -119,6 +120,7 @@ export class PaymentPage {
ionViewWillLeave() {
this.unregisterBackButtonAction && this.unregisterBackButtonAction();
this.menu.swipeEnable(true)
}
close() {
......
......@@ -10,7 +10,7 @@ import { TranslateService } from '@ngx-translate/core';
templateUrl: 'popover.html',
})
export class PopoverPage {
languages = [{ 'name': 'English', 'code': 'en' }]//code will be same as filename ol lang
languages = [{ 'name': 'English', 'code': 'en' }]//code will be same as filename of lang
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, public modalCtrl: ModalController, public storage: Storage, public events: Events, private myservice: Myservice, private translate: TranslateService) {
......
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams,Events } from 'ionic-angular';
import { IonicPage, NavController, NavParams, Events } from 'ionic-angular';
import { Validators, FormGroup, FormBuilder } from '@angular/forms'
import { Myservice } from '../../providers/myservice'
import { Storage } from '@ionic/storage';
......@@ -14,10 +14,10 @@ import { TranslateService } from '@ngx-translate/core';
templateUrl: 'profile.html',
})
export class ProfilePage {
profileForm:FormGroup
profileForm: FormGroup
codes: any;
local:user
image:boolean = false;
local: user
image: boolean = false;
formdata = new FormData();
lang: string = 'en';
......@@ -31,7 +31,7 @@ export class ProfilePage {
password: ['', Validators.compose([Validators.minLength(6)])],//,
new: [''],//Validators.compose([ Validators.minLength(6)])
confirm: [''],// Validators.compose([]), this.MatchPassword.bind(this)
image:[''],
image: [''],
secret_key: ['My_key']
})
......@@ -40,10 +40,15 @@ export class ProfilePage {
this.codes = response.json().dialCodes
this.codes = this.orderbyPipe.transform(this.codes, 'dialCode');
})
}
ionViewDidEnter(){
this.events.subscribe('user:lang', data => {
setTimeout(() => {
this.langTrans();
}, 500);
})
}
langTrans() {
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
......@@ -53,9 +58,12 @@ export class ProfilePage {
this.translate.use('en')
}
})
}
this.storage.get('user_data').then(data=>{
if(data){
ionViewDidEnter() {
this.langTrans();
this.storage.get('user_data').then(data => {
if (data) {
this.local = data
this.profileForm.controls['name'].setValue(this.local.name)
this.profileForm.controls['email'].setValue(this.local.email)
......@@ -71,26 +79,26 @@ export class ProfilePage {
})
}
update(){
if(this.profileForm.value.password.length>0){
update() {
if (this.profileForm.value.password.length > 0) {
this.profileForm.controls["new"].setValidators([Validators.minLength(6), Validators.required]);
this.profileForm.controls["confirm"].setValidators([Validators.required]), this.MatchPassword.bind(this);
this.profileForm.controls["confirm"].setAsyncValidators(this.MatchPassword.bind(this))
}
if(this.profileForm.valid){
if (this.profileForm.valid) {
this.myservice.show_loader()
this.formdata.append('data', JSON.stringify(this.profileForm.value));
this.formdata.append('id', JSON.stringify(this.local.id));
this.myservice.fileUpload(this.formdata,'update_user').subscribe(response=>{
if(response.status=='success'){
this.myservice.fileUpload(this.formdata, 'update_user').subscribe(response => {
if (response.status == 'success') {
this.local = response.data
var This = this
setTimeout(() => {
This.myservice.hide_loader()
This.myservice.hide_loader()
This.events.publish('user:profile', This.local);
}, 500);
}
else{
else {
this.myservice.hide_loader()
this.translate.get(['profile.' + response.message]).subscribe(value => {
this.myservice.show_alert('', value['profile.' + response.message])
......
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams,ViewController } from 'ionic-angular';
import { IonicPage, NavController, NavParams,ViewController,MenuController } from 'ionic-angular';
import { dataService } from "../../providers/common.service";
import { TranslateService } from '@ngx-translate/core';
import { Storage } from "@ionic/storage";
......@@ -13,12 +13,13 @@ export class RatecardPage {
rates:any;
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, private data: dataService, private translate: TranslateService, private storage: Storage) {
constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, private data: dataService, private translate: TranslateService, private storage: Storage, private menu:MenuController) {
this.rates = this.data.getrateData()
console.log(this.rates)
}
ionViewDidEnter(){
this.menu.swipeEnable(false)
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
......@@ -35,4 +36,8 @@ export class RatecardPage {
this.viewCtrl.dismiss();
}
ionViewWillLeave() {
this.menu.swipeEnable(true)
}
}
import { Component, NgZone } from '@angular/core';
import { IonicPage, NavController, NavParams, Platform, LoadingController, AlertController } from 'ionic-angular';
import { IonicPage, NavController, NavParams, Platform, LoadingController, AlertController, MenuController } from 'ionic-angular';
import { dataService } from "../../providers/common.service";
import { Myservice } from "../../providers/myservice";
import { Storage } from "@ionic/storage";
......@@ -28,11 +28,11 @@ export class RidedetailPage {
lang: string = 'en';
baseUrl :string = this.myservice.base_url
constructor(public navCtrl: NavController, public navParams: NavParams, private data: dataService, private zone: NgZone, private myservice: Myservice, private storage: Storage, public platform: Platform, public loadingCtrl: LoadingController, private alertCtrl: AlertController, private translate: TranslateService) {
constructor(public navCtrl: NavController, public navParams: NavParams, private data: dataService, private zone: NgZone, private myservice: Myservice, private storage: Storage, public platform: Platform, public loadingCtrl: LoadingController, private alertCtrl: AlertController, private translate: TranslateService, private menu:MenuController) {
}
ionViewDidEnter() {
this.menu.swipeEnable(false)
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
......@@ -224,6 +224,7 @@ export class RidedetailPage {
ionViewWillLeave() {
this.unregisterBackButtonAction && this.unregisterBackButtonAction();
this.menu.swipeEnable(true)
}
track() {
......
import { Component,NgZone } from '@angular/core';
import { IonicPage, NavController, NavParams,ViewController,ModalController } from 'ionic-angular';
import { IonicPage, NavController, NavParams,ViewController,ModalController,MenuController } from 'ionic-angular';
import { dataService } from "../../providers/common.service";
import { Myservice } from "../../providers/myservice";
import { TranslateService } from '@ngx-translate/core';
......@@ -17,10 +17,11 @@ export class RidenowPage {
totRate:string;
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, public modalCtrl: ModalController, private data: dataService, private myservice: Myservice, private zone: NgZone, private translate: TranslateService, private storage: Storage) {
constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, public modalCtrl: ModalController, private data: dataService, private myservice: Myservice, private zone: NgZone, private translate: TranslateService, private storage: Storage, private menu :MenuController) {
}
ionViewDidEnter() {
this.menu.swipeEnable(false)
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
......@@ -76,9 +77,6 @@ export class RidenowPage {
addcoupon() {
this.viewCtrl.dismiss(this.totRate);
// this.navCtrl.push('AddcouponPage',{rate:this.totRate});
// let modal = this.modalCtrl.create('AddcouponPage');
// modal.present();
}
ratecard() {
......@@ -87,4 +85,8 @@ export class RidenowPage {
modal.present();
}
ionViewWillLeave() {
this.menu.swipeEnable(true)
}
}
import { Component, NgZone } 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 { Storage } from "@ionic/storage";
......@@ -24,10 +24,11 @@ export class RidesummaryPage {
lang: string = 'en';
baseUrl:string = this.myservice.base_url
constructor(public navCtrl: NavController, public navParams: NavParams, private data: dataService, private zone: NgZone, private myservice: Myservice, private storage: Storage, public platform: Platform, private translate: TranslateService) {
constructor(public navCtrl: NavController, public navParams: NavParams, private data: dataService, private zone: NgZone, private myservice: Myservice, private storage: Storage, public platform: Platform, private translate: TranslateService, private menu:MenuController) {
}
ionViewDidEnter() {
this.menu.swipeEnable(false)
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
......@@ -111,6 +112,7 @@ export class RidesummaryPage {
ionViewWillLeave() {
this.unregisterBackButtonAction && this.unregisterBackButtonAction();
this.menu.swipeEnable(true)
}
close() {
......
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ViewController } from 'ionic-angular';
import { IonicPage, NavController, NavParams, ViewController,MenuController } from 'ionic-angular';
import { Myservice } from "../../providers/myservice";
import { Storage } from "@ionic/storage";
import { user, search } from "../../models/mymodel";
......@@ -16,10 +16,11 @@ export class SearchridePage {
searchText: string;
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, private myservice: Myservice, private storage: Storage, private translate: TranslateService) {
constructor(public navCtrl: NavController, public navParams: NavParams, public viewCtrl: ViewController, private myservice: Myservice, private storage: Storage, private translate: TranslateService, private menu:MenuController) {
}
ionViewDidEnter() {
this.menu.swipeEnable(false)
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
......@@ -57,4 +58,7 @@ export class SearchridePage {
this.viewCtrl.dismiss();
}
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 { Storage } from "@ionic/storage";
import { user } from "../../models/mymodel";
......@@ -17,10 +17,11 @@ export class TripdetailsPage {
local:user
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private storage: Storage, private toast: Toast, private callNumber: CallNumber, private translate: TranslateService) {
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private storage: Storage, private toast: Toast, private callNumber: CallNumber, private translate: TranslateService, private menu:MenuController) {
}
ionViewDidEnter() {
this.menu.swipeEnable(false)
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
......@@ -95,4 +96,7 @@ export class TripdetailsPage {
})
}
ionViewWillLeave() {
this.menu.swipeEnable(true)
}
}
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