diff --git a/src/app/components/ats/ats-dashboard/ats-dashboard.component.ts b/src/app/components/ats/ats-dashboard/ats-dashboard.component.ts index 769c933df..ed8f99cc9 100644 --- a/src/app/components/ats/ats-dashboard/ats-dashboard.component.ts +++ b/src/app/components/ats/ats-dashboard/ats-dashboard.component.ts @@ -46,7 +46,7 @@ export class AtsDashboardComponent { this.dataSource.data = this.allCandidates; this.dataSource._updateChangeSubscription(); }, - error: error => this.snackBarService.showSnackbar("Unable to Get All Candidates", "snack-error") + error: (er) => this.snackBarService.showError(er), }) } diff --git a/src/app/components/ats/candidates/new-candidate/new-candidate.component.ts b/src/app/components/ats/candidates/new-candidate/new-candidate.component.ts index b7c3515b5..1e1746acc 100644 --- a/src/app/components/ats/candidates/new-candidate/new-candidate.component.ts +++ b/src/app/components/ats/candidates/new-candidate/new-candidate.component.ts @@ -11,7 +11,6 @@ import { qualifications } from 'src/app/models/ats/constants/qualifications.cons import { EmployeeService } from 'src/app/services/hris/employee/employee.service'; import { GenericDropDownObject } from 'src/app/models/hris/generic-drop-down-object.interface'; import { Observable, debounceTime, distinctUntilChanged, map, startWith, switchMap } from 'rxjs'; -import { EmployeeProfile } from 'src/app/models/hris/employee-profile.interface'; import { Employee } from 'src/app/models/hris/employee.interface'; @Component({ @@ -94,7 +93,7 @@ export class NewCandidateComponent { getAllEmployees() { this.employeeService.getAll().subscribe({ next: data => this.allEmployees = data, - error: error => this.snackBarService.showSnackbar("Unable to Get All Employees", "snack-error") + error: (er) => this.snackBarService.showError(er), }) } @@ -271,7 +270,7 @@ export class NewCandidateComponent { this.isBlacklisted = false; } }, - error: (err) => { } + error: (er) => this.snackBarService.showError(er), }); } clearUpload() { @@ -448,8 +447,7 @@ export class NewCandidateComponent { this.candidateService.addCandidate(candidateDto).subscribe({ next: (data) => this.snackBarService.showSnackbar("Added", "snack-success"), - error: (error) => - this.snackBarService.showSnackbar("Unable to Add Canididate", "snack-error"), + error: (er) => this.snackBarService.showError(er), complete: () => { this.router.navigateByUrl(nextPage); } diff --git a/src/app/components/hris/admin-dashboard/admin-dashboard.component.css b/src/app/components/hris/admin-dashboard/admin-dashboard.component.css index 959d7d4c9..907b09c87 100644 --- a/src/app/components/hris/admin-dashboard/admin-dashboard.component.css +++ b/src/app/components/hris/admin-dashboard/admin-dashboard.component.css @@ -305,6 +305,15 @@ div#results-container { z-index: 99999; } +.growthRatePositive{ + color: #006E2B ; + margin-top: 10px; +} + +.growthRateNegative{ + color: #B3261E ; + margin-top: 10px; +} #dialog-save>button { background: #0029c6; @@ -501,7 +510,7 @@ div#results-container { } .span-churn-rate { - font-size: 18px; + font-size: 14px; font: Roboto; font-weight: 500; line-height: 20px; diff --git a/src/app/components/hris/admin-dashboard/admin-dashboard.component.html b/src/app/components/hris/admin-dashboard/admin-dashboard.component.html index 658137cc9..bf7a06f07 100644 --- a/src/app/components/hris/admin-dashboard/admin-dashboard.component.html +++ b/src/app/components/hris/admin-dashboard/admin-dashboard.component.html @@ -20,8 +20,8 @@ - +
@@ -69,7 +69,7 @@
-
+
View more employees
@@ -143,6 +143,14 @@
+
+
+

{{ this.growthRate }} % Decrease from last + month

+

{{ this.growthRate }} % Increase from last + month

+
+
@@ -173,37 +181,43 @@
-
Project Allocation
+
+
+ Project Allocation +
+
+ more_horiz +
+
- On Bench: {{ employeeCount.totalNumberOfEmployeesOnBench }} + On Project: {{ employeeCount.totalNumberOfEmployeesOnClients }}/{{this.totalNumberOfEmployees}}

- Developers: {{ employeeCount.devsOnBenchCount }} + Billing: {{ 0 }}
- Scrum Masters: - {{ employeeCount.scrumMastersOnBenchCount }} + Not Billing: + {{ 0 }}
- Designers: {{ employeeCount.designersOnBenchCount }} + On Bench: {{ employeeCount.totalNumberOfEmployeesOnBench }}
- -
- - {{ employeeCount.billableEmployeesPercentage }}% Billable - -
+
+ + {{ employeeCount.billableEmployeesPercentage }}% Billed + +
@@ -216,7 +230,14 @@
-
Churn Rate
+
+
+ Churn Rate +
+
+ more_horiz +
+
{{ churnRate.churnRate }}% over {{ churnRate.month }} {{ churnRate.year }} @@ -249,9 +270,14 @@
-
+
+ group + {{ churnRate.churnRateDifference }}% + increase from last month +
+
group - {{ churnRate.churnRate }}% + {{ churnRate.churnRateDifference }}% decrease from last month
@@ -272,161 +298,360 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - + + - - - - - - + + + + + + - - + + - - - - - + + + + + - - + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -504,7 +729,7 @@

Pie Chart
- Stacked Graph + Stacked Graph
Please select an option
@@ -528,7 +753,7 @@
Select category - + {{ category }} @@ -548,10 +773,11 @@
arrow_drop_down - + Select role + (selectionChange)="changeEmployeeRolesOnNewChart($event)" multiple required> {{ type }} diff --git a/src/app/components/hris/admin-dashboard/admin-dashboard.component.ts b/src/app/components/hris/admin-dashboard/admin-dashboard.component.ts index e59a37b56..5b1c54259 100644 --- a/src/app/components/hris/admin-dashboard/admin-dashboard.component.ts +++ b/src/app/components/hris/admin-dashboard/admin-dashboard.component.ts @@ -19,6 +19,7 @@ import { AuthAccessService } from 'src/app/services/shared-services/auth-access/ import { EmployeeCountDataCard } from 'src/app/models/hris/employee-count-data-card.interface'; import { ChurnRateDataCard } from 'src/app/models/hris/churn-rate-data-card.interface'; import { EmployeeBankingandstarterkitService } from 'src/app/services/hris/employee/employee-bankingandstarterkit.service'; +import { DashboardService } from 'src/app/services/hris/employee/dashboard.service'; @Component({ selector: 'app-admin-dashboard', templateUrl: './admin-dashboard.component.html', @@ -59,6 +60,7 @@ export class AdminDashboardComponent { selectedTypes: string[] = []; employeeProfiles: EmployeeProfile[] = []; totalNumberOfEmployees: number = 0; + growthRate: number = 0; roles: string[] = []; searchQuery: string = ''; searchResults: EmployeeProfile[] = []; @@ -92,6 +94,7 @@ export class AdminDashboardComponent { constructor( private employeeBankingandstarterkitService: EmployeeBankingandstarterkitService, private employeeService: EmployeeService, + private dashboardService: DashboardService, public chartService: ChartService, private cookieService: CookieService, private router: Router, @@ -177,7 +180,7 @@ export class AdminDashboardComponent { } }); - this.employeeService.getEmployeeCountData().subscribe({ + this.dashboardService.getEmployeeCountData().subscribe({ next: (data: EmployeeCountDataCard) => { this.employeeCount = data; }, @@ -186,7 +189,7 @@ export class AdminDashboardComponent { } }); - this.employeeService.getChurnRate().subscribe({ + this.dashboardService.getChurnRate().subscribe({ next: (data: ChurnRateDataCard) => { this.churnRate = data; }, @@ -194,6 +197,15 @@ export class AdminDashboardComponent { this.isLoading = false; } }); + + this.dashboardService.getGrowthrate().subscribe({ + next: (data: number ) => { + this.growthRate = data + }, + complete: () => { + this.isLoading = false; + } + }) } getEmployeeTableColumns() { @@ -216,9 +228,7 @@ export class AdminDashboardComponent { this.employeeProfiles = data; this.searchResults = []; }, - error: () => { - this.snackBarService.showSnackbar('Unable to Fetch Employees', 'snack-error'); - }, + error: (er) => this.snackBarService.showError(er), complete: () => { this.loadCounter++; }, @@ -231,9 +241,7 @@ export class AdminDashboardComponent { next: (data) => { this.charts = data; }, - error: () => { - this.snackBarService.showSnackbar('Unable to Fetch Charts', 'snack-error'); - }, + error: (er) => this.snackBarService.showError(er), complete: () => { this.loadCounter++; }, @@ -360,9 +368,7 @@ export class AdminDashboardComponent { this.chartService.isEditing = false this.dialog.closeAll(); }, - error: () => { - this.snackBarService.showSnackbar("Unable to Update Chart", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }); } return @@ -405,8 +411,8 @@ export class AdminDashboardComponent { this.configureDashboardData(); this.isLoadingChart = false; }, - error: () => { - this.snackBarService.showSnackbar('Unable to Create Chart', 'snack-error'); + error: (er) => { + this.snackBarService.showError(er); this.isLoadingChart = false; }, }); diff --git a/src/app/components/hris/charts/chart-report-pdf/chart-report-pdf.component.ts b/src/app/components/hris/charts/chart-report-pdf/chart-report-pdf.component.ts index ed5597b9f..545783890 100644 --- a/src/app/components/hris/charts/chart-report-pdf/chart-report-pdf.component.ts +++ b/src/app/components/hris/charts/chart-report-pdf/chart-report-pdf.component.ts @@ -87,8 +87,8 @@ export class ChartReportPdfComponent { } else { container.removeAttribute("style"); } - }).catch(() => { - this.snackBarService.showSnackbar("Unable to Generating PDF", "snack-error"); + }).catch((er) => { + this.snackBarService.showError(er); if (originalStyle !== null) { container.setAttribute("style", originalStyle); diff --git a/src/app/components/hris/charts/charts.component.css b/src/app/components/hris/charts/charts.component.css index 8509b2ed4..335f129e9 100644 --- a/src/app/components/hris/charts/charts.component.css +++ b/src/app/components/hris/charts/charts.component.css @@ -74,12 +74,7 @@ width: 2.5rem; } -#chart-icon-menu { - transform: rotate(180deg); -} - .icon-width-mobile { - /* width: 3rem !important; */ width: 65px !important; height: 1rem !important; } diff --git a/src/app/components/hris/charts/charts.component.html b/src/app/components/hris/charts/charts.component.html index 8c2d41df8..2ae6b6f8d 100644 --- a/src/app/components/hris/charts/charts.component.html +++ b/src/app/components/hris/charts/charts.component.html @@ -62,9 +62,9 @@

