dev_chapal #3

Merged
chapal merged 8 commits from dev_chapal into devqc 2024-10-16 17:21:42 +06:00
3 changed files with 61 additions and 34 deletions
Showing only changes of commit 989e709830 - Show all commits

View File

@ -88,9 +88,9 @@
[disabled]="selectedProdBSdata===undefined||selectedLine===undefined||selectedDate===undefined">Refresh</button> [disabled]="selectedProdBSdata===undefined||selectedLine===undefined||selectedDate===undefined">Refresh</button>
</div> </div>
<div class="p-col-12"> <div class="p-col-12">
<kendo-grid [data]="employeeList" [pageable]="true" [sortable]="true" [reorderable]="true" [resizable]="true"> <kendo-grid #grid [data]="employeeList" [pageable]="true" [sortable]="true" [reorderable]="true" [resizable]="true" [height]="450">
<ng-template kendoGridToolbarTemplate> <ng-template kendoGridToolbarTemplate>
<button type="button" kendoButton [primary]="true" icon="delete"> <button type="button" kendoButton icon="delete" class="kt-delete">
Remove All Remove All
</button> </button>
<kendo-grid-spacer></kendo-grid-spacer> <kendo-grid-spacer></kendo-grid-spacer>
@ -107,7 +107,7 @@
</kendo-grid-column> </kendo-grid-column>
<kendo-grid-column title="Actions" width="25%" align="middle"> <kendo-grid-column title="Actions" width="25%" align="middle">
<ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex"> <ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
<button kendoButton icon="delete" [primary]="true" style="width: 30%;" <button kendoButton class="kt-delete" icon="delete" style="width: fit-content;"
(click)="onClickRemove(dataItem)">Remove</button> (click)="onClickRemove(dataItem)">Remove</button>
</ng-template> </ng-template>
</kendo-grid-column> </kendo-grid-column>
@ -124,8 +124,8 @@
<kendo-label [for]="supervisor" text=" Supervisor"></kendo-label> <kendo-label [for]="supervisor" text=" Supervisor"></kendo-label>
</div> </div>
<div class="p-col-4"> <div class="p-col-4">
<app-employee-picker (ItemSelected)="GetSelectedEmployee($event)" <app-employee-picker (ItemSelected)="GetSelectedEmployee($event)" [setSelectedEmp]="selectedEmps"
[MultiSelect]="false"></app-employee-picker> [MultiSelect]="false" (keydown)="onKeyDown($event)"></app-employee-picker>
<!-- [MultiSelect]="employeeSelection==='commonEmployee'"></app-employee-picker> --> <!-- [MultiSelect]="employeeSelection==='commonEmployee'"></app-employee-picker> -->
</div> </div>
<div class="p-col-2"></div> <div class="p-col-2"></div>

View File

@ -1,3 +1,9 @@
.label-ailgn{ .label-ailgn{
padding-top: 12px; padding-top: 12px;
} }
.k-grid {
font-size: smaller;
}
.kt-delete {
font-size: smaller;
}

View File

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { HrEmployee } from '../../_models/HREmployee/hrEmployee'; import { HrEmployee } from '../../_models/HREmployee/hrEmployee';
import { SearchEmployee } from '../../_models/Employee/searchEmployee'; import { SearchEmployee } from '../../_models/Employee/searchEmployee';
@ -19,6 +19,7 @@ import { ProdBonusAttn } from 'src/app/_models/Payroll/ProductionBonus/prodBonus
import { EnumBonusItemType, EnumProductionBonusType } from 'src/app/_models/enums'; import { EnumBonusItemType, EnumProductionBonusType } from 'src/app/_models/enums';
import { ProdBonusParameter } from 'src/app/_models/Payroll/ProductionBonus/prodBonusParameter'; import { ProdBonusParameter } from 'src/app/_models/Payroll/ProductionBonus/prodBonusParameter';
import { error } from 'console'; import { error } from 'console';
import { GridComponent } from '@progress/kendo-angular-grid';
@Component({ @Component({
@ -232,35 +233,36 @@ export class ProductionBonusAttendanceComponent implements OnInit {
} }
onClickAdd() { onClickAdd() {
// console.log(this.employeeSelection); // console.log(this.employeeSelection);
debugger;
if (this.selectedEmps === undefined) { if (this.selectedEmps === undefined) {
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']);
@ -288,7 +290,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;
@ -323,9 +325,8 @@ export class ProductionBonusAttendanceComponent implements OnInit {
isCommon: isCommonValue isCommon: isCommonValue
}; };
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);
debugger; this.selectedEmps = undefined;
} }
// GetSelectedEmployee(sremployee: SearchEmployee) { // GetSelectedEmployee(sremployee: SearchEmployee) {
// if (sremployee === undefined) { // if (sremployee === undefined) {
@ -407,4 +408,24 @@ export class ProductionBonusAttendanceComponent implements OnInit {
this.employeeList = []; this.employeeList = [];
this.selectedLine = undefined; this.selectedLine = undefined;
} }
public onKeyDown(pressedKey) {
if (pressedKey.key==="Enter") {
// this.onSave(pressedKey);
this.onClickAdd();
this.scrollToBottom();
}
}
@ViewChild('grid', { static: true })
public grid: GridComponent;
private gridScrollableElement: HTMLElement;
ngAfterViewInit() {
this.gridScrollableElement = this.grid.wrapper.nativeElement.querySelector('.k-grid-content');
}
scrollToBottom(): void {
this.gridScrollableElement.scrollTop = this.gridScrollableElement.scrollHeight;
}
} }