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

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

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