From 5b834601eb18302e9d599eb41c0789f252b1eb03 Mon Sep 17 00:00:00 2001 From: mashfiq Date: Tue, 7 Jan 2025 14:14:49 +0600 Subject: [PATCH] EmployeeNo generation placed just before save --- HRM.UI/ClientApp/src/app/app.api.service.ts | 2 +- .../employee-profile.component.html | 2 +- .../employee-profile.component.ts | 26 +++--- .../general/general.component.html | 7 +- .../general/general.component.ts | 87 ++++++++++++------- .../employee-payroll-profile.component.html | 6 +- .../employee-payroll-profile.component.ts | 52 ++++++++--- 7 files changed, 117 insertions(+), 65 deletions(-) diff --git a/HRM.UI/ClientApp/src/app/app.api.service.ts b/HRM.UI/ClientApp/src/app/app.api.service.ts index c7c3109..f4a3f39 100644 --- a/HRM.UI/ClientApp/src/app/app.api.service.ts +++ b/HRM.UI/ClientApp/src/app/app.api.service.ts @@ -13,7 +13,7 @@ export class ApiService { public isSSO = false; public versionDeployement = false; - public versionNumber = `V-${GlobalfunctionExtension.generateVersionNumber(new Date(2024, 11, 29))}-`+"01"; + public versionNumber = `V-${GlobalfunctionExtension.generateVersionNumber(new Date(2025, 0, 7))}-`+"01"; public static BASE_URL = ''; public base_url = ''; // public currentLink = ''; diff --git a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/employee-profile.component.html b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/employee-profile.component.html index 3aa18a3..94af919 100644 --- a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/employee-profile.component.html +++ b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/employee-profile.component.html @@ -16,7 +16,7 @@
+ placeholder="Input Employee Id for new Employee.." id="txtempno" pInputText style="width:100%" type="text" [readOnly]="true">
diff --git a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/employee-profile.component.ts b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/employee-profile.component.ts index 8e8134c..0da1a2e 100644 --- a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/employee-profile.component.ts +++ b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/employee-profile.component.ts @@ -189,19 +189,19 @@ export class EmployeeProfileComponent implements OnInit { this.refreshEmployee(new HrEmployee()); - this.loadingPanel.ShowLoadingPanel = true; - this.employeeService.generateEmployeeNo().subscribe( - (resp) => { - this.employeeService.hrEmployee.employeeNo = resp as string; - }, - (err) => { - this.notificationService.showError(err); - this.loadingPanel.ShowLoadingPanel = false; - }, - () => { - this.loadingPanel.ShowLoadingPanel = false; - } - ); + // this.loadingPanel.ShowLoadingPanel = true; + // this.employeeService.generateEmployeeNo().subscribe( + // (resp) => { + // this.employeeService.hrEmployee.employeeNo = resp as string; + // }, + // (err) => { + // this.notificationService.showError(err); + // this.loadingPanel.ShowLoadingPanel = false; + // }, + // () => { + // this.loadingPanel.ShowLoadingPanel = false; + // } + // ); } else { this.employeeService.hrEmployee.employeeNo = undefined; diff --git a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.html b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.html index 320c1af..b15d497 100644 --- a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.html +++ b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.html @@ -172,7 +172,8 @@
@@ -359,7 +360,9 @@
-
diff --git a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.ts b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.ts index ad07fce..0564111 100644 --- a/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.ts +++ b/HRM.UI/ClientApp/src/app/core-hr/employee-profile/general/general.component.ts @@ -132,7 +132,7 @@ export class GeneralComponent implements OnInit { } ngOnInit() { - + this.employeePhoto = this.defaultPhoto; this.basicService.getAllReligion().subscribe( (resp: any) => { @@ -173,8 +173,8 @@ export class GeneralComponent implements OnInit { () => { }, () => { - this.defaultNationality=this.nationalities.find(x=>x.description.toLowerCase()=="bangladeshi"); - if(this.defaultNationality){ + this.defaultNationality = this.nationalities.find(x => x.description.toLowerCase() == "bangladeshi"); + if (this.defaultNationality) { this.hrEmployee.nationalityID = this.defaultNationality.id; } } @@ -386,6 +386,29 @@ export class GeneralComponent implements OnInit { } + public saveGeneratedEmployee() { + debugger + if (this.active == false) { + this.loadingPanel.ShowLoadingPanel = true; + this.employeeService.generateEmployeeNo().subscribe( + (resp) => { + this.employeeService.hrEmployee.employeeNo = resp as string; + }, + (err) => { + this.notificationService.showError(err); + this.loadingPanel.ShowLoadingPanel = false; + }, + () => { + this.loadingPanel.ShowLoadingPanel = false; setTimeout(() => { + this.SavePersonalInfo(); + }, 1000); + } + ); + } + else{ + this.SavePersonalInfo(); + } + } SavePersonalInfo() { // console.log(this.hrEmployee.banglaName); // return; @@ -415,7 +438,7 @@ export class GeneralComponent implements OnInit { }, () => { this.loadingPanel.ShowLoadingPanel = false; - this.isDisplay=false; + this.isDisplay = false; this.notificationService.showSuccess('Data save successfully'); if (this.selectedTinFiles !== null && this.selectedTinFiles !== undefined && this.selectedTinFiles.length > 0) { this.saveFile(this.hrEmployee.id, this.selectedTinFiles, enumEmpFileUploadType.TIN); @@ -451,7 +474,7 @@ export class GeneralComponent implements OnInit { }, () => { this.loadingPanel.ShowLoadingPanel = false; - this.isDisplay=false; + this.isDisplay = false; this.notificationService.showSuccess('Data Save successfully.'); this.employeeService.hrEmployee.contacts = []; this.employeeService.hrEmployee.contacts.push(this.contact); @@ -485,48 +508,48 @@ export class GeneralComponent implements OnInit { this.NIDFiles = undefined; } } - saveBanglaPersonalInformation(){ - const data ={ + saveBanglaPersonalInformation() { + const data = { employeeNo: this.employeeService.hrEmployee.employeeNo, banglaName: this.hrEmployee.banglaName, banglaSpouseName: this.hrEmployee.spouseNameBangla, banglaFathersName: this.hrEmployee.fatherNameBangla, banglaMothersName: this.hrEmployee.motherNameBangla } - this.loadingPanel.ShowLoadingPanel=true; + this.loadingPanel.ShowLoadingPanel = true; this.employeeService.updateBanglaInformation(data).subscribe( - (resp: any)=>{ + (resp: any) => { - },(err)=>{ - this.loadingPanel.ShowLoadingPanel=false; - this.notificationService.showError(err.error); - },() =>{ - this.loadingPanel.ShowLoadingPanel=false; - this.isDisplay=false; - this.notificationService.showSuccess("Bangla Information Updated Successfully!"); - } + }, (err) => { + this.loadingPanel.ShowLoadingPanel = false; + this.notificationService.showError(err.error); + }, () => { + this.loadingPanel.ShowLoadingPanel = false; + this.isDisplay = false; + this.notificationService.showSuccess("Bangla Information Updated Successfully!"); + } ) } - SaveBanglaContactInformation(){ - const data ={ + SaveBanglaContactInformation() { + const data = { employeeNo: this.employeeService.hrEmployee.employeeNo, presentPOInBangla: this.contact.presentPOInBangla, presentAddressInBangla: this.contact.presentAddressInBangla, parmanentPOInBangla: this.contact.parmanentPOInBangla, permanentAddressInBangla: this.contact.permanentAddressInBangla } - this.loadingPanel.ShowLoadingPanel=true; + this.loadingPanel.ShowLoadingPanel = true; this.employeeService.updateBanglaContactInformation(data).subscribe( - (resp: any)=>{ + (resp: any) => { - },(err)=>{ - this.loadingPanel.ShowLoadingPanel=false; - this.notificationService.showError(err.error); - },() =>{ - this.loadingPanel.ShowLoadingPanel=false; - this.isDisplay=false; - this.notificationService.showSuccess("Bangla Contact Information Updated Successfully!"); - } + }, (err) => { + this.loadingPanel.ShowLoadingPanel = false; + this.notificationService.showError(err.error); + }, () => { + this.loadingPanel.ShowLoadingPanel = false; + this.isDisplay = false; + this.notificationService.showSuccess("Bangla Contact Information Updated Successfully!"); + } ) } private markFormGroupTouched(formGroup: FormGroup) { @@ -812,8 +835,8 @@ export class GeneralComponent implements OnInit { (err: any) => { this.notificationService.showError(err.error); this.currentFile = undefined; - },()=>{ - this.signaturePopUp=false; + }, () => { + this.signaturePopUp = false; this.notificationService.showSuccess("Signature Uploaded Successfully!") }); this.selectedFiles = undefined; @@ -861,7 +884,7 @@ export class GeneralComponent implements OnInit { tinPopUp: boolean = false; dlnoPopUp: boolean = false; passnoPopUp: boolean = false; - signaturePopUp:boolean = false; + signaturePopUp: boolean = false; popUpAttachment(type: string) { if (type === 'NID') this.nidPopUp = true; diff --git a/HRM.UI/ClientApp/src/app/payroll/career-and-profile/employee-payroll-profile/employee-payroll-profile.component.html b/HRM.UI/ClientApp/src/app/payroll/career-and-profile/employee-payroll-profile/employee-payroll-profile.component.html index 06f498b..8ca04c6 100644 --- a/HRM.UI/ClientApp/src/app/payroll/career-and-profile/employee-payroll-profile/employee-payroll-profile.component.html +++ b/HRM.UI/ClientApp/src/app/payroll/career-and-profile/employee-payroll-profile/employee-payroll-profile.component.html @@ -30,8 +30,8 @@
- +
@@ -229,7 +229,7 @@
-
diff --git a/HRM.UI/ClientApp/src/app/payroll/career-and-profile/employee-payroll-profile/employee-payroll-profile.component.ts b/HRM.UI/ClientApp/src/app/payroll/career-and-profile/employee-payroll-profile/employee-payroll-profile.component.ts index e7279ed..f59d255 100644 --- a/HRM.UI/ClientApp/src/app/payroll/career-and-profile/employee-payroll-profile/employee-payroll-profile.component.ts +++ b/HRM.UI/ClientApp/src/app/payroll/career-and-profile/employee-payroll-profile/employee-payroll-profile.component.ts @@ -137,19 +137,19 @@ export class EmployeePayrollProfileComponent implements OnInit { this.lastSalaryProcessDate(); - this.loadingPanelService.ShowLoadingPanel = true; - this.employeeService.generateEmployeeNo().subscribe( - (resp) => { - this.employee.employeeNo = resp as string; - }, - (err) => { - this.notificationService.showError(err); - this.loadingPanelService.ShowLoadingPanel = false; - }, - () => { - this.loadingPanelService.ShowLoadingPanel = false; - } - ); + // this.loadingPanelService.ShowLoadingPanel = true; + // this.employeeService.generateEmployeeNo().subscribe( + // (resp) => { + // this.employee.employeeNo = resp as string; + // }, + // (err) => { + // this.notificationService.showError(err); + // this.loadingPanelService.ShowLoadingPanel = false; + // }, + // () => { + // this.loadingPanelService.ShowLoadingPanel = false; + // } + // ); } else { this.employee.employeeNo = undefined; @@ -332,6 +332,32 @@ export class EmployeePayrollProfileComponent implements OnInit { } } + public saveGeneratedEmployee() { + + debugger; + if (this.newEmployee === true) { + this.loadingPanelService.ShowLoadingPanel = true; + this.employeeService.generateEmployeeNo().subscribe( + (resp) => { + this.employee.employeeNo = resp as string; + }, + (err) => { + this.notificationService.showError(err); + this.loadingPanelService.ShowLoadingPanel = false; + }, + () => { + this.loadingPanelService.ShowLoadingPanel = false; + setTimeout(() => { + this.saveEmployee(); + }, 1000); + } + ); + + } + else { + this.saveEmployee(); + } + } saveEmployee() {