{{chart.name}}

- +
-
-

{{name}} {{surname}} is a {{role}} (Level {{level}}).Their highest qualification is a NQF Level {{nqf}} in {{education}} from the {{school}} and has {{numberOfYears}} experience in her field.

-
+
+

+ {{name}} {{surname}} is a {{role}} (Level {{level}}). Their highest qualification is a NQF Level {{nqf}} in {{education}} from the {{school}} and is currently at graduate level in their field. +

+ +

+ {{name}} {{surname}} is a {{role}} (Level {{level}}). Their highest qualification is a NQF Level {{nqf}} in {{education}} from the {{school}} and has {{numberOfYears}} years of experience in their field. +

+
+

@@ -114,7 +121,7 @@
{{employeeWorkExp[i].software}}
-
+
diff --git a/src/app/components/hris/cv-document/cv-document.component.ts b/src/app/components/hris/cv-document/cv-document.component.ts index 0a372382b..25729bea4 100644 --- a/src/app/components/hris/cv-document/cv-document.component.ts +++ b/src/app/components/hris/cv-document/cv-document.component.ts @@ -29,6 +29,7 @@ export class CvDocumentComponent { loggedInProfile!: EmployeeData; skills: string[] = []; filteredSkills: string[] = []; + experienceData: EmployeeData[] = []; name: string | undefined = ''; surname: string | undefined = ''; role: string | undefined = ''; @@ -51,6 +52,7 @@ export class CvDocumentComponent { private employeeCertificationService: EmployeeCertificatesService, private employeeWorkExperienceService: WorkExperienceService, public navService: NavService, + private employeeData: EmployeeDataService, ) { } ngOnInit() { @@ -73,22 +75,19 @@ export class CvDocumentComponent { this.surname = data.surname; this.role = data.employeeType?.name; this.level = data.level; - this.getExprienceYears(data.engagementDate); + this.getAdditionalFields(); } }) } - getExprienceYears(date: any) { - const newDate1Obj = new Date(date); - const newDate2Obj = new Date(); - - let years = newDate2Obj.getFullYear() - newDate1Obj.getFullYear(); - let months = newDate2Obj.getMonth() - newDate1Obj.getMonth(); - - months = (months + 12) % 12; - years -= Math.floor(months / 12); - const numYears = (years > 0 ? `${years} ${years === 1 ? 'year' : 'years'}` : 0 + ' years' + (months > 0 ? "" + ` ${months} ${months === 1 ? 'month' : 'months'}` : '')); - this.numberOfYears = numYears; + getAdditionalFields() { + this.employeeData.getEmployeeData(this.employeeId).subscribe({ + next: data => { + console.log(data); + this.experienceData = data.filter(field => field.fieldCodeId == 5); + this.numberOfYears = this.experienceData[0].value; + } + }) } getEmployeeWorkExp() { @@ -111,7 +110,6 @@ export class CvDocumentComponent { getQualifications() { this.employeeQaulificationService.getEmployeeQualificationById(this.employeeId).subscribe({ next: data => { - console.log(data) this.school = data.school; this.education = data.fieldOfStudy; this.nqf = data.highestQualification; diff --git a/src/app/components/hris/employees/employee-approvals/view-banking-approval/view-banking-approval.component.ts b/src/app/components/hris/employees/employee-approvals/view-banking-approval/view-banking-approval.component.ts index b9799f592..5db9dc92a 100644 --- a/src/app/components/hris/employees/employee-approvals/view-banking-approval/view-banking-approval.component.ts +++ b/src/app/components/hris/employees/employee-approvals/view-banking-approval/view-banking-approval.component.ts @@ -109,7 +109,7 @@ export class ViewBankingApprovalComponent { this.backToApprovals(); this.changeDetector.detectChanges(); }, - error: error => this.snackBarService.showSnackbar("Unable to Update Banking Approval", "snack-error") + error: (er) => this.snackBarService.showError(er), }) } diff --git a/src/app/components/hris/employees/employee-approvals/view-starter-kit-approval/view-starter-kit-approval.component.css b/src/app/components/hris/employees/employee-approvals/view-starter-kit-approval/view-starter-kit-approval.component.css index 63d8463a0..768775414 100644 --- a/src/app/components/hris/employees/employee-approvals/view-starter-kit-approval/view-starter-kit-approval.component.css +++ b/src/app/components/hris/employees/employee-approvals/view-starter-kit-approval/view-starter-kit-approval.component.css @@ -100,7 +100,7 @@ #button-approve, #button-decline { - display: inline-block; + display: flex; padding: 5px 24px 5px 5px; justify-content: center; align-items: center; @@ -120,8 +120,7 @@ } #button-icon { - width: 18px; - height: 18px; + display: flex; } #horizontal { diff --git a/src/app/components/hris/employees/employee-approvals/view-starter-kit-approval/view-starter-kit-approval.component.html b/src/app/components/hris/employees/employee-approvals/view-starter-kit-approval/view-starter-kit-approval.component.html index 831830a5e..54324e512 100644 --- a/src/app/components/hris/employees/employee-approvals/view-starter-kit-approval/view-starter-kit-approval.component.html +++ b/src/app/components/hris/employees/employee-approvals/view-starter-kit-approval/view-starter-kit-approval.component.html @@ -53,12 +53,12 @@

{{category}}

+ class="mx-3">check_smallApprove
+ class="mx-3">closeDecline
diff --git a/src/app/components/hris/employees/employee-approvals/view-starter-kit-approval/view-starter-kit-approval.component.ts b/src/app/components/hris/employees/employee-approvals/view-starter-kit-approval/view-starter-kit-approval.component.ts index 84efcb086..ee07de375 100644 --- a/src/app/components/hris/employees/employee-approvals/view-starter-kit-approval/view-starter-kit-approval.component.ts +++ b/src/app/components/hris/employees/employee-approvals/view-starter-kit-approval/view-starter-kit-approval.component.ts @@ -69,7 +69,7 @@ export class ViewStarterKitApprovalComponent { }); if(this.employeeDocuments.length > 0) this.lastUpdatedMessage = this.getNewDate(); }, - error: () => this.snackBarService.showSnackbar(`Unable to Fetch Documents`, "snack-error") + error: (er) => this.snackBarService.showError(er), }) } @@ -168,7 +168,7 @@ export class ViewStarterKitApprovalComponent { this.getEmployeeDocuments(this.employeedId); this.employeeBankingStarterkitService.getAllBankingAndStarterkits(); }, - error: () => this.snackBarService.showSnackbar(`Unable to Update Document`, "snack-error") + error: (er) => this.snackBarService.showError(er), }); } diff --git a/src/app/components/hris/employees/employee-details/employee-details.component.ts b/src/app/components/hris/employees/employee-details/employee-details.component.ts index d3b33270a..6a4fed2ad 100644 --- a/src/app/components/hris/employees/employee-details/employee-details.component.ts +++ b/src/app/components/hris/employees/employee-details/employee-details.component.ts @@ -224,7 +224,7 @@ export class EmployeeDetailsComponent implements OnInit { this.saveEmployeeCustomData(); this.snackBarService.showSnackbar("Updated", "snack-success"); }, - error: (error) => { this.snackBarService.showSnackbar("Unable to Update Information", "snack-error") }, + error: (er) => this.snackBarService.showError(er), }); } } @@ -246,7 +246,7 @@ export class EmployeeDetailsComponent implements OnInit { this.employeeDataService.updateEmployeeData(employeeDataDto).subscribe({ next: (data) => { }, - error: (error) => { }, + error: (er) => this.snackBarService.showError(er), }); } else if (found == null) { @@ -263,9 +263,7 @@ export class EmployeeDetailsComponent implements OnInit { next: (data) => { this.cookieService.set('currentPage', 'Employees'); }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Save Information", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }); } } diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-banking/accordion-banking.component.ts b/src/app/components/hris/employees/employee-profile/accordions/accordion-banking/accordion-banking.component.ts index 84cd4e93b..cce2240c4 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-banking/accordion-banking.component.ts +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-banking/accordion-banking.component.ts @@ -75,12 +75,10 @@ export class AccordionBankingComponent { this.bankingId = this.employeeBanking[this.employeeBanking.length - 1].id; this.initializeBankingForm(this.employeeBanking[this.employeeBanking.length - 1]); } else { - console.warn("No banking details available."); + this.snackBarService.showError("No banking details available."); } }, - error: (err) => { - console.error("Error fetching banking details: ", err); - } + error: (er) => this.snackBarService.showError(er), }); } @@ -164,53 +162,54 @@ export class AccordionBankingComponent { } saveBankingDetails() { - this.editBanking = false; - this.isUpdated = true; - const employeeBankingFormValue = this.employeeBankingsForm.value; - this.employeeBankingDto = { - id: this.bankingId, - employeeId: this.employeeProfile?.id, - bankName: employeeBankingFormValue.bankName, - branch: `${employeeBankingFormValue.branch}`, - accountNo: `${employeeBankingFormValue.accountNo}`, - accountType: employeeBankingFormValue.accountType, - status: 1, - declineReason: this.bankingReason, - file: employeeBankingFormValue.file + if(this.bankingPDFName.length >= 1){ + this.editBanking = false; + this.isUpdated = true; + const employeeBankingFormValue = this.employeeBankingsForm.value; + this.employeeBankingDto = { + id: this.bankingId, + employeeId: this.employeeProfile?.id, + bankName: employeeBankingFormValue.bankName, + branch: `${employeeBankingFormValue.branch}`, + accountNo: `${employeeBankingFormValue.accountNo}`, + accountType: employeeBankingFormValue.accountType, + status: 1, + declineReason: this.bankingReason, + file: employeeBankingFormValue.file + } + if (this.hasBankingData) { + this.employeeBankingService.updatePending(this.employeeBankingDto).subscribe({ + next: () => { + this.addOrUpdateBanking("Updated") + }, + error: (er) => this.snackBarService.showError(er) + }) + } + else { + this.employeeBankingService.addBankingDetails(this.employeeBankingDto).subscribe({ + next: () => { + this.addOrUpdateBanking("Saved") + }, + error: (er) => this.snackBarService.showError(er) + }) + } } - if (this.hasBankingData) { - this.employeeBankingService.updatePending(this.employeeBankingDto).subscribe({ - next: () => { - this.snackBarService.showSnackbar("Updated", "snack-success"); - this.getEmployeeBankingData(); - this.checkBankingInformationProgress(); - this.totalBankingProgress(); - this.employeeBankingStarterkitService.getAllBankingAndStarterkits(); - this.hasUpdatedBanking = true; - this.editBanking = false; - this.employeeBankingsForm.disable(); - }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Save Banking Information", "snack-error"); - } - }) + else{ + this.snackBarService.showSnackbar("Add a Proof of account", "snack-error") } - else { - this.employeeBankingService.addBankingDetails(this.employeeBankingDto).subscribe({ - next: () => { - this.snackBarService.showSnackbar("Saved", "snack-success"); - this.getEmployeeBankingData(); - this.checkBankingInformationProgress(); - this.totalBankingProgress(); - this.employeeBankingStarterkitService.incrementPendingCount(); - this.hasUpdatedBanking = true; - this.editBanking = false; - this.employeeBankingsForm.disable(); - } - , error: (error) => { - this.snackBarService.showSnackbar("Unable to Save Banking Information", "snack-error"); - } - }) + } + + addOrUpdateBanking(message: string) { + this.snackBarService.showSnackbar(message, "snack-success"); + this.getEmployeeBankingData(); + this.checkBankingInformationProgress(); + this.totalBankingProgress(); + this.employeeBankingStarterkitService.getAllBankingAndStarterkits(); + this.hasUpdatedBanking = true; + this.editBanking = false; + this.employeeBankingsForm.disable(); + if(message = "Saved"){ + this.employeeBankingStarterkitService.incrementPendingCount(); } } diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-career-summary-qualifications/accordion-career-summary-qualifications.component.ts b/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-career-summary-qualifications/accordion-career-summary-qualifications.component.ts index ddd06e040..dbaef46a7 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-career-summary-qualifications/accordion-career-summary-qualifications.component.ts +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-career-summary-qualifications/accordion-career-summary-qualifications.component.ts @@ -66,9 +66,7 @@ export class CareerSummaryQualificationsComponent { this.sharedAccordionFunctionality.calculateQualificationProgress(); this.sharedAccordionFunctionality.totalCareerProgress(); }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Fetch Qualification", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }) } @@ -123,9 +121,7 @@ export class CareerSummaryQualificationsComponent { this.sharedAccordionFunctionality.calculateQualificationProgress(); this.sharedAccordionFunctionality.totalCareerProgress(); }, - error: (error) => { - this.snackBarService.showSnackbar("Upload a copy of your Qualification Document", "snack-error"); - }, + error: (er) => this.snackBarService.showError(er), complete: () => this.fetchQualificationsById() }); } else { diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-career-work-experience/accordion-career-work-experience.component.css b/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-career-work-experience/accordion-career-work-experience.component.css index 8e6fe25cc..51413a5ed 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-career-work-experience/accordion-career-work-experience.component.css +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-career-work-experience/accordion-career-work-experience.component.css @@ -70,4 +70,8 @@ mat-icon{ #remove-document-button , .remove-document-button{ color: red; +} + +#project-description-width{ + width:880px; } \ No newline at end of file diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-career-work-experience/accordion-career-work-experience.component.html b/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-career-work-experience/accordion-career-work-experience.component.html index e78ffe205..5e55e855a 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-career-work-experience/accordion-career-work-experience.component.html +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-career-work-experience/accordion-career-work-experience.component.html @@ -230,6 +230,14 @@

