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

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

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