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

MOHEMM-SFH-COLORS
enadhilal 6 years ago
parent 49a47fbc34
commit 0d83f70fde

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

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

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

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

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

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