{{sharedAccordionFunctionality.newWorkExperiences[i].clientName

+
+ + Project description + + +

diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-career-work-experience/accordion-career-work-experience.component.ts b/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-career-work-experience/accordion-career-work-experience.component.ts index 001c2136d..940d34486 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-career-work-experience/accordion-career-work-experience.component.ts +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-career-work-experience/accordion-career-work-experience.component.ts @@ -79,12 +79,8 @@ export class AccordionCareerWorkExperienceComponent { this.workExperienceService.getWorkExperience(this.employeeProfile.id as number).subscribe({ next: (data) => { this.sharedAccordionFunctionality.workExperience = data; - this.sharedAccordionFunctionality.calculateCareerWorkExperienceFormProgress(); - this.sharedAccordionFunctionality.totalCareerProgress(); }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Fetch Work Experiences", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }); } @@ -185,8 +181,6 @@ export class AccordionCareerWorkExperienceComponent { this.editWorkExperience = false; this.addingWorkExperience = false; this.sharedAccordionFunctionality.newWorkExperiences = []; - this.sharedAccordionFunctionality.calculateCareerWorkExperienceFormProgress(); - this.sharedAccordionFunctionality.totalCareerProgress(); } showDialog(newOrUpdate: string, index: number) { @@ -220,13 +214,9 @@ export class AccordionCareerWorkExperienceComponent { this.copyOfWorkExperience.splice(index, 1); this.sharedAccordionFunctionality.workExperience.splice(index, 1); this.sharedAccordionFunctionality.workExperienceFormFields = this.sharedAccordionFunctionality.workExperienceFormFields - 7; - this.sharedAccordionFunctionality.calculateCareerWorkExperienceFormProgress(); - this.sharedAccordionFunctionality.totalCareerProgress(); this.editWorkExperience = false; }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Delete Experience", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }); } @@ -246,13 +236,11 @@ export class AccordionCareerWorkExperienceComponent { this.addingWorkExperience = false; this.sharedAccordionFunctionality.newWorkExperiences = []; this.getWorkExperience(); - this.sharedAccordionFunctionality.calculateCareerWorkExperienceFormProgress(); - this.sharedAccordionFunctionality.totalCareerProgress(); } }, - error: (error) => { + error: (er) => { errorOccurred = true; - this.snackBarService.showSnackbar("Unable to Add Work Experience", "snack-error"); + this.snackBarService.showError(er); this.addingWorkExperience = false; this.editWorkExperience = false; } @@ -272,12 +260,8 @@ export class AccordionCareerWorkExperienceComponent { this.snackBarService.showSnackbar("Updated", "snack-success"); this.hasUpdatedWorkExperience = true; this.getWorkExperience(); - this.sharedAccordionFunctionality.calculateCareerWorkExperienceFormProgress(); - this.sharedAccordionFunctionality.totalCareerProgress(); }, - error: () => { - this.snackBarService.showSnackbar("Unable to Update All Fields", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }); } } diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-certificates/accordion-certificates.component.html b/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-certificates/accordion-certificates.component.html index 6d094111c..c0ab9f0f3 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-certificates/accordion-certificates.component.html +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-certificates/accordion-certificates.component.html @@ -74,7 +74,8 @@

