648 lines
25 KiB
TypeScript
648 lines
25 KiB
TypeScript
import { Component, OnInit, ViewChild, ChangeDetectionStrategy } from '@angular/core';
|
|
import { CalendarDayDialogComponent } from '../../calendar/shared/calendar-day-dialog/calendar-day-dialog.component';
|
|
import { CalendarItemPick, CalendarMiniSchedulerComponent } from '../../calendar/shared/calendar-mini-scheduler/calendar-mini-scheduler.component';
|
|
import { ApiService } from '../../app.api.service';
|
|
import { HRMNotificationService } from '../../app.notification.service';
|
|
import { Bookmark } from '../../_models/Basic/bookmark';
|
|
import { AuthService } from '../../_services/auth/auth.service';
|
|
import { Reminder } from '../../_models/Basic/reminder';
|
|
import { BasicService } from '../../_services/Basic/basic.service';
|
|
import { loadingPanelService } from '../../hrm-loding panel/loding.panel.service';
|
|
import { EmployeeServices } from '../../_services/employee/employee.service';
|
|
import { Router } from '@angular/router';
|
|
import { MenuService } from '../../app.menu.service';
|
|
import { RolePermission } from '../../_models/Authentication/role';
|
|
import { DatePipe } from '@angular/common';
|
|
import { User } from '../../_models/Authentication/user';
|
|
import { JwtHelperService } from '@auth0/angular-jwt';
|
|
import { AuthGuard } from '../../_guards/auth.guard';
|
|
import { PayrollType } from 'src/app/_models/Authentication/payrollType';
|
|
import { TaxParameter } from 'src/app/_models/Payroll/Tax/taxParameter';
|
|
import { EnumUserType } from 'src/app/_models/enums';
|
|
import { WorkflowService } from '../../_services/workflow/workflow.service';
|
|
import { PendingJobDTO } from '../../_models/Work-Flow/pendingJobDTO';
|
|
import { HrNotification } from 'src/app/_models/Basic/HrNotification';
|
|
import { AppMainComponent } from 'src/app/app.main.component';
|
|
import { CommonModule } from '@angular/common';
|
|
import { LoadingPanelComponent } from 'src/app/hrm-loding panel/loading-panel.component';
|
|
import { ButtonModule } from '@progress/kendo-angular-buttons';
|
|
import { DropDownListModule } from '@progress/kendo-angular-dropdowns';
|
|
import { ReactiveFormsModule } from '@angular/forms';
|
|
import { FormsModule } from '@angular/forms';
|
|
import { LayoutModule } from '@progress/kendo-angular-layout';
|
|
import { KENDO_GRID } from '@progress/kendo-angular-grid';
|
|
import { DatePickerModule } from '@progress/kendo-angular-dateinputs';
|
|
import { CustomCalendarComponent } from 'src/app/custom-components/custom-calendar/custom-calendar.component';
|
|
@Component({
|
|
selector: 'app-landing-page',
|
|
templateUrl: './landing-page.component.html',
|
|
styleUrls: ['./landing-page.component.scss']
|
|
,changeDetection: ChangeDetectionStrategy.Eager,
|
|
standalone: false,
|
|
|
|
})
|
|
export class LandingPageComponent implements OnInit {
|
|
imgSrc: string = 'assets/layout/images/Logo.png';
|
|
bookmarks: Bookmark[];
|
|
loadingLinks = false;
|
|
myMenu = [];
|
|
menu = [];
|
|
showReminderEntry = false;
|
|
reminder: Reminder;
|
|
reminderList: Reminder[] = [];
|
|
dashboardData: any;
|
|
isEmployee = 0;
|
|
isLeave = 0;
|
|
isAttendance = 0;
|
|
payrollType = 0;
|
|
employee: any;
|
|
joiningDate: string;
|
|
holidayInfo: any;
|
|
currentUser: User;
|
|
payrollTypes: PayrollType[];
|
|
selectedPayrollTypeID: number;
|
|
currentSalaryMonth: Date;
|
|
currentFiscalYear: string = "";
|
|
payrolltypeString: string = "";
|
|
public showPopUp: boolean = false;
|
|
public switchPayrolltypeid: number;
|
|
_wfmovementTrans: PendingJobDTO[] = [];
|
|
showSalaryDatePopup = false;
|
|
currentPayrollType: PayrollType;
|
|
expectedSalaryDate: Date = new Date();
|
|
expectedSalaryDatestring: string ='';
|
|
expectedApprovalDate: Date = new Date();
|
|
constructor(public authService: AuthService,
|
|
public basicService: BasicService,
|
|
public employeeService: EmployeeServices,
|
|
public apiService: ApiService,
|
|
|
|
public datePipe: DatePipe,
|
|
public router: Router, private auth: AuthGuard,
|
|
public notificationService: HRMNotificationService,
|
|
public loadingPanel: loadingPanelService, public menuService: MenuService,
|
|
public wfService: WorkflowService,public appMain : AppMainComponent) {
|
|
// this.apiService.selectedMenuName = 'Landing Page';
|
|
this.apiService.selectedMenuName = 'Dashboard';
|
|
this.reminder = new Reminder();
|
|
this.auth.menuEvent.subscribe(value => this.UpdateData());
|
|
this.showPopUp = false;
|
|
|
|
}
|
|
data: any[] = [];
|
|
hrNotification: HrNotification[] = [];
|
|
isShowSwitch: boolean = false;
|
|
|
|
@ViewChild(CalendarMiniSchedulerComponent) miniCalendar: CalendarMiniSchedulerComponent;
|
|
@ViewChild('dayDialog') dayDialog: CalendarDayDialogComponent;
|
|
|
|
/** A day picked on the small calendar: its events and tasks, and new / open / edit, as on My Calendar. */
|
|
openCalendarDay(day: Date): void {
|
|
this.dayDialog?.open(day);
|
|
}
|
|
|
|
/** An event or task clicked on the small calendar: its detail (answer, update, edit...), as on My Calendar. */
|
|
openCalendarItem(pick: CalendarItemPick): void {
|
|
this.dayDialog?.openItem(pick.calendarItemID, pick.canEdit, pick.occurrenceStart);
|
|
}
|
|
|
|
/** Something was added, changed or cancelled from the day dialog: the small calendar is read again. */
|
|
onCalendarChanged(): void {
|
|
this.miniCalendar?.reload();
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
this.authService.GetCurrentUser().subscribe(
|
|
(resp) => {
|
|
this.currentUser = resp;
|
|
},
|
|
(x) => {
|
|
},
|
|
() => {
|
|
this.processMenu();
|
|
},
|
|
);
|
|
this.getexpectedDisburseDate();
|
|
this.loadHallOfFameData()
|
|
this.loadHrNotificationData()
|
|
this.loadDashboardData();
|
|
this.loadDashboardEmployee();
|
|
this.loadHolidayInfoForDashboard();
|
|
this.UpdateData();
|
|
this.RefreshControl();
|
|
}
|
|
GetCurrentUserSwitch(){
|
|
const jwtHelper = new JwtHelperService();
|
|
const user = jwtHelper.decodeToken(localStorage.getItem('token'));
|
|
this.isShowSwitch = false;
|
|
if (user.UserType == EnumUserType.User) {
|
|
this.loadingPanel.ShowLoadingPanel = true;
|
|
this.authService.getSwitchUserId(EnumUserType.Employee).subscribe(next => {
|
|
if(next == 0){
|
|
this.isShowSwitch = false;
|
|
}
|
|
else{
|
|
this.isShowSwitch = true;
|
|
}
|
|
}, error => {
|
|
this.isShowSwitch = false;
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
}, () => {
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
});
|
|
}
|
|
}
|
|
loadHallOfFameData() {
|
|
this.loadingPanel.ShowLoadingPanel = true;
|
|
this.basicService.loadHallOfFameData().subscribe(
|
|
(resp) => {
|
|
this.data = resp;
|
|
//console.log(this.data)
|
|
},
|
|
(err) => {
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
this.notificationService.showError(err.error);
|
|
},
|
|
() => {
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
//this.loadGridData();
|
|
}
|
|
)
|
|
}
|
|
loadHrNotificationData() {
|
|
this.loadingPanel.ShowLoadingPanel = true;
|
|
this.basicService.getAllHrNotifications().subscribe(
|
|
(resp)=>{
|
|
this.hrNotification = resp;
|
|
},
|
|
()=>{
|
|
|
|
},
|
|
()=>{
|
|
}
|
|
)
|
|
}
|
|
public payrollTypesImg = [
|
|
{ id: 1, imagePath: 'assets/payrolltype-img/payrolltype1.png' },
|
|
{ id: 2, imagePath: 'assets/payrolltype-img/payrolltype2.png' },
|
|
{ id: 3, imagePath: 'assets/payrolltype-img/payrolltype3.png' },
|
|
{ id: 4, imagePath: 'assets/payrolltype-img/payrolltype4.png' },
|
|
{ id: 5, imagePath: 'assets/payrolltype-img/payrolltype5.png' }
|
|
];
|
|
public getImagePath(typeId: number): string {
|
|
const typeImage = this.payrollTypesImg.find(img => img.id === typeId);
|
|
return typeImage ? typeImage.imagePath : 'assets/layout/images/Logo.png';
|
|
}
|
|
public selectAccessType(typeId: number): void {
|
|
this.switchPayrolltypeid = typeId;
|
|
this.switchAccessType();
|
|
}
|
|
loadDashboardEmployee() {
|
|
this.employeeService.getUserForLandingPage().subscribe(
|
|
(resp) => {
|
|
this.employee = resp[0];
|
|
},
|
|
(x) => {
|
|
console.log(x);
|
|
},
|
|
() => {
|
|
this.employee.profileCompletionPercent = this.employee?.profileCompletionPercent === null ?
|
|
0 : this.employee?.profileCompletionPercent;
|
|
this.joiningDate = this.datePipe.transform(this.employee.joiningDate, 'dd MMM yyyy');
|
|
},
|
|
);
|
|
}
|
|
loadHolidayInfoForDashboard() {
|
|
this.employeeService.GetHolidayInfoForDashboard().subscribe(
|
|
(resp) => {
|
|
this.holidayInfo = resp;
|
|
},
|
|
(x) => {
|
|
console.log(x);
|
|
},
|
|
() => {
|
|
//console.log(this.holidayInfo);
|
|
},
|
|
);
|
|
}
|
|
public isMeeting(date: Date) {
|
|
return /10|15|20/.test(date.getDate().toString()) ? 'meeting' : '';
|
|
}
|
|
public isYearMeeting(date: Date) {
|
|
return date.getMonth() % 3 ? 'meeting' : '';
|
|
}
|
|
public isDecadeMeeting(date: Date) {
|
|
return date.getDate() % 2 ? 'meeting' : '';
|
|
}
|
|
public isCenturyMeeting(date: Date) {
|
|
return date.getDate() % 20 ? 'meeting' : '';
|
|
}
|
|
processMenu() {
|
|
// A top-level menu head with no children is serialised as "items": null (RoleService
|
|
// only creates the list inside its child loop). .flat() does not drop nulls, so every
|
|
// such head left a null in this array and the filters below threw on x.routerLink.
|
|
this.menu = JSON.parse(localStorage.getItem('menuList') || '[]')
|
|
.map(x => x.items)
|
|
.flat()
|
|
.filter(x => x);
|
|
const flatMenu = this.menu.filter(x => x.routerLink === '' && x.items !== null).flatMap(x => x.items);
|
|
const menuToRemove = this.menu.filter(x => x.routerLink === '' && x.items !== null);
|
|
this.menu = this.menu.filter(x => !menuToRemove.includes(x));
|
|
this.menu = [...this.menu, ...flatMenu];
|
|
this.myMenu = this.menu.map(x => x.menuCode);
|
|
this.isEmployee = this.myMenu.map(x => x.startsWith('1')).includes(true) ? 1 : 0;
|
|
this.isLeave = this.myMenu.map(x => x.startsWith('7')).includes(true) ? 1 : 0;
|
|
this.isAttendance = this.myMenu.map(x => x.startsWith('5')).includes(true) ? 1 : 0;
|
|
}
|
|
loadDashboardData() {
|
|
this.employeeService.getLandingPageData(this.isEmployee, this.isLeave, this.isAttendance).subscribe(
|
|
(resp: any) => {
|
|
this.dashboardData = resp[0];
|
|
},
|
|
(x) => {
|
|
console.log(x);
|
|
this.notificationService.showError(x.error);
|
|
},
|
|
() => {
|
|
}
|
|
);
|
|
}
|
|
menuLinkClick(dataItem) {
|
|
var item = dataItem as Bookmark;
|
|
this.menuService.clickedMenuItem = new RolePermission();
|
|
this.menuService.clickedMenuItem.menuKey = item.menuCode;
|
|
this.menuService.clickedMenuItem.link = item.link;
|
|
this.menuService.clickedMenuItem.isBookmarked = true;
|
|
this.router.navigate([item.link]);
|
|
}
|
|
switchUser() {
|
|
this.loadingPanel.ShowLoadingPanel = true;
|
|
this.currentUser.userType = EnumUserType.Employee
|
|
const data = {
|
|
user: this.currentUser,
|
|
payrollTypeId: this.currentUser.PayrollTypeID,
|
|
};
|
|
this.authService.SwtichUserMode(data).subscribe(
|
|
(resp: any) => {
|
|
localStorage.setItem('token', resp);
|
|
ApiService.AuthenticationToken = resp;
|
|
},
|
|
(err: any) => {
|
|
this.notificationService.showError('Invalid Login-ID or Password');
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
},
|
|
() => {
|
|
const jwtHelper = new JwtHelperService();
|
|
const user = jwtHelper.decodeToken(localStorage.getItem('token'));
|
|
if (user.ChangePasswordAtNextLogon === 'True') {
|
|
localStorage.removeItem('menuList');
|
|
this.auth.menuEvent.emit(false);
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
this.router.navigate(['/authentication/change-password']);
|
|
} else {
|
|
this.authService.GetRolePermissionbyUserID().subscribe(
|
|
(menu: any) => {
|
|
localStorage.setItem('menuList', JSON.stringify(menu));
|
|
},
|
|
(errmenu: any) => {
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
},
|
|
() => {
|
|
this.auth.menuEvent.emit(true);
|
|
this.loadBookmark();
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
this.appMain.IsSelfService();
|
|
this.router.navigate(['/']);
|
|
}
|
|
);
|
|
}
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
}
|
|
);
|
|
}
|
|
loadBookmark() {
|
|
this.authService.getBookmarks()
|
|
.subscribe(
|
|
(resp: any) => {
|
|
if (resp != undefined)
|
|
this.menuService.bookMarkpages = resp;
|
|
},
|
|
(x) => {
|
|
|
|
},
|
|
() => {
|
|
// console.log(this.bookmarks);
|
|
});
|
|
}
|
|
removeHandler({ dataItem }) {
|
|
this.loadingPanel.ShowLoadingPanel = true;
|
|
const item = dataItem as Bookmark;
|
|
this.authService.deleteBookmark(item)
|
|
.subscribe(
|
|
(resp: any) => {
|
|
|
|
},
|
|
(x) => {
|
|
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
},
|
|
() => {
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
const index = this.bookmarks.findIndex(x => x.id === item.id);
|
|
this.bookmarks.splice(index, 1);
|
|
});
|
|
}
|
|
editHandler(value: any) {
|
|
}
|
|
add() {
|
|
this.showReminderEntry = true;
|
|
}
|
|
onPopUpClose() {
|
|
this.showReminderEntry = false;
|
|
}
|
|
getexpectedDisburseDate() {
|
|
this.authService.GetPayrollTypeByLoginID().subscribe(
|
|
(resp) => {
|
|
this.currentPayrollType = resp;
|
|
},
|
|
(err) => {
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
this.notificationService.showError(err?.error);
|
|
},
|
|
() => {
|
|
var expectedSalaryDate = new Date();
|
|
var nextPayProcessDate = new Date(this.currentPayrollType.nextPayProcessDate);
|
|
var disburseDate = new Date(nextPayProcessDate.getFullYear(), nextPayProcessDate.getMonth(), 25);
|
|
const currentDate = new Date();
|
|
if(this.currentPayrollType.expectedSalaryDate == null ||
|
|
this.currentPayrollType.expectedSalaryDate == undefined)
|
|
{
|
|
expectedSalaryDate =disburseDate;
|
|
}
|
|
|
|
else expectedSalaryDate = new Date(this.currentPayrollType.expectedSalaryDate);
|
|
|
|
if (expectedSalaryDate < currentDate) {
|
|
|
|
this.expectedSalaryDate =disburseDate;
|
|
this.expectedSalaryDatestring = this.datePipe.transform(disburseDate, 'd MMM yy, EEEE');
|
|
}
|
|
else
|
|
{
|
|
this.expectedSalaryDate =expectedSalaryDate;
|
|
this.expectedSalaryDatestring = this.datePipe.transform(expectedSalaryDate, 'd MMM yy, EEEE');
|
|
|
|
}
|
|
}
|
|
);
|
|
|
|
|
|
}
|
|
onSave() {
|
|
this.loadingPanel.ShowLoadingPanel = true;
|
|
this.basicService.saveReminder(this.reminder).subscribe(
|
|
() => {
|
|
},
|
|
(x) => {
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
console.log(x);
|
|
this.notificationService.showError('Error saving reminder');
|
|
},
|
|
() => {
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
this.showReminderEntry = false;
|
|
if (this.reminder.id > 0) {
|
|
const index = this.reminderList.findIndex(x => x.id === this.reminder.id);
|
|
this.reminderList[index] = this.reminder;
|
|
this.notificationService.showSuccess('Reminder Updated Successfully');
|
|
} else {
|
|
this.reminderList.push(this.reminder);
|
|
this.notificationService.showSuccess('Reminder Saved Successfully');
|
|
this.reminder = new Reminder();
|
|
}
|
|
}
|
|
);
|
|
|
|
}
|
|
onCancel() {
|
|
this.showReminderEntry = false;
|
|
this.reminder = new Reminder();
|
|
}
|
|
private loadReminders() {
|
|
this.basicService.getReminders().subscribe(
|
|
(resp) => {
|
|
this.reminderList = resp;
|
|
},
|
|
(x) => {
|
|
console.log(x);
|
|
this.notificationService.showError('Error Loading Reminders');
|
|
},
|
|
() => {
|
|
}
|
|
);
|
|
}
|
|
public RefreshControl() {
|
|
//console.log('Called');
|
|
this.wfService.getAdminPendingJob().subscribe(
|
|
(resp) => {
|
|
this._wfmovementTrans = resp;
|
|
//console.log(resp);
|
|
},
|
|
(ex) => {
|
|
console.log(ex);
|
|
},
|
|
() => {
|
|
localStorage.removeItem('pendingjobs');
|
|
localStorage.setItem('pendingjobs', JSON.stringify(this._wfmovementTrans));
|
|
this.authService.subject2.next(this._wfmovementTrans);
|
|
},
|
|
);
|
|
}
|
|
editReminder({ dataItem }) {
|
|
this.reminder = dataItem as Reminder;
|
|
this.reminder.time = new Date(this.reminder.time);
|
|
this.showReminderEntry = true;
|
|
}
|
|
removeReminder({ dataItem }) {
|
|
const item = dataItem as Reminder;
|
|
this.loadingPanel.ShowLoadingPanel = true;
|
|
this.basicService.deleteReminder(item).subscribe(
|
|
() => {
|
|
},
|
|
(x) => {
|
|
console.log(x);
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
this.notificationService.showError('Error While Deleting');
|
|
},
|
|
() => {
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
this.notificationService.showSuccess('Deleted Successfully');
|
|
const index = this.reminderList.findIndex(x => x.id === this.reminder.id);
|
|
this.reminderList.splice(index, 1);
|
|
}
|
|
);
|
|
}
|
|
openSalaryDatePopup(): void {
|
|
this.currentPayrollType = undefined;
|
|
this.loadingPanel.ShowLoadingPanel = true;
|
|
this.authService.GetPayrollTypeByLoginID().subscribe(
|
|
(resp) => {
|
|
this.currentPayrollType = resp;
|
|
},
|
|
(err) => {
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
this.notificationService.showError(err?.error);
|
|
},
|
|
() => {
|
|
|
|
this.showSalaryDatePopup = true;
|
|
}
|
|
);
|
|
}
|
|
closeSalaryDatePopup(): void {
|
|
this.showSalaryDatePopup = false;
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
}
|
|
onExpectedDateChange(date: Date): void {
|
|
if (date) this.expectedSalaryDate = date;
|
|
}
|
|
onExpectedApprovalDateChange(date: Date): void {
|
|
if (date) this.expectedApprovalDate = date;
|
|
}
|
|
setExpectedSalaryDate(): void {
|
|
debugger;
|
|
if (!this.expectedSalaryDate) {
|
|
this.notificationService.showError('Please select expected salary date');
|
|
return;
|
|
}
|
|
if (!this.expectedApprovalDate) {
|
|
this.notificationService.showError('Please select expected component approva; date');
|
|
return;
|
|
}
|
|
this.loadingPanel.ShowLoadingPanel = true;
|
|
this.authService.SetExpectedSalaryandApprovalDate(new Date(this.expectedSalaryDate), new Date(this.expectedApprovalDate)).subscribe(
|
|
() => {},
|
|
(err) => {
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
this.notificationService.showError(err?.error || 'Failed to set salary date');
|
|
},
|
|
() => {
|
|
this.expectedSalaryDatestring = this.datePipe.transform(this.expectedSalaryDate, 'd MMM yy, EEEE');
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
this.notificationService.showSuccess('Salary date updated successfully');
|
|
this.showSalaryDatePopup = false;
|
|
}
|
|
);
|
|
}
|
|
handleFilter(value: string) {
|
|
this.myMenu = this.menu.filter(x => x.label.toLowerCase().includes(value));
|
|
}
|
|
onSelect($event: string) {
|
|
const item = this.menu.find(x => x.label === $event);
|
|
this.router.navigate([item.routerLink]);
|
|
}
|
|
onClick(link: string) {
|
|
this.router.navigate([link]);
|
|
}
|
|
showSwitchPoUp() {
|
|
this.showPopUp = true;
|
|
}
|
|
onSwitchPopUpClose() {
|
|
this.showPopUp = false;
|
|
}
|
|
UpdateData() {
|
|
const jwtHelper = new JwtHelperService();
|
|
const user = jwtHelper.decodeToken(localStorage.getItem('token'));
|
|
this.currentSalaryMonth = new Date(user.nextPayProcessDate);
|
|
var taxitem: TaxParameter = undefined;
|
|
|
|
if (user.UserType != EnumUserType.User) return;
|
|
|
|
this.authService.GetUserByID(user.UserID).subscribe(
|
|
(resp) => {
|
|
this.currentUser = resp;
|
|
},
|
|
() => { },
|
|
() => {
|
|
|
|
},
|
|
);
|
|
|
|
this.authService.GetPayrollTypesByLoginID(user.LoginID).subscribe(
|
|
(resp: any) => {
|
|
this.payrollTypes = resp;
|
|
},
|
|
(err: any) => {
|
|
this.notificationService.showError(err.error);
|
|
},
|
|
() => {
|
|
this.selectedPayrollTypeID = user.PayrollTypeID;
|
|
//console.log(this.payrollTypes.length);
|
|
if (this.payrollTypes.length > 1) {
|
|
this.payrolltypeString = this.payrollTypes.find(x => x.id == this.selectedPayrollTypeID).description;
|
|
|
|
}
|
|
}
|
|
);
|
|
}
|
|
switchAccessType() {
|
|
//console.log("abcd");
|
|
if (this.switchPayrolltypeid == undefined) {
|
|
return;
|
|
}
|
|
if (this.switchPayrolltypeid == this.selectedPayrollTypeID) {
|
|
return;
|
|
}
|
|
this.loadingPanel.ShowLoadingPanel = true;
|
|
const data = {
|
|
user: this.currentUser,
|
|
payrollTypeId: this.switchPayrolltypeid,
|
|
};
|
|
this.authService.userPayrolltypeSwitch(data).subscribe(
|
|
(resp: any) => {
|
|
localStorage.setItem('token', resp);
|
|
ApiService.AuthenticationToken = resp;
|
|
},
|
|
(err: any) => {
|
|
this.notificationService.showError('Invalid Login-ID or Password');
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
},
|
|
() => {
|
|
this.loadingPanel.ShowLoadingPanel = false;
|
|
this.selectedPayrollTypeID = this.switchPayrolltypeid;
|
|
this.payrolltypeString = this.payrollTypes.find(x => x.id == this.selectedPayrollTypeID).description;
|
|
this.showPopUp = false;
|
|
this.router.navigate(['/ess/landing-page']);
|
|
this.loadDashboardData();
|
|
}
|
|
);
|
|
}
|
|
public firstContactImage = "https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg";
|
|
public secondContactImage = "https://demos.telerik.com/kendo-ui/content/web/Customers/GOURL.jpg";
|
|
public contactImages: Array<{
|
|
avatar: string;
|
|
name: string;
|
|
position: string;
|
|
}> = [
|
|
{
|
|
avatar: this.firstContactImage,
|
|
name: "Michael Holz",
|
|
position: "Manager",
|
|
},
|
|
{
|
|
avatar: this.secondContactImage,
|
|
name: "André Stewart",
|
|
position: "Product Manager",
|
|
},
|
|
];
|
|
|
|
public contactInitials: Array<{
|
|
avatar: string;
|
|
name: string;
|
|
position: string;
|
|
}> = [
|
|
{ avatar: "JS", name: "Jason Smith", position: "UX Designer" },
|
|
{ avatar: "GP", name: "George Porter", position: "Software Engineer" },
|
|
];
|
|
}
|