Commit a045aa14 by Nattana Chaiyamat

สาขาและหน่วยธุรกิจ

parent 3e106ed7
......@@ -16,7 +16,7 @@ interface table {
styleUrls: ['./department-list.component.scss']
})
export class DepartmentListComponent implements OnInit {
bu2List: Bu2Model[] = []
bu2List: { check: boolean, data: Bu2Model }[] = []
bu2ListLoading = false
bu2: Bu2Model = new MyBu2Model()
bu2Table: table = {
......@@ -41,6 +41,11 @@ export class DepartmentListComponent implements OnInit {
search: ""
}
currentModal: 'add' | 'edit' | 'delete' = "add"
numDataListChecked = 0
isDataListChecked = false
isDataListCheckedAll = false
constructor(private bu2Service: Bu2Service,
private bu1Service: Bu1Service,
private toastr: ToastrService,
......@@ -104,9 +109,11 @@ export class DepartmentListComponent implements OnInit {
this.bu2ListLoading = true
this.bu2Service.getList().subscribe({
next: response => {
this.bu2List = response.map(x => new MyBu2Model(x))
this.bu2List = response.map(x => ({ check: false, data: new MyBu2Model(x) }))
this.bu2ListLoading = false
this.onBu2TableSearchChange()
this.isDataListCheckedAll = false
this.dataListCheckAll()
this.cdr.detectChanges()
}, error: error => {
this.bu2ListLoading = false
......@@ -119,9 +126,12 @@ export class DepartmentListComponent implements OnInit {
this.bu2Table.page = Array.from({ length: Math.ceil(this.filterBu2Table().length / 10) }, (_, i) => i + 1);
}
filterBu2Table() {
return this.bu2List.filter(x => x.bu2id.toLowerCase().includes(this.bu2Table.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu2Table.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu2Table.search.toLowerCase()))
return this.bu2List.filter(x => {
const data = x.data
return data.bu2id.toLowerCase().includes(this.bu2Table.search.toLowerCase()) ||
data.tdesc.toLowerCase().includes(this.bu2Table.search.toLowerCase()) ||
data.edesc.toLowerCase().includes(this.bu2Table.search.toLowerCase())
})
}
selectBu2(bu2?: Bu2Model) {
this.bu2 = new MyBu2Model(bu2)
......@@ -133,18 +143,22 @@ export class DepartmentListComponent implements OnInit {
})
}
}
bu2idChange() {
const bu2 = this.bu2List.find(x => x.bu2id == this.bu2.bu2id)
this.selectBu2(bu2 || new MyBu2Model({ bu2id: this.bu2.bu2id }))
}
// bu2idChange() {
// const bu2 = this.bu2List.find(x => x.bu2id == this.bu2.bu2id)
// this.selectBu2(bu2 || new MyBu2Model({ bu2id: this.bu2.bu2id }))
// }
onBu2ModalSearchChange() {
this.bu2Modal.currentPage = 1
this.bu2Modal.page = Array.from({ length: Math.ceil(this.filterBu2Modal().length / 10) }, (_, i) => i + 1);
this.dataListCheck()
}
filterBu2Modal() {
return this.bu2List.filter(x => x.bu2id.toLowerCase().includes(this.bu2Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu2Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu2Modal.search.toLowerCase()))
return this.bu2List.filter(x => {
const data = x.data
return data.bu2id.toLowerCase().includes(this.bu2Table.search.toLowerCase()) ||
data.tdesc.toLowerCase().includes(this.bu2Table.search.toLowerCase()) ||
data.edesc.toLowerCase().includes(this.bu2Table.search.toLowerCase())
})
}
......@@ -196,7 +210,8 @@ export class DepartmentListComponent implements OnInit {
}
deleteBu2() {
this.bu2ListLoading = true
this.bu2Service.delete(this.bu2).subscribe({
const body = this.bu2List.filter(x => x.check).map(x => new MyBu2Model(x.data))
this.bu2Service.delete(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -211,5 +226,18 @@ export class DepartmentListComponent implements OnInit {
}
})
}
dataListCheckAll() {
const selectAll = this.isDataListCheckedAll;
this.filterBu2Table().forEach(x => x.check = selectAll);
this.dataListCheck();
}
dataListCheck() {
const dataCheck = this.filterBu2Table();
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every(x => x.check) : false;
this.numDataListChecked = this.bu2List.filter(x => x.check).length
this.isDataListChecked = Boolean(this.numDataListChecked)
}
}
<div class="w-full min-height-50px mb-10px justify-between items-center">
<div class="flex justify-between">
<div class="flex pr-2">
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md"
data-hs-overlay="#department-register-upload-modal"
(click)="fileInput.value = '';selectedFile=null;selectedFileName = 'กรุณาเลือกไฟล์'">
<i class="ri-add-line"></i>
นำเข้าข้อมูล
<div class="flex">
<div class="flex items-center">
<input type="checkbox" class="ti-form-checkbox pointer-events-none" id="hs-default-checkbox"
[(ngModel)]="isDataListChecked">
<label for="hs-default-checkbox" class="text-sm text-gray-500 mx-2 pointer-events-none">
{{numDataListChecked}} Selected</label>
</div>
<div class="mx-1 flex items-center">
<button (click)="isDataListCheckedAll = !isDataListCheckedAll;dataListCheckAll()" id='check-boxall'
class="focus:ring-2 focus:ring-primary rounded-sm flex item-center">
<i class="fs-l transition-all duration-200"
[ngClass]="{'ri-checkbox-multiple-line text-gray-500': !isDataListCheckedAll, 'ri-checkbox-multiple-fill text-primary': isDataListCheckedAll}"></i>
</button>
<a class="mx-2 justify-center -mb-px inline-flex items-center gap-2 font-weight-500 font-size-12px text-center text-secondary border-secondary border-b-2 align-items-end"
href="javascript:void(0);" (click)="downloadFile()">
ดาวน์โหลดตัวอย่างไฟล์
</a>
<label class="text-sm text-gray-500 ml-2" for="check-boxall">Select All</label>
</div>
</div>
<div class="flex justify-end">
......@@ -27,17 +29,34 @@
</div>
</div>
<div class="px-1">
<button type="button"
class=" h-45px ti-btn ti-btn bg-pink-500/10 text-pink-500 hover:text-white hover:bg-pink-500 ring-offset-white focus:ring-pink-500 dark:focus:ring-offset-white/10 h-10 m-0 shadow-md"
data-hs-overlay="#department-register-upload-modal"
(click)="fileInput.value = '';selectedFile=null;selectedFileName = 'กรุณาเลือกไฟล์'">
<i class="ti ti-file-plus"></i>
import
</button>
</div>
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
data-hs-overlay="#department-register-modal-add" (click)="currentModel='add';selectBu1()">
<i class="ri-add-line"></i>
Add
</button>
</div>
<div class="px-1">
<!-- <div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-info h-45px m-0 shadow-md">
<i class="ri-printer-line"></i>
Print
</button>
</div> -->
<div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
(click)="currentModel='deleteGroup';selectBu1()"
data-hs-overlay="#department-register-delete-alert-modal">
<i class="ri-delete-bin-6-line"></i>
Delete
</button>
</div>
<!-- <div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-warning h-45px m-0 shadow-md">
......@@ -55,10 +74,10 @@
<thead>
<tr>
<ng-container
*ngFor="let item of ['ลำดับ','รหัสฝ่าย','รายละเอียดฝ่าย (ไทย)','รายละเอียดฝ่าย (อังกฤษ)','การจัดการ']; let f = first; let l = last">
*ngFor="let item of ['','รหัสฝ่าย','รายละเอียดฝ่าย (ไทย)','รายละเอียดฝ่าย (อังกฤษ)','การจัดการ']; let f = first; let l = last">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary !text-center">
<span class="font-size-12px font-weight-700">{{ item }}</span>
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l">
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!f&&!l">
<i class="ti ti-dots-vertical fs-l"></i>
</div>
</th>
......@@ -85,13 +104,16 @@
<tbody *ngIf="!bu1ListLoading&&bu1ListFilter().length">
<tr
*ngFor="let item of bu1ListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index">
<td class="text-center">{{((currentPage-1) * 10)+(i+1)}}</td>
<td class="text-center">{{item.bu1id}}</td>
<td>{{item.tdesc}}</td>
<td>{{item.edesc}}</td>
<td class="text-center">
<input type="checkbox" class="ti-form-checkbox cursor-pointer" id="checkbox-{{item.data.bu1id}}"
[(ngModel)]="item.check" (ngModelChange)="dataListCheck()">
</td>
<td class="text-center">{{item.data.bu1id}}</td>
<td>{{item.data.tdesc}}</td>
<td>{{item.data.edesc}}</td>
<td class="flex justify-center">
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1"
(click)="currentModel='edit';selectBu1(item)"
(click)="currentModel='edit';selectBu1(item.data)"
data-hs-overlay="#department-register-modal-edit"></i>
<!-- <i class="ti ti-trash cursor-pointer i-gray fs-l px-1"
(click)="currentModel='delete';selectBu1(item)"
......@@ -364,6 +386,11 @@
<i class="ti ti-upload"></i>
</button>
</div>
<div class="flex justify-center mt-2rem ">
<h1 class="cursor-pointer justify-center -mb-px inline-flex items-center gap-2 font-weight-500 font-size-12px
text-center text-secondary border-secondary border-b-2 align-items-end" (click)="downloadFile()">
ดาวน์โหลดตัวอย่างไฟล์</h1>
</div>
<div class="flex justify-center mt-2rem mb-1rem space-x-4">
<button type="submit" data-hs-overlay="#department-register-upload-modal"
class="ti-btn ti-btn-secondary" [class.ti-btn-disabled]="!selectedFile" (click)="uploadFile()"
......
......@@ -12,7 +12,7 @@ import { FileService } from 'src/app/shared/services/file.service';
export class DepartmentRegisterComponent implements OnInit {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
bu1List: Bu1Model[] = []
bu1List: { check: boolean, data: Bu1Model }[] = []
bu1ListLoading = false
bu1: Bu1Model = new MyBu1Model()
search = ""
......@@ -20,7 +20,11 @@ export class DepartmentRegisterComponent implements OnInit {
selectedFile: File | null = null;
selectedFileName: string = 'กรุณาเลือกไฟล์';
currentModel: 'add' | 'edit' | 'delete' = "add"
currentModel: 'add' | 'edit' | 'delete' | 'deleteGroup' = "add"
numDataListChecked = 0
isDataListChecked = false
isDataListCheckedAll = false
constructor(private bu1Service: Bu1Service,
private toastr: ToastrService,
private cdr: ChangeDetectorRef,
......@@ -82,7 +86,9 @@ export class DepartmentRegisterComponent implements OnInit {
this.bu1ListLoading = true
this.bu1Service.getList().subscribe({
next: response => {
this.bu1List = response.map(x => new MyBu1Model(x))
this.bu1List = response.map(x => ({ check: false, data: new MyBu1Model(x) }))
this.isDataListCheckedAll = false
this.dataListCheckAll()
this.bu1ListLoading = false
this.searchChange()
this.cdr.detectChanges()
......@@ -95,11 +101,15 @@ export class DepartmentRegisterComponent implements OnInit {
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.bu1ListFilter().length / 10) }, (_, i) => i + 1);
this.dataListCheck()
}
bu1ListFilter() {
return this.bu1List.filter(x => x.bu1id.toLowerCase().includes(this.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.search.toLowerCase()))
return this.bu1List.filter(x => {
const data = x.data
return data.bu1id.toLowerCase().includes(this.search.toLowerCase()) ||
data.tdesc.toLowerCase().includes(this.search.toLowerCase()) ||
data.edesc.toLowerCase().includes(this.search.toLowerCase())
})
}
selectBu1(bu1?: Bu1Model) {
this.bu1 = new MyBu1Model(bu1)
......@@ -130,7 +140,8 @@ export class DepartmentRegisterComponent implements OnInit {
}
deleteBu1() {
this.bu1ListLoading = true
this.bu1Service.delete(this.bu1).subscribe({
const body = this.bu1List.filter(x => x.check).map(x => new MyBu1Model(x.data))
this.bu1Service.delete(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -145,6 +156,17 @@ export class DepartmentRegisterComponent implements OnInit {
}
})
}
dataListCheckAll() {
const selectAll = this.isDataListCheckedAll;
this.bu1ListFilter().forEach(x => x.check = selectAll);
this.dataListCheck();
}
dataListCheck() {
const dataCheck = this.bu1ListFilter();
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every(x => x.check) : false;
this.numDataListChecked = this.bu1List.filter(x => x.check).length
this.isDataListChecked = Boolean(this.numDataListChecked)
}
}
......@@ -16,7 +16,7 @@ interface table {
styleUrls: ['./section-registration.component.scss']
})
export class SectionRegistrationComponent implements OnInit {
bu3List: Bu3Model[] = []
bu3List: { check: boolean, data: Bu3Model }[] = []
bu3ListLoading = false
bu3: Bu3Model = new MyBu3Model()
bu3Table: table = {
......@@ -41,6 +41,10 @@ export class SectionRegistrationComponent implements OnInit {
search: ""
}
currentModal: 'add' | 'edit' | 'delete' = "add"
numDataListChecked = 0
isDataListChecked = false
isDataListCheckedAll = false
constructor(private bu3Service: Bu3Service,
private bu2Service: Bu2Service,
private toastr: ToastrService,
......@@ -105,9 +109,11 @@ export class SectionRegistrationComponent implements OnInit {
this.bu3ListLoading = true
this.bu3Service.getList().subscribe({
next: response => {
this.bu3List = response.map(x => new MyBu3Model(x))
this.bu3List = response.map(x => ({ check: false, data: new MyBu3Model(x) }))
this.bu3ListLoading = false
this.onBu3TableSearchChange()
this.isDataListCheckedAll = false
this.dataListCheckAll()
this.cdr.detectChanges()
}, error: error => {
this.bu3ListLoading = false
......@@ -118,11 +124,15 @@ export class SectionRegistrationComponent implements OnInit {
onBu3TableSearchChange() {
this.bu3Table.currentPage = 1
this.bu3Table.page = Array.from({ length: Math.ceil(this.filterBu3Table().length / 10) }, (_, i) => i + 1);
this.dataListCheck()
}
filterBu3Table() {
return this.bu3List.filter(x => x.bu3id.toLowerCase().includes(this.bu3Table.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu3Table.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu3Table.search.toLowerCase()))
return this.bu3List.filter(x => {
const data = x.data
return data.bu3id.toLowerCase().includes(this.bu3Table.search.toLowerCase()) ||
data.tdesc.toLowerCase().includes(this.bu3Table.search.toLowerCase()) ||
data.edesc.toLowerCase().includes(this.bu3Table.search.toLowerCase())
})
}
selectBu3(bu3?: Bu3Model) {
this.bu3 = new MyBu3Model(bu3)
......@@ -134,18 +144,21 @@ export class SectionRegistrationComponent implements OnInit {
})
}
}
bu3idChange() {
const bu3 = this.bu3List.find(x => x.bu3id == this.bu3.bu3id)
this.selectBu3(bu3 || new MyBu3Model({ bu3id: this.bu3.bu3id }))
}
// bu3idChange() {
// const bu3 = this.bu3List.find(x => x.bu3id == this.bu3.bu3id)
// this.selectBu3(bu3 || new MyBu3Model({ bu3id: this.bu3.bu3id }))
// }
onBu3ModalSearchChange() {
this.bu3Modal.currentPage = 1
this.bu3Modal.page = Array.from({ length: Math.ceil(this.filterBu3Modal().length / 10) }, (_, i) => i + 1);
}
filterBu3Modal() {
return this.bu3List.filter(x => x.bu3id.toLowerCase().includes(this.bu3Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu3Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu3Modal.search.toLowerCase()))
return this.bu3List.filter(x => {
const data = x.data
return data.bu3id.toLowerCase().includes(this.bu3Table.search.toLowerCase()) ||
data.tdesc.toLowerCase().includes(this.bu3Table.search.toLowerCase()) ||
data.edesc.toLowerCase().includes(this.bu3Table.search.toLowerCase())
})
}
addBu3() {
this.bu3ListLoading = true
......@@ -166,7 +179,8 @@ export class SectionRegistrationComponent implements OnInit {
}
deleteBu3() {
this.bu3ListLoading = true
this.bu3Service.delete(this.bu3).subscribe({
const body = this.bu3List.filter(x => x.check).map(x => new MyBu3Model(x.data))
this.bu3Service.delete(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -211,5 +225,18 @@ export class SectionRegistrationComponent implements OnInit {
positionClass: 'toast-top-right',
})
}
dataListCheckAll() {
const selectAll = this.isDataListCheckedAll;
this.filterBu3Table().forEach(x => x.check = selectAll);
this.dataListCheck();
}
dataListCheck() {
const dataCheck = this.filterBu3Table();
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every(x => x.check) : false;
this.numDataListChecked = this.bu3List.filter(x => x.check).length
this.isDataListChecked = Boolean(this.numDataListChecked)
}
}
......@@ -17,7 +17,7 @@ interface table {
styleUrls: ['./sub-department-four.component.scss']
})
export class SubDepartmentFourComponent implements OnInit {
bu7List: Bu7Model[] = []
bu7List: { check: boolean, data: Bu7Model }[] = []
bu7ListLoading = false
bu7: Bu7Model = new MyBu7Model()
bu7Table: table = {
......@@ -42,6 +42,10 @@ export class SubDepartmentFourComponent implements OnInit {
search: ""
}
currentModal: 'add' | 'edit' | 'delete' = "add"
numDataListChecked = 0
isDataListChecked = false
isDataListCheckedAll = false
constructor(private bu7Service: Bu7Service,
private bu6Service: Bu6Service,
private toastr: ToastrService,
......@@ -105,9 +109,11 @@ export class SubDepartmentFourComponent implements OnInit {
this.bu7ListLoading = true
this.bu7Service.getList().subscribe({
next: response => {
this.bu7List = response.map(x => new MyBu7Model(x))
this.bu7List = response.map(x => ({ check: false, data: new MyBu7Model(x) }))
this.bu7ListLoading = false
this.onBu7TableSearchChange()
this.isDataListCheckedAll = false
this.dataListCheckAll()
this.cdr.detectChanges()
}, error: error => {
this.bu7ListLoading = false
......@@ -118,11 +124,15 @@ export class SubDepartmentFourComponent implements OnInit {
onBu7TableSearchChange() {
this.bu7Table.currentPage = 1
this.bu7Table.page = Array.from({ length: Math.ceil(this.filterBu7Table().length / 10) }, (_, i) => i + 1);
this.dataListCheck()
}
filterBu7Table() {
return this.bu7List.filter(x => x.bu7id.toLowerCase().includes(this.bu7Table.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu7Table.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu7Table.search.toLowerCase()))
return this.bu7List.filter(x => {
const data = x.data
return data.bu7id.toLowerCase().includes(this.bu7Table.search.toLowerCase()) ||
data.tdesc.toLowerCase().includes(this.bu7Table.search.toLowerCase()) ||
data.edesc.toLowerCase().includes(this.bu7Table.search.toLowerCase())
})
}
selectBu7(bu7?: Bu7Model) {
this.bu7 = new MyBu7Model(bu7 || {})
......@@ -134,18 +144,17 @@ export class SubDepartmentFourComponent implements OnInit {
})
}
}
bu7idChange() {
const bu7 = this.bu7List.find(x => x.bu7id == this.bu7.bu7id)
this.selectBu7(bu7 || new MyBu7Model({ bu7id: this.bu7.bu7id }))
}
onBu7ModalSearchChange() {
this.bu7Modal.currentPage = 1
this.bu7Modal.page = Array.from({ length: Math.ceil(this.filterBu7Modal().length / 10) }, (_, i) => i + 1);
}
filterBu7Modal() {
return this.bu7List.filter(x => x.bu7id.toLowerCase().includes(this.bu7Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu7Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu7Modal.search.toLowerCase()))
return this.bu7List.filter(x => {
const data = x.data
return data.bu7id.toLowerCase().includes(this.bu7Table.search.toLowerCase()) ||
data.tdesc.toLowerCase().includes(this.bu7Table.search.toLowerCase()) ||
data.edesc.toLowerCase().includes(this.bu7Table.search.toLowerCase())
})
}
addBu7() {
this.bu7ListLoading = true
......@@ -166,7 +175,8 @@ export class SubDepartmentFourComponent implements OnInit {
}
deleteBu7() {
this.bu7ListLoading = true
this.bu7Service.delete(this.bu7).subscribe({
const body = this.bu7List.filter(x => x.check).map(x => new MyBu7Model(x.data))
this.bu7Service.delete(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -211,6 +221,19 @@ export class SubDepartmentFourComponent implements OnInit {
positionClass: 'toast-top-right',
})
}
dataListCheckAll() {
const selectAll = this.isDataListCheckedAll;
this.filterBu7Table().forEach(x => x.check = selectAll);
this.dataListCheck();
}
dataListCheck() {
const dataCheck = this.filterBu7Table();
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every(x => x.check) : false;
this.numDataListChecked = this.bu7List.filter(x => x.check).length
this.isDataListChecked = Boolean(this.numDataListChecked)
}
}
......@@ -16,7 +16,7 @@ interface table {
styleUrls: ['./sub-department-one.component.scss']
})
export class SubDepartmentOneComponent implements OnInit {
bu4List: Bu4Model[] = []
bu4List: { check: boolean, data: Bu4Model }[] = []
bu4ListLoading = false
bu4: Bu4Model = new MyBu4Model()
bu4Table: table = {
......@@ -41,6 +41,10 @@ export class SubDepartmentOneComponent implements OnInit {
search: ""
}
currentModal: 'add' | 'edit' | 'delete' = "add"
numDataListChecked = 0
isDataListChecked = false
isDataListCheckedAll = false
constructor(private bu4Service: Bu4Service,
private bu3Service: Bu3Service,
private toastr: ToastrService,
......@@ -104,7 +108,7 @@ export class SubDepartmentOneComponent implements OnInit {
this.bu4ListLoading = true
this.bu4Service.getList().subscribe({
next: response => {
this.bu4List = response.map(x => new MyBu4Model(x))
this.bu4List = response.map(x => ({ check: false, data: new MyBu4Model(x) }))
this.bu4ListLoading = false
this.onBu4TableSearchChange()
this.cdr.detectChanges()
......@@ -117,11 +121,15 @@ export class SubDepartmentOneComponent implements OnInit {
onBu4TableSearchChange() {
this.bu4Table.currentPage = 1
this.bu4Table.page = Array.from({ length: Math.ceil(this.filterBu4Table().length / 10) }, (_, i) => i + 1);
this.dataListCheck()
}
filterBu4Table() {
return this.bu4List.filter(x => x.bu4id.toLowerCase().includes(this.bu4Table.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu4Table.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu4Table.search.toLowerCase()))
return this.bu4List.filter(x => {
const data = x.data
return data.bu4id.toLowerCase().includes(this.bu4Table.search.toLowerCase()) ||
data.tdesc.toLowerCase().includes(this.bu4Table.search.toLowerCase()) ||
data.edesc.toLowerCase().includes(this.bu4Table.search.toLowerCase())
})
}
selectBu4(bu4?: Bu4Model) {
this.bu4 = new MyBu4Model(bu4 || {})
......@@ -133,18 +141,17 @@ export class SubDepartmentOneComponent implements OnInit {
})
}
}
bu4idChange() {
const bu4 = this.bu4List.find(x => x.bu4id == this.bu4.bu4id)
this.selectBu4(bu4 || new MyBu4Model({ bu4id: this.bu4.bu4id }))
}
onBu4ModalSearchChange() {
this.bu4Modal.currentPage = 1
this.bu4Modal.page = Array.from({ length: Math.ceil(this.filterBu4Modal().length / 10) }, (_, i) => i + 1);
}
filterBu4Modal() {
return this.bu4List.filter(x => x.bu4id.toLowerCase().includes(this.bu4Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu4Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu4Modal.search.toLowerCase()))
return this.bu4List.filter(x => {
const data = x.data
return data.bu4id.toLowerCase().includes(this.bu4Table.search.toLowerCase()) ||
data.tdesc.toLowerCase().includes(this.bu4Table.search.toLowerCase()) ||
data.edesc.toLowerCase().includes(this.bu4Table.search.toLowerCase())
})
}
addBu4() {
this.bu4ListLoading = true
......@@ -165,7 +172,8 @@ export class SubDepartmentOneComponent implements OnInit {
}
deleteBu4() {
this.bu4ListLoading = true
this.bu4Service.delete(this.bu4).subscribe({
const body = this.bu4List.filter(x => x.check).map(x => new MyBu4Model(x.data))
this.bu4Service.delete(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -210,6 +218,20 @@ export class SubDepartmentOneComponent implements OnInit {
positionClass: 'toast-top-right',
})
}
dataListCheckAll() {
const selectAll = this.isDataListCheckedAll;
this.filterBu4Table().forEach(x => x.check = selectAll);
this.dataListCheck();
}
dataListCheck() {
const dataCheck = this.filterBu4Table();
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every(x => x.check) : false;
this.numDataListChecked = this.bu4List.filter(x => x.check).length
this.isDataListChecked = Boolean(this.numDataListChecked)
}
}
......@@ -17,7 +17,7 @@ interface table {
styleUrls: ['./sub-department-three.component.scss']
})
export class SubDepartmentThreeComponent implements OnInit {
bu6List: Bu6Model[] = []
bu6List: { check: boolean, data: Bu6Model }[] = []
bu6ListLoading = false
bu6: Bu6Model = new MyBu6Model()
bu6Table: table = {
......@@ -42,6 +42,10 @@ export class SubDepartmentThreeComponent implements OnInit {
search: ""
}
currentModal: 'add' | 'edit' | 'detele' = "add"
numDataListChecked = 0
isDataListChecked = false
isDataListCheckedAll = false
constructor(private bu6Service: Bu6Service,
private bu5Service: Bu5Service,
private toastr: ToastrService,
......@@ -105,9 +109,11 @@ export class SubDepartmentThreeComponent implements OnInit {
this.bu6ListLoading = true
this.bu6Service.getList().subscribe({
next: response => {
this.bu6List = response.map(x => new MyBu6Model(x))
this.bu6List = response.map(x => ({ check: false, data: new MyBu6Model(x) }))
this.bu6ListLoading = false
this.onBu6TableSearchChange()
this.isDataListCheckedAll = false
this.dataListCheckAll()
this.cdr.detectChanges()
}, error: error => {
this.bu6ListLoading = false
......@@ -118,11 +124,15 @@ export class SubDepartmentThreeComponent implements OnInit {
onBu6TableSearchChange() {
this.bu6Table.currentPage = 1
this.bu6Table.page = Array.from({ length: Math.ceil(this.filterBu6Table().length / 10) }, (_, i) => i + 1);
this.dataListCheck()
}
filterBu6Table() {
return this.bu6List.filter(x => x.bu6id.toLowerCase().includes(this.bu6Table.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu6Table.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu6Table.search.toLowerCase()))
return this.bu6List.filter(x => {
const data = x.data
return data.bu6id.toLowerCase().includes(this.bu6Table.search.toLowerCase()) ||
data.tdesc.toLowerCase().includes(this.bu6Table.search.toLowerCase()) ||
data.edesc.toLowerCase().includes(this.bu6Table.search.toLowerCase())
})
}
selectBu6(bu6?: Bu6Model) {
this.bu6 = new MyBu6Model(bu6)
......@@ -134,18 +144,17 @@ export class SubDepartmentThreeComponent implements OnInit {
})
}
}
bu6idChange() {
const bu6 = this.bu6List.find(x => x.bu6id == this.bu6.bu6id)
this.selectBu6(bu6 || new MyBu6Model({ bu6id: this.bu6.bu6id }))
}
onBu6ModalSearchChange() {
this.bu6Modal.currentPage = 1
this.bu6Modal.page = Array.from({ length: Math.ceil(this.filterBu6Modal().length / 10) }, (_, i) => i + 1);
}
filterBu6Modal() {
return this.bu6List.filter(x => x.bu6id.toLowerCase().includes(this.bu6Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu6Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu6Modal.search.toLowerCase()))
return this.bu6List.filter(x => {
const data = x.data
return data.bu6id.toLowerCase().includes(this.bu6Table.search.toLowerCase()) ||
data.tdesc.toLowerCase().includes(this.bu6Table.search.toLowerCase()) ||
data.edesc.toLowerCase().includes(this.bu6Table.search.toLowerCase())
})
}
addBu6() {
this.bu6ListLoading = true
......@@ -166,7 +175,8 @@ export class SubDepartmentThreeComponent implements OnInit {
}
deleteBu6() {
this.bu6ListLoading = true
this.bu6Service.delete(this.bu6).subscribe({
const body = this.bu6List.filter(x => x.check).map(x => new MyBu6Model(x.data))
this.bu6Service.delete(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -211,6 +221,19 @@ export class SubDepartmentThreeComponent implements OnInit {
positionClass: 'toast-top-right',
})
}
dataListCheckAll() {
const selectAll = this.isDataListCheckedAll;
this.filterBu6Table().forEach(x => x.check = selectAll);
this.dataListCheck();
}
dataListCheck() {
const dataCheck = this.filterBu6Table();
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every(x => x.check) : false;
this.numDataListChecked = this.bu6List.filter(x => x.check).length
this.isDataListChecked = Boolean(this.numDataListChecked)
}
}
......@@ -16,7 +16,7 @@ interface table {
styleUrls: ['./sub-department-two.component.scss']
})
export class SubDepartmentTwoComponent implements OnInit {
bu5List: Bu5Model[] = []
bu5List: { check: boolean, data: Bu5Model }[] = []
bu5ListLoading = false
bu5: Bu5Model = new MyBu5Model()
bu5Table: table = {
......@@ -41,6 +41,11 @@ export class SubDepartmentTwoComponent implements OnInit {
search: ""
}
currentModal: 'add' | 'edit' | 'delete' = "add"
numDataListChecked = 0
isDataListChecked = false
isDataListCheckedAll = false
constructor(private bu5Service: Bu5Service,
private bu4Service: Bu4Service,
private toastr: ToastrService,
......@@ -104,9 +109,11 @@ export class SubDepartmentTwoComponent implements OnInit {
this.bu5ListLoading = true
this.bu5Service.getList().subscribe({
next: response => {
this.bu5List = response.map(x => new MyBu5Model(x))
this.bu5List = response.map(x => ({ check: false, data: new MyBu5Model(x) }))
this.bu5ListLoading = false
this.onBu5TableSearchChange()
this.isDataListCheckedAll = false
this.dataListCheckAll()
this.cdr.detectChanges()
}, error: error => {
this.bu5ListLoading = false
......@@ -117,11 +124,15 @@ export class SubDepartmentTwoComponent implements OnInit {
onBu5TableSearchChange() {
this.bu5Table.currentPage = 1
this.bu5Table.page = Array.from({ length: Math.ceil(this.filterBu5Table().length / 10) }, (_, i) => i + 1);
this.dataListCheck()
}
filterBu5Table() {
return this.bu5List.filter(x => x.bu5id.toLowerCase().includes(this.bu5Table.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu5Table.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu5Table.search.toLowerCase()))
return this.bu5List.filter(x => {
const data = x.data
return data.bu5id.toLowerCase().includes(this.bu5Table.search.toLowerCase()) ||
data.tdesc.toLowerCase().includes(this.bu5Table.search.toLowerCase()) ||
data.edesc.toLowerCase().includes(this.bu5Table.search.toLowerCase())
})
}
selectBu5(bu5?: Bu5Model) {
this.bu5 = new MyBu5Model(bu5 || {})
......@@ -133,18 +144,17 @@ export class SubDepartmentTwoComponent implements OnInit {
})
}
}
bu5idChange() {
const bu5 = this.bu5List.find(x => x.bu5id == this.bu5.bu5id)
this.selectBu5(bu5 || new MyBu5Model({ bu5id: this.bu5.bu5id }))
}
onBu5ModalSearchChange() {
this.bu5Modal.currentPage = 1
this.bu5Modal.page = Array.from({ length: Math.ceil(this.filterBu5Modal().length / 10) }, (_, i) => i + 1);
}
filterBu5Modal() {
return this.bu5List.filter(x => x.bu5id.toLowerCase().includes(this.bu5Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu5Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu5Modal.search.toLowerCase()))
return this.bu5List.filter(x => {
const data = x.data
return data.bu5id.toLowerCase().includes(this.bu5Table.search.toLowerCase()) ||
data.tdesc.toLowerCase().includes(this.bu5Table.search.toLowerCase()) ||
data.edesc.toLowerCase().includes(this.bu5Table.search.toLowerCase())
})
}
addBu5() {
this.bu5ListLoading = true
......@@ -165,7 +175,8 @@ export class SubDepartmentTwoComponent implements OnInit {
}
deleteBu5() {
this.bu5ListLoading = true
this.bu5Service.delete(this.bu5).subscribe({
const body = this.bu5List.filter(x => x.check).map(x => new MyBu5Model(x.data))
this.bu5Service.delete(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -210,5 +221,18 @@ export class SubDepartmentTwoComponent implements OnInit {
positionClass: 'toast-top-right',
})
}
dataListCheckAll() {
const selectAll = this.isDataListCheckedAll;
this.filterBu5Table().forEach(x => x.check = selectAll);
this.dataListCheck();
}
dataListCheck() {
const dataCheck = this.filterBu5Table();
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every(x => x.check) : false;
this.numDataListChecked = this.bu5List.filter(x => x.check).length
this.isDataListChecked = Boolean(this.numDataListChecked)
}
}
<div class="w-full min-height-50px mb-10px justify-between items-center">
<div class="flex pr-2 pb-2rem">
<div class="flex justify-between">
<div class="flex">
<div class="flex items-center">
<input type="checkbox" class="ti-form-checkbox pointer-events-none" id="hs-default-checkbox"
......@@ -13,23 +13,7 @@
<i class="fs-l transition-all duration-200"
[ngClass]="{'ri-checkbox-multiple-line text-gray-500': !isDataListCheckedAll, 'ri-checkbox-multiple-fill text-primary': isDataListCheckedAll}"></i>
</button>
<label class="text-sm text-gray-500 ml-2" for="check-boxall" >Select All</label>
</div>
</div>
</div>
<div class="flex justify-between">
<div class="flex pr-2">
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md"
data-hs-overlay="#company-registration-page-upload-modal"
(click)="fileInput.value = '';selectedFile=null;selectedFileName = 'กรุณาเลือกไฟล์'">
<i class="ri-add-line"></i>
นำเข้าข้อมูล
</button>
<a class="mx-2 justify-center -mb-px inline-flex items-center gap-2 font-weight-500 font-size-12px text-center text-secondary border-secondary border-b-2 align-items-end"
href="javascript:void(0);" (click)="downloadFile()">
ดาวน์โหลดตัวอย่างไฟล์
</a>
<label class="text-sm text-gray-500 ml-2" for="check-boxall">Select All</label>
</div>
</div>
<div class="flex justify-end">
......@@ -44,6 +28,15 @@
</div>
</div>
<div class="px-1">
<button type="button"
class=" h-45px ti-btn ti-btn bg-pink-500/10 text-pink-500 hover:text-white hover:bg-pink-500 ring-offset-white focus:ring-pink-500 dark:focus:ring-offset-white/10 h-10 m-0 shadow-md"
data-hs-overlay="#company-registration-page-upload-modal"
(click)="fileInput.value = '';selectedFile=null;selectedFileName = 'กรุณาเลือกไฟล์'">
<i class="ti ti-file-plus"></i>
import
</button>
</div>
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
(click)="modalStatus='add';setData()" data-hs-overlay="#company-registration-page-modal">
<i class="ri-add-line"></i>
......@@ -109,7 +102,7 @@
id="checkbox-{{item.data.code}}" [(ngModel)]="item.check" (ngModelChange)="dataListCheck()">
</td>
<td class="text-center">
<label for="checkbox-{{item.data.code}}">&nbsp;{{item.data.code}}</label>
</td>
<td>{{item.data.tdesc}}</td>
......@@ -211,11 +204,13 @@
</div>
</div>
<div class="ti-modal-body padding-16px pt-0 overflow-y-0">
<label for="input-label" class="ti-form-label mt-2rem">รหัสบริษัท<span class="text-danger">*</span></label>
<label for="input-label" class="ti-form-label mt-2rem">รหัสบริษัท<span
class="text-danger">*</span></label>
<input type="text" id="input-label" class="ti-form-input w-1/2"
[ngClass]="{'bg-input-readonly':modalStatus=='edit'}" [readonly]="modalStatus=='edit'"
[(ngModel)]="dataSelect.code" [maxLength]="5">
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)<span class="text-danger">*</span></label>
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)<span
class="text-danger">*</span></label>
<input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="dataSelect.tdesc">
<label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียด (อังกฤษ)</label>
<input type="text" id="detail_eng" class="ti-form-input h-16" [(ngModel)]="dataSelect.edesc">
......@@ -323,6 +318,11 @@
<i class="ti ti-upload"></i>
</button>
</div>
<div class="flex justify-center mt-2rem ">
<h1 class="cursor-pointer justify-center -mb-px inline-flex items-center gap-2 font-weight-500 font-size-12px
text-center text-secondary border-secondary border-b-2 align-items-end" (click)="downloadFile()">
ดาวน์โหลดตัวอย่างไฟล์</h1>
</div>
<div class="flex justify-center mt-2rem mb-1rem space-x-4">
<button type="submit" class="ti-btn ti-btn-secondary"
data-hs-overlay="#company-registration-page-upload-modal"
......
......@@ -259,7 +259,8 @@
<i class="ti ti-circle-x cursor-pointer"></i>
</button>
<button type="button" class="flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay="#sub-employee-registration-empgroup-table-modal" (click)="modal.search=''">
data-hs-overlay="#sub-employee-registration-empgroup-table-modal"
(click)="modal.search='';searchModalChange(empGroupListFilter())">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
......@@ -310,7 +311,8 @@
<i class="ti ti-circle-x cursor-pointer"></i>
</button>
<button type="button" class="flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay="#sub-employee-registration-emp-table-modal" (click)="modal.search=''">
data-hs-overlay="#sub-employee-registration-emp-table-modal"
(click)="modal.search='';searchModalChange(employeeModalListFilter())">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
......@@ -333,7 +335,8 @@
<i class="ti ti-circle-x cursor-pointer"></i>
</button>
<button type="button" class="flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay="#sub-employee-registration-bu1-table-modal" (click)="modal.search=''">
data-hs-overlay="#sub-employee-registration-bu1-table-modal"
(click)="modal.search='';searchModalChange(bu1ListFilter())">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
......@@ -356,7 +359,8 @@
<i class="ti ti-circle-x cursor-pointer"></i>
</button>
<button type="button" class="flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay="#sub-employee-registration-bu2-table-modal" (click)="modal.search=''">
data-hs-overlay="#sub-employee-registration-bu2-table-modal"
(click)="modal.search='';searchModalChange(bu2ListFilter())">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
......@@ -379,7 +383,8 @@
<i class="ti ti-circle-x cursor-pointer"></i>
</button>
<button type="button" class="flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay="#sub-employee-registration-bu3-table-modal" (click)="modal.search=''">
data-hs-overlay="#sub-employee-registration-bu3-table-modal"
(click)="modal.search='';searchModalChange(bu3ListFilter())">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
......@@ -402,7 +407,8 @@
<i class="ti ti-circle-x cursor-pointer"></i>
</button>
<button type="button" class="flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay="#sub-employee-registration-bu4-table-modal" (click)="modal.search=''">
data-hs-overlay="#sub-employee-registration-bu4-table-modal"
(click)="modal.search='';searchModalChange(bu4ListFilter())">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
......@@ -425,7 +431,8 @@
<i class="ti ti-circle-x cursor-pointer"></i>
</button>
<button type="button" class="flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay="#sub-employee-registration-bu5-table-modal" (click)="modal.search=''">
data-hs-overlay="#sub-employee-registration-bu5-table-modal"
(click)="modal.search='';searchModalChange(bu5ListFilter())">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
......@@ -447,7 +454,8 @@
<i class="ti ti-circle-x cursor-pointer"></i>
</button>
<button type="button" class="flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay="#sub-employee-registration-bu6-table-modal" (click)="modal.search=''">
data-hs-overlay="#sub-employee-registration-bu6-table-modal"
(click)="modal.search='';searchModalChange(bu6ListFilter())">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
......@@ -469,7 +477,8 @@
<i class="ti ti-circle-x cursor-pointer"></i>
</button>
<button type="button" class="flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay="#sub-employee-registration-bu7-table-modal" (click)="modal.search=''">
data-hs-overlay="#sub-employee-registration-bu7-table-modal"
(click)="modal.search='';searchModalChange(bu7ListFilter())">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
......@@ -492,7 +501,8 @@
<i class="ti ti-circle-x cursor-pointer"></i>
</button>
<button type="button" class="flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay="#sub-employee-registration-position-table-modal" (click)="modal.search=''">
data-hs-overlay="#sub-employee-registration-position-table-modal"
(click)="modal.search='';searchModalChange(positionListFilter())">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
......@@ -515,7 +525,8 @@
<i class="ti ti-circle-x cursor-pointer"></i>
</button>
<button type="button" class="flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay="#sub-employee-registration-jobcode-table-modal" (click)="modal.search=''">
data-hs-overlay="#sub-employee-registration-jobcode-table-modal"
(click)="modal.search='';searchModalChange(jobcodeListFilter())">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
......@@ -538,7 +549,8 @@
<i class="ti ti-circle-x cursor-pointer"></i>
</button>
<button type="button" class="flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay="#sub-employee-registration-branch-table-modal" (click)="modal.search=''">
data-hs-overlay="#sub-employee-registration-branch-table-modal"
(click)="modal.search='';searchModalChange(branchListFilter())">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
......@@ -561,7 +573,8 @@
<i class="ti ti-circle-x cursor-pointer"></i>
</button>
<button type="button" class="flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay="#sub-employee-registration-emptype-table-modal" (click)="modal.search=''">
data-hs-overlay="#sub-employee-registration-emptype-table-modal"
(click)="modal.search='';searchModalChange(empTypeListFilter())">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
......@@ -584,7 +597,8 @@
<i class="ti ti-circle-x cursor-pointer"></i>
</button>
<button type="button" class="flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay="#sub-employee-registration-pl-table-modal" (click)="modal.search=''">
data-hs-overlay="#sub-employee-registration-pl-table-modal"
(click)="modal.search='';searchModalChange(plListFilter())">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
......
......@@ -448,7 +448,7 @@ export class SubEmployeeRegistrationComponent {
this.employeeService.getList().subscribe({
next: response => {
this.employee.dataList = response.map((x: any) => ({ check: false, data: new MyEmployeeModel(x) }))
this.employeeModal.dataList = response.map((x: any) => new MyEmployeeModel(x)).filter(x => x.employeeId != this.decodeJWT(sessionStorage.getItem("accessToken") || '').employeeid)
this.employeeModal.dataList = response.filter(x => x.employeeId != this.decodeJWT(sessionStorage.getItem("accessToken") || '').employeeid).map((x: any) => new MyEmployeeModel(x))
this.employee.loading = false
this.isDataListCheckedAll = false
this.dataListCheckAll()
......@@ -462,8 +462,8 @@ export class SubEmployeeRegistrationComponent {
}
employeeModalListFilter() {
return this.employeeModal.dataList.filter(x => x.employeeId.toLowerCase().includes(this.modal.search.toLowerCase()) ||
x.fname.toLowerCase().includes(this.search.toLowerCase()) ||
x.lname.toLowerCase().includes(this.search.toLowerCase()) ||
x.fname.toLowerCase().includes(this.modal.search.toLowerCase()) ||
x.lname.toLowerCase().includes(this.modal.search.toLowerCase()) ||
x.position.tdesc.toLowerCase().includes(this.modal.search.toLowerCase()) ||
x.jobCode.tdesc.toLowerCase().includes(this.modal.search.toLowerCase()))
}
......
......@@ -10,6 +10,7 @@ export interface DataModel {
tdesc: string;
edesc: string;
competencyGrades: CompetencyGradeModel[]
companyId: string
}
@Component({
......@@ -29,7 +30,7 @@ export class GradeManagementComponent {
dataList: DataModel[] = [];
dataLoading = false
dataSelect: DataModel = { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [] }
dataSelect: DataModel = { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [], companyId: '' }
constructor(private toastr: ToastrService,
private competencyGroupGradeService: CompetencyGroupGradeService,
......@@ -40,13 +41,13 @@ export class GradeManagementComponent {
this.getCompetencyGroupGradeList()
}
selectData(data?: DataModel) {
this.dataSelect = JSON.parse(JSON.stringify(data || { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [] }))
this.dataSelect = JSON.parse(JSON.stringify(data || { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [], companyId: '' }))
}
getCompetencyGroupGradeList() {
this.dataLoading = true
this.competencyGroupGradeService.getList().subscribe({
next: response => {
this.dataList = response.map(x => ({ check: false, code: x.groupGradeId, tdesc: x.tdesc, edesc: x.edesc, competencyGrades: x.competencyGrades }))
this.dataList = response.map(x => ({ check: false, code: x.groupGradeId, tdesc: x.tdesc, edesc: x.edesc, competencyGrades: x.competencyGrades, companyId: x.companyId }))
this.isDataListCheckedAll = false
this.dataListCheckAll()
this.searchChange()
......@@ -97,7 +98,7 @@ export class GradeManagementComponent {
}
deleteCompetencyGroupGradeList() {
const body = this.dataSelect.code ? new MyCompetencyGroupGradeModel({ groupGradeId: this.dataSelect.code, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc }) : this.dataList.filter(x => x.check).map(x => new MyCompetencyGroupGradeModel({ groupGradeId: x.code, tdesc: x.tdesc, edesc: x.edesc }))
const body = this.dataSelect.code ? new MyCompetencyGroupGradeModel({ groupGradeId: this.dataSelect.code, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, companyId: this.dataSelect.companyId }) : this.dataList.filter(x => x.check).map(x => new MyCompetencyGroupGradeModel({ groupGradeId: x.code, tdesc: x.tdesc, edesc: x.edesc }))
this.dataLoading = true
this.competencyGroupGradeService.delete(body).subscribe({
next: response => {
......
......@@ -9,6 +9,7 @@ export interface DataModel {
tdesc: string
edesc: string
competencyGrades: CompetencyGradeModel[]
companyId: string
}
@Component({
......@@ -19,22 +20,22 @@ export interface DataModel {
export class GroupGradeComponent implements OnInit {
@Output() sendBackTab: EventEmitter<undefined> = new EventEmitter<undefined>();
@Input() typeTab: 'add' | 'edit' = 'add'
@Input() dataSelect: DataModel = { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [] }
dataOriginal: DataModel = { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [] }
@Input() dataSelect: DataModel = { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [], companyId: '' }
dataOriginal: DataModel = { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [], companyId: '' }
@Output() sendDataList: EventEmitter<DataModel[]> = new EventEmitter<DataModel[]>();
currentTab = 1
constructor(private toastr: ToastrService,
private competencyGroupGradeService: CompetencyGroupGradeService,
private cdr: ChangeDetectorRef) { }
ngOnInit(): void {
this.dataOriginal = JSON.parse(JSON.stringify(this.dataSelect || { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [] }))
this.dataOriginal = JSON.parse(JSON.stringify(this.dataSelect || { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [], companyId: '' }))
}
clear() {
if (this.typeTab == 'add') {
this.dataSelect = { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [] }
this.dataSelect = { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [], companyId: '' }
this.cdr.detectChanges()
} else if (this.typeTab == 'edit') {
this.dataSelect = { check: false, code: this.dataOriginal.code, tdesc: '', edesc: '', competencyGrades: [] }
this.dataSelect = { check: false, code: this.dataOriginal.code, tdesc: '', edesc: '', competencyGrades: [], companyId: '' }
this.cdr.detectChanges()
}
}
......@@ -42,7 +43,7 @@ export class GroupGradeComponent implements OnInit {
this.sendBackTab.emit();
}
postCompetencyGroupGrade() {
this.competencyGroupGradeService.post(new MyCompetencyGroupGradeModel({ groupGradeId: this.dataSelect.code, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, competencyGrades: this.dataSelect.competencyGrades })).subscribe({
this.competencyGroupGradeService.post(new MyCompetencyGroupGradeModel({ groupGradeId: this.dataSelect.code, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, competencyGrades: this.dataSelect.competencyGrades, companyId: this.dataSelect.companyId })).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......@@ -58,7 +59,7 @@ export class GroupGradeComponent implements OnInit {
getCompetencyGroupGradeList() {
this.competencyGroupGradeService.getList().subscribe({
next: response => {
this.sendDataList.emit(response.map(x => ({ check: false, code: x.groupGradeId, tdesc: x.tdesc, edesc: x.edesc, competencyGrades: x.competencyGrades })))
this.sendDataList.emit(response.map(x => ({ check: false, code: x.groupGradeId, tdesc: x.tdesc, edesc: x.edesc, competencyGrades: x.competencyGrades, companyId: this.dataSelect.companyId })))
this.cdr.detectChanges()
}
})
......
......@@ -10,6 +10,7 @@ export interface DataModel {
tdesc: string
edesc: string
competencyGrades: CompetencyGradeModel[]
companyId: string
}
@Component({
......@@ -18,7 +19,7 @@ export interface DataModel {
styleUrls: ['./sub-grade-registration.component.scss'],
})
export class SubGradeRegistrationComponent {
@Input() dataSelect: DataModel = { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [] }
@Input() dataSelect: DataModel = { check: false, code: '', tdesc: '', edesc: '', competencyGrades: [], companyId: '' }
@Output() sendDataSelect: EventEmitter<DataModel> = new EventEmitter<DataModel>();
competencyGrade: { select: CompetencyGradeModel, dataList: { check: boolean, data: CompetencyGradeModel }[] } = { select: new MyCompetencyGradeModel({}), dataList: [] }
currentPage = 1;
......
......@@ -21,7 +21,7 @@ export class Bu1Service {
post(body: Bu1Model): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: Bu1Model): Observable<AlertModel> {
delete(body: Bu1Model[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
......
......@@ -21,7 +21,7 @@ export class Bu2Service {
post(body: Bu2Model): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: Bu2Model): Observable<AlertModel> {
delete(body: Bu2Model[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
......
......@@ -21,7 +21,7 @@ import { AlertModel } from '../model/alert.model';
post(body: Bu3Model): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: Bu3Model): Observable<AlertModel> {
delete(body: Bu3Model[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
......
......@@ -21,7 +21,7 @@ export class Bu4Service {
post(body: Bu4Model): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: Bu4Model): Observable<AlertModel> {
delete(body: Bu4Model[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
......
......@@ -21,7 +21,7 @@ export class Bu5Service {
post(body: Bu5Model): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: Bu5Model): Observable<AlertModel> {
delete(body: Bu5Model[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
......
......@@ -21,7 +21,7 @@ export class Bu6Service {
post(body: Bu6Model): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: Bu6Model): Observable<AlertModel> {
delete(body: Bu6Model[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
......
......@@ -21,7 +21,7 @@ export class Bu7Service {
post(body: Bu7Model): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: Bu7Model): Observable<AlertModel> {
delete(body: Bu7Model[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment