Commit 8cbf148f by Nattana Chaiyamat

ส่วนย่อย4

parent 39c6ff1f
...@@ -104,7 +104,7 @@ export class DepartmentListComponent implements OnInit { ...@@ -104,7 +104,7 @@ export class DepartmentListComponent implements OnInit {
this.bu2ListLoading = true this.bu2ListLoading = true
this.bu2Service.getList().subscribe({ this.bu2Service.getList().subscribe({
next: response => { next: response => {
this.bu2List = response this.bu2List = response.map(x => new MyBu2Model(x))
this.bu2ListLoading = false this.bu2ListLoading = false
this.onBu2TableSearchChange() this.onBu2TableSearchChange()
this.cdr.detectChanges() this.cdr.detectChanges()
...@@ -150,7 +150,7 @@ export class DepartmentListComponent implements OnInit { ...@@ -150,7 +150,7 @@ export class DepartmentListComponent implements OnInit {
getBu1List() { getBu1List() {
this.bu1Service.getList().subscribe(response => { this.bu1Service.getList().subscribe(response => {
this.bu1List = response this.bu1List = response.map(x => new MyBu1Model(x))
this.onBu1ModalSearchChange() this.onBu1ModalSearchChange()
}) })
} }
......
...@@ -82,7 +82,7 @@ export class DepartmentRegisterComponent implements OnInit { ...@@ -82,7 +82,7 @@ export class DepartmentRegisterComponent implements OnInit {
this.bu1ListLoading = true this.bu1ListLoading = true
this.bu1Service.getList().subscribe({ this.bu1Service.getList().subscribe({
next: response => { next: response => {
this.bu1List = response this.bu1List = response.map(x => new MyBu1Model(x))
this.bu1ListLoading = false this.bu1ListLoading = false
this.searchChange() this.searchChange()
this.cdr.detectChanges() this.cdr.detectChanges()
......
...@@ -105,7 +105,7 @@ export class SectionRegistrationComponent implements OnInit { ...@@ -105,7 +105,7 @@ export class SectionRegistrationComponent implements OnInit {
this.bu3ListLoading = true this.bu3ListLoading = true
this.bu3Service.getList().subscribe({ this.bu3Service.getList().subscribe({
next: response => { next: response => {
this.bu3List = response this.bu3List = response.map(x => new MyBu3Model(x))
this.bu3ListLoading = false this.bu3ListLoading = false
this.onBu3TableSearchChange() this.onBu3TableSearchChange()
this.cdr.detectChanges() this.cdr.detectChanges()
...@@ -184,7 +184,7 @@ export class SectionRegistrationComponent implements OnInit { ...@@ -184,7 +184,7 @@ export class SectionRegistrationComponent implements OnInit {
getBu2List() { getBu2List() {
this.bu2Service.getList().subscribe(response => { this.bu2Service.getList().subscribe(response => {
this.bu2List = response this.bu2List = response.map(x => new MyBu2Model(x))
this.onBu2ModalSearchChange() this.onBu2ModalSearchChange()
}) })
} }
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
<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="#sub-department-four-upload-modal"> data-hs-overlay="#sub-department-four-upload-modal"
(click)="fileInput.value = '';selectedFile=null;selectedFileName = 'กรุณาเลือกไฟล์'">
<i class="ri-add-line"></i> <i class="ri-add-line"></i>
นำเข้าข้อมูล นำเข้าข้อมูล
</button> </button>
...@@ -28,7 +29,8 @@ ...@@ -28,7 +29,8 @@
</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';selectBu6();selectBu7()" data-hs-overlay="#sub-department-four-modal-add"> (click)="currentModal='add';selectBu6();selectBu7()"
data-hs-overlay="#sub-department-four-modal-add">
<i class="ri-add-line"></i> <i class="ri-add-line"></i>
Add Add
</button> </button>
...@@ -47,9 +49,9 @@ ...@@ -47,9 +49,9 @@
</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>
...@@ -111,11 +113,13 @@ ...@@ -111,11 +113,13 @@
</a> </a>
</li> </li>
<li *ngFor="let item of bu7Table.page;let f = first;let l = last"> <li *ngFor="let item of bu7Table.page;let f = first;let l = last">
<ng-container *ngIf="item==3&&bu7Table.currentPage!=1&&bu7Table.currentPage!=2&&bu7Table.currentPage!=3"> <ng-container
*ngIf="item==3&&bu7Table.currentPage!=1&&bu7Table.currentPage!=2&&bu7Table.currentPage!=3">
<a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i> <a aria-label="anchor" class="page-link" href="javascript:void(0);"><i class="ri-more-line"></i>
</a> </a>
</ng-container> </ng-container>
<ng-container *ngIf="(f||l)||(item==bu7Table.currentPage-1||item==bu7Table.currentPage||item==bu7Table.currentPage+1)"> <ng-container
*ngIf="(f||l)||(item==bu7Table.currentPage-1||item==bu7Table.currentPage||item==bu7Table.currentPage+1)">
<a class="page-link" href="javascript:void(0);" [class.active]="item==bu7Table.currentPage" <a class="page-link" href="javascript:void(0);" [class.active]="item==bu7Table.currentPage"
(click)="bu7Table.currentPage=item">{{item}} (click)="bu7Table.currentPage=item">{{item}}
</a> </a>
...@@ -181,16 +185,20 @@ ...@@ -181,16 +185,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)]="bu6.bu6id" (ngModelChange)="bu6idChange()"> 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"
style="padding-right: 3.5rem;" [(ngModel)]="bu6.bu6id" (ngModelChange)="bu6idChange()">
<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)="selectBu6()"> <button type="button" class="flex items-center text-red-500" (click)="selectBu6()">
<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="#sub-department-four-bu6-table-modal"> <button type="button" class="flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay="#sub-department-four-bu6-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,20 +208,25 @@ ...@@ -200,20 +208,25 @@
readonly [value]="bu6.tdesc"> readonly [value]="bu6.tdesc">
</div> </div>
</div> </div>
<label class="ti-form-label mt-2rem">ส่วนย่อย4</label> <label class="ti-form-label mt-2rem">ส่วนย่อย4*</label>
<div class="relative flex rounded-md w-1/2"> <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" class="ti-form-input h-16" [(ngModel)]="bu7.bu7id">
[(ngModel)]="bu7.bu7id" (ngModelChange)="bu7idChange()"> <!-- <input type="text" id="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"> 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)]="bu7.bu7id" (ngModelChange)="bu7idChange()">
<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)="selectBu7()"> <button type="button" class="flex items-center text-red-500" (click)="selectBu7()">
<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="#sub-department-four-bu7-table-modal"> <button type="button" class="flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay="#sub-department-four-bu7-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> </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)]="bu7.tdesc"> <input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu7.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)]="bu7.edesc"> <input type="text" id="detail_eng" class="ti-form-input h-16" [(ngModel)]="bu7.edesc">
...@@ -223,10 +236,12 @@ ...@@ -223,10 +236,12 @@
data-hs-overlay="#sub-department-four-modal-add"> data-hs-overlay="#sub-department-four-modal-add">
ย้อนกลับ ย้อนกลับ
</button> </button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);" <button type="button" class="ti-btn ti-btn-success"
data-hs-overlay="#sub-department-four-alert-add-modal"> data-hs-overlay="#sub-department-four-alert-add-modal"
[class.ti-btn-disabled]="!bu6.bu6id||!bu7.bu7id||!bu7.tdesc"
[disabled]="!bu6.bu6id||!bu7.bu7id||!bu7.tdesc">
บันทึกข้อมูล บันทึกข้อมูล
</a> </button>
</div> </div>
</div> </div>
</div> </div>
...@@ -277,17 +292,20 @@ ...@@ -277,17 +292,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)]="bu6.bu6id" (ngModelChange)="bu6idChange()"> 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"
style="padding-right: 3.5rem;" [(ngModel)]="bu6.bu6id" (ngModelChange)="bu6idChange()">
<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)="selectBu6()"> <button type="button" class="flex items-center text-red-500" (click)="selectBu6()">
<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="#sub-department-four-bu6-table-modal"> <button type="button" class="flex items-center text-gray-500 dark:text-white/70"
data-hs-overlay="#sub-department-four-bu6-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,14 +315,14 @@ ...@@ -297,14 +315,14 @@
readonly [value]="bu6.tdesc"> readonly [value]="bu6.tdesc">
</div> </div>
</div> </div>
<label for="input-label" class="ti-form-label mt-2rem">ส่วนย่อย4</label> <label for="input-label" class="ti-form-label mt-2rem">ส่วนย่อย4*</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]="bu7.bu7id"> readonly [value]="bu7.bu7id">
</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)]="bu7.tdesc"> <input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="bu7.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)]="bu7.edesc"> <input type="text" id="detail_eng" class="ti-form-input h-16" [(ngModel)]="bu7.edesc">
...@@ -314,10 +332,12 @@ ...@@ -314,10 +332,12 @@
data-hs-overlay="#sub-department-four-modal-edit"> data-hs-overlay="#sub-department-four-modal-edit">
ย้อนกลับ ย้อนกลับ
</button> </button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);" <button type="button" class="ti-btn ti-btn-success"
data-hs-overlay="#sub-department-four-alert-edit-modal"> data-hs-overlay="#sub-department-four-alert-edit-modal"
[class.ti-btn-disabled]="!bu6.bu6id||!bu7.bu7id||!bu7.tdesc"
[disabled]="!bu6.bu6id||!bu7.bu7id||!bu7.tdesc">
บันทึกข้อมูล บันทึกข้อมูล
</a> </button>
</div> </div>
</div> </div>
</div> </div>
...@@ -563,7 +583,7 @@ ...@@ -563,7 +583,7 @@
</h3> </h3>
<div class="flex justify-end"> <div class="flex justify-end">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger" <button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#sub-department-four-alert-add-modal"> data-hs-overlay="#sub-department-four-modal-add">
<span class="sr-only">Close</span> <span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i> <i class="ti ti-circle-x fs-xxl"></i>
</button> </button>
...@@ -575,16 +595,11 @@ ...@@ -575,16 +595,11 @@
</p> </p>
<div class="flex justify-end mt-2rem mb-1rem"> <div class="flex justify-end mt-2rem mb-1rem">
<button type="button" *ngIf="currentModal=='add'" <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="#sub-department-four-modal-add"> data-hs-overlay="#sub-department-four-modal-add">
ย้อนกลับ ย้อนกลับ
</button> </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-four-modal-edit">
ย้อนกลับ
</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="#sub-department-four-alert-add-modal" (click)="addBu7();"> data-hs-overlay="#sub-department-four-alert-add-modal" (click)="addBu7();">
บันทึกข้อมูล บันทึกข้อมูล
...@@ -604,7 +619,7 @@ ...@@ -604,7 +619,7 @@
</h3> </h3>
<div class="flex justify-end"> <div class="flex justify-end">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger" <button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#sub-department-four-alert-edit-modal"> data-hs-overlay="#sub-department-four-modal-edit">
<span class="sr-only">Close</span> <span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i> <i class="ti ti-circle-x fs-xxl"></i>
</button> </button>
...@@ -616,12 +631,7 @@ ...@@ -616,12 +631,7 @@
</p> </p>
<div class="flex justify-end mt-2rem mb-1rem"> <div class="flex justify-end mt-2rem mb-1rem">
<button type="button" *ngIf="currentModal=='add'" <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-four-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" 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-four-modal-edit"> data-hs-overlay="#sub-department-four-modal-edit">
ย้อนกลับ ย้อนกลับ
...@@ -683,7 +693,7 @@ ...@@ -683,7 +693,7 @@
<h1 class="mt-2" style="text-align: center;">ไฟล์</h1> <h1 class="mt-2" style="text-align: center;">ไฟล์</h1>
<div class="mt-2 p-2"> <div class="mt-2 p-2">
<div class="flex rounded-md"> <div class="flex rounded-md">
<input #fileInput type="file" (change)="onFileSelected($event)" hidden> <input #fileInput id="fileInput" type="file" (change)="onFileSelected($event)" hidden>
<input type="text" [value]="selectedFileName" readonly (click)="fileInput.click()" <input type="text" [value]="selectedFileName" readonly (click)="fileInput.click()"
class="ti-form-input rounded-none ltr:rounded-l-md rtl:rounded-r-md focus:z-10 cursor-pointer"> class="ti-form-input rounded-none ltr:rounded-l-md rtl:rounded-r-md focus:z-10 cursor-pointer">
<button type="button" (click)="fileInput.click()" <button type="button" (click)="fileInput.click()"
...@@ -693,6 +703,7 @@ ...@@ -693,6 +703,7 @@
</div> </div>
<div class="flex justify-center mt-2rem mb-1rem space-x-4"> <div class="flex justify-center mt-2rem mb-1rem space-x-4">
<button type="submit" class="ti-btn ti-btn-secondary" (click)="uploadFile()" <button type="submit" class="ti-btn ti-btn-secondary" (click)="uploadFile()"
data-hs-overlay="#sub-department-four-upload-modal" [class.ti-btn-disabled]="!selectedFile"
[disabled]="!selectedFile"> [disabled]="!selectedFile">
อัปโหลด อัปโหลด
</button> </button>
......
...@@ -19,7 +19,7 @@ interface table { ...@@ -19,7 +19,7 @@ interface table {
export class SubDepartmentFourComponent implements OnInit { export class SubDepartmentFourComponent implements OnInit {
bu7List: Bu7Model[] = [] bu7List: Bu7Model[] = []
bu7ListLoading = false bu7ListLoading = false
bu7: Bu7Model = new MyBu7Model({}) bu7: Bu7Model = new MyBu7Model()
bu7Table: table = { bu7Table: table = {
currentPage: 1, currentPage: 1,
page: Array.from({ length: 1 }, (_, i) => i + 1), page: Array.from({ length: 1 }, (_, i) => i + 1),
...@@ -35,13 +35,13 @@ export class SubDepartmentFourComponent implements OnInit { ...@@ -35,13 +35,13 @@ export class SubDepartmentFourComponent implements OnInit {
search: "" search: ""
} }
bu6List: Bu6Model[] = [] bu6List: Bu6Model[] = []
bu6: Bu6Model = new MyBu6Model({}) bu6: Bu6Model = new MyBu6Model()
bu6Modal: table = { bu6Modal: table = {
currentPage: 1, currentPage: 1,
page: Array.from({ length: 1 }, (_, i) => i + 1), page: Array.from({ length: 1 }, (_, i) => i + 1),
search: "" search: ""
} }
currentModal = "" currentModal: 'add' | 'edit' | 'delete' = "add"
constructor(private bu7Service: Bu7Service, constructor(private bu7Service: Bu7Service,
private bu6Service: Bu6Service, private bu6Service: Bu6Service,
private toastr: ToastrService, private toastr: ToastrService,
...@@ -65,6 +65,7 @@ export class SubDepartmentFourComponent implements OnInit { ...@@ -65,6 +65,7 @@ export class SubDepartmentFourComponent implements OnInit {
} }
const formData = new FormData(); const formData = new FormData();
formData.append('file', this.selectedFile); formData.append('file', this.selectedFile);
this.bu7ListLoading = true
this.fileService.upload(formData, 'mbu7').subscribe({ this.fileService.upload(formData, 'mbu7').subscribe({
next: response => { next: response => {
if (response.success) { if (response.success) {
...@@ -72,9 +73,11 @@ export class SubDepartmentFourComponent implements OnInit { ...@@ -72,9 +73,11 @@ export class SubDepartmentFourComponent implements OnInit {
this.getBu7List() this.getBu7List()
} else { } else {
this.showAlert(response.message, 'error') this.showAlert(response.message, 'error')
this.bu7ListLoading = false
} }
}, error: error => { }, error: error => {
this.showAlert(error.message, 'error') this.showAlert(error.message, 'error')
this.bu7ListLoading = false
} }
}) })
} }
...@@ -102,7 +105,7 @@ export class SubDepartmentFourComponent implements OnInit { ...@@ -102,7 +105,7 @@ export class SubDepartmentFourComponent implements OnInit {
this.bu7ListLoading = true this.bu7ListLoading = true
this.bu7Service.getList().subscribe({ this.bu7Service.getList().subscribe({
next: response => { next: response => {
this.bu7List = response this.bu7List = response.map(x => new MyBu7Model(x))
this.bu7ListLoading = false this.bu7ListLoading = false
this.onBu7TableSearchChange() this.onBu7TableSearchChange()
this.cdr.detectChanges() this.cdr.detectChanges()
...@@ -145,6 +148,7 @@ export class SubDepartmentFourComponent implements OnInit { ...@@ -145,6 +148,7 @@ export class SubDepartmentFourComponent implements OnInit {
x.edesc.toLowerCase().includes(this.bu7Modal.search.toLowerCase())) x.edesc.toLowerCase().includes(this.bu7Modal.search.toLowerCase()))
} }
addBu7() { addBu7() {
this.bu7ListLoading = true
this.bu7Service.post({ ...this.bu7, parent: this.bu6.bu6id }).subscribe({ this.bu7Service.post({ ...this.bu7, parent: this.bu6.bu6id }).subscribe({
next: response => { next: response => {
if (response.success) { if (response.success) {
...@@ -152,13 +156,16 @@ export class SubDepartmentFourComponent implements OnInit { ...@@ -152,13 +156,16 @@ export class SubDepartmentFourComponent implements OnInit {
this.getBu7List() this.getBu7List()
} else { } else {
this.showAlert(response.message, 'error') this.showAlert(response.message, 'error')
this.bu7ListLoading = false
} }
}, error: error => { }, error: error => {
this.showAlert(error.message, 'error') this.showAlert(error.message, 'error')
this.bu7ListLoading = false
} }
}) })
} }
deleteBu7() { deleteBu7() {
this.bu7ListLoading = true
this.bu7Service.delete(this.bu7).subscribe({ this.bu7Service.delete(this.bu7).subscribe({
next: response => { next: response => {
if (response.success) { if (response.success) {
...@@ -166,16 +173,18 @@ export class SubDepartmentFourComponent implements OnInit { ...@@ -166,16 +173,18 @@ export class SubDepartmentFourComponent implements OnInit {
this.getBu7List() this.getBu7List()
} else { } else {
this.showAlert(response.message, 'error') this.showAlert(response.message, 'error')
this.bu7ListLoading = false
} }
}, error: error => { }, error: error => {
this.showAlert(error.message, 'error') this.showAlert(error.message, 'error')
this.bu7ListLoading = false
} }
}) })
} }
getBu6List() { getBu6List() {
this.bu6Service.getList().subscribe(response => { this.bu6Service.getList().subscribe(response => {
this.bu6List = response this.bu6List = response.map(x => new MyBu6Model(x))
this.onBu6ModalSearchChange() this.onBu6ModalSearchChange()
}) })
} }
......
...@@ -104,7 +104,7 @@ export class SubDepartmentOneComponent implements OnInit { ...@@ -104,7 +104,7 @@ export class SubDepartmentOneComponent implements OnInit {
this.bu4ListLoading = true this.bu4ListLoading = true
this.bu4Service.getList().subscribe({ this.bu4Service.getList().subscribe({
next: response => { next: response => {
this.bu4List = response this.bu4List = response.map(x => new MyBu4Model(x))
this.bu4ListLoading = false this.bu4ListLoading = false
this.onBu4TableSearchChange() this.onBu4TableSearchChange()
this.cdr.detectChanges() this.cdr.detectChanges()
...@@ -183,7 +183,7 @@ export class SubDepartmentOneComponent implements OnInit { ...@@ -183,7 +183,7 @@ export class SubDepartmentOneComponent implements OnInit {
getBu3List() { getBu3List() {
this.bu3Service.getList().subscribe(response => { this.bu3Service.getList().subscribe(response => {
this.bu3List = response this.bu3List = response.map(x => new MyBu3Model(x))
this.onBu3ModalSearchChange() this.onBu3ModalSearchChange()
}) })
} }
......
...@@ -105,7 +105,7 @@ export class SubDepartmentThreeComponent implements OnInit { ...@@ -105,7 +105,7 @@ export class SubDepartmentThreeComponent implements OnInit {
this.bu6ListLoading = true this.bu6ListLoading = true
this.bu6Service.getList().subscribe({ this.bu6Service.getList().subscribe({
next: response => { next: response => {
this.bu6List = response this.bu6List = response.map(x => new MyBu6Model(x))
this.bu6ListLoading = false this.bu6ListLoading = false
this.onBu6TableSearchChange() this.onBu6TableSearchChange()
this.cdr.detectChanges() this.cdr.detectChanges()
...@@ -184,7 +184,7 @@ export class SubDepartmentThreeComponent implements OnInit { ...@@ -184,7 +184,7 @@ export class SubDepartmentThreeComponent implements OnInit {
getBu5List() { getBu5List() {
this.bu5Service.getList().subscribe(response => { this.bu5Service.getList().subscribe(response => {
this.bu5List = response this.bu5List = response.map(x => new MyBu5Model(x))
this.onBu5ModalSearchChange() this.onBu5ModalSearchChange()
}) })
} }
......
...@@ -104,7 +104,7 @@ export class SubDepartmentTwoComponent implements OnInit { ...@@ -104,7 +104,7 @@ export class SubDepartmentTwoComponent implements OnInit {
this.bu5ListLoading = true this.bu5ListLoading = true
this.bu5Service.getList().subscribe({ this.bu5Service.getList().subscribe({
next: response => { next: response => {
this.bu5List = response this.bu5List = response.map(x => new MyBu5Model(x))
this.bu5ListLoading = false this.bu5ListLoading = false
this.onBu5TableSearchChange() this.onBu5TableSearchChange()
this.cdr.detectChanges() this.cdr.detectChanges()
...@@ -183,7 +183,7 @@ export class SubDepartmentTwoComponent implements OnInit { ...@@ -183,7 +183,7 @@ export class SubDepartmentTwoComponent implements OnInit {
getBu4List() { getBu4List() {
this.bu4Service.getList().subscribe(response => { this.bu4Service.getList().subscribe(response => {
this.bu4List = response this.bu4List = response.map(x => new MyBu4Model(x))
this.onBu4ModalSearchChange() this.onBu4ModalSearchChange()
}) })
} }
......
...@@ -13,12 +13,12 @@ export class MyBu7Model implements Bu7Model { ...@@ -13,12 +13,12 @@ export class MyBu7Model implements Bu7Model {
edesc: string; edesc: string;
parent: string; parent: string;
companyId: string; companyId: string;
constructor(data: Partial<Bu7Model>) { constructor(data?: Partial<Bu7Model>) {
this.bu7id = data.bu7id || "" this.bu7id = data?.bu7id || ""
this.tdesc = data.tdesc || "" this.tdesc = data?.tdesc || ""
this.edesc = data.edesc || "" this.edesc = data?.edesc || ""
this.parent = data.parent || "" this.parent = data?.parent || ""
this.companyId = data.companyId || "" this.companyId = data?.companyId || ""
} }
} }
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