fixing rememberMy and remove user name and password text when click athor user

mekawy-issues
enadhilal 6 years ago
parent 49a47fbc34
commit 0d83f70fde

@ -140,6 +140,8 @@ export class LoginComponent implements OnInit, OnDestroy {
const remember = localStorage.getItem('remember'); // ****// const remember = localStorage.getItem('remember'); // ****//
this.empname = localStorage.getItem('emp-name'); this.empname = localStorage.getItem('emp-name');
this.logintype = localStorage.getItem('login-type'); this.logintype = localStorage.getItem('login-type');
// tslint:disable-next-line: radix
this.currentLang = parseInt(localStorage.getItem('lang'));
// tslint:disable-next-line: triple-equals // tslint:disable-next-line: triple-equals
if (remember == 'true') { this.remeberMe = true; } else { this.remeberMe = false; } if (remember == 'true') { this.remeberMe = true; } else { this.remeberMe = false; }
} }
@ -184,6 +186,7 @@ export class LoginComponent implements OnInit, OnDestroy {
public remeberMyInfo() { public remeberMyInfo() {
if (this.username) {localStorage.setItem('user', this.username); } if (this.username) {localStorage.setItem('user', this.username); }
if (this.password) {localStorage.setItem('password', this.password); } if (this.password) {localStorage.setItem('password', this.password); }
if (this.currentLang) {localStorage.setItem('lang', this.currentLang.toString()); }
localStorage.setItem('remember', 'true'); localStorage.setItem('remember', 'true');
} }
@ -353,6 +356,11 @@ export class LoginComponent implements OnInit, OnDestroy {
} }
login() { login() {
let anotherUser = this.sharedData.getSharedData('anotherUser');
if(anotherUser){
this.username = '';
this.password = '';
}
console.log('login emit'); console.log('login emit');
console.log('login'); console.log('login');
// this.checkUserAuthentication(); // this.checkUserAuthentication();

@ -1,4 +1,4 @@
<div feedback class="custom-button"> <div feedback class="custom-button" *ngIf='show'>
<div class="iconBox"> <div class="iconBox">
<img [src]="icon" class="icon"> <img [src]="icon" class="icon">
</div> </div>

@ -16,6 +16,7 @@ export class StatsButtonComponent implements OnInit {
@Output() trigger = new EventEmitter(); @Output() trigger = new EventEmitter();
@Input() focusicon: string; @Input() focusicon: string;
@Input() disabled = false; @Input() disabled = false;
@Input() show: boolean ;
public direction: string; public direction: string;
public style: any; public style: any;
constructor( constructor(

@ -15,6 +15,7 @@ import { ConfirmLoginComponent } from 'src/app/authentication/confirm-login/conf
import * as moment from 'moment' import * as moment from 'moment'
import { ButtonSettings } from '../button/models/button-settingsl'; import { ButtonSettings } from '../button/models/button-settingsl';
import { Events } from '@ionic/angular'; import { Events } from '@ionic/angular';
import { SharedDataService } from '../../services/shared-data-service/shared-data.service';
@Component({ @Component({
selector: "welcome-login", selector: "welcome-login",
@ -76,7 +77,8 @@ export class WelcomeComponent implements OnInit, AfterViewInit, OnDestroy {
public ts: TranslatorService, public ts: TranslatorService,
public cs: CommonService, public cs: CommonService,
public authservice: AuthenticationService, public authservice: AuthenticationService,
public events: Events public events: Events,
public sharedData: SharedDataService,
) { } ) { }
ngOnInit() { ngOnInit() {
@ -209,6 +211,7 @@ export class WelcomeComponent implements OnInit, AfterViewInit, OnDestroy {
login() { login() {
this.sharedData.setSharedData(true, "anotherUser")
this.onLogin.emit(); this.onLogin.emit();
} }
loginwithuser() { loginwithuser() {

@ -14,6 +14,7 @@
[title]="button.title" [title]="button.title"
[statsValue]="button.statsValue" [statsValue]="button.statsValue"
[icon]="button.icon" [icon]="button.icon"
[show]="button.show"
(click)="openStatsButton(button.link)"> (click)="openStatsButton(button.link)">
</app-stats-button> </app-stats-button>
</ion-slide> </ion-slide>
@ -46,7 +47,7 @@
[icon]="subMenu.ICON"> [icon]="subMenu.ICON">
</app-services-button> </app-services-button>
</ion-slide> </ion-slide>
<ion-slide *ngIf="i == 0"> <ion-slide *ngIf="i == 0 && showVcationRule">
<app-services-button <app-services-button
(click)="Vacation_Rule()" (click)="Vacation_Rule()"
[title]="vacationRuleTitle" [title]="vacationRuleTitle"

@ -34,6 +34,7 @@ import { GetSubordinatesLeavesResponse } from '../hmg-common/services/dashbored/
import { AccrualService } from '../accrual-balances/services/accrual.service'; import { AccrualService } from '../accrual-balances/services/accrual.service';
import { TimeCardService } from '../time-card/service/time-card.service'; import { TimeCardService } from '../time-card/service/time-card.service';
import { WorklistMainService } from '../notification/service/work-list.main.service'; import { WorklistMainService } from '../notification/service/work-list.main.service';
import { isThisISOWeek } from 'date-fns';
@Component({ @Component({
selector: 'app-home', selector: 'app-home',
@ -57,12 +58,15 @@ export class HomePage implements OnInit {
ticketRequestObject: any; ticketRequestObject: any;
leaveRequestObject: any; leaveRequestObject: any;
missingSwipeRequestObject: any; missingSwipeRequestObject: any;
public isShow = false;
public showVcationRule = false;
public statsButtons = [ public statsButtons = [
{ {
title: this.ts.trPK('home','worklist'), title: this.ts.trPK('home','worklist'),
statsValue: 0, statsValue: 0,
icon: 'assets/icon/new-design/work_list.png', icon: 'assets/icon/new-design/work_list.png',
link: '1' link: '1',
show: true
}, },
// { // {
// title: 'Pending Request', // title: 'Pending Request',
@ -74,19 +78,22 @@ export class HomePage implements OnInit {
title: this.ts.trPK('home','missing-swipes'), title: this.ts.trPK('home','missing-swipes'),
statsValue: 0, statsValue: 0,
icon: 'assets/icon/new-design/missing_swipe.png', icon: 'assets/icon/new-design/missing_swipe.png',
link: '2' link: '2',
show:true
}, },
{ {
title: this.ts.trPK('home','leave-balance'), title: this.ts.trPK('home','leave-balance'),
statsValue: 0, statsValue: 0,
icon: 'assets/icon/new-design/leave_balance.png', icon: 'assets/icon/new-design/leave_balance.png',
link: '3' link: '3',
show: this.isShow,
}, },
{ {
title: this.ts.trPK('absenceList','tickets-balance'), title: this.ts.trPK('absenceList','tickets-balance'),
statsValue: 0, statsValue: 0,
icon: 'assets/icon/new-design/ticket_balance.png', icon: 'assets/icon/new-design/ticket_balance.png',
link: '4' link: '4',
show: this.isShow
} }
]; ];
@ -256,11 +263,22 @@ export class HomePage implements OnInit {
setServicesPrivilage() { setServicesPrivilage() {
for (const servicePrivilage of AuthenticationService.servicePrivilage) { for (const servicePrivilage of AuthenticationService.servicePrivilage) {
if (servicePrivilage.Previlege === false) { if (servicePrivilage.Previlege === false) {
document if(servicePrivilage.ServiceName === 'accrualBalance'){
.getElementById(servicePrivilage.ServiceName) this.statsButtons[2].show = false;
.setAttribute('disabled', 'disabled'); this.statsButtons[3].show = false;
document.getElementById(servicePrivilage.ServiceName).style.filter = }
'grayscale(1)'; if(servicePrivilage.ServiceName === 'vacationRule'){
this.showVcationRule = false;
}
// document
// .getElementById(servicePrivilage.ServiceName)
// .setAttribute('disabled', 'disabled');
// document.getElementById(servicePrivilage.ServiceName).style.filter =
// 'grayscale(1)';
}else{
this.statsButtons[2].show = true;
this.statsButtons[3].show = true;
this.showVcationRule = true;
} }
} }
} }

Loading…
Cancel
Save