diff --git a/HRM.UI/ClientApp/src/app/_services/ess/ess.service.ts b/HRM.UI/ClientApp/src/app/_services/ess/ess.service.ts index 8787832..729a720 100644 --- a/HRM.UI/ClientApp/src/app/_services/ess/ess.service.ts +++ b/HRM.UI/ClientApp/src/app/_services/ess/ess.service.ts @@ -20,6 +20,9 @@ export class EssService { getAllPUR() { return this.apiService.httpGet('/Ess/getAllPUR'); } + getUserProfile() { + return this.apiService.httpGet('/Ess/getUserProfile'); + } savePUR(param: any) { return this.apiService.httpPost('/Ess/savePUR', param); } diff --git a/HRM.UI/ClientApp/src/app/ess/brac-self-service/brac-self-service.component.html b/HRM.UI/ClientApp/src/app/ess/brac-self-service/brac-self-service.component.html new file mode 100644 index 0000000..a774f96 --- /dev/null +++ b/HRM.UI/ClientApp/src/app/ess/brac-self-service/brac-self-service.component.html @@ -0,0 +1,342 @@ + +@if (apiService.isSelService === true) { +
+ +
+} +
+ + +
+
+ Profile photo +
+
+ {{empName}} + {{empStatus}} +
+ {{empDesignation}} · {{empDepartment}} + + + + + + {{empLocation}} + +
+
+
+ + + + +
+
+ + +
+
+
+
+ + + + +
+ Personal Information +
+ + View All + + + + +
+ +
+ +
+ Employee ID + {{employeeId}} +
+ +
+ Full Name + {{fullName}} +
+ +
+ Date of Birth + + + + + + + {{dateOfBirth}} + +
+ +
+ Gender + {{gender}} +
+ +
+ Status + + {{statusLabel}} + +
+ + + +
+ TIN + + {{(showAllAmounts || showTin) ? tinFull : tinMasked}} + + + + + + +
+ +
+
+ + +
+
+
+
+ + + + + +
+ Employment Details +
+ + View All + + + + +
+ +
+
+ Division + {{division}} +
+ +
+ Department + {{department}} +
+ +
+ Designation + {{designation}} +
+ +
+ Grade + + {{grade}} + +
+ +
+ Joining Date + + + + + + + {{joiningDate}} + +
+ +
+ Years of Service + {{yearsOfService}} +
+ + + +
+ Location + {{workLocation}} +
+ +
+
+ + +
+
+
+
+ + + +
+ Contact Information +
+ + View All + + + + +
+
+
+ Work Email + + {{workEmail}} + + + + + +
+ +
+ Mobile + + {{mobile}} + + + + + +
+ +
+
+ + +
+ + +@if (showModal) { +
+ +
+
+
+
+ + + + + + +
+
+

Switch to Admin

+

Select a payroll type to continue

+
+
+ +
+
+

Select a payroll type to switch to Admin mode.

+
+ @for (type of payrollTypes; track type) { +
+
+ {{ type.description }} +
+
+ {{ type.description }} + Admin Mode +
+
+ + + +
+
+ } +
+
+ +
+
+
+} diff --git a/HRM.UI/ClientApp/src/app/ess/brac-self-service/brac-self-service.component.scss b/HRM.UI/ClientApp/src/app/ess/brac-self-service/brac-self-service.component.scss new file mode 100644 index 0000000..77e154a --- /dev/null +++ b/HRM.UI/ClientApp/src/app/ess/brac-self-service/brac-self-service.component.scss @@ -0,0 +1,530 @@ +/* Same as user-ss-dashboard: no layout padding around the page */ +:host ::ng-deep .layout-wrapper .layout-main .layout-content { + padding: 0px !important; +} + +/* ── Page wrapper ── */ +.up-page { + display: flex; + flex-direction: column; + gap: 16px; + box-sizing: border-box; + font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; + /* Keep the page above the absolutely positioned background canvas */ + position: relative; + z-index: 1; +} + +/* Same width as user-ss-dashboard */ +.customGrid { + margin: 0 80px; + transition: margin 0.4s ease; +} +@media (max-width: 991px) { + .customGrid { margin: 0; } +} + +/* ── Profile Hero ── */ +.up-hero { + display: flex; + align-items: center; + justify-content: space-between; + padding: 20px 20px; + border: 1px solid #D4E4F7; + border-radius: 14px; + background: + radial-gradient(ellipse 70% 150% at 0% 50%, rgba(219, 234, 254, 0.60) 0%, rgba(219, 234, 254, 0) 100%), + radial-gradient(ellipse 55% 150% at 100% 50%, rgba(191, 219, 254, 0.45) 0%, rgba(191, 219, 254, 0) 100%), + linear-gradient(to right, #EEF6FF 0%, #F8FBFF 45%, #FFFFFF 70%, #F8FBFF 100%); + box-sizing: border-box; +} + +.up-hero-left { + display: flex; + align-items: center; + gap: 18px; +} + +.up-photo { + width: 82px; + height: 82px; + border-radius: 12px; + object-fit: cover; + flex-shrink: 0; + border: 1.5px solid #DBEAFE; +} + +.up-hero-info { + display: flex; + flex-direction: column; + gap: 5px; +} + +.up-hero-name-row { + display: flex; + align-items: center; + gap: 10px; + flex-wrap: wrap; +} + +.up-hero-name { + font-size: 22px; + font-weight: 700; + color: #0A0A0A; + line-height: 1.2; +} + +.up-hero-status-badge { + background: #DCFCE7; + color: #16A34A; + font-size: 12px; + font-weight: 500; + padding: 2px 10px; + border-radius: 100px; +} + +.up-hero-designation { + font-size: 14px; + color: #6B7280; + font-weight: 400; +} + +.up-hero-location { + display: flex; + align-items: center; + gap: 4px; + font-size: 13px; + color: #9CA3AF; + font-weight: 400; +} + +/* Hero right group */ +.up-hero-right { + display: flex; + align-items: center; + gap: 10px; + flex-shrink: 0; +} + +/* Global eye button */ +.up-global-eye-btn { + display: flex; + align-items: center; + gap: 6px; + padding: 6px 12px; + border: 1.5px solid #BFDBFE; + border-radius: 20px; + background: #EFF6FF; + cursor: pointer; + font-size: 12.5px; + font-weight: 600; + color: #2563EB; + transition: background 0.15s, border-color 0.15s; + flex-shrink: 0; +} + +.up-global-eye-btn:hover { + background: #DBEAFE; + border-color: #93C5FD; +} + +.up-global-eye-btn.up-global-eye-active { + background: #2563EB; + border-color: #2563EB; + color: #ffffff; +} + +/* Edit Profile button */ +.up-btn-edit { + display: none; + /* display: inline-flex; */ + align-items: center; + gap: 7px; + height: 40px; + padding: 0 18px; + background: rgba(255, 255, 255, 0.85); + border: 1px solid #BFDBFE; + border-radius: 10px; + color: #045AEA; + font-size: 14px; + font-weight: 500; + cursor: pointer; + white-space: nowrap; + transition: background 0.15s, border-color 0.15s; + font-family: 'Inter', -apple-system, sans-serif; +} +.up-btn-edit:hover { + background: rgba(239, 246, 255, 0.95); + border-color: #93C5FD; +} + +/* ── Section cards ── */ +.up-section { + background: #ffffff; + border: 1px solid #EEF1F5; + border-radius: 14px; + padding: 20px 24px; + box-sizing: border-box; +} + +.up-section-header { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 22px; +} + +.up-section-title-row { + display: flex; + align-items: center; + gap: 10px; +} + +.up-section-icon-wrap { + width: 36px; + height: 36px; + border-radius: 9px; + background: #EEF4FF; + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; +} + +.up-section-title { + font-size: 16px; + font-weight: 600; + color: #0A0A0A; +} + +.up-view-all { + /* display: flex; */ + display: none; + align-items: center; + gap: 4px; + font-size: 13px; + color: #045AEA; + font-weight: 400; + cursor: pointer; + transition: color 0.15s; + user-select: none; +} +.up-view-all:hover { color: #0347c7; } + +/* ── Fields grid ── */ +.up-fields-grid { + display: grid; + gap: 22px 20px; +} + +.up-grid-4 { grid-template-columns: repeat(4, 1fr); } +.up-grid-2 { grid-template-columns: repeat(2, 1fr); } + +.up-field { + display: flex; + flex-direction: column; + gap: 6px; +} + +.up-field-label { + font-size: 12px; + color: #9CA3AF; + font-weight: 400; +} + +.up-field-value { + font-size: 14px; + font-weight: 500; + color: #0A0A0A; + display: flex; + align-items: center; + gap: 6px; +} + +/* Active status badge */ +.up-active-badge { + display: inline-flex; + align-items: center; + background: #DCFCE7; + color: #16A34A; + font-size: 12px; + font-weight: 500; + padding: 3px 10px; + border-radius: 100px; +} + +/* Grade badge */ +.up-grade-badge { + display: inline-flex; + align-items: center; + background: #D1FAE5; + color: #065F46; + font-size: 12px; + font-weight: 600; + padding: 3px 10px; + border-radius: 100px; +} + +/* Eye toggle */ +.up-eye { + cursor: pointer; + flex-shrink: 0; + opacity: 0.65; + transition: opacity 0.15s; +} +.up-eye:hover { opacity: 1; } + +/* Copy button */ +.up-copy-btn { + cursor: pointer; + flex-shrink: 0; + opacity: 0.45; + transition: opacity 0.15s; +} +.up-copy-btn:hover { opacity: 0.9; } + +/* ── Responsive ── */ +@media (max-width: 1100px) { + .up-page { padding: 20px 24px 28px; } + .up-grid-4 { grid-template-columns: repeat(2, 1fr); } +} + +@media (max-width: 768px) { + .up-page { padding: 16px 16px 24px; } + .up-hero { flex-direction: column; align-items: flex-start; gap: 16px; } + .up-btn-edit { width: 100%; justify-content: center; } + .up-grid-4 { grid-template-columns: repeat(2, 1fr); } + .up-grid-2 { grid-template-columns: 1fr; } + .up-hero-name { font-size: 18px; } +} + +@media (max-width: 480px) { + .up-section { padding: 18px 16px; } + .up-grid-4 { grid-template-columns: 1fr; } + .up-hero { padding: 18px 16px; } +} + +/* ── Switch button + Switch User modal (from Payroll Home) ── */ +.ph-btn-download { + display: inline-flex; + align-items: center; + gap: 8px; + background: linear-gradient(135deg, #045AEA, #3B82F6); + color: #ffffff; + border: none; + border-radius: 10px; + padding: 0 20px; + height: 40px; + font-size: 13.5px; + font-weight: 600; + cursor: pointer; + white-space: nowrap; + box-sizing: border-box; +} +.ph-btn-download:hover { opacity: 0.88; } + +/* Kendo Dialog shell: strip its own frame so the card below keeps the same design */ +:host ::ng-deep .ph-switch-dialog .k-window, +:host ::ng-deep .ph-switch-dialog .k-dialog { + background: transparent; + border: 0; + box-shadow: none; + border-radius: 20px; + max-width: calc(100vw - 32px); +} +:host ::ng-deep .ph-switch-dialog .k-window-content, +:host ::ng-deep .ph-switch-dialog .k-dialog-content { + padding: 0; + background: transparent; + overflow: visible; +} + +.ph-modal-card { + background: #ffffff; + border-radius: 20px; + box-shadow: 0 24px 60px rgba(4, 90, 234, 0.15), 0 4px 16px rgba(0,0,0,0.1); + width: 100%; + max-width: 620px; + overflow: hidden; + animation: ph-slide-up 0.2s ease; +} + +@keyframes ph-slide-up { + from { transform: translateY(24px); opacity: 0; } + to { transform: translateY(0); opacity: 1; } +} + +/* Modal Header */ +.ph-modal-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 22px 24px 20px; + border-bottom: 1px solid #F1F5F9; +} + +.ph-modal-header-left { + display: flex; + align-items: center; + gap: 14px; +} + +.ph-modal-icon-wrap { + width: 46px; + height: 46px; + background: #EEF4FF; + border-radius: 12px; + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; +} + +.ph-modal-title { + font-size: 17px; + font-weight: 700; + color: #0A0A0A; + margin: 0 0 2px; + line-height: 1.3; +} + +.ph-modal-subtitle { + font-size: 13px; + color: #6B7280; + margin: 0; +} + +.ph-modal-close { + width: 36px; + height: 36px; + border: none; + background: #F3F4F6; + border-radius: 8px; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; + transition: background 0.15s; +} +.ph-modal-close:hover { background: #E5E7EB; } + +/* Modal Body */ +.ph-modal-body { + padding: 20px 24px; +} + +.ph-modal-hint { + font-size: 13px; + color: #6B7280; + margin: 0 0 16px; +} + +/* Two payroll types side by side; a single one takes the full width */ +.ph-type-list { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 10px; +} +.ph-type-item:only-child { + grid-column: 1 / -1; +} +@media (max-width: 480px) { + .ph-type-list { grid-template-columns: 1fr; } +} + +/* Payroll type image (same images as user-ss-dashboard) */ +.ph-type-img { + width: 32px; + height: 32px; + object-fit: contain; +} + +.ph-type-item { + display: flex; + align-items: center; + gap: 14px; + padding: 16px 18px; + border: 1.5px solid #E5E7EB; + border-radius: 14px; + cursor: pointer; + transition: border-color 0.15s, background 0.15s, box-shadow 0.15s; + background: #ffffff; +} + +.ph-type-item:hover { + border-color: #045AEA; + background: #F0F6FF; + box-shadow: 0 2px 10px rgba(4, 90, 234, 0.10); +} + +.ph-type-icon-wrap { + width: 44px; + height: 44px; + background: #EEF4FF; + border-radius: 12px; + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; + transition: background 0.15s; +} + +.ph-type-item:hover .ph-type-icon-wrap { + background: #DBEAFE; +} + +.ph-type-info { + flex: 1; + display: flex; + flex-direction: column; + gap: 3px; + min-width: 0; +} + +.ph-type-name { + font-size: 15px; + font-weight: 600; + color: #111827; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.ph-type-sub { + font-size: 12px; + color: #9CA3AF; +} + +.ph-type-arrow { + flex-shrink: 0; + opacity: 0; + transition: opacity 0.15s, transform 0.15s; +} + +.ph-type-item:hover .ph-type-arrow { + opacity: 1; + transform: translateX(3px); +} + +/* Modal Footer */ +.ph-modal-footer { + padding: 16px 24px 22px; + border-top: 1px solid #F1F5F9; + display: flex; + justify-content: flex-end; +} + +.ph-modal-cancel-btn { + padding: 10px 28px; + border: 1.5px solid #D1D5DB; + border-radius: 8px; + background: #ffffff; + color: #374151; + font-size: 14px; + font-weight: 500; + cursor: pointer; + font-family: inherit; + transition: background 0.15s, border-color 0.15s; +} +.ph-modal-cancel-btn:hover { background: #F9FAFB; border-color: #9CA3AF; } diff --git a/HRM.UI/ClientApp/src/app/ess/brac-self-service/brac-self-service.component.ts b/HRM.UI/ClientApp/src/app/ess/brac-self-service/brac-self-service.component.ts new file mode 100644 index 0000000..5b00d2c --- /dev/null +++ b/HRM.UI/ClientApp/src/app/ess/brac-self-service/brac-self-service.component.ts @@ -0,0 +1,345 @@ +import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { JwtHelperService } from '@auth0/angular-jwt'; +import { HRMNotificationService } from 'src/app/app.notification.service'; +import { EssService } from 'src/app/_services/ess/ess.service'; +import { loadingPanelService } from 'src/app/hrm-loding panel/loding.panel.service'; +import { AuthService } from 'src/app/_services/auth/auth.service'; +import { ApiService } from 'src/app/app.api.service'; +import { EnumUserType } from 'src/app/_models/enums'; +import { PayrollType } from 'src/app/_models/Authentication/payrollType'; +import { Bookmark } from 'src/app/_models/Basic/bookmark'; +import { AppMainComponent } from 'src/app/app.main.component'; +import { AuthGuard } from 'src/app/_guards/auth.guard'; + +@Component({ + selector: 'app-brac-self-service', + templateUrl: './brac-self-service.component.html', + styleUrls: ['./brac-self-service.component.scss'], + changeDetection: ChangeDetectionStrategy.Eager, + standalone: false +}) +export class BRACSelfServiceComponent implements OnInit { + + // Hero + empName = ''; + empStatus = ''; + empDesignation = ''; + empDepartment = ''; + empLocation = ''; + empPhoto = ApiService.DEFAULT_PHOTO; + + // Personal Information + employeeId = ''; + fullName = ''; + dateOfBirth = ''; + gender = ''; + statusLabel = ''; + nationalIdMasked = ''; + nationalIdFull = ''; + showNationalId = false; + tinMasked = ''; + tinFull = ''; + showTin = false; + + // Employment Details + division = ''; + department = ''; + designation = ''; + grade = ''; + joiningDate = ''; + yearsOfService = ''; + manager = ''; + workLocation = ''; + + // Contact Information + workEmail = ''; + personalEmail = ''; + mobile = ''; + address = ''; + + showAllAmounts = false; + + // Switch (same as GP_Master hress/payroll-home) + switchUserId: number; + payrollTypes: PayrollType[] = []; + showModal: boolean = false; + selectedPayrollTypeID: number; + bookmarks: Bookmark[]; + + // Payroll type images (same as user-ss-dashboard) + 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'; + } + + constructor( + private notify: HRMNotificationService, + private essService: EssService, + private loadingPanel: loadingPanelService, + private authService: AuthService, + private apiService: ApiService, + public appMain: AppMainComponent, + private auth: AuthGuard, + public router: Router, + ) {} + + ngOnInit(): void { + this.loadProfile(); + } + + private loadProfile(): void { + this.loadingPanel.ShowLoadingPanel = true; + + this.essService.getUserProfile().subscribe( + (res) => { + const b = res?.basic && res.basic.length > 0 ? res.basic[0] : {}; + const c = res?.contact && res.contact.length > 0 ? res.contact[0] : {}; + this.mapBasicData(b); + this.mapContactData(c); + // Same as user-ss-dashboard: a plain URL, so the browser fetches and caches the image itself. + this.empPhoto = this.apiService.empPhotoUrl(this.employeeId); + }, + (err) => { + this.loadingPanel.ShowLoadingPanel = false; + this.notify.showError(err?.error || 'Failed to load profile data'); + }, + () => { + this.loadingPanel.ShowLoadingPanel = false; + this.LoadSwitchUserId(); + } + ); + } + + // Backend maps EMPLOYEE.STATUS = 1 to the literal 'Live' (see EmployeeDA.GetSelfServiceBasicData). + // Employees know this state as "Active", so present it that way. + private displayStatus(raw: string): string { + return /^live$/i.test(raw.trim()) ? 'Active' : raw.trim(); + } + + // Calendar-accurate elapsed time from joining date to today, e.g. "17 years 1 month 25 days". + private formatServiceLength(from: Date): string { + const now = new Date(); + let years = now.getFullYear() - from.getFullYear(); + let months = now.getMonth() - from.getMonth(); + let days = now.getDate() - from.getDate(); + + if (days < 0) { + months -= 1; + const prevMonthDays = new Date(now.getFullYear(), now.getMonth(), 0).getDate(); + days += prevMonthDays; + } + if (months < 0) { + years -= 1; + months += 12; + } + + const parts: string[] = []; + if (years > 0) parts.push(years + (years === 1 ? ' year' : ' years')); + if (months > 0) parts.push(months + (months === 1 ? ' month' : ' months')); + if (days > 0) parts.push(days + (days === 1 ? ' day' : ' days')); + return parts.length ? parts.join(' ') : '0 days'; + } + + private mapBasicData(b: any): void { + const str = (v: any): string => (v != null ? String(v).trim() : ''); + + this.empName = str(b.fullName); + this.empStatus = this.displayStatus(str(b.status)); + this.empDesignation = str(b.designation); + this.empDepartment = str(b.department); + this.empLocation = str(b.location); + + this.employeeId = str(b.employeeNo); + this.fullName = str(b.fullName); + this.gender = str(b.gender); + this.statusLabel = this.displayStatus(str(b.status)); + + const nid = str(b.nid); + this.nationalIdFull = nid; + this.nationalIdMasked = nid.length > 4 ? '••••••••' + nid.slice(-4) : (nid ? '••••••••' : '—'); + + const tin = str(b.tin); + this.tinFull = tin; + this.tinMasked = tin.length > 3 ? '•••••••' + tin.slice(-3) : (tin ? '•••••••' : '—'); + + if (b.birthDate) { + const d = new Date(b.birthDate); + if (!isNaN(d.getTime())) + this.dateOfBirth = d.toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }); + } + + this.division = str(b.division); + this.department = str(b.department); + this.designation = str(b.designation); + this.grade = str(b.grade); + const lm = str(b.lineManager); + const dash = lm.indexOf('-'); + this.manager = dash >= 0 ? lm.substring(dash + 1).trim() : lm; + this.workLocation = str(b.location); + + if (b.joiningDate) { + const jd = new Date(b.joiningDate); + if (!isNaN(jd.getTime())) { + this.joiningDate = jd.toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }); + this.yearsOfService = this.formatServiceLength(jd); + } + } + + this.workEmail = str(b.emailAddress); + this.mobile = str(b.mobileNo); + } + + private mapContactData(c: any): void { + const str = (v: any): string => (v != null ? String(v).trim() : ''); + this.personalEmail = str(c.personalEmail); + this.address = str(c.permanentAddress) || str(c.presentAddress); + } + + /** Same fallback as user-ss-dashboard when the employee has no photo on file. */ + onOwnPhotoError() { + this.empPhoto = ApiService.DEFAULT_PHOTO; + } + + toggleAllAmounts(e: MouseEvent): void { + e.stopPropagation(); + this.showAllAmounts = !this.showAllAmounts; + } + + toggleNationalId(e: MouseEvent): void { + e.stopPropagation(); + this.showNationalId = !this.showNationalId; + } + + toggleTin(e: MouseEvent): void { + e.stopPropagation(); + this.showTin = !this.showTin; + } + + copy(text: string): void { + navigator.clipboard?.writeText(text).then(() => { + this.notify.showSuccess('Copied to clipboard'); + }); + } + + /* ── Switch User (same as GP_Master hress/payroll-home) ── */ + private LoadSwitchUserId() { + this.authService.getSwitchUserId(EnumUserType.User).subscribe( + (resp) => { + if (resp == 0) { + this.switchUserId = undefined; + } + else { + this.switchUserId = resp; + } + }, + (err) => { + }, + () => { + }); + } + + switchUser() { + this.loadPayrollTypes(); + } + + private loadPayrollTypes() { + this.loadingPanel.ShowLoadingPanel = true; + this.authService.getAdminPayrollTypes().subscribe( + (resp) => { + this.payrollTypes = resp; + }, + () => { + this.loadingPanel.ShowLoadingPanel = false; + }, + () => { + this.loadingPanel.ShowLoadingPanel = false; + if (this.payrollTypes.length > 0) { + this.showModal = true; + } + }); + } + + onPopUpClose() { + this.showModal = false; + } + + selectAccessType(typeId: number): void { + this.selectedPayrollTypeID = typeId; + this.processSwitchUser(); + } + + private processSwitchUser() { + this.loadingPanel.ShowLoadingPanel = true; + var currentUser; + this.authService.GetCurrentUser().subscribe( + (item: any) => { + currentUser = item; + }, + (errmenu: any) => { + this.loadingPanel.ShowLoadingPanel = false; + }, + () => { + currentUser.UserType = EnumUserType.User; + const data = { + user: currentUser, + payrollTypeId: this.selectedPayrollTypeID, + }; + this.authService.SwtichUserMode(data).subscribe( + (resp: any) => { + localStorage.setItem('token', resp); + ApiService.AuthenticationToken = resp; + }, + (err: any) => { + this.notify.showError('Invalid Login-ID or Password'); + this.loadingPanel.ShowLoadingPanel = false; + }, + () => { + const jwtHelper = new JwtHelperService(); + const user = jwtHelper.decodeToken(localStorage.getItem('token')); + this.appMain.IsSelfService(); + if (user.ChangePasswordAtNextLogon === 'True' && this.apiService.isSSO !== 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)); + this.router.navigate(['/']); + }, + (errmenu: any) => { + this.loadingPanel.ShowLoadingPanel = false; + }, + () => { + this.loadingPanel.ShowLoadingPanel = false; + this.loadBookmark(); + this.auth.menuEvent.emit(true); + }); + } + this.loadingPanel.ShowLoadingPanel = false; + }); + }); + } + + private loadBookmark() { + this.authService.getBookmarks().subscribe( + (resp: any) => { + this.bookmarks = resp; + }, + (x) => { + }, + () => { + localStorage.removeItem('bookmark'); + localStorage.setItem('bookmark', JSON.stringify(this.bookmarks)); + }); + } +} diff --git a/HRM.UI/ClientApp/src/app/ess/ess-routing.module.ts b/HRM.UI/ClientApp/src/app/ess/ess-routing.module.ts index a9c895d..8c94d3a 100644 --- a/HRM.UI/ClientApp/src/app/ess/ess-routing.module.ts +++ b/HRM.UI/ClientApp/src/app/ess/ess-routing.module.ts @@ -54,6 +54,7 @@ import { TrainingNeedAnalysisLmComponent } from './training-need-analysis-lm/tra import { CoreHrDashboardComponent } from '../core-hr/core-hr-dashboard/core-hr-dashboard/core-hr-dashboard.component'; import { SelfServiceDashboardComponent } from './self-service-dashboard/self-service-dashboard.component'; import { UserSSDashboardComponent } from './user-ssdashboard/user-ssdashboard.component'; +import { BRACSelfServiceComponent } from './brac-self-service/brac-self-service.component'; import { CompanyUpdatesComponent } from './company-updates/company-updates.component'; import { CandidateSelectionOfferLetterComponent } from '../recruitment/candidate-selection-offer-letter/candidate-selection-offer-letter.component'; import { TaxMasterComponent } from '../payroll-tax/tax-master/tax-master.component'; @@ -63,7 +64,7 @@ export const routes: Routes = [ { path: 'self-profile', component: SelfProfileComponent, canActivate: [AuthGuard] }, { path: 'ess-dashboard', component: EssDashboardComponent, canActivate: [AuthGuard] }, { path: 'selfservice-dashboard', component: SelfServiceDashboardComponent, canActivate: [AuthGuard] }, - { path: 'self-dashboard', component: UserSSDashboardComponent, canActivate: [AuthGuard] }, + { path: 'self-dashboard', component: BRACSelfServiceComponent, canActivate: [AuthGuard] }, { path: 'company-updates', component: CompanyUpdatesComponent, canActivate: [AuthGuard] }, { path: 'landing-page', component: LandingPageComponent, canActivate: [AuthGuard] }, { path: 'leave-approve', component: LeaveApproveComponent, canActivate: [AuthGuard] }, diff --git a/HRM.UI/ClientApp/src/app/ess/ess.module.ts b/HRM.UI/ClientApp/src/app/ess/ess.module.ts index 0bf1b06..b49c986 100644 --- a/HRM.UI/ClientApp/src/app/ess/ess.module.ts +++ b/HRM.UI/ClientApp/src/app/ess/ess.module.ts @@ -92,6 +92,7 @@ import { EssTrainingScheduleComponent } from './ess-training-schedule/ess-traini import { TrainingNeedAnalysisLmComponent } from './training-need-analysis-lm/training-need-analysis-lm.component'; import { SelfServiceDashboardComponent } from './self-service-dashboard/self-service-dashboard.component'; import { UserSSDashboardComponent } from './user-ssdashboard/user-ssdashboard.component'; +import { BRACSelfServiceComponent } from './brac-self-service/brac-self-service.component'; import { RecruitmentModule } from '../recruitment/recruitment.module'; import { TalentManagementModule } from '../talent-management/talent-management.module'; import { CandidateSelectionOfferLetterComponent } from '../recruitment/candidate-selection-offer-letter/candidate-selection-offer-letter.component'; @@ -122,7 +123,7 @@ import { ChunkPipe } from '../helper/chunk.pipe'; GatemanApprovalComponent,MyTeamComponent, LeaveHistoryComponent, ScheduleMailLogComponent, CordinatorDashboardComponent, ProratedApproveComponent, PfExceptionComponent, MemberBalanceLedgerComponent, EssTrainingCalenderComponent, EssTrainingScheduleComponent, TrainingNeedAnalysisLmComponent, SelfServiceDashboardComponent, - UserSSDashboardComponent, CompanyUpdatesComponent, + UserSSDashboardComponent, BRACSelfServiceComponent, CompanyUpdatesComponent, EmployeeDictionaryComponent, IndependentDevelopmentPlanComponent, MyIdpComponent, EssComponentUploaderComponent, EssComponentApprovalComponent ], diff --git a/HRM.UI/Controllers/Ess/EssController.cs b/HRM.UI/Controllers/Ess/EssController.cs index 2c60bfd..60ba742 100644 --- a/HRM.UI/Controllers/Ess/EssController.cs +++ b/HRM.UI/Controllers/Ess/EssController.cs @@ -201,6 +201,29 @@ namespace HRM.UI.Controllers.Ess return Ok(items); } + [HttpGet("getUserProfile")] + public ActionResult GetUserProfile() + { + CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User); + int employeeId = currentUser.EmployeeID.GetValueOrDefault(); + try + { + DataSet basicDs = new HRM.DA.EmployeeService().GetSelfServiceBasicData(employeeId); + DataSet contactDs = new HRM.DA.EmployeeService().GetSelfServiceContactData(employeeId); + + var result = new + { + basic = basicDs.Tables.Count > 0 ? basicDs.Tables[0] : new DataTable(), + contact = contactDs.Tables.Count > 0 ? contactDs.Tables[0] : new DataTable() + }; + return Ok(result); + } + catch (Exception ex) + { + return StatusCode(StatusCodes.Status500InternalServerError, ex.Message); + } + } + [HttpPost] [Route("updateStatusToRejected")] public ActionResult UpdateStatusToRejected(ProfileUpdateRequest item)