{{sharedAccordionFunctionality.empl Issue date + [value]="copyOfCertificates[i].issueDate" + [matDatepickerFilter]="disableFutureDates"> @@ -171,7 +172,8 @@

{{newCertificates[i].certificateName}}

Issue date + [value]="newCertificates[i].issueDate" + [matDatepickerFilter]="disableFutureDates"> diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-certificates/accordion-certificates.component.ts b/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-certificates/accordion-certificates.component.ts index b7edbffa3..434dc25fc 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-certificates/accordion-certificates.component.ts +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-certificates/accordion-certificates.component.ts @@ -72,12 +72,8 @@ export class AccordionCertificatesComponent { next: (data) => { this.sharedAccordionFunctionality.employeeCertificates = data; this.sharedAccordionFunctionality.employeeCertificatesFields = this.sharedAccordionFunctionality.employeeCertificatesFields * this.sharedAccordionFunctionality.employeeCertificates.length; - this.sharedAccordionFunctionality.calculateCareerCertificatesFormProgress(); - this.sharedAccordionFunctionality.totalCareerProgress(); }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Fetch Certificates", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }); } @@ -93,8 +89,6 @@ export class AccordionCertificatesComponent { employeeId: this.employeeProfile.id as number } this.newCertificates.push(newCertificate); - this.sharedAccordionFunctionality.calculateCareerCertificatesFormProgress(); - this.sharedAccordionFunctionality.totalCareerProgress(); } findDifferenceInArrays(): EmployeeCertificates[] { @@ -131,13 +125,11 @@ export class AccordionCertificatesComponent { this.addingCertificate = false; this.newCertificates = []; this.getEmployeeCertificate(); - this.sharedAccordionFunctionality.calculateCareerCertificatesFormProgress(); - this.sharedAccordionFunctionality.totalCareerProgress(); } }, - error: (error) => { + error: (er) => { errorOccurred = true; - this.snackBarService.showSnackbar("Unable to Update All Fields", "snack-error"); + this.snackBarService.showError(er); this.addingCertificate = false; this.editCertificate = false; } @@ -158,9 +150,7 @@ export class AccordionCertificatesComponent { this.hasUpdatedCertificateData = true; this.getEmployeeCertificate(); }, - error: () => { - this.snackBarService.showSnackbar("Unable to Update All Fields", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }); } @@ -239,13 +229,9 @@ export class AccordionCertificatesComponent { this.copyOfCertificates.splice(index, 1); this.sharedAccordionFunctionality.employeeCertificates.splice(index, 1); this.sharedAccordionFunctionality.employeeCertificatesFields = this.sharedAccordionFunctionality.employeeCertificatesFields - 4; - this.sharedAccordionFunctionality.calculateCareerCertificatesFormProgress(); - this.sharedAccordionFunctionality.totalCareerProgress(); this.editCertificate = false; }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Delete Certificate", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }); } @@ -295,4 +281,11 @@ export class AccordionCertificatesComponent { }); reader.readAsDataURL(file); } + + currentDate: Date = new Date(); + + disableFutureDates = (selectedDate: Date | null): boolean => { + const date = (selectedDate || new Date()); + return date <= this.currentDate; + } } \ No newline at end of file diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-salary-details/accordion-salary-details.component.ts b/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-salary-details/accordion-salary-details.component.ts index 5ede5065b..3d6a33fcc 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-salary-details/accordion-salary-details.component.ts +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-career-summary/accordion-salary-details/accordion-salary-details.component.ts @@ -89,9 +89,7 @@ export class AccordionSalaryDetailsComponent { this.initializeSalaryDetailsForm(this.employeeSalary, data.taxNumber); this.getEmployeeSalaryDetails(data.taxNumber); }, - error: (error) => { - this.snackBarService.showSnackbar("Error fetching salary details", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }) } } @@ -105,9 +103,7 @@ export class AccordionSalaryDetailsComponent { this.sharedAccordionFunctionality.calculateSalaryDetails(); this.sharedAccordionFunctionality.totalCareerProgress(); }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Fetch Salary Details", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }) } else { @@ -116,9 +112,7 @@ export class AccordionSalaryDetailsComponent { this.employeeSalary = data; this.initializeSalaryDetailsForm(this.employeeSalary, taxNumber); }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Fetch Salary Details", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }) } } @@ -192,9 +186,7 @@ export class AccordionSalaryDetailsComponent { this.sharedAccordionFunctionality.calculateSalaryDetails(); this.sharedAccordionFunctionality.totalCareerProgress(); }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Update Salary Information", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }), this.employeeService.updateEmployee(this.employeeProfile).subscribe({ next: (data) => { @@ -212,9 +204,7 @@ export class AccordionSalaryDetailsComponent { this.sharedAccordionFunctionality.calculateSalaryDetails(); this.sharedAccordionFunctionality.totalCareerProgress(); }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Save Salary Information", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }) } } diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-additional-documents/accordion-additional-documents.component.ts b/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-additional-documents/accordion-additional-documents.component.ts index 046ce9179..6cc1d1494 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-additional-documents/accordion-additional-documents.component.ts +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-additional-documents/accordion-additional-documents.component.ts @@ -31,6 +31,7 @@ export class AccordionDocumentsCustomDocumentsComponent { fileCategories = []; unarchivedCustomDocuments: CustomField[] = []; + customFields: CustomField[] = []; roles: string[] = []; isLoadingUpload: boolean = false; uploadButtonIndex: number = 0; @@ -47,8 +48,8 @@ export class AccordionDocumentsCustomDocumentsComponent { employeeId = this.route.snapshot.params['id']; dataSource = new MatTableDataSource(this.fileCategories); infinity = Infinity; - selectedFieldCode: string = ''; + constructor( private customFieldService: CustomFieldService, private route: ActivatedRoute, @@ -77,9 +78,7 @@ export class AccordionDocumentsCustomDocumentsComponent { this.getDocumentFieldCodes(); this.sharedAccordionFunctionality.calculateAdditionalDocumentProgress(); }, - error: error => { - this.snackBarService.showSnackbar("Unable to Retrieve Additional Documents", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }); } else { this.employeeId = this.navService.employeeProfile.id; @@ -88,9 +87,7 @@ export class AccordionDocumentsCustomDocumentsComponent { this.sharedAccordionFunctionality.additionalDocuments = data; this.sharedAccordionFunctionality.calculateAdditionalDocumentProgress(); }, - error: error => { - this.snackBarService.showSnackbar("Unable to Retrieve Additional Documents", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }); } } @@ -136,7 +133,7 @@ export class AccordionDocumentsCustomDocumentsComponent { } else { this.unarchivedCustomDocuments.push(field); - this.unarchivedCustomDocuments = this.unarchivedCustomDocuments.filter((field: any) => field.category == this.sharedAccordionFunctionality.category[3].id) + this.customFields = this.unarchivedCustomDocuments.filter((field: any) => field.category == this.sharedAccordionFunctionality.category[3].id) } index++; }) @@ -205,9 +202,9 @@ export class AccordionDocumentsCustomDocumentsComponent { this.getAdditionalDocuments(); this.sharedAccordionFunctionality.calculateAdditionalDocumentProgress(); }, - error: (error: any) => { + error: (er: any) => { this.isLoadingUpload = false; - this.snackBarService.showSnackbar("Unable to Save Document", "snack-error"); + this.snackBarService.showError(er); } }) @@ -236,8 +233,8 @@ export class AccordionDocumentsCustomDocumentsComponent { this.sharedAccordionFunctionality.calculateAdditionalDocumentProgress(); }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Update Document", "snack-error"); + error: (er) => { + this.snackBarService.showError(er); this.isLoadingUpload = false; } }); diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-administrative-documents/accordion-administrative-documents.component.ts b/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-administrative-documents/accordion-administrative-documents.component.ts index fbf7148d3..af2e87e1e 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-administrative-documents/accordion-administrative-documents.component.ts +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-administrative-documents/accordion-administrative-documents.component.ts @@ -134,9 +134,7 @@ export class AccordionAdministrativeDocumentsComponent { this.sharedAccordionFunctionality.calculateAdminDocumentProgress(); this.sharedAccordionFunctionality.totalDocumentsProgress(); }, - error: error => { - this.snackBarService.showSnackbar("Unable to Retrieve Administrative Documents", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }); } else { this.employeeId = this.navService.employeeProfile.id; @@ -148,9 +146,7 @@ export class AccordionAdministrativeDocumentsComponent { this.sharedAccordionFunctionality.totalDocumentsProgress(); }, - error: error => { - this.snackBarService.showSnackbar("Unable to Retrieve Administrative Documents", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }); } } @@ -178,9 +174,9 @@ export class AccordionAdministrativeDocumentsComponent { this.sharedAccordionFunctionality.totalDocumentsProgress(); }, - error: (error) => { + error: (er) => { this.isLoadingUpload = false; - this.snackBarService.showSnackbar("Unable to Save Document", "snack-error"); + this.snackBarService.showError(er); } }); } else { @@ -209,8 +205,8 @@ export class AccordionAdministrativeDocumentsComponent { this.sharedAccordionFunctionality.totalDocumentsProgress(); }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Update Document", "snack-error"); + error: (er) => { + this.snackBarService.showError(er); this.isLoadingUpload = false; } }); diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-documents-starterkit/accordion-documents.component.ts b/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-documents-starterkit/accordion-documents.component.ts index 8abcab02a..d1cc2a97b 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-documents-starterkit/accordion-documents.component.ts +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-documents-starterkit/accordion-documents.component.ts @@ -119,9 +119,7 @@ export class AccordionDocumentsComponent { this.sharedAccordionFunctionality.calculateStarterKitDocuments(); this.sharedAccordionFunctionality.totalDocumentsProgress(); }, - error: error => { - this.snackBarService.showSnackbar("Unable to Retrieve Starter Kit Documents", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }) } else { this.employeeId = this.navService.employeeProfile.id; @@ -133,9 +131,7 @@ export class AccordionDocumentsComponent { this.sharedAccordionFunctionality.totalDocumentsProgress(); }, - error: error => { - this.snackBarService.showSnackbar("Unable to Retrieve Starter Kit Documents", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }) } @@ -162,9 +158,9 @@ export class AccordionDocumentsComponent { this.sharedAccordionFunctionality.totalDocumentsProgress(); this.employeeBankingandstarterkitService.getAllBankingAndStarterkits(); }, - error: (error) => { + error: (er) => { this.isLoadingUpload = false; - this.snackBarService.showSnackbar("Unable to Save Document", "snack-error"); + this.snackBarService.showError(er); } }); } else { @@ -193,8 +189,8 @@ export class AccordionDocumentsComponent { this.sharedAccordionFunctionality.totalDocumentsProgress(); this.employeeBankingandstarterkitService.getAllBankingAndStarterkits(); }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Update Document", "snack-error"); + error: (er) => { + this.snackBarService.showError(er); this.isLoadingUpload = false; } }); diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-employee-documents/accordion-employee-documents.component.ts b/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-employee-documents/accordion-employee-documents.component.ts index 364e73002..1baf37a35 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-employee-documents/accordion-employee-documents.component.ts +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-employee-documents/accordion-employee-documents.component.ts @@ -126,9 +126,7 @@ export class AccordionEmployeeDocumentsComponent { this.sharedAccordionFunctionality.calculateEmployeeDocumentProgress(); this.sharedAccordionFunctionality.totalDocumentsProgress(); }, - error: error => { - this.snackBarService.showSnackbar("Unable to Retrieve", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }); } else { this.employeeId = this.navService.employeeProfile.id; @@ -140,9 +138,7 @@ export class AccordionEmployeeDocumentsComponent { this.sharedAccordionFunctionality.totalDocumentsProgress(); }, - error: error => { - this.snackBarService.showSnackbar("Unable to Retrieve Employee Documents", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }); } } @@ -170,9 +166,9 @@ export class AccordionEmployeeDocumentsComponent { this.sharedAccordionFunctionality.totalDocumentsProgress(); }, - error: (error) => { + error: (er) => { this.isLoadingUpload = false; - this.snackBarService.showSnackbar("Unable to Save Document", "snack-error"); + this.snackBarService.showError(er); } }); } else { @@ -201,8 +197,8 @@ export class AccordionEmployeeDocumentsComponent { this.sharedAccordionFunctionality.totalDocumentsProgress(); }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Update Document", "snack-error"); + error: (er) => { + this.snackBarService.showError(er); this.isLoadingUpload = false; } }); diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-my-documents/accordion-my-documents.component.ts b/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-my-documents/accordion-my-documents.component.ts index 2a1ea795b..af006e5d5 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-my-documents/accordion-my-documents.component.ts +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-documents/accordion-my-documents/accordion-my-documents.component.ts @@ -127,9 +127,9 @@ export class AccordionDocumentsAdditionalComponent { this.snackBarService.showSnackbar("Saved", "snack-success"); this.getAdditionalDocuments(); }, - error: (error) => { + error: (er) => { this.isLoadingUpload = false; - this.snackBarService.showSnackbar("Unable to Upload Document", "snack-error"); + this.snackBarService.showError(er); } }); @@ -167,7 +167,7 @@ export class AccordionDocumentsAdditionalComponent { this.snackBarService.showSnackbar("Deleted", "snack-success"); this.getAdditionalDocuments(); }, - error: () => this.snackBarService.showSnackbar("Unable to Delete Document", "snack-warning") + error: (er) => this.snackBarService.showError(er), }); } @@ -179,9 +179,7 @@ export class AccordionDocumentsAdditionalComponent { this.dataSource.data = this.fileCategories; this.getAdditionalDocumentReferences(); }, - error: error => { - this.snackBarService.showSnackbar("Unable to Retrieve Employee Documents", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }) } else { this.employeeId = this.navService.employeeProfile.id; @@ -192,9 +190,7 @@ export class AccordionDocumentsAdditionalComponent { this.getAdditionalDocumentReferences(); }, - error: error => { - this.snackBarService.showSnackbar("Unable to Retrieve Employee Documents", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }) } } diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-career-additional-information/accordion-career-additional-information.component.ts b/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-career-additional-information/accordion-career-additional-information.component.ts index 8d4ffe295..e33f2877b 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-career-additional-information/accordion-career-additional-information.component.ts +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-career-additional-information/accordion-career-additional-information.component.ts @@ -83,9 +83,8 @@ export class AccordionCareerAdditionalInformationComponent { this.getAllEmployees(); } this.getEmployeeFieldCodes(); - }, error: () => { - this.snackBarService.showSnackbar("Unable to Fetch User Profile", "snack-error"); - } + }, + error: (er) => this.snackBarService.showError(er), }) } } @@ -195,7 +194,7 @@ export class AccordionCareerAdditionalInformationComponent { this.getEmployeeData(); this.updateEmployeeProfile.emit(1); }, - error: (error) => { this.snackBarService.showSnackbar("Unable to Update Career Information", "snack-error") }, + error: (er) => this.snackBarService.showError(er), }); } else { const formatFound: any = fieldcode?.code @@ -217,9 +216,7 @@ export class AccordionCareerAdditionalInformationComponent { this.getEmployeeData(); this.updateEmployeeProfile.emit(1); }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Save Career Information", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }); } } diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-additional-details/accordion-profile-additional.component.ts b/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-additional-details/accordion-profile-additional.component.ts index 900952a53..63eb543b2 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-additional-details/accordion-profile-additional.component.ts +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-additional-details/accordion-profile-additional.component.ts @@ -21,12 +21,12 @@ import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-accordion-profile-additional', templateUrl: './accordion-profile-additional.component.html', - styleUrls: [ './accordion-profile-additional.component.css' ] + styleUrls: ['./accordion-profile-additional.component.css'] }) export class AccordionProfileAdditionalComponent { screenWidth = window.innerWidth; - @HostListener('window:resize', [ '$event' ]) + @HostListener('window:resize', ['$event']) usingProfile: boolean = true; onResize() { @@ -37,8 +37,10 @@ export class AccordionProfileAdditionalComponent { @Input() employeeProfile!: { employeeDetails: EmployeeProfile, simpleEmployee: SimpleEmployee } customFields: CustomField[] = []; + unarchivedCustomDocuments: CustomField[] = []; additionalFormProgress: number = 0; - employeeId : number | undefined; + fieldCodeStatus: number = -1; + employeeId: number | undefined; loggedInProfile!: EmployeeProfile | SimpleEmployee; constructor( @@ -77,16 +79,16 @@ export class AccordionProfileAdditionalComponent { this.employeeProfileService.getEmployeeById(this.employeeProfile.employeeDetails.id as number).subscribe({ next: data => { this.employeeProfile.employeeDetails = data; - }, complete: () => { + }, + complete: () => { this.getEmployeeData(); this.getEmployeeTypes(); if (this.authAccessService.isAdmin() || this.authAccessService.isSuperAdmin() || this.authAccessService.isJourney() || this.authAccessService.isTalent()) { this.getAllEmployees(); } this.getEmployeeFieldCodes(); - }, error: () => { - this.snackBarService.showSnackbar("Unable to Fetch User Profile", "snack-error"); - } + }, + error: (er) => this.snackBarService.showError(er), }) } } @@ -133,11 +135,26 @@ export class AccordionProfileAdditionalComponent { getEmployeeFieldCodes() { this.customFieldService.getAllFieldCodes().subscribe({ next: data => { - this.customFields = data.filter((data: CustomField) => data.category === this.sharedAccordionFunctionality.category[ 0 ].id); this.checkAdditionalInformation(); this.sharedAccordionFunctionality.checkAdditionalFormProgress(); this.sharedAccordionFunctionality.totalProfileProgress(); + this.checkArchived(data); + } + }) + } + + checkArchived(fields: CustomField[]) { + this.unarchivedCustomDocuments = []; + var index = 0; + fields.forEach((field) => { + if (this.fieldCodeStatus == field.status && field.category === 0) { + fields.splice(index, 1); + } + else { + this.unarchivedCustomDocuments.push(field); + this.customFields = this.unarchivedCustomDocuments.filter((field: any) => field.category == this.sharedAccordionFunctionality.category[0].id) } + index++; }) } @@ -146,10 +163,10 @@ export class AccordionProfileAdditionalComponent { this.customFields.forEach(fieldName => { if (fieldName.code != null || fieldName.code != undefined) { const customData = this.sharedAccordionFunctionality.employeeData.filter((data: EmployeeData) => data.fieldCodeId === fieldName.id) - formGroupConfig[ fieldName.code ] = new FormControl({ value: customData[ 0 ] ? customData[ 0 ].value : '', disabled: true }); + formGroupConfig[fieldName.code] = new FormControl({ value: customData[0] ? customData[0].value : '', disabled: true }); this.sharedAccordionFunctionality.additionalInfoForm = this.fb.group(formGroupConfig); if (fieldName.required == true) { - this.sharedAccordionFunctionality.additionalInfoForm.controls[ fieldName.code ].setValidators(Validators.required); + this.sharedAccordionFunctionality.additionalInfoForm.controls[fieldName.code].setValidators(Validators.required); } this.sharedAccordionFunctionality.additionalInfoForm.disable(); } @@ -182,7 +199,7 @@ export class AccordionProfileAdditionalComponent { const formatFound: any = fieldcode.code const employeeDataDto = { id: found.id, - employeeId: this.employeeId != undefined ? this.employeeId: this.loggedInProfile.id!, + employeeId: this.employeeId != undefined ? this.employeeId : this.loggedInProfile.id!, fieldcodeId: found.fieldCodeId, value: this.sharedAccordionFunctionality.additionalInfoForm.get(formatFound)?.value } @@ -197,13 +214,13 @@ export class AccordionProfileAdditionalComponent { this.getEmployeeData(); this.updateEmployeeProfile.emit(1); }, - error: (error) => { this.snackBarService.showSnackbar("Unable to Update Additional Information", "snack-error") }, + error: (er) => this.snackBarService.showError(er), }); } else { const formatFound: any = fieldcode?.code const employeeDataDto = { id: 0, - employeeId: this.employeeId != undefined ? this.employeeId: this.loggedInProfile.id!, + employeeId: this.employeeId != undefined ? this.employeeId : this.loggedInProfile.id!, fieldcodeId: fieldcode.id, value: this.sharedAccordionFunctionality.additionalInfoForm.get(formatFound)?.value } @@ -219,9 +236,7 @@ export class AccordionProfileAdditionalComponent { this.getEmployeeData(); this.updateEmployeeProfile.emit(1); }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Save Additional Information", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }); } } @@ -241,17 +256,17 @@ export class AccordionProfileAdditionalComponent { case PropertyAccessLevel.none: if (!initialLoad) control.disable(); - this.sharedPropertyAccessService.employeeProfilePermissions[ fieldName ] = false; + this.sharedPropertyAccessService.employeeProfilePermissions[fieldName] = false; break; case PropertyAccessLevel.read: if (!initialLoad) control.disable(); - this.sharedPropertyAccessService.employeeProfilePermissions[ fieldName ] = true; + this.sharedPropertyAccessService.employeeProfilePermissions[fieldName] = true; break; case PropertyAccessLevel.write: if (!initialLoad) control.enable(); - this.sharedPropertyAccessService.employeeProfilePermissions[ fieldName ] = true; + this.sharedPropertyAccessService.employeeProfilePermissions[fieldName] = true; break; default: if (!initialLoad) diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-address-details/accordion-profile-address-details.component.html b/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-address-details/accordion-profile-address-details.component.html index e51860d40..e7f4f191d 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-address-details/accordion-profile-address-details.component.html +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-address-details/accordion-profile-address-details.component.html @@ -39,19 +39,19 @@ -
- Suburb/District - + City/Town + {{ city }}
-
+
- City/Town - + Suburb/District +
@@ -143,19 +143,19 @@
-
- Suburb/District - + City/Town + {{ city }}
-
+
- City/Town - + Suburb/District +
diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-address-details/accordion-profile-address-details.component.ts b/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-address-details/accordion-profile-address-details.component.ts index 21086fe1f..c24941c88 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-address-details/accordion-profile-address-details.component.ts +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-address-details/accordion-profile-address-details.component.ts @@ -81,8 +81,8 @@ export class AccordionProfileAddressDetailsComponent { physicalComplexName: [this.employeeProfile!.employeeDetails.physicalAddress?.complexName?.trim()], physicalStreetNumber: [this.employeeProfile!.employeeDetails.physicalAddress?.streetNumber?.trim(), [Validators.required, Validators.pattern(/^[0-9]*$/)]], physicalStreetName: [this.employeeProfile!.employeeDetails.physicalAddress?.streetName?.trim(), Validators.required], - physicalSuburb: [this.employeeProfile!.employeeDetails.physicalAddress?.suburbOrDistrict?.trim(), Validators.required], physicalCity: [this.employeeProfile!.employeeDetails.physicalAddress?.city?.trim(), Validators.required], + physicalSuburb: [this.employeeProfile!.employeeDetails.physicalAddress?.suburbOrDistrict?.trim()], physicalCountry: [this.employeeProfile!.employeeDetails.physicalAddress?.country?.trim(), Validators.required], physicalProvince: [this.employeeProfile!.employeeDetails.physicalAddress?.province?.trim(), Validators.required], physicalPostalCode: [this.employeeProfile!.employeeDetails.physicalAddress?.postalCode?.trim(), [Validators.required, Validators.pattern(/^[0-9]*$/), Validators.maxLength(4), Validators.minLength(4)]], @@ -90,8 +90,8 @@ export class AccordionProfileAddressDetailsComponent { postalComplexName: [this.employeeProfile!.employeeDetails.postalAddress?.complexName?.trim()], postalStreetNumber: [this.employeeProfile!.employeeDetails.postalAddress?.streetNumber?.trim(), [Validators.required, Validators.pattern(/^[0-9]*$/)]], postalStreetName: [this.employeeProfile!.employeeDetails.postalAddress?.streetName?.trim(), Validators.required], - postalSuburb: [this.employeeProfile!.employeeDetails.postalAddress?.suburbOrDistrict?.trim(), Validators.required], postalCity: [this.employeeProfile!.employeeDetails.postalAddress?.city?.trim(), Validators.required], + postalSuburb: [this.employeeProfile!.employeeDetails.postalAddress?.suburbOrDistrict?.trim()], postalCountry: [this.employeeProfile!.employeeDetails.postalAddress?.country?.trim(), Validators.required], postalProvince: [this.employeeProfile!.employeeDetails.postalAddress?.province?.trim(), Validators.required], postalPostalCode: [this.employeeProfile!.employeeDetails.postalAddress?.postalCode?.trim(), [Validators.required, Validators.pattern(/^[0-9]*$/), Validators.maxLength(4), Validators.minLength(4)]] @@ -110,8 +110,8 @@ export class AccordionProfileAddressDetailsComponent { postalComplexName: this.sharedAccordionFunctionality.addressDetailsForm.get('physicalComplexName')?.value, postalStreetNumber: this.sharedAccordionFunctionality.addressDetailsForm.get('physicalStreetNumber')?.value, postalStreetName: this.sharedAccordionFunctionality.addressDetailsForm.get('physicalStreetName')?.value, - postalSuburb: this.sharedAccordionFunctionality.addressDetailsForm.get('physicalSuburb')?.value, postalCity: this.sharedAccordionFunctionality.addressDetailsForm.get('physicalCity')?.value, + postalSuburb: this.sharedAccordionFunctionality.addressDetailsForm.get('physicalSuburb')?.value, postalCountry: this.sharedAccordionFunctionality.addressDetailsForm.get('physicalCountry')?.value, postalProvince: this.sharedAccordionFunctionality.addressDetailsForm.get('physicalProvince')?.value, postalPostalCode: this.sharedAccordionFunctionality.addressDetailsForm.get('physicalPostalCode')?.value @@ -127,8 +127,8 @@ export class AccordionProfileAddressDetailsComponent { complexName: addressDetailFormValue['physicalComplexName'], streetName: addressDetailFormValue['physicalStreetName'], streetNumber: addressDetailFormValue['physicalStreetNumber'], - suburbOrDistrict: addressDetailFormValue['physicalSuburb'], city: addressDetailFormValue['physicalCity'], + suburbOrDistrict: addressDetailFormValue['physicalSuburb'], country: addressDetailFormValue['physicalCountry'], province: addressDetailFormValue['physicalProvince'], postalCode: addressDetailFormValue['physicalPostalCode'], @@ -140,8 +140,8 @@ export class AccordionProfileAddressDetailsComponent { complexName: this.sharedAccordionFunctionality.physicalEqualPostal ? addressDetailFormValue['physicalComplexName'] : addressDetailFormValue['postalComplexName'], streetNumber: this.sharedAccordionFunctionality.physicalEqualPostal ? addressDetailFormValue['physicalStreetNumber'] : addressDetailFormValue['postalStreetNumber'], streetName: this.sharedAccordionFunctionality.physicalEqualPostal ? addressDetailFormValue['physicalStreetName'] : addressDetailFormValue['postalStreetName'], - suburbOrDistrict: this.sharedAccordionFunctionality.physicalEqualPostal ? addressDetailFormValue['physicalSuburb'] : addressDetailFormValue['postalSuburb'], city: this.sharedAccordionFunctionality.physicalEqualPostal ? addressDetailFormValue['physicalCity'] : addressDetailFormValue['postalCity'], + suburbOrDistrict: this.sharedAccordionFunctionality.physicalEqualPostal ? addressDetailFormValue['physicalSuburb'] : addressDetailFormValue['postalSuburb'], country: this.sharedAccordionFunctionality.physicalEqualPostal ? addressDetailFormValue['physicalCountry'] : addressDetailFormValue['postalCountry'], province: this.sharedAccordionFunctionality.physicalEqualPostal ? addressDetailFormValue['physicalProvince'] : addressDetailFormValue['postalProvince'], postalCode: this.sharedAccordionFunctionality.physicalEqualPostal ? addressDetailFormValue['physicalPostalCode'] : addressDetailFormValue['postalPostalCode'], @@ -161,14 +161,10 @@ export class AccordionProfileAddressDetailsComponent { this.getEmployeeFields(); this.sharedAccordionFunctionality.editAddress = false; }, - error: (error: any) => { - this.snackBarService.showSnackbar("Unable to Update Address Information", "snack-error"); - }, + error: (er) => this.snackBarService.showError(er), }); }, - error: (error: any) => { - this.snackBarService.showSnackbar("Unable to Update Address Information", "snack-error"); - }, + error: (er: any) => this.snackBarService.showError(er), }); } else { this.snackBarService.showSnackbar("Some Fields Are Still Missing Information", "snack-error"); @@ -224,74 +220,91 @@ export class AccordionProfileAddressDetailsComponent { loadPhysicalAddress() { this.locationApiService.getCountries().subscribe({ - next: (data) => { - this.countries = data - }, - error: (error: any) => { - this.snackBarService.showSnackbar('Unable to Load Countries', "snack-error") - }, - complete: () => { - this.selectedCountry = this.employeeProfile!.employeeDetails.physicalAddress?.country! - if(this.selectedCountry == " ") - { - return; - } - this.locationApiService.getProvinces(this.selectedCountry).subscribe({ - next: (data) => this.provinces = data, - error: (error: any) => { - this.snackBarService.showSnackbar('Unable to Load Provinces', "snack-error") - }, - complete: () => { - this.selectedProvince = this.employeeProfile!.employeeDetails.physicalAddress?.province! + next: (data) => { + if (!data || data.length === 0) { + return; + } + this.countries = data; + this.selectedCountry = this.employeeProfile?.employeeDetails.physicalAddress?.country || ''; + if (!this.selectedCountry.trim()) { + return; + } this.locationApiService.getProvinces(this.selectedCountry).subscribe({ - next: (data) => this.provinces = data, - complete: () => { - this.locationApiService.getCities(this.selectedCountry, this.selectedProvince).subscribe({ - next: (data) => this.cities = data, - }); - } + next: (data) => { + if (!data || data.length === 0) { + return; + } + this.provinces = data; + this.selectedProvince = this.employeeProfile?.employeeDetails.physicalAddress?.province || ''; + if (this.selectedProvince) { + this.locationApiService.getCities(this.selectedCountry, this.selectedProvince).subscribe({ + next: (data) => { + if (!data || data.length === 0) { + return; + } + this.cities = data; + }, + error: (error: any) => { + this.snackBarService.showSnackbar('Unable to Load Cities', "snack-error"); + } + }); + } + }, + error: (error: any) => { + this.snackBarService.showSnackbar('Unable to Load Provinces', "snack-error"); + } }); - } - }) - } - }) + }, + error: (error: any) => { + this.snackBarService.showSnackbar('Unable to Load Countries', "snack-error"); + } + }); } loadPostalAddress() { this.locationApiService.getCountries().subscribe({ - next: (data) => { - this.postalCountries = data - }, - error: (error: any) => { - this.snackBarService.showSnackbar('Unable to Load Countries', "snack-error") - }, - complete: () => { - this.selectedPostalCountry = this.employeeProfile!.employeeDetails.postalAddress?.country! - if(this.selectedPostalCountry == " ") - { - return; - } - this.locationApiService.getProvinces(this.selectedPostalCountry).subscribe({ - next: (data) => this.postalProvinces = data, - error: (error: any) => { - this.snackBarService.showSnackbar('Unable to Load Provinces', "snack-error") - }, - complete: () => { - this.selectedPostalProvince = this.employeeProfile!.employeeDetails.postalAddress?.province! + next: (data) => { + if (!data || data.length === 0) { + return; + } + this.postalCountries = data; + this.selectedPostalCountry = this.employeeProfile?.employeeDetails.postalAddress?.country || ''; + if (!this.selectedPostalCountry.trim()) { + return; + } this.locationApiService.getProvinces(this.selectedPostalCountry).subscribe({ - next: (data) => this.postalProvinces = data, - complete: () => { - this.locationApiService.getCities(this.selectedPostalCountry, this.selectedPostalProvince).subscribe({ - next: (data) => this.postalCities = data, - }); - } + next: (data) => { + if (!data || data.length === 0) { + return; + } + this.postalProvinces = data; + this.selectedPostalProvince = this.employeeProfile?.employeeDetails.postalAddress?.province || ''; + if (this.selectedPostalProvince) { + this.locationApiService.getCities(this.selectedPostalCountry, this.selectedPostalProvince).subscribe({ + next: (data) => { + if (!data || data.length === 0) { + return; + } + this.postalCities = data; + }, + error: (error: any) => { + this.snackBarService.showSnackbar('Unable to Load Cities', "snack-error"); + } + }); + } + }, + error: (error: any) => { + this.snackBarService.showSnackbar('Unable to Load Provinces', "snack-error"); + } }); - } - }) - } - }) + }, + error: (error: any) => { + this.snackBarService.showSnackbar('Unable to Load Countries', "snack-error"); + } + }); } + getEmployeeData() { if (this.employeeId != undefined) { this.employeeDataService.getEmployeeData(this.employeeId).subscribe({ @@ -361,9 +374,8 @@ export class AccordionProfileAddressDetailsComponent { } this.getEmployeeFieldCodes(); this.initializeForm(); - }, error: () => { - this.snackBarService.showSnackbar("Unable to Fetch User Profile", "snack-error"); - } + }, + error: (er) => this.snackBarService.showError(er), }) } } diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-contact-details/accordion-profile-contact-details.component.html b/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-contact-details/accordion-profile-contact-details.component.html index a392a4a9b..ce280b9fd 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-contact-details/accordion-profile-contact-details.component.html +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-contact-details/accordion-profile-contact-details.component.html @@ -41,7 +41,7 @@
- Work email + Work Email @@ -81,7 +81,7 @@
- Home Number + Alternative Number - Emergency contact name + Emergency Contact Name @@ -119,7 +119,7 @@
- Emergency contact number + Emergency Contact Number { this.snackBarService.showSnackbar("Unable to Save Contact Information", "snack-error") }, + error: (er) => this.snackBarService.showError(er), }); } else { diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-employee-details/accordion-profile-employee-details.component.ts b/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-employee-details/accordion-profile-employee-details.component.ts index 64ef8dbba..e3ff4fa10 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-employee-details/accordion-profile-employee-details.component.ts +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-employee-details/accordion-profile-employee-details.component.ts @@ -248,9 +248,7 @@ export class AccordionProfileEmployeeDetailsComponent { this.sharedAccordionFunctionality.employeeDetailsForm.disable(); this.navService.refreshEmployee(); }, - error: () => { - this.snackBarService.showSnackbar("Unable to Update Employee Details", "snack-error"); - } + error: (er) => this.snackBarService.showError(er), }); } else { this.snackBarService.showSnackbar("ID Number Already in Use", "snack-error"); @@ -377,7 +375,8 @@ export class AccordionProfileEmployeeDetailsComponent { this.sharedAccordionFunctionality.employeePostalAddress = data.postalAddress!; this.sharedAccordionFunctionality.hasDisability = data.disability; this.sharedAccordionFunctionality.hasDisability = this.employeeProfile!.employeeDetails.disability; - }, complete: () => { + }, + complete: () => { this.getEmployeeData(); this.getEmployeeTypes(); if (this.authAccessService.isAdmin() || this.authAccessService.isSuperAdmin() || this.authAccessService.isJourney() || this.authAccessService.isTalent()) { @@ -385,9 +384,8 @@ export class AccordionProfileEmployeeDetailsComponent { } this.getEmployeeFieldCodes(); this.initializeForm(); - }, error: () => { - this.snackBarService.showSnackbar("Unable to Fetch User Profile", "snack-error"); - } + }, + error: (er) => this.snackBarService.showError(er), }) } } diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-personal-details/accordion-profile-personal-details.component.html b/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-personal-details/accordion-profile-personal-details.component.html index b420cad7c..7a1954388 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-personal-details/accordion-profile-personal-details.component.html +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-personal-details/accordion-profile-personal-details.component.html @@ -69,18 +69,18 @@

