dev_mashfiq #9

Merged
chapal merged 2 commits from dev_mashfiq into devqc 2024-10-31 15:38:10 +06:00
2 changed files with 45 additions and 35 deletions
Showing only changes of commit 5aec24eeab - Show all commits

View File

@ -90,7 +90,7 @@
<div class="p-col-12"> <div class="p-col-12">
<kendo-grid #grid [data]="employeeList" [pageable]="false" [sortable]="true" [reorderable]="true" [resizable]="true" [height]="450"> <kendo-grid #grid [data]="employeeList" [pageable]="false" [sortable]="true" [reorderable]="true" [resizable]="true" [height]="450">
<ng-template kendoGridToolbarTemplate> <ng-template kendoGridToolbarTemplate>
<button type="button" kendoButton icon="delete" class="kt-delete"> <button type="button" kendoButton icon="delete" class="kt-delete" (click)="onClickRemoveAll()">
Remove All Remove All
</button> </button>
<kendo-grid-spacer></kendo-grid-spacer> <kendo-grid-spacer></kendo-grid-spacer>
@ -114,19 +114,19 @@
</kendo-grid> </kendo-grid>
</div> </div>
<div class="p-col-2 label-ailgn"> <div class="p-col-2 label-ailgn">
<!-- <input type="radio" name="employeeSelection" value="commonEmployee" #commonEmployee <input type="radio" name="employeeSelection" value="commonEmployee" #commonEmployee
[(ngModel)]="employeeSelection" kendoRadioButton /> [(ngModel)]="employeeSelection" kendoRadioButton />
<kendo-label [for]="commonEmployee" text=" Common Employee"></kendo-label> --> <kendo-label [for]="commonEmployee" text=" Multiple"></kendo-label>
</div> </div>
<div class="p-col-2 label-ailgn"> <div class="p-col-2 label-ailgn">
<!-- <input type="radio" name="employeeSelection" value="supervisor" #supervisor [(ngModel)]="employeeSelection" <input type="radio" name="employeeSelection" value="supervisor" #supervisor [(ngModel)]="employeeSelection"
kendoRadioButton /> kendoRadioButton />
<kendo-label [for]="supervisor" text=" Supervisor"></kendo-label> --> <kendo-label [for]="supervisor" text=" Single"></kendo-label>
</div> </div>
<div class="p-col-4"> <div class="p-col-4">
<app-employee-picker (ItemSelected)="GetSelectedEmployee($event)" [setSelectedEmp]="selectedEmps" <app-employee-picker (ItemSelected)="GetSelectedEmployee($event)" [setSelectedEmp]="selectedEmps"
[MultiSelect]="false" (keydown)="onKeyDown($event)" *ngIf="allEmps.length!=0"></app-employee-picker> [MultiSelect]="employeeSelection==='commonEmployee'" (keydown)="onKeyDown($event)" ></app-employee-picker>
<!-- [MultiSelect]="employeeSelection==='commonEmployee'"></app-employee-picker> --> <!-- [MultiSelect]="false" (keydown)="onKeyDown($event)" *ngIf="allEmps.length!=0"></app-employee-picker> -->
</div> </div>
<div class="p-col-2"></div> <div class="p-col-2"></div>
<div class="p-col-2" align="right"> <div class="p-col-2" align="right">

View File

