Commit aa4afe9f by Nattana Chaiyamat

ทะเบียนส่วน

parent 789d0100
......@@ -210,10 +210,8 @@
</div>
<label class="ti-form-label mt-2rem">เเผนก*</label>
<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" class="ti-form-input h-16" [(ngModel)]="bu2.bu2id">
<!-- <input type="text" id="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button" class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm 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()">
......@@ -222,8 +220,8 @@
<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> -->
</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)]="bu2.tdesc">
<label for="detail_eng" class="ti-form-label mt-2rem">รายละเอียดแผนก (อังกฤษ)</label>
......
......@@ -18,7 +18,7 @@ interface table {
export class DepartmentListComponent implements OnInit {
bu2List: Bu2Model[] = []
bu2ListLoading = false
bu2: Bu2Model = new MyBu2Model({})
bu2: Bu2Model = new MyBu2Model()
bu2Table: table = {
currentPage: 1,
page: Array.from({ length: 1 }, (_, i) => i + 1),
......@@ -64,6 +64,7 @@ export class DepartmentListComponent implements OnInit {
}
const formData = new FormData();
formData.append('file', this.selectedFile);
this.bu2ListLoading = true
this.fileService.upload(formData, 'mbu2').subscribe({
next: response => {
if (response.success) {
......@@ -71,9 +72,11 @@ export class DepartmentListComponent implements OnInit {
this.getBu2List()
} else {
this.showAlert(response.message, 'error')
this.bu2ListLoading = false
}
}, error: error => {
this.showAlert(error.message, 'error')
this.bu2ListLoading = false
}
})
}
......@@ -121,7 +124,7 @@ export class DepartmentListComponent implements OnInit {
x.edesc.toLowerCase().includes(this.bu2Table.search.toLowerCase()))
}
selectBu2(bu2?: Bu2Model) {
this.bu2 = new MyBu2Model(bu2 || {})
this.bu2 = new MyBu2Model(bu2)
this.selectBu1()
if (this.bu2.parent) {
this.bu1Service.getById(this.bu2.parent).subscribe(response => {
......@@ -165,7 +168,7 @@ export class DepartmentListComponent implements OnInit {
x.edesc.toLowerCase().includes(this.bu1Modal.search.toLowerCase()))
}
selectBu1(bu1?: Bu1Model) {
this.bu1 = new MyBu1Model(bu1 || {})
this.bu1 = new MyBu1Model(bu1)
}
showAlert(text: string, type: 'success' | 'error') {
......@@ -175,6 +178,7 @@ export class DepartmentListComponent implements OnInit {
})
}
addBu2() {
this.bu2ListLoading = true
this.bu2Service.post({ ...this.bu2, parent: this.bu1.bu1id }).subscribe({
next: response => {
if (response.success) {
......@@ -182,13 +186,16 @@ export class DepartmentListComponent implements OnInit {
this.getBu2List()
} else {
this.showAlert(response.message, 'error')
this.bu2ListLoading = false
}
}, error: error => {
this.showAlert(error.message, 'error')
this.bu2ListLoading = false
}
})
}
deleteBu2() {
this.bu2ListLoading = true
this.bu2Service.delete(this.bu2).subscribe({
next: response => {
if (response.success) {
......@@ -196,9 +203,11 @@ export class DepartmentListComponent implements OnInit {
this.getBu2List()
} else {
this.showAlert(response.message, 'error')
this.bu2ListLoading = false
}
}, error: error => {
this.showAlert(error.message, 'error')
this.bu2ListLoading = false
}
})
}
......
......@@ -41,6 +41,7 @@ export class DepartmentRegisterComponent implements OnInit {
}
const formData = new FormData();
formData.append('file', this.selectedFile);
this.bu1ListLoading = true
this.fileService.upload(formData, 'mbu1').subscribe({
next: response => {
if (response.success) {
......@@ -48,9 +49,11 @@ export class DepartmentRegisterComponent implements OnInit {
this.getBu1List()
} else {
this.showAlert(response.message, 'error')
this.bu1ListLoading = false
}
}, error: error => {
this.showAlert(error.message, 'error')
this.bu1ListLoading = false
}
})
}
......@@ -99,7 +102,7 @@ export class DepartmentRegisterComponent implements OnInit {
x.edesc.toLowerCase().includes(this.search.toLowerCase()))
}
selectBu1(bu1?: Bu1Model) {
this.bu1 = new MyBu1Model(bu1 || {})
this.bu1 = new MyBu1Model(bu1)
}
showAlert(text: string, type: 'success' | 'error') {
......@@ -117,10 +120,11 @@ export class DepartmentRegisterComponent implements OnInit {
this.getBu1List()
} else {
this.showAlert(response.message, 'error')
this.bu1ListLoading = false
}
}, error: error => {
this.bu1ListLoading = false
this.showAlert(error.message, 'error')
this.bu1ListLoading = false
}
})
}
......@@ -133,10 +137,11 @@ export class DepartmentRegisterComponent implements OnInit {
this.getBu1List()
} else {
this.showAlert(response.message, 'error')
this.bu1ListLoading = false
}
}, error: error => {
this.bu1ListLoading = false
this.showAlert(error.message, 'error')
this.bu1ListLoading = false
}
})
}
......
......@@ -3,7 +3,7 @@
<div class="flex pr-2">
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-secondary h-20px m-0 shadow-md"
data-hs-overlay="#section-registration-upload-modal">
data-hs-overlay="#section-registration-upload-modal" (click)="selectedFileName = 'กรุณาเลือกไฟล์'">
<i class="ri-add-line"></i>
นำเข้าข้อมูล
</button>
......@@ -28,7 +28,8 @@
</div>
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
(click)="currentModal='add';selectBu2();selectBu3()" 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>
......@@ -47,10 +48,10 @@
</div>
</div>
</div>
</div>
</div>
<div class="page px-rem">
<div class="page px-rem">
<div class="overflow-auto shadow-md rounded-t-md">
<table class="ti-custom-table ti-custom-table-head ti-custom-table-hover table-bordered">
<thead>
......@@ -96,7 +97,8 @@
<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)="selectBu3(item)" data-hs-overlay="#section-registration-alert-delete-modal"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" currentModal='delete'
(click)="selectBu3(item)" data-hs-overlay="#section-registration-alert-delete-modal"></i>
</td>
</tr>
</tbody>
......@@ -111,11 +113,13 @@
</a>
</li>
<li *ngFor="let item of bu3Table.page;let f = first;let l = last">
<ng-container *ngIf="item==3&&bu3Table.currentPage!=1&&bu3Table.currentPage!=2&&bu3Table.currentPage!=3">
<ng-container
*ngIf="item==3&&bu3Table.currentPage!=1&&bu3Table.currentPage!=2&&bu3Table.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==bu3Table.currentPage-1||item==bu3Table.currentPage||item==bu3Table.currentPage+1)">
<ng-container
*ngIf="(f||l)||(item==bu3Table.currentPage-1||item==bu3Table.currentPage||item==bu3Table.currentPage+1)">
<a class="page-link" href="javascript:void(0);" [class.active]="item==bu3Table.currentPage"
(click)="bu3Table.currentPage=item">{{item}}
</a>
......@@ -134,7 +138,7 @@
</li>
</ul>
</nav>
</div>
</div>
<div id="section-registration-modal-add" class="hs-overlay hidden ti-modal">
......@@ -181,16 +185,20 @@
</div>
</div>
<div class="ti-modal-body">
<label class="ti-form-label">อยู่ภายใต้หน่วยงาน</label>
<label class="ti-form-label">อยู่ภายใต้หน่วยงาน*</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-sm ltr:rounded-r-sm rtl:rounded-l-sm 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">
<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()">
<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">
<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>
......@@ -200,18 +208,23 @@
readonly [value]="bu2.tdesc">
</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">
<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)]="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">
<input type="text" class="ti-form-input h-16" [(ngModel)]="bu3.bu3id">
<!-- <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)]="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">
<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> -->
</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)]="bu3.tdesc">
......@@ -223,10 +236,12 @@
data-hs-overlay="#section-registration-modal-add">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#section-registration-alert-modal">
<button type="button" class="ti-btn ti-btn-success"
data-hs-overlay="#section-registration-alert-modal"
[class.ti-btn-disabled]="!bu2.bu2id||!bu3.bu3id||!bu3.tdesc"
[disabled]="!bu2.bu2id||!bu3.bu3id||!bu3.tdesc">
บันทึกข้อมูล
</a>
</button>
</div>
</div>
</div>
......@@ -277,17 +292,20 @@
</div>
</div>
<div class="ti-modal-body">
<label for="hs-trailing-button-add-on-with-icon"
class="ti-form-label">อยู่ภายใต้หน่วยงาน</label>
<label for="hs-trailing-button-add-on-with-icon" class="ti-form-label">อยู่ภายใต้หน่วยงาน</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-sm ltr:rounded-r-sm rtl:rounded-l-sm 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">
<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()">
<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">
<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>
......@@ -314,10 +332,12 @@
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-edit-modal">
<button type="button" class="ti-btn ti-btn-success"
data-hs-overlay="#section-registration-alert-edit-modal"
[class.ti-btn-disabled]="!bu2.bu2id||!bu3.bu3id||!bu3.tdesc"
[disabled]="!bu2.bu2id||!bu3.bu3id||!bu3.tdesc">
บันทึกข้อมูล
</a>
</button>
</div>
</div>
</div>
......@@ -563,7 +583,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="#section-registration-modal-add">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
......@@ -575,16 +595,11 @@
</p>
<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="#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()">
บันทึกข้อมูล
......@@ -604,7 +619,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="#section-registration-modal-edit">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
......@@ -616,11 +631,6 @@
</p>
<div class="flex justify-end mt-2rem mb-1rem">
<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">
......@@ -657,14 +667,9 @@
</p>
<div class="flex justify-end mt-2rem mb-1rem">
<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'"
<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-edit">
data-hs-overlay="#section-registration-alert-delete-modal">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
......@@ -697,7 +702,8 @@
</button>
</div>
<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"
data-hs-overlay="#section-registration-upload-modal" (click)="uploadFile()"
[disabled]="!selectedFile">
อัปโหลด
</button>
......
......@@ -18,7 +18,7 @@ interface table {
export class SectionRegistrationComponent implements OnInit {
bu3List: Bu3Model[] = []
bu3ListLoading = false
bu3: Bu3Model = new MyBu3Model({})
bu3: Bu3Model = new MyBu3Model()
bu3Table: table = {
currentPage: 1,
page: Array.from({ length: 1 }, (_, i) => i + 1),
......@@ -34,13 +34,13 @@ export class SectionRegistrationComponent implements OnInit {
search: ""
}
bu2List: Bu2Model[] = []
bu2: Bu2Model = new MyBu2Model({})
bu2: Bu2Model = new MyBu2Model()
bu2Modal: table = {
currentPage: 1,
page: Array.from({ length: 1 }, (_, i) => i + 1),
search: ""
}
currentModal = ""
currentModal: 'add' | 'edit' | 'delete' = "add"
constructor(private bu3Service: Bu3Service,
private bu2Service: Bu2Service,
private toastr: ToastrService,
......@@ -65,6 +65,7 @@ export class SectionRegistrationComponent implements OnInit {
}
const formData = new FormData();
formData.append('file', this.selectedFile);
this.bu3ListLoading = true
this.fileService.upload(formData, 'mbu3').subscribe({
next: response => {
if (response.success) {
......@@ -72,9 +73,11 @@ export class SectionRegistrationComponent implements OnInit {
this.getBu3List()
} else {
this.showAlert(response.message, 'error')
this.bu3ListLoading = false
}
}, error: error => {
this.showAlert(error.message, 'error')
this.bu3ListLoading = false
}
})
}
......@@ -122,7 +125,7 @@ export class SectionRegistrationComponent implements OnInit {
x.edesc.toLowerCase().includes(this.bu3Table.search.toLowerCase()))
}
selectBu3(bu3?: Bu3Model) {
this.bu3 = new MyBu3Model(bu3 || {})
this.bu3 = new MyBu3Model(bu3)
this.selectBu2()
if (this.bu3.parent) {
this.bu2Service.getById(this.bu3.parent).subscribe(response => {
......@@ -145,6 +148,7 @@ export class SectionRegistrationComponent implements OnInit {
x.edesc.toLowerCase().includes(this.bu3Modal.search.toLowerCase()))
}
addBu3() {
this.bu3ListLoading = true
this.bu3Service.post({ ...this.bu3, parent: this.bu2.bu2id }).subscribe({
next: response => {
if (response.success) {
......@@ -152,13 +156,16 @@ export class SectionRegistrationComponent implements OnInit {
this.getBu3List()
} else {
this.showAlert(response.message, 'error')
this.bu3ListLoading = false
}
}, error: error => {
this.showAlert(error.message, 'error')
this.bu3ListLoading = false
}
})
}
deleteBu3() {
this.bu3ListLoading = true
this.bu3Service.delete(this.bu3).subscribe({
next: response => {
if (response.success) {
......@@ -166,9 +173,11 @@ export class SectionRegistrationComponent implements OnInit {
this.getBu3List()
} else {
this.showAlert(response.message, 'error')
this.bu3ListLoading = false
}
}, error: error => {
this.showAlert(error.message, 'error')
this.bu3ListLoading = false
}
})
}
......@@ -193,7 +202,7 @@ export class SectionRegistrationComponent implements OnInit {
x.edesc.toLowerCase().includes(this.bu2Modal.search.toLowerCase()))
}
selectBu2(bu2?: Bu2Model) {
this.bu2 = new MyBu2Model(bu2 || {})
this.bu2 = new MyBu2Model(bu2)
}
showAlert(text: string, type: 'success' | 'error') {
......
......@@ -34,7 +34,7 @@ export class SubDepartmentOneComponent implements OnInit {
search: ""
}
bu3List: Bu3Model[] = []
bu3: Bu3Model = new MyBu3Model({})
bu3: Bu3Model = new MyBu3Model()
bu3Modal: table = {
currentPage: 1,
page: Array.from({ length: 1 }, (_, i) => i + 1),
......
......@@ -742,7 +742,7 @@
<i class="ti ti-wallet text-lg"></i>
Bal: $7,12,950
</a>
<a routerLink="/signin/basic" class="ti-dropdown-item">
<a (click)="logOut()" routerLink="/auth/login" class="ti-dropdown-item">
<i class="ti ti-logout text-lg"></i>
Log Out
</a>
......
......@@ -13,6 +13,10 @@ export class HeaderComponent {
private elementRef: ElementRef) {
}
logOut() {
sessionStorage.clear()
}
themeChange(type: string, type1: string) {
this.elementRef.nativeElement.ownerDocument.documentElement?.setAttribute('class', type);
this.elementRef.nativeElement.ownerDocument.documentElement?.setAttribute('style', "");
......@@ -37,11 +41,11 @@ export class HeaderComponent {
toggleSidebar() {
let html = this.elementRef.nativeElement.ownerDocument.documentElement;
if(window.innerWidth <= 992){
if (window.innerWidth <= 992) {
html?.setAttribute('toggled', html?.getAttribute('toggled') == 'open' ? 'close' : 'open');
if(html?.getAttribute('toggled') == 'open'){
if (html?.getAttribute('toggled') == 'open') {
document.querySelector('#responsive-overlay')?.classList.add('active');
}else{
} else {
document.querySelector('#responsive-overlay')?.classList.remove('active');
}
}
......
......@@ -13,12 +13,12 @@ export class MyBu2Model implements Bu2Model {
edesc: string;
parent: string;
companyId: string;
constructor(data: Partial<Bu2Model>) {
this.bu2id = data.bu2id || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
this.parent = data.parent || ""
this.companyId = data.companyId || ""
constructor(data?: Partial<Bu2Model>) {
this.bu2id = data?.bu2id || ""
this.tdesc = data?.tdesc || ""
this.edesc = data?.edesc || ""
this.parent = data?.parent || ""
this.companyId = data?.companyId || ""
}
}
......@@ -13,12 +13,12 @@ export class MyBu3Model implements Bu3Model {
edesc: string;
parent: string;
companyId: string;
constructor(data: Partial<Bu3Model>) {
this.bu3id = data.bu3id || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
this.parent = data.parent || ""
this.companyId = data.companyId || ""
constructor(data?: Partial<Bu3Model>) {
this.bu3id = data?.bu3id || ""
this.tdesc = data?.tdesc || ""
this.edesc = data?.edesc || ""
this.parent = data?.parent || ""
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