Commit ba632578 by Nattana Chaiyamat

ทะเบียนแผนก

parent e5a9079a
<div class="w-full min-height-50px mb-10px justify-between items-center"> <div class="w-full min-height-50px mb-10px justify-between items-center">
<div class="flex justify-between"> <div class="flex justify-between">
<div class="flex pr-2"> <div class="flex pr-2">
<!-- Content ของ div แรก --> <!-- Content ของ div แรก -->
<div class="px-1"> <div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md" <button type="button" class="ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md"
data-hs-overlay="#department-list-upload-modal"> data-hs-overlay="#department-list-upload-modal" (click)="selectedFileName = 'กรุณาเลือกไฟล์'">
<i class="ri-add-line"></i> <i class="ri-add-line"></i>
นำเข้าข้อมูล นำเข้าข้อมูล
</button> </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" <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()"> href="javascript:void(0);" (click)="downloadFile()">
ดาวน์โหลดตัวอย่างไฟล์ ดาวน์โหลดตัวอย่างไฟล์
</a> </a>
</div>
</div> </div>
</div> <div class="flex justify-end">
<div class="flex justify-end"> <div class="px-1">
<div class="px-1">
<div class="relative shadow-md"> <div class="relative shadow-md">
<input type="text" id="hs-leading-icon" name="hs-leading-icon" <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" class="ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 " placeholder="Search by No. or Name"
[(ngModel)]="bu2Table.search" (ngModelChange)="onBu2TableSearchChange()"> [(ngModel)]="bu2Table.search" (ngModelChange)="onBu2TableSearchChange()">
<div <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"> 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> <i class="ri-search-line text-gray"></i>
</div> </div>
</div> </div>
</div> </div>
<div class="px-1"> <div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md" <button type="button" class="ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
(click)="currentModal='add';selectBu1();selectBu2()" data-hs-overlay="#department-list-modal-add"> (click)="currentModal='add';selectBu1();selectBu2()" data-hs-overlay="#department-list-modal-add">
...@@ -46,95 +46,98 @@ ...@@ -46,95 +46,98 @@
Help Help
</button> </button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="page px-rem"> <div class="page px-rem">
<div class="overflow-auto shadow-md rounded-t-md"> <div class="overflow-auto shadow-md rounded-t-md">
<table class="ti-custom-table ti-custom-table-head ti-custom-table-hover table-bordered"> <table class="ti-custom-table ti-custom-table-head ti-custom-table-hover table-bordered">
<thead> <thead>
<tr> <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 !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">
<i class="ti ti-dots-vertical fs-l"></i>
</div>
</th>
</ng-container>
</tr>
</thead>
<tbody *ngIf="bu2ListLoading">
<tr>
<td class="text-center" colspan="100%">
<div *ngFor="let item of [1,2,3]" class="ti-spinner w-8 h-8 text-secondary mx-1" role="status"
aria-label="loading">
<span class="sr-only">Loading...</span>
</div>
</td>
</tr>
</tbody>
<tbody *ngIf="!bu2ListLoading&&!filterBu2Table().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="!bu2ListLoading&&filterBu2Table().length">
<tr
*ngFor="let item of filterBu2Table() | slice:((bu2Table.currentPage-1) * 10) : (((bu2Table.currentPage-1) * 10) + 10);let i = index">
<td class="text-center">
{{((bu2Table.currentPage-1) * 10)+(i+1)}}
</td>
<td class="text-center">{{item.bu2id}}</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)="selectBu2(item);currentModal='edit'"
data-hs-overlay="#department-list-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="selectBu2(item)" data-hs-overlay="#department-list-alert-delete-modal"></i>
</td>
</tr>
</tbody>
</table>
</div>
<nav class="pagination-style-3 overflow-auto my-5" *ngIf="bu2Table.page.length">
<ul class="ti-pagination">
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="bu2Table.currentPage = (bu2Table.currentPage-1 || 1)">
<i class="ri-arrow-left-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
<li *ngFor="let item of bu2Table.page;let f = first;let l = last">
<ng-container *ngIf="item==3&&bu2Table.currentPage!=1&&bu2Table.currentPage!=2&&bu2Table.currentPage!=3">
<a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i>
</a>
</ng-container>
<ng-container *ngIf="(f||l)||(item==bu2Table.currentPage-1||item==bu2Table.currentPage||item==bu2Table.currentPage+1)">
<a class="page-link" href="javascript:void(0);" [class.active]="item==bu2Table.currentPage"
(click)="bu2Table.currentPage=item">{{item}}
</a>
</ng-container>
<ng-container <ng-container
*ngIf="item==bu2Table.page.length-2&&bu2Table.currentPage!=bu2Table.page.length&&bu2Table.currentPage!=bu2Table.page.length-1&&bu2Table.currentPage!=bu2Table.page.length-2"> *ngFor="let item of ['ลำดับ','รหัสแผนก','รายละเอียดแผนก (ไทย)','รายละเอียดแผนก (อังกฤษ)','การจัดการ']; let f = first; let l = last">
<a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i> <th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary !text-center">
</a> <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">
<i class="ti ti-dots-vertical fs-l"></i>
</div>
</th>
</ng-container> </ng-container>
</li> </tr>
<li> </thead>
<a aria-label="anchor" class="page-link" href="javascript:void(0);" <tbody *ngIf="bu2ListLoading">
(click)="bu2Table.currentPage = (bu2Table.currentPage > bu2Table.page.length-1 ? bu2Table.currentPage: bu2Table.currentPage+1 )"> <tr>
<i class="ri-arrow-right-s-line align-middle rtl:rotate-180"></i> <td class="text-center" colspan="100%">
</a> <div *ngFor="let item of [1,2,3]" class="ti-spinner w-8 h-8 text-secondary mx-1" role="status"
</li> aria-label="loading">
</ul> <span class="sr-only">Loading...</span>
</nav> </div>
</td>
</tr>
</tbody>
<tbody *ngIf="!bu2ListLoading&&!filterBu2Table().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="!bu2ListLoading&&filterBu2Table().length">
<tr
*ngFor="let item of filterBu2Table() | slice:((bu2Table.currentPage-1) * 10) : (((bu2Table.currentPage-1) * 10) + 10);let i = index">
<td class="text-center">
{{((bu2Table.currentPage-1) * 10)+(i+1)}}
</td>
<td class="text-center">{{item.bu2id}}</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)="selectBu2(item);currentModal='edit'"
data-hs-overlay="#department-list-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="selectBu2(item)"
data-hs-overlay="#department-list-alert-delete-modal"></i>
</td>
</tr>
</tbody>
</table>
</div> </div>
<nav class="pagination-style-3 overflow-auto my-5" *ngIf="bu2Table.page.length">
<ul class="ti-pagination">
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="bu2Table.currentPage = (bu2Table.currentPage-1 || 1)">
<i class="ri-arrow-left-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
<li *ngFor="let item of bu2Table.page;let f = first;let l = last">
<ng-container
*ngIf="item==3&&bu2Table.currentPage!=1&&bu2Table.currentPage!=2&&bu2Table.currentPage!=3">
<a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i>
</a>
</ng-container>
<ng-container
*ngIf="(f||l)||(item==bu2Table.currentPage-1||item==bu2Table.currentPage||item==bu2Table.currentPage+1)">
<a class="page-link" href="javascript:void(0);" [class.active]="item==bu2Table.currentPage"
(click)="bu2Table.currentPage=item">{{item}}
</a>
</ng-container>
<ng-container
*ngIf="item==bu2Table.page.length-2&&bu2Table.currentPage!=bu2Table.page.length&&bu2Table.currentPage!=bu2Table.page.length-1&&bu2Table.currentPage!=bu2Table.page.length-2">
<a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i>
</a>
</ng-container>
</li>
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="bu2Table.currentPage = (bu2Table.currentPage > bu2Table.page.length-1 ? bu2Table.currentPage: bu2Table.currentPage+1 )">
<i class="ri-arrow-right-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
</ul>
</nav>
</div>
<div id="department-list-modal-add" class="hs-overlay hidden ti-modal"> <div id="department-list-modal-add" class="hs-overlay hidden ti-modal">
...@@ -156,7 +159,7 @@ ...@@ -156,7 +159,7 @@
<div class="flex justify-end" style="padding-right: 1rem;"> <div class="flex justify-end" style="padding-right: 1rem;">
<div class="px-1"> <div class="px-1">
<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)="selectBu1();selectBu2()"> (click)="selectBu1();selectBu2()">
<svg class="svg-indigo" width="16" height="16" viewBox="0 0 64.00 64.00" <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" 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)"> transform="rotate(45)matrix(-1, 0, 0, 1, 0, 0)">
...@@ -181,16 +184,20 @@ ...@@ -181,16 +184,20 @@
</div> </div>
</div> </div>
<div class="ti-modal-body"> <div class="ti-modal-body">
<label class="ti-form-label">อยู่ภายใต้หน่วยงาน</label> <label class="ti-form-label">อยู่ภายใต้หน่วยงาน*</label>
<div class="flex"> <div class="flex">
<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-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10" style="padding-right: 3.5rem;" <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
[(ngModel)]="bu1.bu1id" (ngModelChange)="bu1idChange()"> name="hs-leading-button-add-on-with-icon-and-button"
<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"> class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10"
<button type="button" class="flex items-center text-red-500" (click)="selectBu1()"> 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> <i class="ti ti-circle-x cursor-pointer"></i>
</button> </button>
<button type="button" class="flex items-center text-gray-500 dark:text-white/70" data-hs-overlay="#department-list-bu1-table-modal"> <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> <i class="ri-search-line cursor-pointer text-gray"></i>
</button> </button>
</div> </div>
...@@ -200,8 +207,11 @@ ...@@ -200,8 +207,11 @@
readonly [value]="bu1.tdesc"> readonly [value]="bu1.tdesc">
</div> </div>
</div> </div>
<label class="ti-form-label mt-2rem">เเผนก</label> <label class="ti-form-label mt-2rem">เเผนก*</label>
<div class="relative flex rounded-md w-1/2"> <div class="relative flex rounded-md w-1/2">
<input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu2.bu2id">
</div>
<!-- <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-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10" style="padding-right: 3.5rem;" <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-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10" style="padding-right: 3.5rem;"
[(ngModel)]="bu2.bu2id" (ngModelChange)="bu2idChange()"> [(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"> <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">
...@@ -212,10 +222,10 @@ ...@@ -212,10 +222,10 @@
<i class="ri-search-line cursor-pointer text-gray"></i> <i class="ri-search-line cursor-pointer text-gray"></i>
</button> </button>
</div> </div>
</div> </div> -->
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)</label> <label for="detail_th" class="ti-form-label mt-2rem">รายละเอียดแผนก (ไทย)*</label>
<input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu2.tdesc"> <input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu2.tdesc">
<label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียด (อังกฤษ)</label> <label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียดแผนก (อังกฤษ)*</label>
<input type="text" id="detail_eng" class="ti-form-input h-16" [(ngModel)]="bu2.edesc"> <input type="text" id="detail_eng" class="ti-form-input h-16" [(ngModel)]="bu2.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" <button type="button"
...@@ -223,10 +233,11 @@ ...@@ -223,10 +233,11 @@
data-hs-overlay="#department-list-modal-add"> data-hs-overlay="#department-list-modal-add">
ย้อนกลับ ย้อนกลับ
</button> </button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);" <button class="ti-btn ti-btn-success" type="button" data-hs-overlay="#department-list-alert-modal"
data-hs-overlay="#department-list-alert-modal"> [class.ti-btn-disabled]="!bu1.bu1id||!bu2.bu2id||!bu2.tdesc"
[disabled]="!bu1.bu1id||!bu2.bu2id||!bu2.tdesc">
บันทึกข้อมูล บันทึกข้อมูล
</a> </button>
</div> </div>
</div> </div>
</div> </div>
...@@ -252,7 +263,7 @@ ...@@ -252,7 +263,7 @@
<div class="flex justify-end" style="padding-right: 1rem;"> <div class="flex justify-end" style="padding-right: 1rem;">
<div class="px-1"> <div class="px-1">
<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)="selectBu1();bu2.tdesc='';bu2.edesc=''"> (click)="selectBu1();bu2.tdesc='';bu2.edesc=''">
<svg class="svg-indigo" width="16" height="16" viewBox="0 0 64.00 64.00" <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" 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)"> transform="rotate(45)matrix(-1, 0, 0, 1, 0, 0)">
...@@ -277,17 +288,20 @@ ...@@ -277,17 +288,20 @@
</div> </div>
</div> </div>
<div class="ti-modal-body"> <div class="ti-modal-body">
<label for="hs-trailing-button-add-on-with-icon" <label for="hs-trailing-button-add-on-with-icon" class="ti-form-label">อยู่ภายใต้หน่วยงาน*</label>
class="ti-form-label">อยู่ภายใต้หน่วยงาน</label>
<div class="flex"> <div class="flex">
<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-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10" style="padding-right: 3.5rem;" <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
[(ngModel)]="bu1.bu1id" (ngModelChange)="bu1idChange()"> name="hs-leading-button-add-on-with-icon-and-button"
<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"> class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10"
<button type="button" class="flex items-center text-red-500" (click)="selectBu1()"> 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> <i class="ti ti-circle-x cursor-pointer"></i>
</button> </button>
<button type="button" class="flex items-center text-gray-500 dark:text-white/70" data-hs-overlay="#department-list-bu1-table-modal"> <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> <i class="ri-search-line cursor-pointer text-gray"></i>
</button> </button>
</div> </div>
...@@ -297,27 +311,29 @@ ...@@ -297,27 +311,29 @@
readonly [value]="bu1.tdesc"> readonly [value]="bu1.tdesc">
</div> </div>
</div> </div>
<label for="input-label" class="ti-form-label mt-2rem">เเผนก</label> <label for="input-label" class="ti-form-label mt-2rem">เเผนก*</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 bg-input-readonly" <input type="text" id="input-label" class="ti-form-input w-full pr-10 bg-input-readonly"
readonly [value]="bu2.bu2id"> readonly [value]="bu2.bu2id">
</div> </div>
</div> </div>
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียด (ไทย)</label> <label for="detail_th" class="ti-form-label mt-2rem">รายละเอียดแผนก (ไทย)*</label>
<input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu2.tdesc"> <input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu2.tdesc">
<label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียด (อังกฤษ)</label> <label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียดแผนก (อังกฤษ)</label>
<input type="text" id="detail_eng" class="ti-form-input h-16" [(ngModel)]="bu2.edesc"> <input type="text" id="detail_eng" class="ti-form-input h-16" [(ngModel)]="bu2.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" <button type="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" 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="#department-list-modal-edit"> data-hs-overlay="#department-list-modal-edit">
ย้อนกลับ ย้อนกลับ
</button> </button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);" <button class="ti-btn ti-btn-success" type="button"
data-hs-overlay="#department-list-alert-edit-modal"> data-hs-overlay="#department-list-alert-edit-modal"
[class.ti-btn-disabled]="!bu1.bu1id||!bu2.bu2id||!bu2.tdesc"
[disabled]="!bu1.bu1id||!bu2.bu2id||!bu2.tdesc">
บันทึกข้อมูล บันทึกข้อมูล
</a> </button>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="flex pr-2"> <div class="flex pr-2">
<div class="px-1"> <div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md" <button type="button" class="ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md"
data-hs-overlay="#department-register-upload-modal"> data-hs-overlay="#department-register-upload-modal" (click)="selectedFileName = 'กรุณาเลือกไฟล์'">
<i class="ri-add-line"></i> <i class="ri-add-line"></i>
นำเข้าข้อมูล นำเข้าข้อมูล
</button> </button>
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,7 @@
<div class="absolute flex"> <div class="absolute flex">
<div class="px-1"> <div class="px-1">
<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)="selectBu1(undefined,bu1.bu1id)"> (click)="bu1.tdesc='';bu1.edesc=''">
<svg class="svg-indigo" width="16" height="16" viewBox="0 0 64.00 64.00" <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" 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)"> transform="rotate(45)matrix(-1, 0, 0, 1, 0, 0)">
......
...@@ -96,8 +96,8 @@ export class DepartmentRegisterComponent implements OnInit { ...@@ -96,8 +96,8 @@ export class DepartmentRegisterComponent implements OnInit {
x.tdesc.toLowerCase().includes(this.search.toLowerCase()) || x.tdesc.toLowerCase().includes(this.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.search.toLowerCase())) x.edesc.toLowerCase().includes(this.search.toLowerCase()))
} }
selectBu1(bu1?: Bu1Model, bu1id?: string) { selectBu1(bu1?: Bu1Model) {
this.bu1 = new MyBu1Model(bu1 || { bu1id: bu1id }) this.bu1 = new MyBu1Model(bu1 || {})
} }
showAlert(text: string, type: 'success' | 'error') { showAlert(text: string, type: 'success' | 'error') {
...@@ -107,6 +107,7 @@ export class DepartmentRegisterComponent implements OnInit { ...@@ -107,6 +107,7 @@ export class DepartmentRegisterComponent implements OnInit {
}) })
} }
addBu1() { addBu1() {
this.bu1ListLoading = true
this.bu1Service.post(this.bu1).subscribe({ this.bu1Service.post(this.bu1).subscribe({
next: response => { next: response => {
if (response.success) { if (response.success) {
...@@ -116,11 +117,13 @@ export class DepartmentRegisterComponent implements OnInit { ...@@ -116,11 +117,13 @@ export class DepartmentRegisterComponent implements OnInit {
this.showAlert(response.message, 'error') this.showAlert(response.message, 'error')
} }
}, error: error => { }, error: error => {
this.bu1ListLoading = false
this.showAlert(error.message, 'error') this.showAlert(error.message, 'error')
} }
}) })
} }
deleteBu1() { deleteBu1() {
this.bu1ListLoading = true
this.bu1Service.delete(this.bu1).subscribe({ this.bu1Service.delete(this.bu1).subscribe({
next: response => { next: response => {
if (response.success) { if (response.success) {
...@@ -130,6 +133,7 @@ export class DepartmentRegisterComponent implements OnInit { ...@@ -130,6 +133,7 @@ export class DepartmentRegisterComponent implements OnInit {
this.showAlert(response.message, 'error') this.showAlert(response.message, 'error')
} }
}, error: error => { }, error: error => {
this.bu1ListLoading = false
this.showAlert(error.message, 'error') this.showAlert(error.message, 'error')
} }
}) })
......
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