-
+
Disability - - + + {{disability.value}}
-
+
diff --git a/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-personal-details/accordion-profile-personal-details.component.ts b/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-personal-details/accordion-profile-personal-details.component.ts index ad59a3d1f..f822e6eba 100644 --- a/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-personal-details/accordion-profile-personal-details.component.ts +++ b/src/app/components/hris/employees/employee-profile/accordions/accordion-profile/accordion-profile-personal-details/accordion-profile-personal-details.component.ts @@ -9,6 +9,8 @@ import { SnackbarService } from 'src/app/services/shared-services/snackbar-servi import { SharedAccordionFunctionality } from '../../../shared-accordion-functionality'; import { PropertyAccessLevel } from 'src/app/models/hris/constants/enums/property-access-levels.enum'; import { LocationApiService } from 'src/app/services/hris/location-api.service'; +import { GenericDropDownObject } from 'src/app/models/hris/generic-drop-down-object.interface'; +import { disabilities } from 'src/app/models/hris/constants/disabilities.constant'; @Component({ selector: 'app-accordion-profile-personal-details', @@ -19,6 +21,7 @@ export class AccordionProfilePersonalDetailsComponent { screenWidth = window.innerWidth; countries: string[] = []; + isCustomType: boolean = false; @HostListener('window:resize', ['$event']) usingProfile: boolean = true; @@ -30,15 +33,46 @@ export class AccordionProfilePersonalDetailsComponent { this.usingProfile = this.employeeProfile!.simpleEmployee == undefined; this.initializeForm(); this.loadCountries(); + this.checkDisabilityType(); + + this.sharedAccordionFunctionality.personalDetailsForm.get('disability')?.valueChanges.subscribe(value => { + const disabilityNotesControl = this.sharedAccordionFunctionality.personalDetailsForm.get('disabilityType'); + if (value === true) { + disabilityNotesControl?.setValidators([Validators.required]); + } else { + disabilityNotesControl?.clearValidators(); + } + disabilityNotesControl?.updateValueAndValidity(); + }); + + this.sharedAccordionFunctionality.personalDetailsForm.get('disabilityType')?.valueChanges.subscribe(value => { + const disabilityNotesControl = this.sharedAccordionFunctionality.personalDetailsForm.get('disabilityNotes'); + if (value == 'Other') { + disabilityNotesControl?.setValidators([Validators.required]); + } else { + disabilityNotesControl?.clearValidators(); + } + disabilityNotesControl?.updateValueAndValidity(); + }); } @Input() employeeProfile!: { employeeDetails: EmployeeProfile, simpleEmployee: SimpleEmployee } + checkDisabilityType(){ + if(disabilities.map(x => x.value).includes(this.employeeProfile.employeeDetails.disabilityNotes!)){ + this.isCustomType = false; + } + else{ + this.isCustomType = true + } + } + initializeForm() { this.sharedAccordionFunctionality.personalDetailsForm = this.fb.group({ gender: [this.employeeProfile!.employeeDetails.gender, Validators.required], race: [this.employeeProfile!.employeeDetails.race, Validators.required], disability: [this.employeeProfile!.employeeDetails.disability, Validators.required], + disabilityType: [!this.isCustomType ? this.employeeProfile.employeeDetails.disabilityNotes: "Other"], nationality: [this.employeeProfile!.employeeDetails.nationality, Validators.required], countryOfBirth: [this.employeeProfile!.employeeDetails.countryOfBirth, Validators.required], disabilityList: "", @@ -122,11 +156,25 @@ export class AccordionProfilePersonalDetailsComponent { this.sharedAccordionFunctionality.hasDisability = event.value; } + setTypeOther(event: any) { + if(event.source.value == 'Other'){ + this.sharedAccordionFunctionality.typeOther = true; + } + else{ + this.sharedAccordionFunctionality.typeOther = false; + } + } + savePersonalEdit() { if (this.sharedAccordionFunctionality.personalDetailsForm.valid) { const personalDetailsFormValue = this.sharedAccordionFunctionality.personalDetailsForm.value; this.sharedAccordionFunctionality.employeeProfileDto!.disability = personalDetailsFormValue.disability; - this.sharedAccordionFunctionality.employeeProfileDto!.disabilityNotes = personalDetailsFormValue.disabilityNotes; + if(this.sharedAccordionFunctionality.typeOther == false){ + this.sharedAccordionFunctionality.employeeProfileDto!.disabilityNotes = personalDetailsFormValue.disabilityType; + } + else{ + this.sharedAccordionFunctionality.employeeProfileDto!.disabilityNotes = personalDetailsFormValue.disabilityNotes; + } this.sharedAccordionFunctionality.employeeProfileDto!.race = personalDetailsFormValue.race; this.sharedAccordionFunctionality.employeeProfileDto!.gender = personalDetailsFormValue.gender; this.sharedAccordionFunctionality.employeeProfileDto!.countryOfBirth = personalDetailsFormValue.countryOfBirth; @@ -140,9 +188,7 @@ export class AccordionProfilePersonalDetailsComponent { this.sharedAccordionFunctionality.personalDetailsForm.disable(); this.sharedAccordionFunctionality.editPersonal = false; }, - error: (error) => { - this.snackBarService.showSnackbar("Unable to Save Personal Information", "snack-error"); - }, + error: (er) => this.snackBarService.showError(er), }); } else { diff --git a/src/app/components/hris/employees/employee-profile/employee-profile.component.css b/src/app/components/hris/employees/employee-profile/employee-profile.component.css index fee495301..f41e628ee 100644 --- a/src/app/components/hris/employees/employee-profile/employee-profile.component.css +++ b/src/app/components/hris/employees/employee-profile/employee-profile.component.css @@ -132,6 +132,7 @@ font-weight: 500; line-height: 20px; letter-spacing: 0.1px; + cursor: pointer; } #profile-header { @@ -427,4 +428,8 @@ div.row { #overall-progress-bar { border-color: #0029C6; +} + +#progress-container{ + margin-top: 0.8rem !important; } \ No newline at end of file diff --git a/src/app/components/hris/employees/employee-profile/employee-profile.component.ts b/src/app/components/hris/employees/employee-profile/employee-profile.component.ts index 8e18ebaf9..e2e768a5e 100644 --- a/src/app/components/hris/employees/employee-profile/employee-profile.component.ts +++ b/src/app/components/hris/employees/employee-profile/employee-profile.component.ts @@ -179,10 +179,7 @@ export class EmployeeProfileComponent implements OnChanges { this.employeeId = this.authAccessService.getUserId(); } - if (this.authAccessService.isAdmin() || - this.authAccessService.isSuperAdmin() || - this.authAccessService.isJourney() || - this.authAccessService.isTalent()) { + if (this.authAccessService.isSupport()) { this.usingSimpleProfile = false; } else { @@ -219,9 +216,7 @@ export class EmployeeProfileComponent implements OnChanges { next: (data: EmployeeTermination) => { this.terminationData = data; }, - error: err => { - this.snackBarService.showSnackbar('Unable to Fetch Termination Details', err); - } + error: (er) => this.snackBarService.showError(er), }); } @@ -252,9 +247,7 @@ export class EmployeeProfileComponent implements OnChanges { } this.changeDetectorRef.detectChanges(); }, - error: (error: any) => { - this.snackBarService.showSnackbar("Unable to Retrieve Profile", 'snack-error'); - } + error: (er: any) => this.snackBarService.showError(er), }) } @@ -275,9 +268,7 @@ export class EmployeeProfileComponent implements OnChanges { if (!this.usingSimpleProfile) this.getAllEmployees(); }, - error: () => { - this.snackBarService.showSnackbar("Unable to Retrieve Profile", 'snack-error'); - } + error: (er: any) => this.snackBarService.showError(er), }) } @@ -297,7 +288,7 @@ export class EmployeeProfileComponent implements OnChanges { get basedInString(): string { let basedIn = ''; if (this.employeeProfile.physicalAddress !== undefined && this.employeeProfile.physicalAddress.suburbOrDistrict && this.employeeProfile.physicalAddress.suburbOrDistrict.length > 2) { - basedIn = `Based in ${this.employeeProfile.physicalAddress.suburbOrDistrict}`; + basedIn = `Based in ${this.employeeProfile.physicalAddress.city}`; } return basedIn; } @@ -421,9 +412,7 @@ export class EmployeeProfileComponent implements OnChanges { this.snackBarService.showSnackbar("Updated", "snack-success"); this.navService.refreshEmployee(); }, - error: () => { - this.snackBarService.showSnackbar('Unable to Update Employee Profile Picture', 'snack-error'); - } + error: (er) => this.snackBarService.showError(er), }); } diff --git a/src/app/components/hris/employees/employee-profile/shared-accordion-functionality.ts b/src/app/components/hris/employees/employee-profile/shared-accordion-functionality.ts index 73eab7bed..427eb538d 100644 --- a/src/app/components/hris/employees/employee-profile/shared-accordion-functionality.ts +++ b/src/app/components/hris/employees/employee-profile/shared-accordion-functionality.ts @@ -71,7 +71,6 @@ export class SharedAccordionFunctionality { fileMyDocumentCategories = MyDocumentTypes; employeeQualification!: EmployeeQualifications; - employeeQualificationDto: EmployeeQualifications = { id: 0, employeeId: 0, @@ -87,6 +86,7 @@ export class SharedAccordionFunctionality { panelOpenState: boolean = false; physicalEqualPostal: boolean = true; hasDisability: boolean | undefined = false; + typeOther: boolean | undefined = false; editEmployee: boolean = false; editPersonal: boolean = false; editAddress: boolean = false; @@ -432,86 +432,32 @@ export class SharedAccordionFunctionality { } calculateCareerAdditionalFormProgress() { - let filledCount = 0; + let numberOfPopulatedFields = 0; + let numberOfRequiredFields = 0; + const formControls = this.additionalCareerInfoForm.controls; - let totalFields = Object.keys(this.additionalCareerInfoForm.controls).length; + for (const controlName in formControls) { if (formControls.hasOwnProperty(controlName)) { const control = formControls[controlName]; - if (control.value != null && control.value != "") { - filledCount++; + let isRequired = false; + if (control.validator) { + const validator = control.validator({} as AbstractControl); + isRequired = validator && validator['required'] ? true : false; } - } - } - this.additionalCareerFormProgress = Math.round((filledCount / totalFields) * 100); - if (Number.isNaN(this.additionalCareerFormProgress)) { - this.additionalCareerFormProgress = 0; - } - } - - calculateCareerWorkExperienceFormProgress() { - let targetWorkExp: any = []; - let newTargetWorkExp: any = []; - this.filteredFilledWorkExp.length = 0; - this.workExperienceFormFields = 7 * this.workExperience.length; - - if (this.workExperience.length === 0) { - this.workExperienceFormFields = 0; - this.filteredFilledWorkExp.length = 0; - } - else { - for (const element of this.workExperience) { - targetWorkExp.push(element); - } - targetWorkExp.filter((element: any) => { - const { employeeId, id, ...samplearray } = element; - newTargetWorkExp.push(samplearray); - }); - - newTargetWorkExp.filter((obj: any) => Object.values(obj).some((value: any) => { - if (value.length !== 0) { - this.filteredFilledWorkExp.push(value) + if (isRequired) { + numberOfRequiredFields++; + if (control.value != null && control.value !== '') { + numberOfPopulatedFields++; + } } } - )); - } - - const FilledCount = this.filteredFilledWorkExp.length; - this.workExpFormProgress = FilledCount === 0 || this.workExperienceFormFields == 0 ? 0 - : Math.round((FilledCount / this.workExperienceFormFields) * 100); - } - - calculateCareerCertificatesFormProgress() { - let targetCertificates: any = []; - let newTargetCertificates: any = []; - this.filteredFilledCertificate.length = 0; - this.employeeCertificatesFields = 4 * this.employeeCertificates.length; - - if (this.employeeCertificates.length === 0) { - this.employeeCertificatesFields = 0; - this.filteredFilledCertificate.length = 0; } - else { - for (const element of this.employeeCertificates) { - targetCertificates.push(element); - } - - targetCertificates.filter((element: any) => { - const { employeeId, id, certificateDocument, ...samplearray } = element; - newTargetCertificates.push(samplearray); - }); - - newTargetCertificates.filter((obj: any) => Object.values(obj).some((value: any) => { - if (value.length !== 0) { - this.filteredFilledCertificate.push(value) - } - } - )); + if (numberOfRequiredFields === 0) { + this.additionalCareerFormProgress = 100; + } else { + this.additionalCareerFormProgress = Math.round((numberOfPopulatedFields / numberOfRequiredFields) * 100); } - - const FilledCount = this.filteredFilledCertificate.length; - this.certificateFormProgress = FilledCount === 0 || this.employeeCertificatesFields == 0 ? 0 - : Math.round((FilledCount / this.employeeCertificatesFields) * 100); } calculateSalaryDetails() { @@ -536,10 +482,10 @@ export class SharedAccordionFunctionality { totalCareerProgress() { if (this.additionalCareerFormProgress == Infinity) { - this.careerFormProgress = Math.floor((this.qualificationFormProgress + this.certificateFormProgress + this.workExpFormProgress + this.salaryDetailsFormProgress) / 4); + this.careerFormProgress = Math.floor((this.qualificationFormProgress + this.salaryDetailsFormProgress) / 2); } else { - this.careerFormProgress = Math.floor((this.additionalCareerFormProgress + this.qualificationFormProgress + this.certificateFormProgress + this.workExpFormProgress + this.salaryDetailsFormProgress) / 5); + this.careerFormProgress = Math.floor((this.additionalCareerFormProgress + this.qualificationFormProgress + this.salaryDetailsFormProgress) / 3); this.updateCareer.emit(this.careerFormProgress); } } diff --git a/src/app/components/hris/employees/employee-termination/employee-termination.component.ts b/src/app/components/hris/employees/employee-termination/employee-termination.component.ts index 8c6204081..63082c548 100644 --- a/src/app/components/hris/employees/employee-termination/employee-termination.component.ts +++ b/src/app/components/hris/employees/employee-termination/employee-termination.component.ts @@ -109,7 +109,7 @@ export class EmployeeTerminationComponent implements OnInit { }; this.employeeTerminationService.saveEmployeeTermination(employeeTerminationDto).subscribe({ next: () => this.snackBarService.showSnackbar("Employee Terminated", "snack-success"), - error: () => this.snackBarService.showSnackbar("Unable to Save Termination", 'snack-error'), + error: (er) => this.snackBarService.showError(er), complete: () => { this.router.navigateByUrl(nextPage); } diff --git a/src/app/components/hris/employees/new-employee/new-employee.component.html b/src/app/components/hris/employees/new-employee/new-employee.component.html index 194dbd507..2c3a706e2 100644 --- a/src/app/components/hris/employees/new-employee/new-employee.component.html +++ b/src/app/components/hris/employees/new-employee/new-employee.component.html @@ -147,7 +147,7 @@

Employee Details

Do you have any disabilities? - + {{ check ? "Yes" : "No"}} @@ -156,7 +156,13 @@

Employee Details

Disability is required
- + + Disability Types + + {{ type.value }} + + + Disability Notes @@ -272,7 +278,7 @@

Physical Address

Street Number - Street number must only contain numbers + Please enter a valid street number
@@ -550,7 +556,7 @@

Starter kits