EmployeeNo generation placed just before save

This commit is contained in:
mashfiq 2025-01-07 14:14:49 +06:00
parent 6a89e67a42
commit 5b834601eb
7 changed files with 117 additions and 65 deletions

View File

@ -13,7 +13,7 @@ export class ApiService {
public isSSO = false; public isSSO = false;
public versionDeployement = 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 static BASE_URL = '';
public base_url = ''; public base_url = '';
// public currentLink = ''; // public currentLink = '';

View File

@ -16,7 +16,7 @@
</div> </div>
<div *ngIf="newEmployee" class="p-col-12 p-lg-4"> <div *ngIf="newEmployee" class="p-col-12 p-lg-4">
<input [(ngModel)]="this.employeeService.hrEmployee.employeeNo" <input [(ngModel)]="this.employeeService.hrEmployee.employeeNo"
placeholder="Input Employee Id for new Employee.." id="txtempno" pInputText style="width:100%" type="text"> placeholder="Input Employee Id for new Employee.." id="txtempno" pInputText style="width:100%" type="text" [readOnly]="true">
</div> </div>
<div class="p-col-12 p-lg-6" style="margin: auto;" align="middle"> <div class="p-col-12 p-lg-6" style="margin: auto;" align="middle">
<span class="k-icon k-i-warning k-i-exception"></span> <span class="k-icon k-i-warning k-i-exception"></span>

View File

@ -189,19 +189,19 @@ export class EmployeeProfileComponent implements OnInit {
this.refreshEmployee(new HrEmployee()); this.refreshEmployee(new HrEmployee());
this.loadingPanel.ShowLoadingPanel = true; // this.loadingPanel.ShowLoadingPanel = true;
this.employeeService.generateEmployeeNo().subscribe( // this.employeeService.generateEmployeeNo().subscribe(
(resp) => { // (resp) => {
this.employeeService.hrEmployee.employeeNo = resp as string; // this.employeeService.hrEmployee.employeeNo = resp as string;
}, // },
(err) => { // (err) => {
this.notificationService.showError(err); // this.notificationService.showError(err);
this.loadingPanel.ShowLoadingPanel = false; // this.loadingPanel.ShowLoadingPanel = false;
}, // },
() => { // () => {
this.loadingPanel.ShowLoadingPanel = false; // this.loadingPanel.ShowLoadingPanel = false;
} // }
); // );
} }
else { else {
this.employeeService.hrEmployee.employeeNo = undefined; this.employeeService.hrEmployee.employeeNo = undefined;

View File

@ -172,7 +172,8 @@
<div class="p-col-12 p-lg-12" align="right" style="margin-top: 20px;"> <div class="p-col-12 p-lg-12" align="right" style="margin-top: 20px;">
<button class="k-button k-primary" kendoButton icon="save" <button class="k-button k-primary" kendoButton icon="save"
(click)="SavePersonalInfo()"> (click)="saveGeneratedEmployee()">
<!-- (click)="SavePersonalInfo()"> -->
Save Save
</button> </button>
</div> </div>
@ -359,7 +360,9 @@
</button> </button>
</div> </div>
<div class="p-col-12 p-md-12 p-lg-4" style="margin-top: 11px;" align="right"> <div class="p-col-12 p-md-12 p-lg-4" style="margin-top: 11px;" align="right">
<button class="k-button k-primary" kendoButton icon="save" (click)="SavePersonalInfo()"> <button class="k-button k-primary" kendoButton icon="save"
(click)="saveGeneratedEmployee()">
<!-- (click)="SavePersonalInfo()"> -->
Save Save
</button> </button>
</div> </div>

View File

@ -132,7 +132,7 @@ export class GeneralComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.employeePhoto = this.defaultPhoto; this.employeePhoto = this.defaultPhoto;
this.basicService.getAllReligion().subscribe( this.basicService.getAllReligion().subscribe(
(resp: any) => { (resp: any) => {
@ -173,8 +173,8 @@ export class GeneralComponent implements OnInit {
() => { () => {
}, },
() => { () => {
this.defaultNationality=this.nationalities.find(x=>x.description.toLowerCase()=="bangladeshi"); this.defaultNationality = this.nationalities.find(x => x.description.toLowerCase() == "bangladeshi");
if(this.defaultNationality){ if (this.defaultNationality) {
this.hrEmployee.nationalityID = this.defaultNationality.id; 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() { SavePersonalInfo() {
// console.log(this.hrEmployee.banglaName); // console.log(this.hrEmployee.banglaName);
// return; // return;
@ -415,7 +438,7 @@ export class GeneralComponent implements OnInit {
}, },
() => { () => {
this.loadingPanel.ShowLoadingPanel = false; this.loadingPanel.ShowLoadingPanel = false;
this.isDisplay=false; this.isDisplay = false;
this.notificationService.showSuccess('Data save successfully'); this.notificationService.showSuccess('Data save successfully');
if (this.selectedTinFiles !== null && this.selectedTinFiles !== undefined && this.selectedTinFiles.length > 0) { if (this.selectedTinFiles !== null && this.selectedTinFiles !== undefined && this.selectedTinFiles.length > 0) {
this.saveFile(this.hrEmployee.id, this.selectedTinFiles, enumEmpFileUploadType.TIN); this.saveFile(this.hrEmployee.id, this.selectedTinFiles, enumEmpFileUploadType.TIN);
@ -451,7 +474,7 @@ export class GeneralComponent implements OnInit {
}, },
() => { () => {
this.loadingPanel.ShowLoadingPanel = false; this.loadingPanel.ShowLoadingPanel = false;
this.isDisplay=false; this.isDisplay = false;
this.notificationService.showSuccess('Data Save successfully.'); this.notificationService.showSuccess('Data Save successfully.');
this.employeeService.hrEmployee.contacts = []; this.employeeService.hrEmployee.contacts = [];
this.employeeService.hrEmployee.contacts.push(this.contact); this.employeeService.hrEmployee.contacts.push(this.contact);
@ -485,48 +508,48 @@ export class GeneralComponent implements OnInit {
this.NIDFiles = undefined; this.NIDFiles = undefined;
} }
} }
saveBanglaPersonalInformation(){ saveBanglaPersonalInformation() {
const data ={ const data = {
employeeNo: this.employeeService.hrEmployee.employeeNo, employeeNo: this.employeeService.hrEmployee.employeeNo,
banglaName: this.hrEmployee.banglaName, banglaName: this.hrEmployee.banglaName,
banglaSpouseName: this.hrEmployee.spouseNameBangla, banglaSpouseName: this.hrEmployee.spouseNameBangla,
banglaFathersName: this.hrEmployee.fatherNameBangla, banglaFathersName: this.hrEmployee.fatherNameBangla,
banglaMothersName: this.hrEmployee.motherNameBangla banglaMothersName: this.hrEmployee.motherNameBangla
} }
this.loadingPanel.ShowLoadingPanel=true; this.loadingPanel.ShowLoadingPanel = true;
this.employeeService.updateBanglaInformation(data).subscribe( this.employeeService.updateBanglaInformation(data).subscribe(
(resp: any)=>{ (resp: any) => {
},(err)=>{ }, (err) => {
this.loadingPanel.ShowLoadingPanel=false; this.loadingPanel.ShowLoadingPanel = false;
this.notificationService.showError(err.error); this.notificationService.showError(err.error);
},() =>{ }, () => {
this.loadingPanel.ShowLoadingPanel=false; this.loadingPanel.ShowLoadingPanel = false;
this.isDisplay=false; this.isDisplay = false;
this.notificationService.showSuccess("Bangla Information Updated Successfully!"); this.notificationService.showSuccess("Bangla Information Updated Successfully!");
} }
) )
} }
SaveBanglaContactInformation(){ SaveBanglaContactInformation() {
const data ={ const data = {
employeeNo: this.employeeService.hrEmployee.employeeNo, employeeNo: this.employeeService.hrEmployee.employeeNo,
presentPOInBangla: this.contact.presentPOInBangla, presentPOInBangla: this.contact.presentPOInBangla,
presentAddressInBangla: this.contact.presentAddressInBangla, presentAddressInBangla: this.contact.presentAddressInBangla,
parmanentPOInBangla: this.contact.parmanentPOInBangla, parmanentPOInBangla: this.contact.parmanentPOInBangla,
permanentAddressInBangla: this.contact.permanentAddressInBangla permanentAddressInBangla: this.contact.permanentAddressInBangla
} }
this.loadingPanel.ShowLoadingPanel=true; this.loadingPanel.ShowLoadingPanel = true;
this.employeeService.updateBanglaContactInformation(data).subscribe( this.employeeService.updateBanglaContactInformation(data).subscribe(
(resp: any)=>{ (resp: any) => {
},(err)=>{ }, (err) => {
this.loadingPanel.ShowLoadingPanel=false; this.loadingPanel.ShowLoadingPanel = false;
this.notificationService.showError(err.error); this.notificationService.showError(err.error);
},() =>{ }, () => {
this.loadingPanel.ShowLoadingPanel=false; this.loadingPanel.ShowLoadingPanel = false;
this.isDisplay=false; this.isDisplay = false;
this.notificationService.showSuccess("Bangla Contact Information Updated Successfully!"); this.notificationService.showSuccess("Bangla Contact Information Updated Successfully!");
} }
) )
} }
private markFormGroupTouched(formGroup: FormGroup) { private markFormGroupTouched(formGroup: FormGroup) {
@ -812,8 +835,8 @@ export class GeneralComponent implements OnInit {
(err: any) => { (err: any) => {
this.notificationService.showError(err.error); this.notificationService.showError(err.error);
this.currentFile = undefined; this.currentFile = undefined;
},()=>{ }, () => {
this.signaturePopUp=false; this.signaturePopUp = false;
this.notificationService.showSuccess("Signature Uploaded Successfully!") this.notificationService.showSuccess("Signature Uploaded Successfully!")
}); });
this.selectedFiles = undefined; this.selectedFiles = undefined;
@ -861,7 +884,7 @@ export class GeneralComponent implements OnInit {
tinPopUp: boolean = false; tinPopUp: boolean = false;
dlnoPopUp: boolean = false; dlnoPopUp: boolean = false;
passnoPopUp: boolean = false; passnoPopUp: boolean = false;
signaturePopUp:boolean = false; signaturePopUp: boolean = false;
popUpAttachment(type: string) { popUpAttachment(type: string) {
if (type === 'NID') if (type === 'NID')
this.nidPopUp = true; this.nidPopUp = true;

View File

@ -30,8 +30,8 @@
<label>Employee Id </label> <label>Employee Id </label>
</div> </div>
<div class="p-col-12 p-md-6 p-lg-8 form-control-lg "> <div class="p-col-12 p-md-6 p-lg-8 form-control-lg ">
<input formControlName="employeeId" [readonly]="!newEmployee" <input formControlName="employeeId"[readonly]="true"
[(ngModel)]="employee.employeeNo" type="text" style="width:100%" pInputText required> [(ngModel)]="employee.employeeNo" type="text" style="width:100%" pInputText required><!-- [readonly]="!newEmployee"-->
</div> </div>
<div class="p-col-12 p-md-6 p-lg-4" style="margin:auto"> <div class="p-col-12 p-md-6 p-lg-4" style="margin:auto">
<label for="txtempName">Name </label> <label for="txtempName">Name </label>
@ -229,7 +229,7 @@
</button> </button>
</div> </div>
<div class="p-col-6" align="right"> <div class="p-col-6" align="right">
<button icon="save" kendoButton [primary]="true" (click)="saveEmployee()"> <button icon="save" kendoButton [primary]="true" (click)="saveGeneratedEmployee()">
Save Save
</button> </button>
</div> </div>

View File

@ -137,19 +137,19 @@ export class EmployeePayrollProfileComponent implements OnInit {
this.lastSalaryProcessDate(); this.lastSalaryProcessDate();
this.loadingPanelService.ShowLoadingPanel = true; // this.loadingPanelService.ShowLoadingPanel = true;
this.employeeService.generateEmployeeNo().subscribe( // this.employeeService.generateEmployeeNo().subscribe(
(resp) => { // (resp) => {
this.employee.employeeNo = resp as string; // this.employee.employeeNo = resp as string;
}, // },
(err) => { // (err) => {
this.notificationService.showError(err); // this.notificationService.showError(err);
this.loadingPanelService.ShowLoadingPanel = false; // this.loadingPanelService.ShowLoadingPanel = false;
}, // },
() => { // () => {
this.loadingPanelService.ShowLoadingPanel = false; // this.loadingPanelService.ShowLoadingPanel = false;
} // }
); // );
} }
else { else {
this.employee.employeeNo = undefined; 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() { saveEmployee() {