@ -179,6 +179,10 @@ export class ProductionBonusAttendanceComponent implements OnInit {
this.productionBonusSetup.fromDate = new Date(this.productionBonusSetup.fromDate); this.productionBonusSetup.fromDate = new Date(this.productionBonusSetup.fromDate);
this.productionBonusSetup.toDate = new Date(this.productionBonusSetup.toDate); this.productionBonusSetup.toDate = new Date(this.productionBonusSetup.toDate);
this.loadingPanelService.ShowLoadingPanel = false; this.loadingPanelService.ShowLoadingPanel = false;
this.startTime = this.setTime(this.startTime, 6, 0, 0);
this.endTime = this.setTime(this.endTime, 23, 59, 0);
this.selectedLine = undefined;
} }
) )
} }
@ -265,31 +269,31 @@ export class ProductionBonusAttendanceComponent implements OnInit {
this.notificationService.showWarning('Please Select an Employee'); this.notificationService.showWarning('Please Select an Employee');
return; return;
} }
// if (this.employeeSelection === 'commonEmployee') { if (this.employeeSelection === 'commonEmployee') {
// if (this.selectedEmps !== null || this.selectedEmps !== undefined) { if (this.selectedEmps !== null || this.selectedEmps !== undefined) {
// // console.log(this.selectedEmps); // console.log(this.selectedEmps);
// // console.log(this.employeeList); // console.log(this.employeeList);
// // for (let i = 0; i < this.selectedEmps.length; i++) { // for (let i = 0; i < this.selectedEmps.length; i++) {
// // this.AddEmployeebyId(this.selectedEmps[i].employeeID); // this.AddEmployeebyId(this.selectedEmps[i].employeeID);
// // } // }
// for (let i = 0, isNew = true; i < this.selectedEmps.length; i++, isNew = true) { for (let i = 0, isNew = true; i < this.selectedEmps.length; i++, isNew = true) {
// for (let j = 0; j < this.employeeList.length; j++) { for (let j = 0; j < this.employeeList.length; j++) {
// if (this.selectedEmps[i].employeeID == this.employeeList[j].id) { if (this.selectedEmps[i].employeeID == this.employeeList[j].id) {
// this.notificationService.showWarning("EmployeeNo " + this.employeeList[j].employeeNo + " Already Exists"); this.notificationService.showWarning("EmployeeNo " + this.employeeList[j].employeeNo + " Already Exists");
// isNew = false; isNew = false;
// break; break;
// } }
// } }
// if (isNew) { if (isNew) {
// this.AddEmployeebyId(this.selectedEmps[i].employeeID); this.AddEmployeebyId(this.selectedEmps[i].employeeID);
// this.AddEmployeeGridData(this.selectedEmps[i].employeeID, true); this.AddEmployeeGridData(this.selectedEmps[i].employeeID, true);
// } }
// debugger; debugger;
// } }
// } }
// } }
// else { else {
let sid: number; let sid: number;
const emp = this.employeeList.find((e1) => e1.id === this.selectedEmps['employeeID']); const emp = this.employeeList.find((e1) => e1.id === this.selectedEmps['employeeID']);
const att = this.prodBonusAttn.find((e1) => e1.employeeID === this.selectedEmps['employeeID']); const att = this.prodBonusAttn.find((e1) => e1.employeeID === this.selectedEmps['employeeID']);
@ -317,7 +321,7 @@ export class ProductionBonusAttendanceComponent implements OnInit {
else { else {
this.notificationService.showWarning('Employee already exist ! Can\'t Add'); this.notificationService.showWarning('Employee already exist ! Can\'t Add');
} }
// } }
} }
AddEmployeebyId(empId: number) { AddEmployeebyId(empId: number) {
// this.loadingPanelService.ShowLoadingPanel = true; // this.loadingPanelService.ShowLoadingPanel = true;
@ -348,11 +352,11 @@ export class ProductionBonusAttendanceComponent implements OnInit {
outTime: this.selectedDate, outTime: this.selectedDate,
bonusHour: 0, bonusHour: 0,
employeeID: empId, employeeID: empId,
isCommon: isCommonValue isCommon: false
}; };
this.prodBonusAttn.push(newProdBonusAttn); this.prodBonusAttn.push(newProdBonusAttn);
// console.log('emplist ' + this.employeeList.length + '\n PbAttn ' + this.prodBonusAttn.length); // console.log('emplist ' + this.employeeList.length + '\n PbAttn ' + this.prodBonusAttn.length);
this.selectedEmps = undefined; // this.selectedEmps = undefined;
} }
// GetSelectedEmployee(sremployee: SearchEmployee) { // GetSelectedEmployee(sremployee: SearchEmployee) {
// if (sremployee === undefined) { // if (sremployee === undefined) {
@ -427,18 +431,24 @@ export class ProductionBonusAttendanceComponent implements OnInit {
this.prodBonusAttn.splice(index, 1); this.prodBonusAttn.splice(index, 1);
} }
} }
public onClickRemoveAll(){
this.employeeList = [];
this.prodBonusAttn = [];
}
clear() { public clear() {
this.productionBonusSetup = new ProductionBonusSetup(); this.productionBonusSetup = new ProductionBonusSetup();
this.employeeList = []; this.employeeList = [];
this.selectedLine = undefined; this.selectedLine = undefined;
} }
public onKeyDown(pressedKey) { public onKeyDown(pressedKey) {
debugger;
if (pressedKey.key === "Enter") { if (pressedKey.key === "Enter") {
// this.onSave(pressedKey); // this.onSave(pressedKey);
this.onClickAdd(); this.onClickAdd();
this.scrollToBottom(); this.scrollToBottom();
this.selectedEmps = undefined;
} }
} }