Commit ce3ce317 by kantavee

input add>search edit>search clear ทะเบียนส่วนกับส่วนย่อยที่2

parent c8c4c04c
......@@ -156,17 +156,16 @@
<div class="ti-modal-body">
<label class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="flex">
<div class="flex rounded-md w-1/2">
<input type="text"
class="ti-form-input rounded-none ltr:rounded-l-md br-transparent focus:z-10 br-transparent ti-form-input-no-border-left border-radius-0.25"
[(ngModel)]="bu1.bu1id" (ngModelChange)="bu1idChange()">
<div
class="w-auto inline-flex flex-shrink-0 justify-center items-center h-[2.875rem] w-[2.875rem] border focus:z-10 focus:outline-none focus:ring-0 focus:ring-primary transition-all text-sm bx-transparent">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10" (click)="selectBu1()"></i>
</div>
<div
class="inline-flex flex-shrink-0 justify-center items-center h-[2.875rem] w-[2.875rem] ltr:rounded-r-md rtl:rounded-l-md border focus:z-10 focus:outline-none focus:ring-0 focus:ring-primary transition-all text-sm bl-transparent border-radius-0.25">
<i class="ri-search-line cursor-pointer text-gray" data-hs-overlay="#department-list-bu1-table-modal"></i>
<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)]="bu1.bu1id" (ngModelChange)="bu1idChange()">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<button type="button" class="flex items-center text-red-500" (click)="selectBu1()">
<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="#department-list-bu1-table-modal">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
</div>
<div class="flex rounded-md w-1/2 pl-1rem">
......@@ -175,17 +174,16 @@
</div>
</div>
<label class="ti-form-label mt-2rem">เเผนก</label>
<div class="flex rounded-md w-1/2">
<input type="text"
class="ti-form-input rounded-none ltr:rounded-l-md br-transparent focus:z-10 br-transparent ti-form-input-no-border-left border-radius-0.25"
[(ngModel)]="bu2.bu2id" (ngModelChange)="bu2idChange()">
<div
class="w-auto inline-flex flex-shrink-0 justify-center items-center h-[2.875rem] w-[2.875rem] border focus:z-10 focus:outline-none focus:ring-0 focus:ring-primary transition-all text-sm bx-transparent">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10" (click)="selectBu2()"></i>
</div>
<div
class="inline-flex flex-shrink-0 justify-center items-center h-[2.875rem] w-[2.875rem] ltr:rounded-r-md rtl:rounded-l-md border focus:z-10 focus:outline-none focus:ring-0 focus:ring-primary transition-all text-sm bl-transparent border-radius-0.25">
<i class="ri-search-line cursor-pointer text-gray" data-hs-overlay="#department-list-bu2-table-modal"></i>
<div class="relative flex rounded-md w-1/2">
<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" (ngModelChange)="bu2idChange()">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<button type="button" class="flex items-center text-red-500" (click)="selectBu2()">
<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="#department-list-bu2-table-modal">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
</div>
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)</label>
......@@ -251,18 +249,16 @@
<label for="hs-trailing-button-add-on-with-icon"
class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="flex">
<div class="flex rounded-md w-1/2">
<input type="text" id="hs-trailing-button-add-on-with-icon"
name="hs-trailing-button-add-on-with-icon"
class="ti-form-input rounded-none ltr:rounded-l-md br-transparent focus:z-10 br-transparent ti-form-input-no-border-left border-radius-0.25"
[(ngModel)]="bu1.bu1id" (ngModelChange)="bu1idChange()">
<div
class="w-auto inline-flex flex-shrink-0 justify-center items-center h-[2.875rem] w-[2.875rem] border focus:z-10 focus:outline-none focus:ring-0 focus:ring-primary transition-all text-sm bx-transparent">
<i class="ti ti-circle-x text-red-500 cursor-pointer right-10" (click)="selectBu1()"></i>
</div>
<div
class="inline-flex flex-shrink-0 justify-center items-center h-[2.875rem] w-[2.875rem] ltr:rounded-r-md rtl:rounded-l-md border focus:z-10 focus:outline-none focus:ring-0 focus:ring-primary transition-all text-sm bl-transparent border-radius-0.25">
<i class="ri-search-line cursor-pointer text-gray" data-hs-overlay="#department-list-bu1-table-modal"></i>
<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)]="bu1.bu1id" (ngModelChange)="bu1idChange()">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<button type="button" class="flex items-center text-red-500" (click)="selectBu1()">
<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="#department-list-bu1-table-modal">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
</div>
<div class="flex rounded-md w-1/2 pl-1rem">
......
......@@ -3,7 +3,8 @@
<div class="relative shadow-md">
<input type="text" id="hs-leading-icon" name="hs-leading-icon"
class="ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 " placeholder="Search by No. or Name"
[(ngModel)]="search" (ngModelChange)="searchChange()">
[(ngModel)]="bu3Table.search" (ngModelChange)="onBu3TableSearchChange()">
<div
class="absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4">
<i class="ri-search-line text-gray"></i>
......@@ -12,7 +13,7 @@
</div>
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
data-hs-overlay="#section-registration-modal-add">
(click)="currentModal='add';selectBu2();selectBu3()" data-hs-overlay="#section-registration-modal-add">
<i class="ri-add-line"></i>
Add
</button>
......@@ -53,7 +54,7 @@
*ngFor="let item of ['ลำดับ','รหัสส่วน','รายละเอียดส่วน (ไทย)','รายละเอียดส่วน (อังกฤษ)','การจัดการ']; let f = first; let l = last">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary"
[class.!text-center]="f||l">
<span class="text-sm">{{ item }}</span>
<span class="!text-sm">{{ item }}</span>
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l">
<i class="ti ti-dots-vertical fs-l"></i>
</div>
......@@ -61,24 +62,25 @@
</ng-container>
</tr>
</thead>
<tbody *ngIf="!bu3ListFilter().length">
<tbody *ngIf="!filterBu3Table().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="bu3ListFilter().length">
<tbody *ngIf="filterBu3Table().length">
<tr
*ngFor="let item of bu3ListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index">
*ngFor="let item of filterBu3Table() | slice:((bu3Table.currentPage-1) * 10) : (((bu3Table.currentPage-1) * 10) + 10);let i = index">
<td class="flex justify-center">
{{((currentPage-1) * 10)+(i+1)}}
{{((bu3Table.currentPage-1) * 10)+(i+1)}}
</td>
<td>{{item.bu3id}}</td>
<td>{{item.tdesc}}</td>
<td>{{item.edesc}}</td>
<td class="flex justify-center">
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1" (click)="selectBu3(item)"
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1"
(click)="selectBu3(item);currentModal='edit'"
data-hs-overlay="#section-registration-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="deleteBu3(item)"></i>
</td>
......@@ -86,30 +88,29 @@
</tbody>
</table>
</div>
<nav class="pagination-style-3 overflow-auto my-5" *ngIf="page.length">
<nav class="pagination-style-3 overflow-auto my-5" *ngIf="bu3Table.page.length">
<ul class="ti-pagination">
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="currentPage = (currentPage-1 || 1)">
(click)="bu3Table.currentPage = (bu3Table.currentPage-1 || 1)">
<i class="ri-arrow-left-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
<li *ngFor="let item of page">
<a class="page-link" href="javascript:void(0);" [class.active]="item==currentPage"
(click)="currentPage=item">{{item}}
<li *ngFor="let item of bu3Table.page">
<a class="page-link" href="javascript:void(0);" [class.active]="item==bu3Table.currentPage"
(click)="bu3Table.currentPage=item">{{item}}
</a>
<!-- <a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i>
</a> -->
</li>
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="currentPage = (currentPage > page.length-1 ? currentPage: currentPage+1 )">
(click)="bu3Table.currentPage = (bu3Table.currentPage > bu3Table.page.length-1 ? bu3Table.currentPage: bu3Table.currentPage+1 )">
<i class="ri-arrow-right-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
</ul>
</nav>
</div>
</div>
......@@ -122,7 +123,8 @@
</h3>
<div class="flex justify-end">
<div class="button-clear">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(click)="selectBu2();selectBu3()">
<svg class="svg-indigo" width="16" height="16" viewBox="0 0 64.00 64.00"
xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#595BEA" stroke-width="3.84"
transform="rotate(45)matrix(-1, 0, 0, 1, 0, 0)">
......@@ -151,58 +153,51 @@
</button>
</div>
</div>
<div class="ti-modal-body" style="margin-top: 40px;">
<label for="part" class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="relative">
<div class="relative rounded-xl overflow-auto">
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<div>
<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;">
<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>
<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">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
</div>
</div>
</div>
<div class="flex flex-col-6">
<input type="text" id="part2" class="ti-form-input w-full" placeholder="" style="background-color: #B3B3B3; margin-left: 10px;" disabled>
</div>
<div class="ti-modal-body">
<label class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="flex">
<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)]="bu2.bu2id" (ngModelChange)="bu2idChange()">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<button type="button" class="flex items-center text-red-500" (click)="selectBu2()">
<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="#section-registration-bu2-table-modal">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
</div>
<div class="flex rounded-md w-1/2 pl-1rem">
<input type="text" id="input-label" class="ti-form-input w-full pr-10 bg-input-readonly"
readonly [value]="bu2.tdesc">
</div>
</div>
<label for="part" class="ti-form-label mt-2rem">ส่วน</label>
<div class="relative w-1/2">
<div>
<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;">
<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>
<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">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
</div>
<label class="ti-form-label mt-2rem">ส่วน</label>
<div class="relative flex rounded-md w-1/2">
<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" (ngModelChange)="bu3idChange()">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<button type="button" class="flex items-center text-red-500" (click)="selectBu3()">
<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="#section-registration-bu3-table-modal">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
</div>
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)</label>
<input type="text" id="detail_th" class="ti-form-input h-16" placeholder="">
<input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu3.tdesc">
<label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียด (อังกฤษ)</label>
<input type="text" id="detail_eng" class="ti-form-input h-16" placeholder="">
<input type="text" id="detail_eng" class="ti-form-input h-16" [(ngModel)]="bu3.edesc">
<div class="flex justify-end mt-2rem mb-1rem space-x-4">
<button type="button"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#section-registration-modal-add">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);">
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#department-list-alert-modal">
บันทึกข้อมูล
</a>
</div>
......@@ -220,14 +215,15 @@
</h3>
<div class="flex justify-end">
<div class="button-clear">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(click)="selectBu2();bu3.tdesc='';bu3.edesc=''">
<svg class="svg-indigo" width="16" height="16" viewBox="0 0 64.00 64.00"
xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#595BEA" stroke-width="3.84"
transform="rotate(45)matrix(-1, 0, 0, 1, 0, 0)">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
<g id="SVGRepo_iconCarrier">
<path d="M15 49A24 24 0 0 1 32 8"></path>W
<path d="M15 49A24 24 0 0 1 32 8"></path>
<path d="M49 15a24 24 0 0 1-17 41"></path>
<polyline points="15.03 40 15.03 48.97 8 48.97"></polyline>
<polyline points="48.97 24 48.97 15.03 56 15.03"></polyline>
......@@ -249,47 +245,46 @@
</button>
</div>
</div>
<div class="ti-modal-body" style="margin-top: 40px;">
<label for="part" class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="relative">
<div class="relative rounded-xl overflow-auto">
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<div>
<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)]="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">
<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">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
</div>
</div>
</div>
<div class="flex flex-col-6">
<input type="text" id="part2" class="ti-form-input w-full" placeholder="" style="background-color: #B3B3B3; margin-left: 10px;" [(ngModel)]="bu2.tdesc" readonly>
</div>
<div class="ti-modal-body">
<label for="hs-trailing-button-add-on-with-icon"
class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="flex">
<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)]="bu2.bu2id" (ngModelChange)="bu2idChange()">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<button type="button" class="flex items-center text-red-500" (click)="selectBu2()">
<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="#section-registration-bu2-table-modal">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
</div>
<div class="flex rounded-md w-1/2 pl-1rem">
<input type="text" id="input-label" class="ti-form-input w-full pr-10 bg-input-readonly"
readonly [value]="bu2.tdesc">
</div>
</div>
<label for="input-label" class="ti-form-label mt-2rem">ส่วน</label>
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<input type="text" id="input-label" class="ti-form-input w-full pr-10 bg-input-readonly"
readonly [value]="bu3.bu3id">
</div>
</div>
<label for="part" class="ti-form-label mt-2rem">ส่วน</label>
<input type="text" id="part" class="ti-form-input w-1/2 pr-10" style="background-color: #B3B3B3;" [(ngModel)]="bu3.bu3id" readonly>
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)</label>
<input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu3.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)]="bu3.edesc">
<div class="flex justify-end mt-2rem mb-1rem space-x-4">
<div class="flex justify-end mt-2rem mb-1rem space-x-4 ">
<button type="button"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#section-registration-modal-add">
data-hs-overlay="#section-registration-modal-edit">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#section-registration-alert-modal">
data-hs-overlay="#department-list-alert-modal">
บันทึกข้อมูล
</a>
</div>
......@@ -298,7 +293,237 @@
</div>
</div>
<div id="section-registration-alert-modal" class="hs-overlay hidden ti-modal">
<div id="section-registration-bu2-table-modal" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out lg:!max-w-4xl lg:w-full m-3 lg:!mx-auto">
<div class="max-h-full overflow-hidden ti-modal-content">
<div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary">
ข้อมูลทะเบียนเเผนก
</h3>
<div class="flex justify-end">
<button *ngIf="currentModal=='add'" type="button"
class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#section-registration-modal-add">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
<button *ngIf="currentModal=='edit'" type="button"
class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#section-registration-modal-edit">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
</div>
</div>
<div class="ti-modal-body">
<div class="flex justify-end pb-1rem">
<div class="px-1">
<div class="relative shadow-md">
<input type="text" id="hs-leading-icon" name="hs-leading-icon"
class="ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
placeholder="Search by No. or Name" [(ngModel)]="bu2Modal.search"
(ngModelChange)="onBu2ModalSearchChange()">
<div
class="absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4">
<i class="ri-search-line text-gray"></i>
</div>
</div>
</div>
</div>
<div class="overflow-auto border">
<table class="ti-custom-table ti-custom-table-head">
<thead>
<tr>
<ng-container
*ngFor="let item of ['ลำดับ','รหัสเเผนก','รายละเอียดเเผนก (ไทย)','รายละเอียดเเผนก (อังกฤษ)']; let f = first; let l = last">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary"
[class.!text-center]="f">
<span class="text-sm">{{ item }}</span>
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l">
<i class="ti ti-dots-vertical fs-l"></i>
</div>
</th>
</ng-container>
</tr>
</thead>
<tbody *ngIf="!filterBu2Modal().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="filterBu2Modal().length">
<ng-container *ngIf="currentModal=='add'">
<tr *ngFor="let item of filterBu2Modal() | slice:((bu2Modal.currentPage-1) * 10) : (((bu2Modal.currentPage-1) * 10) + 10);let i = index"
class="cursor-pointer" (click)="selectBu2(item)"
data-hs-overlay="#section-registration-modal-add">
<td class="flex justify-center">
{{((bu2Modal.currentPage-1) * 10)+(i+1)}}
</td>
<td>{{item.bu2id}}</td>
<td>{{item.tdesc}}</td>
<td>{{item.edesc}}</td>
</tr>
</ng-container>
<ng-container *ngIf="currentModal=='edit'">
<tr *ngFor="let item of filterBu2Modal() | slice:((bu2Modal.currentPage-1) * 10) : (((bu2Modal.currentPage-1) * 10) + 10);let i = index"
class="cursor-pointer" (click)="selectBu2(item)"
data-hs-overlay="#section-registration-modal-edit">
<td class="flex justify-center">
{{((bu2Modal.currentPage-1) * 10)+(i+1)}}
</td>
<td>{{item.bu2id}}</td>
<td>{{item.tdesc}}</td>
<td>{{item.edesc}}</td>
</tr>
</ng-container>
</tbody>
</table>
</div>
<nav class="pagination-style-3 overflow-auto my-5" *ngIf="bu2Modal.page.length">
<ul class="ti-pagination">
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="bu2Modal.currentPage = (bu2Modal.currentPage-1 || 1)">
<i class="ri-arrow-left-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
<li *ngFor="let item of bu2Modal.page">
<a class="page-link" href="javascript:void(0);" [class.active]="item==bu2Modal.currentPage"
(click)="bu2Modal.currentPage=item">{{item}}
</a>
<!-- <a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i>
</a> -->
</li>
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="bu2Modal.currentPage = (bu2Modal.currentPage > bu2Modal.page.length-1 ? bu2Modal.currentPage: bu2Modal.currentPage+1 )">
<i class="ri-arrow-right-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
</ul>
</nav>
<div class="flex justify-end mt-2rem mb-1rem space-x-4">
<button type="button" *ngIf="currentModal=='add'"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#section-registration-modal-add">
ย้อนกลับ
</button>
<button type="button" *ngIf="currentModal=='edit'"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#section-registration-modal-edit">
ย้อนกลับ
</button>
</div>
</div>
</div>
</div>
</div>
<div id="section-registration-bu3-table-modal" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out lg:!max-w-4xl lg:w-full m-3 lg:!mx-auto">
<div class="max-h-full overflow-hidden ti-modal-content">
<div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary">
ข้อมูลทะเบียนส่วน
</h3>
<div class="flex justify-end">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#section-registration-modal-add">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
</div>
</div>
<div class="ti-modal-body">
<div class="flex justify-end pb-1rem">
<div class="px-1">
<div class="relative shadow-md">
<input type="text" id="hs-leading-icon" name="hs-leading-icon"
class="ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
placeholder="Search by No. or Name" [(ngModel)]="bu3Modal.search"
(ngModelChange)="onBu3ModalSearchChange()">
<div
class="absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4">
<i class="ri-search-line text-gray"></i>
</div>
</div>
</div>
</div>
<div class="overflow-auto border">
<table class="ti-custom-table ti-custom-table-head">
<thead>
<tr>
<ng-container
*ngFor="let item of ['ลำดับ','รหัสส่วน','รายละเอียดส่วน (ไทย)','รายละเอียดส่วน (อังกฤษ)']; let f = first; let l = last">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary"
[class.!text-center]="f">
<span class="text-sm">{{ item }}</span>
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l">
<i class="ti ti-dots-vertical fs-l"></i>
</div>
</th>
</ng-container>
</tr>
</thead>
<tbody *ngIf="!filterBu3Modal().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="filterBu3Modal().length">
<tr *ngFor="let item of filterBu3Modal() | slice:((bu3Modal.currentPage-1) * 10) : (((bu3Modal.currentPage-1) * 10) + 10);let i = index"
class="cursor-pointer" (click)="selectBu3(item)"
data-hs-overlay="#section-registration-modal-add">
<td class="flex justify-center">
{{((bu3Modal.currentPage-1) * 10)+(i+1)}}
</td>
<td>{{item.bu3id}}</td>
<td>{{item.tdesc}}</td>
<td>{{item.edesc}}</td>
</tr>
</tbody>
</table>
</div>
<nav class="pagination-style-3 overflow-auto my-5" *ngIf="bu3Modal.page.length">
<ul class="ti-pagination">
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="bu3Modal.currentPage = (bu3Modal.currentPage-1 || 1)">
<i class="ri-arrow-left-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
<li *ngFor="let item of bu3Modal.page">
<a class="page-link" href="javascript:void(0);" [class.active]="item==bu3Modal.currentPage"
(click)="bu3Modal.currentPage=item">{{item}}
</a>
<!-- <a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i>
</a> -->
</li>
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="bu3Modal.currentPage = (bu3Modal.currentPage > bu3Modal.page.length-1 ? bu3Modal.currentPage: bu3Modal.currentPage+1 )">
<i class="ri-arrow-right-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
</ul>
</nav>
<div class="flex justify-end mt-2rem mb-1rem space-x-4">
<button type="button"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#section-registration-modal-add">
ย้อนกลับ
</button>
</div>
</div>
</div>
</div>
</div>
<div id="department-list-alert-modal" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] flex items-center">
<div class="max-h-full overflow-hidden ti-modal-content w-full">
<div class="ti-modal-header">
......@@ -307,7 +532,7 @@
</h3>
<div class="flex justify-end">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#section-registration-alert-modal">
data-hs-overlay="#department-list-alert-modal">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
......@@ -319,13 +544,18 @@
</p>
<div class="flex justify-end mt-2rem mb-1rem">
<button type="button"
<button type="button" *ngIf="currentModal=='add'"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#section-registration-alert-modal">
data-hs-overlay="#section-registration-modal-add">
ย้อนกลับ
</button>
<button type="button" *ngIf="currentModal=='edit'"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#section-registration-modal-edit">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#section-registration-alert-modal" (click)="addBu3()">
data-hs-overlay="#department-list-alert-modal" (click)="addBu3()">
บันทึกข้อมูล
</a>
</div>
......
......@@ -16,4 +16,21 @@ table.ti-custom-table thead {
table.ti-custom-table thead th span {
font-size: 12px;
font-weight: bold;
}
.ti-modal-content-search{
width: 90%; /* ความกว้างที่คุณต้องการ */
position: absolute; /* ทำให้สามารถจัดตำแหน่งได้ */
top: 50%; /* ให้อยู่กลางในแนวตั้ง */
left: 50%; /* ให้อยู่กลางในแนวนอน */
transform: translate(-50%, -50%); /* เคลื่อนที่ modal กลับมาให้ตรงกลาง */
background-color: #fff;
overflow-y: auto;
}
.ti-modal-body-search {
display: flex; /* ใช้ flexbox เพื่อจัดตำแหน่ง */
justify-content: center; /* จัดฟอร์มให้อยู่กลางในแนวนอน */
flex-direction: column; /* ทำให้ฟอร์มแสดงผลในรูปแบบคอลัมน์ */
height: calc(100% - 50px); /* ให้ความสูงเป็น 100% ลบด้วยระยะห่างข้างบน */
margin-left: 100px;
margin-right: 50px;
}
\ No newline at end of file
import { Component, EventEmitter, Input, OnInit, } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { Bu2Model, MyBu2Model } from 'src/app/shared/model/bu2.model';
import { Bu3Model, MyBu3Model } from 'src/app/shared/model/bu3.model';
import { Bu2Service } from 'src/app/shared/services/bu2.service';
import { Bu3Service } from 'src/app/shared/services/bu3.service';
interface table {
currentPage: number,
page: number[],
search: string
}
@Component({
selector: 'app-section-registration',
templateUrl: './section-registration.component.html',
styleUrls: ['./section-registration.component.scss']
})
export class SectionRegistrationComponent implements OnInit {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
bu3List: Bu3Model[] = []
bu3: Bu3Model = new MyBu3Model({})
bu3Table: table = {
currentPage: 1,
page: Array.from({ length: 1 }, (_, i) => i + 1),
search: ""
}
bu3Modal: table = {
currentPage: 1,
page: Array.from({ length: 1 }, (_, i) => i + 1),
search: ""
}
bu2List: Bu2Model[] = []
bu2: Bu2Model = new MyBu2Model({})
search = ""
bu2Modal: table = {
currentPage: 1,
page: Array.from({ length: 1 }, (_, i) => i + 1),
search: ""
}
currentModal = ""
constructor(private bu3Service: Bu3Service,
private bu2Service: Bu2Service
private bu2Service: Bu2Service,
private toastr: ToastrService
) { }
ngOnInit(): void {
this.getBu3List()
this.getBu2List()
}
getBu3List() {
this.bu3Service.getList().subscribe(response => {
this.bu3List = response
this.searchChange()
this.onBu3TableSearchChange()
})
}
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.bu3ListFilter().length / 10) }, (_, i) => i + 1);
onBu3TableSearchChange() {
this.bu3Table.currentPage = 1
this.bu3Table.page = Array.from({ length: Math.ceil(this.filterBu3Table().length / 10) }, (_, i) => i + 1);
}
bu3ListFilter() {
return this.bu3List.filter(x => x.bu3id.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
filterBu3Table() {
return this.bu3List.filter(x => x.bu3id.toLowerCase().includes(this.bu3Table.search) ||
x.tdesc.toLowerCase().includes(this.bu3Table.search) ||
x.edesc.toLowerCase().includes(this.bu3Table.search))
}
selectBu3(bu3: Bu3Model) {
this.bu2Service.getById(bu3.parent).subscribe(response =>{
this.bu2 = response
})
this.bu3 = new MyBu3Model(bu3)
selectBu3(bu3?: Bu3Model) {
this.bu3 = new MyBu3Model(bu3 || {})
this.selectBu2()
if (this.bu3.parent) {
this.bu2Service.getById(this.bu3.parent).subscribe(response => {
this.bu2 = new MyBu2Model(response)
})
}
}
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) ||
x.tdesc.toLowerCase().includes(this.bu3Modal.search) ||
x.edesc.toLowerCase().includes(this.bu3Modal.search))
}
addBu3() {
// this.bu3Service.post(this.bu3).subscribe((response:any) => {
......@@ -52,11 +88,41 @@ export class SectionRegistrationComponent implements OnInit {
// })
}
deleteBu3(bu3: Bu3Model) {
// this.bu3Service.delete(new MyBu1Model(bu3)).subscribe((response:any) => {
// this.bu3Service.delete(new MyBu3Model(bu3)).subscribe((response:any) => {
// if (response.success) {
// this.getBu3List()
// }
// })
}
getBu2List() {
this.bu2Service.getList().subscribe(response => {
this.bu2List = response
this.onBu2ModalSearchChange()
})
}
onBu2ModalSearchChange() {
this.bu2Modal.currentPage = 1
this.bu2Modal.page = Array.from({ length: Math.ceil(this.filterBu2Modal().length / 10) }, (_, i) => i + 1);
}
bu2idChange() {
const bu2 = this.bu2List.find(x => x.bu2id == this.bu2.bu2id)
this.selectBu2(bu2 || new MyBu2Model({ bu2id: this.bu2.bu2id }))
}
filterBu2Modal() {
return this.bu2List.filter(x => x.bu2id.toLowerCase().includes(this.bu2Modal.search) ||
x.tdesc.toLowerCase().includes(this.bu2Modal.search) ||
x.edesc.toLowerCase().includes(this.bu2Modal.search))
}
selectBu2(bu2?: Bu2Model) {
this.bu2 = new MyBu2Model(bu2 || {})
}
showSuccess() {
this.toastr.success('This is an example of tip', 'TIP', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
}
......@@ -3,8 +3,8 @@
<div class="relative shadow-md">
<input type="text" id="hs-leading-icon" name="hs-leading-icon"
class="ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 " placeholder="Search by No. or Name"
[(ngModel)]="search" (ngModelChange)="searchChange()">
[(ngModel)]="bu5Table.search" (ngModelChange)="onBu5TableSearchChange()">
<div
class="absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4">
<i class="ri-search-line text-gray"></i>
......@@ -13,7 +13,7 @@
</div>
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
data-hs-overlay="#sub-department-two-component-modal-add">
(click)="currentModal='add';selectBu4();selectBu5()" data-hs-overlay="#sub-department-two-modal-add">
<i class="ri-add-line"></i>
Add
</button>
......@@ -54,7 +54,7 @@
*ngFor="let item of ['ลำดับ','รหัสส่วนย่อยที่2','รายละเอียดส่วนย่อยที่2 (ไทย)','รายละเอียดส่วนย่อยที่2 (อังกฤษ)','การจัดการ']; let f = first; let l = last">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary"
[class.!text-center]="f||l">
<span class="text-sm">{{ item }}</span>
<span class="!text-sm">{{ item }}</span>
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l">
<i class="ti ti-dots-vertical fs-l"></i>
</div>
......@@ -62,24 +62,25 @@
</ng-container>
</tr>
</thead>
<tbody *ngIf="!bu5ListFilter().length">
<tbody *ngIf="!filterBu5Table().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="bu5ListFilter().length">
<tbody *ngIf="filterBu5Table().length">
<tr
*ngFor="let item of bu5ListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index">
*ngFor="let item of filterBu5Table() | slice:((bu5Table.currentPage-1) * 10) : (((bu5Table.currentPage-1) * 10) + 10);let i = index">
<td class="flex justify-center">
{{((currentPage-1) * 10)+(i+1)}}
{{((bu5Table.currentPage-1) * 10)+(i+1)}}
</td>
<td>{{item.bu5id}}</td>
<td>{{item.tdesc}}</td>
<td>{{item.edesc}}</td>
<td class="flex justify-center">
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1" (click)="selectBu5(item)"
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1"
(click)="selectBu5(item);currentModal='edit'"
data-hs-overlay="#sub-department-two-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="deleteBu5(item)"></i>
</td>
......@@ -87,24 +88,22 @@
</tbody>
</table>
</div>
<nav class="pagination-style-3 overflow-auto my-5" *ngIf="page.length">
<nav class="pagination-style-3 overflow-auto my-5" *ngIf="bu5Table.page.length">
<ul class="ti-pagination">
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="currentPage = (currentPage-1 || 1)">
(click)="bu5Table.currentPage = (bu5Table.currentPage-1 || 1)">
<i class="ri-arrow-left-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
<li *ngFor="let item of page">
<a class="page-link" href="javascript:void(0);" [class.active]="item==currentPage"
(click)="currentPage=item">{{item}}
<li *ngFor="let item of bu5Table.page">
<a class="page-link" href="javascript:void(0);" [class.active]="item==bu5Table.currentPage"
(click)="bu5Table.currentPage=item">{{item}}
</a>
<!-- <a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i>
</a> -->
</li>
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="currentPage = (currentPage > page.length-1 ? currentPage: currentPage+1 )">
(click)="bu5Table.currentPage = (bu5Table.currentPage > bu5Table.page.length-1 ? bu5Table.currentPage: bu5Table.currentPage+1 )">
<i class="ri-arrow-right-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
......@@ -115,16 +114,17 @@
</div>
<div id="sub-department-two-component-modal-add" class="hs-overlay hidden ti-modal">
<div id="sub-department-two-modal-add" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)]">
<div class="max-h-full overflow-hidden ti-modal-content">
<div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary">
เพิ่มข้อมูลทะเบียนส่วนย่อย 2
</h3>
<div class="flex justify-end" >
<div class="flex justify-end">
<div class="button-clear">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(click)="selectBu4();selectBu5()">
<svg class="svg-indigo" width="16" height="16" viewBox="0 0 64.00 64.00"
xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#595BEA" stroke-width="3.84"
transform="rotate(45)matrix(-1, 0, 0, 1, 0, 0)">
......@@ -147,64 +147,57 @@
</button>
</div>
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#sub-department-two-component-modal-add">
data-hs-overlay="#sub-department-two-modal-add">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
</div>
</div>
<div class="ti-modal-body " style="margin-top: 40px;">
<label for="input-label" class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="relative">
<div class="relative rounded-xl overflow-auto">
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<div>
<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;">
<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>
<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">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
</div>
</div>
</div>
<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>
</div>
</div>
</div>
</div>
<label for="input-label" class="ti-form-label mt-2rem">ส่วนย่อย2</label>
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<div>
<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;">
<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>
<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">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
</div>
<div class="ti-modal-body">
<label class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="flex">
<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" (ngModelChange)="bu4idChange()">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<button type="button" class="flex items-center text-red-500" (click)="selectBu4()">
<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-department-two-bu4-table-modal">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
</div>
<div class="flex rounded-md w-1/2 pl-1rem">
<input type="text" id="input-label" class="ti-form-input w-full pr-10 bg-input-readonly"
readonly [value]="bu4.tdesc">
</div>
</div>
<label class="ti-form-label mt-2rem">ส่วนย่อย2</label>
<div class="relative flex rounded-md w-1/2">
<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)]="bu5.bu5id" (ngModelChange)="bu5idChange()">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<button type="button" class="flex items-center text-red-500" (click)="selectBu5()">
<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-department-two-bu5-table-modal">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
</div>
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)</label>
<input type="text" id="detail_th" class="ti-form-input h-16">
<input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu5.tdesc">
<label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียด (อังกฤษ)</label>
<input type="text" id="detail_eng" class="ti-form-input h-16" placeholder="">
<input type="text" id="detail_eng" class="ti-form-input h-16" [(ngModel)]="bu5.edesc">
<div class="flex justify-end mt-2rem mb-1rem space-x-4">
<button type="button"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#sub-department-two-component-modal-add">
data-hs-overlay="#sub-department-two-modal-add">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-department-two-alert-modal">
data-hs-overlay="#department-list-alert-modal">
บันทึกข้อมูล
</a>
</div>
......@@ -222,14 +215,15 @@
</h3>
<div class="flex justify-end">
<div class="button-clear">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(click)="selectBu4();bu5.tdesc='';bu5.edesc=''">
<svg class="svg-indigo" width="16" height="16" viewBox="0 0 64.00 64.00"
xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#595BEA" stroke-width="3.84"
transform="rotate(45)matrix(-1, 0, 0, 1, 0, 0)">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
<g id="SVGRepo_iconCarrier">
<path d="M15 49A24 24 0 0 1 32 8"></path>W
<path d="M15 49A24 24 0 0 1 32 8"></path>
<path d="M49 15a24 24 0 0 1-17 41"></path>
<polyline points="15.03 40 15.03 48.97 8 48.97"></polyline>
<polyline points="48.97 24 48.97 15.03 56 15.03"></polyline>
......@@ -251,38 +245,36 @@
</button>
</div>
</div>
<div class="ti-modal-body " style="margin-top: 40px;">
<label for="input-label" class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="relative">
<div class="relative rounded-xl overflow-auto">
<div class="sm:grid grid-cols-2 gap-1">
<div class="relative w-full">
<div>
<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">
<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>
<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">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</div>
</div>
</div>
</div>
<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;" [(ngModel)]="bu4.tdesc" readonly>
</div>
</div>
<div class="ti-modal-body">
<label for="hs-trailing-button-add-on-with-icon"
class="ti-form-label mt-2rem">อยู่ภายใต้หน่วยงาน</label>
<div class="flex">
<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" (ngModelChange)="bu4idChange()">
<div class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<button type="button" class="flex items-center text-red-500" (click)="selectBu4()">
<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-department-two-bu4-table-modal">
<i class="ri-search-line cursor-pointer text-gray"></i>
</button>
</div>
</div>
</div>
<div class="flex rounded-md w-1/2 pl-1rem">
<input type="text" id="input-label" class="ti-form-input w-full pr-10 bg-input-readonly"
readonly [value]="bu4.tdesc">
</div>
</div>
<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">
<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 bg-input-readonly"
readonly [value]="bu5.bu5id">
</div>
</div>
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)</label>
<input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu5.tdesc" >
<input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu5.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)]="bu5.edesc">
<div class="flex justify-end mt-2rem mb-1rem space-x-4 ">
......@@ -292,7 +284,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-department-two-alert-modal">
data-hs-overlay="#department-list-alert-modal">
บันทึกข้อมูล
</a>
</div>
......@@ -300,7 +292,238 @@
</div>
</div>
</div>
<div id="sub-department-two-alert-modal" class="hs-overlay hidden ti-modal">
<div id="sub-department-two-bu4-table-modal" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out lg:!max-w-4xl lg:w-full m-3 lg:!mx-auto">
<div class="max-h-full overflow-hidden ti-modal-content">
<div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary">
ข้อมูลทะเบียนส่วนย่อยที่ 1
</h3>
<div class="flex justify-end">
<button *ngIf="currentModal=='add'" type="button"
class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#sub-department-two-modal-add">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
<button *ngIf="currentModal=='edit'" type="button"
class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#sub-department-two-modal-edit">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
</div>
</div>
<div class="ti-modal-body">
<div class="flex justify-end pb-1rem">
<div class="px-1">
<div class="relative shadow-md">
<input type="text" id="hs-leading-icon" name="hs-leading-icon"
class="ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
placeholder="Search by No. or Name" [(ngModel)]="bu4Modal.search"
(ngModelChange)="onBu4ModalSearchChange()">
<div
class="absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4">
<i class="ri-search-line text-gray"></i>
</div>
</div>
</div>
</div>
<div class="overflow-auto border">
<table class="ti-custom-table ti-custom-table-head">
<thead>
<tr>
<ng-container
*ngFor="let item of ['ลำดับ','รหัสส่วนย่อยที่1','รายละเอียดส่วนย่อยที่1 (ไทย)','รายละเอียดส่วนย่อยที่1 (อังกฤษ)']; let f = first; let l = last">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary"
[class.!text-center]="f">
<span class="text-sm">{{ item }}</span>
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l">
<i class="ti ti-dots-vertical fs-l"></i>
</div>
</th>
</ng-container>
</tr>
</thead>
<tbody *ngIf="!filterBu4Modal().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="filterBu4Modal().length">
<ng-container *ngIf="currentModal=='add'">
<tr *ngFor="let item of filterBu4Modal() | slice:((bu4Modal.currentPage-1) * 10) : (((bu4Modal.currentPage-1) * 10) + 10);let i = index"
class="cursor-pointer" (click)="selectBu4(item)"
data-hs-overlay="#sub-department-two-modal-add">
<td class="flex justify-center">
{{((bu4Modal.currentPage-1) * 10)+(i+1)}}
</td>
<td>{{item.bu4id}}</td>
<td>{{item.tdesc}}</td>
<td>{{item.edesc}}</td>
</tr>
</ng-container>
<ng-container *ngIf="currentModal=='edit'">
<tr *ngFor="let item of filterBu4Modal() | slice:((bu4Modal.currentPage-1) * 10) : (((bu4Modal.currentPage-1) * 10) + 10);let i = index"
class="cursor-pointer" (click)="selectBu4(item)"
data-hs-overlay="#sub-department-two-modal-edit">
<td class="flex justify-center">
{{((bu4Modal.currentPage-1) * 10)+(i+1)}}
</td>
<td>{{item.bu4id}}</td>
<td>{{item.tdesc}}</td>
<td>{{item.edesc}}</td>
</tr>
</ng-container>
</tbody>
</table>
</div>
<nav class="pagination-style-3 overflow-auto my-5" *ngIf="bu4Modal.page.length">
<ul class="ti-pagination">
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="bu4Modal.currentPage = (bu4Modal.currentPage-1 || 1)">
<i class="ri-arrow-left-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
<li *ngFor="let item of bu4Modal.page">
<a class="page-link" href="javascript:void(0);" [class.active]="item==bu4Modal.currentPage"
(click)="bu4Modal.currentPage=item">{{item}}
</a>
<!-- <a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i>
</a> -->
</li>
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="bu4Modal.currentPage = (bu4Modal.currentPage > bu4Modal.page.length-1 ? bu4Modal.currentPage: bu4Modal.currentPage+1 )">
<i class="ri-arrow-right-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
</ul>
</nav>
<div class="flex justify-end mt-2rem mb-1rem space-x-4">
<button type="button" *ngIf="currentModal=='add'"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#sub-department-two-modal-add">
ย้อนกลับ
</button>
<button type="button" *ngIf="currentModal=='edit'"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#sub-department-two-modal-edit">
ย้อนกลับ
</button>
</div>
</div>
</div>
</div>
</div>
<div id="sub-department-two-bu5-table-modal" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out lg:!max-w-4xl lg:w-full m-3 lg:!mx-auto">
<div class="max-h-full overflow-hidden ti-modal-content">
<div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary">
ข้อมูลทะเบียนส่วนย่อยที่ 2
</h3>
<div class="flex justify-end">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#sub-department-two-modal-add">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
</div>
</div>
<div class="ti-modal-body">
<div class="flex justify-end pb-1rem">
<div class="px-1">
<div class="relative shadow-md">
<input type="text" id="hs-leading-icon" name="hs-leading-icon"
class="ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
placeholder="Search by No. or Name" [(ngModel)]="bu5Modal.search"
(ngModelChange)="onBu5ModalSearchChange()">
<div
class="absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4">
<i class="ri-search-line text-gray"></i>
</div>
</div>
</div>
</div>
<div class="overflow-auto border">
<table class="ti-custom-table ti-custom-table-head">
<thead>
<tr>
<ng-container
*ngFor="let item of ['ลำดับ','รหัสส่วนย่อยที่2','รายละเอียดส่วนย่อยที่2 (ไทย)','รายละเอียดส่วนย่อยที่2 (อังกฤษ)']; let f = first; let l = last">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary"
[class.!text-center]="f">
<span class="text-sm">{{ item }}</span>
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l">
<i class="ti ti-dots-vertical fs-l"></i>
</div>
</th>
</ng-container>
</tr>
</thead>
<tbody *ngIf="!filterBu5Modal().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="filterBu5Modal().length">
<tr *ngFor="let item of filterBu5Modal() | slice:((bu5Modal.currentPage-1) * 10) : (((bu5Modal.currentPage-1) * 10) + 10);let i = index"
class="cursor-pointer" (click)="selectBu5(item)"
data-hs-overlay="#sub-department-two-modal-add">
<td class="flex justify-center">
{{((bu5Modal.currentPage-1) * 10)+(i+1)}}
</td>
<td>{{item.bu5id}}</td>
<td>{{item.tdesc}}</td>
<td>{{item.edesc}}</td>
</tr>
</tbody>
</table>
</div>
<nav class="pagination-style-3 overflow-auto my-5" *ngIf="bu5Modal.page.length">
<ul class="ti-pagination">
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="bu5Modal.currentPage = (bu5Modal.currentPage-1 || 1)">
<i class="ri-arrow-left-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
<li *ngFor="let item of bu5Modal.page">
<a class="page-link" href="javascript:void(0);" [class.active]="item==bu5Modal.currentPage"
(click)="bu5Modal.currentPage=item">{{item}}
</a>
<!-- <a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i>
</a> -->
</li>
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="bu5Modal.currentPage = (bu5Modal.currentPage > bu5Modal.page.length-1 ? bu5Modal.currentPage: bu5Modal.currentPage+1 )">
<i class="ri-arrow-right-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
</ul>
</nav>
<div class="flex justify-end mt-2rem mb-1rem space-x-4">
<button type="button"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#sub-department-two-modal-add">
ย้อนกลับ
</button>
</div>
</div>
</div>
</div>
</div>
<div id="department-list-alert-modal" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] flex items-center">
<div class="max-h-full overflow-hidden ti-modal-content w-full">
<div class="ti-modal-header">
......@@ -309,7 +532,7 @@
</h3>
<div class="flex justify-end">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#sub-department-two-alert-modal">
data-hs-overlay="#department-list-alert-modal">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
......@@ -321,13 +544,18 @@
</p>
<div class="flex justify-end mt-2rem mb-1rem">
<button type="button"
<button type="button" *ngIf="currentModal=='add'"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#sub-department-two-alert-modal">
data-hs-overlay="#sub-department-two-modal-add">
ย้อนกลับ
</button>
<button type="button" *ngIf="currentModal=='edit'"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#sub-department-two-modal-edit">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-department-two-alert-modal" (click)="addBu5()">
data-hs-overlay="#department-list-alert-modal" (click)="addBu5()">
บันทึกข้อมูล
</a>
</div>
......
import { Component, EventEmitter, Input, OnInit } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { Bu4Model, MyBu4Model } from 'src/app/shared/model/bu4.model';
import { Bu5Model, MyBu5Model } from 'src/app/shared/model/bu5.model';
import { Bu4Service } from 'src/app/shared/services/bu4.service';
import { Bu5Service } from 'src/app/shared/services/bu5.service';
interface table {
currentPage: number,
page: number[],
search: string
}
@Component({
selector: 'app-sub-department-two',
templateUrl: './sub-department-two.component.html',
styleUrls: ['./sub-department-two.component.scss']
})
export class SubDepartmentTwoComponent implements OnInit {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
bu5List: Bu5Model[] = []
bu5: Bu5Model = new MyBu5Model({})
bu5Table: table = {
currentPage: 1,
page: Array.from({ length: 1 }, (_, i) => i + 1),
search: ""
}
bu5Modal: table = {
currentPage: 1,
page: Array.from({ length: 1 }, (_, i) => i + 1),
search: ""
}
bu4List: Bu4Model[] = []
bu4: Bu4Model = new MyBu4Model({})
search = ""
bu4Modal: table = {
currentPage: 1,
page: Array.from({ length: 1 }, (_, i) => i + 1),
search: ""
}
currentModal = ""
constructor(private bu5Service: Bu5Service,
private bu4Service: Bu4Service
private bu4Service: Bu4Service,
private toastr: ToastrService
) { }
ngOnInit(): void {
this.getBu5List()
this.getBu4List()
}
getBu5List() {
this.bu5Service.getList().subscribe(response => {
this.bu5List = response
this.searchChange()
this.onBu5TableSearchChange()
})
}
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.bu5ListFilter().length / 10) }, (_, i) => i + 1);
onBu5TableSearchChange() {
this.bu5Table.currentPage = 1
this.bu5Table.page = Array.from({ length: Math.ceil(this.filterBu5Table().length / 10) }, (_, i) => i + 1);
}
bu5ListFilter() {
return this.bu5List.filter(x => x.bu5id.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
filterBu5Table() {
return this.bu5List.filter(x => x.bu5id.toLowerCase().includes(this.bu5Table.search) ||
x.tdesc.toLowerCase().includes(this.bu5Table.search) ||
x.edesc.toLowerCase().includes(this.bu5Table.search))
}
selectBu5(bu5: Bu5Model) {
this.bu4Service.getById(bu5.parent).subscribe(response => {
this.bu4 = response
})
this.bu5 = new MyBu5Model(bu5)
selectBu5(bu5?: Bu5Model) {
this.bu5 = new MyBu5Model(bu5 || {})
this.selectBu4()
if (this.bu5.parent) {
this.bu4Service.getById(this.bu5.parent).subscribe(response => {
this.bu4 = new MyBu4Model(response)
})
}
}
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) ||
x.tdesc.toLowerCase().includes(this.bu5Modal.search) ||
x.edesc.toLowerCase().includes(this.bu5Modal.search))
}
addBu5() {
// this.bu5Service.post(this.bu5).subscribe((response:any) => {
......@@ -59,4 +95,34 @@ export class SubDepartmentTwoComponent implements OnInit {
// })
}
getBu4List() {
this.bu4Service.getList().subscribe(response => {
this.bu4List = response
this.onBu4ModalSearchChange()
})
}
onBu4ModalSearchChange() {
this.bu4Modal.currentPage = 1
this.bu4Modal.page = Array.from({ length: Math.ceil(this.filterBu4Modal().length / 10) }, (_, i) => i + 1);
}
bu4idChange() {
const bu4 = this.bu4List.find(x => x.bu4id == this.bu4.bu4id)
this.selectBu4(bu4 || new MyBu4Model({ bu4id: this.bu4.bu4id }))
}
filterBu4Modal() {
return this.bu4List.filter(x => x.bu4id.toLowerCase().includes(this.bu4Modal.search) ||
x.tdesc.toLowerCase().includes(this.bu4Modal.search) ||
x.edesc.toLowerCase().includes(this.bu4Modal.search))
}
selectBu4(bu4?: Bu4Model) {
this.bu4 = new MyBu4Model(bu4 || {})
}
showSuccess() {
this.toastr.success('This is an example of tip', 'TIP', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
}
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