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 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 = '';

View File

@ -16,7 +16,7 @@
</div>
<div *ngIf="newEmployee" class="p-col-12 p-lg-4">
<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 class="p-col-12 p-lg-6" style="margin: auto;" align="middle">
<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.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;

View File

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

View File

@ -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;

View File

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

View File

@ -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() {