Commit 7863658f by Natthaphat Pankiang

bu6,bu7

parent 673f4a0f
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
<div class="relative w-full"> <div class="relative w-full">
<div> <div>
<div class="relative flex rounded-md"> <div class="relative flex rounded-md">
<input type="text" id="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button" class="ti-form-input rounded-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" value="01" style="padding-right: 3.5rem;" [(ngModel)]="bu2.bu2id"> <input type="text" id="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button" class="ti-form-input rounded-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;" [(ngModel)]="bu2.bu2id">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2"> <div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i> <i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i>
<svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"> <svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
......
import { Component } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Bu6Model, MyBu6Model } from 'src/app/shared/model/bu6.model';
import { Bu7Model, MyBu7Model } from 'src/app/shared/model/bu7.model';
import { Bu6Service } from 'src/app/shared/services/bu6.service';
import { Bu7Service } from 'src/app/shared/services/bu7.service';
@Component({ @Component({
selector: 'app-sub-department-four', selector: 'app-sub-department-four',
templateUrl: './sub-department-four.component.html', templateUrl: './sub-department-four.component.html',
styleUrls: ['./sub-department-four.component.scss'] styleUrls: ['./sub-department-four.component.scss']
}) })
export class SubDepartmentFourComponent { export class SubDepartmentFourComponent implements OnInit {
modalOptions: { currentPage = 1
[nameModal: string]: { // ชื่อตรวจสอบการเปิดปิด page = Array.from({ length: 1 }, (_, i) => i + 1);
isModalOpen: boolean; // เปิด/ปิด bu7List: Bu7Model[] = []
modalSize: string; // ขนาดของ Modal (s,m,l,vw10-vw100 ) bu7: Bu7Model = new MyBu7Model({})
backdropClose: boolean; // (คลิก Backdrop แล้ว true ปิด false ไม่ปิด ) bu6: Bu6Model = new MyBu6Model({})
} search = ""
} = { constructor(private bu7Service: Bu7Service,
"add": { private bu6Service: Bu6Service
isModalOpen: false, ) { }
modalSize: 'm', ngOnInit(): void {
backdropClose: true, this.getBu7List()
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
}
openModal(name: string, size: string, closeOnBackdrop?: boolean) {
this.modalOptions[name].modalSize = size;
this.modalOptions[name].backdropClose = closeOnBackdrop || false;
this.modalOptions[name].isModalOpen = true;
document.body.style.overflow = 'hidden'; // ล็อก Scroll
} }
getBu7List() {
closeModal(name: string) { this.bu7Service.getList().subscribe(response => {
this.modalOptions[name].isModalOpen = false; this.bu7List = response
// ตรวจสอบว่ามี Modal อื่นเปิดอยู่หรือไม่ this.searchChange()
if (!this.isAnyModalOpen()) { })
document.body.style.overflow = ''; // คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
}
} }
searchChange() {
isAnyModalOpen(): boolean { this.currentPage = 1
// Logic ตรวจสอบว่า Modal อื่นยังเปิดอยู่หรือไม่ this.page = Array.from({ length: Math.ceil(this.bu7ListFilter().length / 10) }, (_, i) => i + 1);
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // หากไม่มี Modal อื่นเปิด }
bu7ListFilter() {
return this.bu7List.filter(x => x.bu7id.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
}
selectBu7(bu7: Bu7Model) {
this.bu6Service.getById(bu7.parent).subscribe(response =>{
this.bu6 = new MyBu6Model(response)
})
this.bu7 = new MyBu7Model(bu7)
console.log("5",this.bu6)
console.log(this.bu7)
}
addBu7() {
// this.bu7Service.post(this.bu7).subscribe((response:any) => {
// if (response.success) {
// this.getBu7List()
// }
// })
}
deleteBu7(bu7: Bu7Model) {
// this.bu7Service.delete(new MyBu1Model(bu7)).subscribe((response:any) => {
// if (response.success) {
// this.getBu7List()
// }
// })
} }
} }
...@@ -218,7 +218,7 @@ ...@@ -218,7 +218,7 @@
<div class="max-h-full overflow-hidden ti-modal-content"> <div class="max-h-full overflow-hidden ti-modal-content">
<div class="ti-modal-header"> <div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary"> <h3 class="text-xxl font-bold text-primary">
แก้ไขข้อมูลทะเบียนเเผนก แก้ไขข้อมูลทะเบียนส่วนย่อย 1
</h3> </h3>
<div class="flex justify-end"> <div class="flex justify-end">
<div class="button-clear"> <div class="button-clear">
...@@ -259,7 +259,7 @@ ...@@ -259,7 +259,7 @@
<div class="relative w-full"> <div class="relative w-full">
<div> <div>
<div class="relative flex rounded-md"> <div class="relative flex rounded-md">
<input type="text" id="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button" class="ti-form-input rounded-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;" [(ngModel)]="bu3.bu3id" readonly> <input type="text" id="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button" class="ti-form-input rounded-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;" [(ngModel)]="bu3.bu3id">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2"> <div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i> <i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i>
<svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"> <svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
...@@ -270,7 +270,7 @@ ...@@ -270,7 +270,7 @@
</div> </div>
</div> </div>
<div class="flex flex-col-6" > <div class="flex flex-col-6" >
<input type="text" id="input-label" class="ti-form-input w-full" style="background-color: #B3B3B3; margin-left:10px;" disabled value="ฝ่าย" [(ngModel)]="bu3.tdesc"> <input type="text" id="input-label" class="ti-form-input w-full" style="background-color: #B3B3B3; margin-left:10px;" [(ngModel)]="bu3.tdesc" readonly>
</div> </div>
</div> </div>
</div> </div>
......
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit } from '@angular/core';
import { Bu5Model, MyBu5Model } from 'src/app/shared/model/bu5.model';
import { Bu6Model, MyBu6Model } from 'src/app/shared/model/bu6.model';
import { Bu5Service } from 'src/app/shared/services/bu5.service';
import { Bu6Service } from 'src/app/shared/services/bu6.service';
@Component({ @Component({
selector: 'app-sub-department-three', selector: 'app-sub-department-three',
templateUrl: './sub-department-three.component.html', templateUrl: './sub-department-three.component.html',
styleUrls: ['./sub-department-three.component.scss'] styleUrls: ['./sub-department-three.component.scss']
}) })
export class SubDepartmentThreeComponent { export class SubDepartmentThreeComponent implements OnInit {
modalOptions: { currentPage = 1
[nameModal: string]: { // ชื่อตรวจสอบการเปิดปิด page = Array.from({ length: 1 }, (_, i) => i + 1);
isModalOpen: boolean; // เปิด/ปิด bu6List: Bu6Model[] = []
modalSize: string; // ขนาดของ Modal (s,m,l,vw10-vw100 ) bu6: Bu6Model = new MyBu6Model({})
backdropClose: boolean; // (คลิก Backdrop แล้ว true ปิด false ไม่ปิด ) bu5: Bu5Model = new MyBu5Model({})
} search = ""
} = { constructor(private bu6Service: Bu6Service,
"add": { private bu5Service: Bu5Service
isModalOpen: false, ) { }
modalSize: 'm', ngOnInit(): void {
backdropClose: true, this.getBu6List()
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
}
openModal(name: string, size: string, closeOnBackdrop?: boolean) {
this.modalOptions[name].modalSize = size;
this.modalOptions[name].backdropClose = closeOnBackdrop || false;
this.modalOptions[name].isModalOpen = true;
document.body.style.overflow = 'hidden'; // ล็อก Scroll
} }
getBu6List() {
closeModal(name: string) { this.bu6Service.getList().subscribe(response => {
this.modalOptions[name].isModalOpen = false; this.bu6List = response
// ตรวจสอบว่ามี Modal อื่นเปิดอยู่หรือไม่ this.searchChange()
if (!this.isAnyModalOpen()) { })
document.body.style.overflow = ''; // คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
}
} }
searchChange() {
isAnyModalOpen(): boolean { this.currentPage = 1
// Logic ตรวจสอบว่า Modal อื่นยังเปิดอยู่หรือไม่ this.page = Array.from({ length: Math.ceil(this.bu6ListFilter().length / 10) }, (_, i) => i + 1);
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // หากไม่มี Modal อื่นเปิด }
bu6ListFilter() {
return this.bu6List.filter(x => x.bu6id.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
}
selectBu6(bu6: Bu6Model) {
this.bu5Service.getById(bu6.parent).subscribe(response =>{
this.bu5 = new MyBu5Model(response)
})
this.bu6 = new MyBu6Model(bu6)
console.log("5",this.bu5)
console.log(this.bu6)
}
addBu6() {
// this.bu6Service.post(this.bu6).subscribe((response:any) => {
// if (response.success) {
// this.getBu6List()
// }
// })
}
deleteBu6(bu6: Bu6Model) {
// this.bu6Service.delete(new MyBu1Model(bu6)).subscribe((response:any) => {
// if (response.success) {
// this.getBu6List()
// }
// })
} }
} }
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
<div class="max-h-full overflow-hidden ti-modal-content"> <div class="max-h-full overflow-hidden ti-modal-content">
<div class="ti-modal-header"> <div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary"> <h3 class="text-xxl font-bold text-primary">
เพิ่มข้อมูลทะเบียนส่วนย่อย 1 เพิ่มข้อมูลทะเบียนส่วนย่อย 2
</h3> </h3>
<div class="flex justify-end" > <div class="flex justify-end" >
<div class="button-clear"> <div class="button-clear">
...@@ -177,7 +177,7 @@ ...@@ -177,7 +177,7 @@
</div> </div>
</div> </div>
</div> </div>
<label for="input-label" class="ti-form-label mt-2rem">ส่วนย่อย1</label> <label for="input-label" class="ti-form-label mt-2rem">ส่วนย่อย2</label>
<div class="sm:grid grid-cols-2 gap-1"> <div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full"> <div class="relative w-full">
<div> <div>
...@@ -218,7 +218,7 @@ ...@@ -218,7 +218,7 @@
<div class="max-h-full overflow-hidden ti-modal-content"> <div class="max-h-full overflow-hidden ti-modal-content">
<div class="ti-modal-header"> <div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary"> <h3 class="text-xxl font-bold text-primary">
แก้ไขข้อมูลทะเบียนเเผนก แก้ไขข้อมูลทะเบียนส่วนย่อย 2
</h3> </h3>
<div class="flex justify-end"> <div class="flex justify-end">
<div class="button-clear"> <div class="button-clear">
...@@ -259,7 +259,7 @@ ...@@ -259,7 +259,7 @@
<div class="relative w-full"> <div class="relative w-full">
<div> <div>
<div class="relative flex rounded-md"> <div class="relative flex rounded-md">
<input type="text" id="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button" class="ti-form-input rounded-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;" [(ngModel)]="bu4.bu4id" readonly> <input type="text" id="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button" class="ti-form-input rounded-none ltr:rounded-r-md rtl:rounded-l-md focus:z-10" style="padding-right: 3.5rem;" [(ngModel)]="bu4.bu4id">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2"> <div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center pointer-events-none z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i> <i class="ti ti-circle-x text-red-500 cursor-pointer right-10"></i>
<svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"> <svg class="h-3.5 w-3.5 text-gray-500 dark:text-white/70" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
...@@ -270,12 +270,12 @@ ...@@ -270,12 +270,12 @@
</div> </div>
</div> </div>
<div class="flex flex-col-6" > <div class="flex flex-col-6" >
<input type="text" id="input-label" class="ti-form-input w-full" style="background-color: #B3B3B3; margin-left:10px;" disabled value="ฝ่าย" [(ngModel)]="bu4.tdesc"> <input type="text" id="input-label" class="ti-form-input w-full" style="background-color: #B3B3B3; margin-left:10px;" [(ngModel)]="bu4.tdesc" readonly>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<label for="input-label" class="ti-form-label mt-2rem">ส่วนย่อย1</label> <label for="input-label" class="ti-form-label mt-2rem">ส่วนย่อย2</label>
<div class="sm:grid grid-cols-2 gap-1"> <div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full"> <div class="relative w-full">
<input type="text" id="input-label" class="ti-form-input w-full pr-10 " style="background-color: #B3B3B3;" [value]="bu5.bu5id"> <input type="text" id="input-label" class="ti-form-input w-full pr-10 " style="background-color: #B3B3B3;" [value]="bu5.bu5id">
......
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