Commit 9309430b by kantavee

เเก้ dashboardmodule

parents ba4be01e 12579f2c
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<div class="page"> <div class="page">
<div class="border-b border-gray-200 dark:border-white/10"> <div class="border-b border-gray-200 dark:border-white/10">
<nav class="-mb-0.5 flex space-x-6 rtl:space-x-reverse"> <nav class="-mb-0.5 flex space-x-6 rtl:space-x-reverse">
<a class="pl-8 text-xxl font-bold hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 px-1 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary active" <a class="ml-8 text-xxl font-bold hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 px-1 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary active"
href="javascript:void(0);" id="underline-item-1" data-hs-tab="#underline-1" href="javascript:void(0);" id="underline-item-1" data-hs-tab="#underline-1"
aria-controls="underline-1" (click)="pathTitle = ['ตั้งค่าผู้ใช้งาน','สร้างชื่อผู้ใช้งาน']"> aria-controls="underline-1" (click)="pathTitle = ['ตั้งค่าผู้ใช้งาน','สร้างชื่อผู้ใช้งาน']">
สร้างชื่อผู้ใช้งาน สร้างชื่อผู้ใช้งาน
......
...@@ -49,6 +49,8 @@ import { Bu6Service } from 'src/app/shared/services/bu6.service'; ...@@ -49,6 +49,8 @@ import { Bu6Service } from 'src/app/shared/services/bu6.service';
import { Bu7Service } from 'src/app/shared/services/bu7.service'; import { Bu7Service } from 'src/app/shared/services/bu7.service';
import { PositionService } from 'src/app/shared/services/position.service'; import { PositionService } from 'src/app/shared/services/position.service';
import { PLService } from 'src/app/shared/services/pl.service'; import { PLService } from 'src/app/shared/services/pl.service';
import { EmpGroupService } from 'src/app/shared/services/emp_group.service';
import { EmpTypeService } from 'src/app/shared/services/employee-type.service';
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -96,7 +98,7 @@ import { PLService } from 'src/app/shared/services/pl.service'; ...@@ -96,7 +98,7 @@ import { PLService } from 'src/app/shared/services/pl.service';
HttpClientModule, HttpClientModule,
FormsModule FormsModule
], ],
providers: [Bu1Service,Bu2Service,Bu3Service,Bu4Service,Bu5Service,Bu6Service,Bu7Service,PositionService,PLService,{ providers: [Bu1Service,Bu2Service,Bu3Service,Bu4Service,Bu5Service,Bu6Service,Bu7Service,PositionService,PLService,EmpGroupService,EmpTypeService,{
provide: HTTP_INTERCEPTORS, provide: HTTP_INTERCEPTORS,
useClass: HttpRequestInterceptor, useClass: HttpRequestInterceptor,
multi: true, multi: true,
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
<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)]="search" (ngModelChange)="searchChange()">
<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>
...@@ -73,24 +74,54 @@ ...@@ -73,24 +74,54 @@
</ng-container> </ng-container>
</tr> </tr>
</thead> </thead>
<tbody> <tbody *ngIf="!emp_typeListFilter().length">
<tr *ngFor="let item of[ <tr>
['01','พนักงานประจำรายเดือน', 'พนักงานประจำรายเดือน'], <td class="text-center" colspan="100%">
['02','พนักงานประจำรายวัน', 'พนักงานประจำรายวัน']];let i = index"> ไม่พบข้อมูล
<td style="font-size: 12px; " class="flex justify-center"> </td>
</tr>
</tbody>
<tbody *ngIf="emp_typeListFilter().length">
<tr
*ngFor="let item of emp_typeListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index">
<td class="flex justify-center">
<input type="checkbox" style="margin-right: 20px; transform:scale(0.7)"> <input type="checkbox" style="margin-right: 20px; transform:scale(0.7)">
{{item[0]}} {{item.codeId}}
</td> </td>
<td style="text-align: center; font-size: 12px;">{{item[1]}}</td> <td class="text-center">{{item.tdesc}}</td>
<td style="text-align: center; font-size: 12px;padding-left: 9.2%; padding-right: 50%;">{{item[2]}}</td> <td class="text-center">{{item.edesc}}</td>
<td class="flex justify-center"> <td class="flex justify-center">
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1" data-hs-overlay="#employee-categories-modal-edit"></i> <i class="ti ti-edit cursor-pointer i-gray fs-l px-1" (click)="selectEmp_type(item)"
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1"></i> data-hs-overlay="#employee-categories-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="deleteEmp_type(item)"></i>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<nav class="pagination-style-3 overflow-auto my-5" *ngIf="page.length">
<ul class="ti-pagination">
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="currentPage = (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}}
</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 )">
<i class="ri-arrow-right-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
</ul>
</nav>
</div> </div>
</div> </div>
...@@ -147,7 +178,8 @@ ...@@ -147,7 +178,8 @@
data-hs-overlay="#employee-categories-modal-add"> data-hs-overlay="#employee-categories-modal-add">
ย้อนกลับ ย้อนกลับ
</button> </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="#employee-categories-alert-modal">
บันทึกข้อมูล บันทึกข้อมูล
</a> </a>
</div> </div>
...@@ -196,18 +228,55 @@ ...@@ -196,18 +228,55 @@
</div> </div>
<div class="ti-modal-body" style="margin-top: 40px;"> <div class="ti-modal-body" style="margin-top: 40px;">
<label for="input-label" class="ti-form-label mt-2rem">รหัสประเภทพนักงาน</label> <label for="input-label" class="ti-form-label mt-2rem">รหัสประเภทพนักงาน</label>
<input type="text" id="input-label" class="ti-form-input w-1/2 bg-input-readonly" style="background-color: #B3B3B3;" placeholder="" readonly> <input type="text" id="input-label" class="ti-form-input w-1/2 bg-input-readonly" style="background-color: #B3B3B3;" [(ngModel)]="emp_type.codeId" readonly>
<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" placeholder=""> <input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="emp_type.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" placeholder=""> <input type="text" id="detail_eng" class="ti-form-input h-16" [(ngModel)]="emp_type.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"
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="#employee-categories-modal-edit"> data-hs-overlay="#employee-categories-modal-edit">
ย้อนกลับ ย้อนกลับ
</button> </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="#employee-categories-alert-modal">
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div id="employee-categories-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">
<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="#employee-group-unit-component-alert-modal">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
</div>
</div>
<div class="ti-modal-body ">
<p class="mt-1 text-gray-800 dark:text-white/70">
ยืนยันการบันทึกข้อมูลหรือไม่
</p>
<div class="flex justify-end mt-2rem mb-1rem">
<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="#employee-categories-alert-modal">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#employee-categories-alert-modal" (click)="addEmp_type()">
บันทึกข้อมูล บันทึกข้อมูล
</a> </a>
</div> </div>
......
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { EmpTypeModel, MyEmpTypeModel } from 'src/app/shared/model/employee-type.model';
import { EmpTypeService } from 'src/app/shared/services/employee-type.service';
@Component({ @Component({
selector: 'app-employee-categories', selector: 'app-employee-categories',
...@@ -15,6 +18,19 @@ export class EmployeeCategories { ...@@ -15,6 +18,19 @@ export class EmployeeCategories {
this.sendPathTitle.emit(['การจัดการข้อมูลองค์กร', 'ข้อมูลลักษณะงาน', tab.text]) this.sendPathTitle.emit(['การจัดการข้อมูลองค์กร', 'ข้อมูลลักษณะงาน', tab.text])
this.activeTab = tab.id; this.activeTab = tab.id;
} }
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
emp_typeList: EmpTypeModel[] = []
emp_type: EmpTypeModel = new MyEmpTypeModel({})
search = ""
constructor(private EmpTypeService: EmpTypeService,
private toastr: ToastrService
) { }
ngOnInit(): void {
this.getEmpTypeList()
}
modalOptions: { modalOptions: {
[nameModal: string]: { // ชื่อตรวจสอบการเปิดปิด [nameModal: string]: { // ชื่อตรวจสอบการเปิดปิด
isModalOpen: boolean; // เปิด/ปิด isModalOpen: boolean; // เปิด/ปิด
...@@ -31,6 +47,11 @@ export class EmployeeCategories { ...@@ -31,6 +47,11 @@ export class EmployeeCategories {
isModalOpen: false, isModalOpen: false,
modalSize: 'm', modalSize: 'm',
backdropClose: true, backdropClose: true,
},
"upload":{
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
} }
} }
...@@ -53,5 +74,46 @@ export class EmployeeCategories { ...@@ -53,5 +74,46 @@ export class EmployeeCategories {
// Logic ตรวจสอบว่า Modal อื่นยังเปิดอยู่หรือไม่ // Logic ตรวจสอบว่า Modal อื่นยังเปิดอยู่หรือไม่
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // หากไม่มี Modal อื่นเปิด return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // หากไม่มี Modal อื่นเปิด
} }
getEmpTypeList() {
this.EmpTypeService.getList().subscribe(response => {
this.emp_typeList = response
this.searchChange()
})
}
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.emp_typeListFilter().length / 10) }, (_, i) => i + 1);
}
emp_typeListFilter() {
return this.emp_typeList.filter(x => x.codeId.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
}
selectEmp_type(emp_type: EmpTypeModel) {
// this.showSuccess()
this.emp_type = new MyEmpTypeModel(emp_type)
}
showSuccess() {
this.toastr.success('This is an example of tip', 'TIP', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
addEmp_type() {
// this.emp_typeService.post(this.emp_type).subscribe((response:any) => {
// if (response.success) {
// this.getemp_typeList()
// }
// })
}
deleteEmp_type(emp_type: EmpTypeModel) {
// this.emp_typeService.delete(new MyEmpTypeModel(emp_type)).subscribe((response:any) => {
// if (response.success) {
// this.getemp_typeList()
// }
// })
}
} }
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
<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)]="search" (ngModelChange)="searchChange()">
<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>
...@@ -65,29 +66,54 @@ ...@@ -65,29 +66,54 @@
</ng-container> </ng-container>
</tr> </tr>
</thead> </thead>
<tbody> <tbody *ngIf="!emp_groupListFilter().length">
<tr *ngFor="let item of[ <tr>
['PG005', 'Chair Man', 'Chair Man'], <td class="text-center" colspan="100%">
['PG004', 'Managing Director', 'Managing Director'], ไม่พบข้อมูล
['PG003', 'Sr.Director', 'Sr.Director'], </td>
['PG002', 'General Manager', 'General Manager'], </tr>
['PG001', 'Manager', 'Manager'], </tbody>
['RG005', 'Suoervisor', 'Suoervisor'], <tbody *ngIf="emp_groupListFilter().length">
['RG004', 'Leader', 'Leader']];let i = index"> <tr
<td style="font-size: 12px;" class="flex justify-center"> *ngFor="let item of emp_groupListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index">
<td class="flex justify-center">
<input type="checkbox" style="margin-right: 20px; transform:scale(0.7)"> <input type="checkbox" style="margin-right: 20px; transform:scale(0.7)">
{{item[0]}} {{item.groupId}}
</td> </td>
<td style="text-align: center; font-size: 12px;" >{{item[1]}}</td> <td class="text-center">{{item.tdesc}}</td>
<td style="text-align: center; font-size: 12px;" >{{item[2]}}</td> <td class="text-center">{{item.edesc}}</td>
<td class="flex justify-center"> <td class="flex justify-center">
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1" data-hs-overlay="#employee-group-unit-component-modal-edit"></i> <i class="ti ti-edit cursor-pointer i-gray fs-l px-1" (click)="selectEmp_group(item)"
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1"></i> data-hs-overlay="#employee-group-unit-component-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="deleteEmp_group(item)"></i>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<nav class="pagination-style-3 overflow-auto my-5" *ngIf="page.length">
<ul class="ti-pagination">
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);"
(click)="currentPage = (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}}
</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 )">
<i class="ri-arrow-right-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
</ul>
</nav>
</div> </div>
</div> </div>
...@@ -144,7 +170,8 @@ ...@@ -144,7 +170,8 @@
data-hs-overlay="#employee-group-unit-component-modal-add"> data-hs-overlay="#employee-group-unit-component-modal-add">
ย้อนกลับ ย้อนกลับ
</button> </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="#employee-group-unit-component-alert-modal">
บันทึกข้อมูล บันทึกข้อมูล
</a> </a>
</div> </div>
...@@ -193,18 +220,19 @@ ...@@ -193,18 +220,19 @@
</div> </div>
<div class="ti-modal-body " style="margin-top: 40px;"> <div class="ti-modal-body " style="margin-top: 40px;">
<label for="input-label" class="ti-form-label mt-2rem">รหัสกลุ่มพนักงาน</label> <label for="input-label" class="ti-form-label mt-2rem">รหัสกลุ่มพนักงาน</label>
<input type="text" id="input-label" class="ti-form-input w-1/2 bg-input-readonly" value="01" readonly style="background-color: #B3B3B3;"> <input type="text" id="input-label" class="ti-form-input w-1/2 bg-input-readonly" style="background-color: #B3B3B3;" [(ngModel)]="emp_group.groupId" readonly>
<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" value="กลุ่ม 1"> <input type="text" id="detail_th" class="ti-form-input" [(ngModel)]="emp_group.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" placeholder=""> <input type="text" id="detail_eng" class="ti-form-input" [(ngModel)]="emp_group.edesc">
<div class="flex justify-end mt-2rem mb-1rem"> <div class="flex justify-end mt-2rem mb-1rem">
<button type="button" <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="#employee-group-unit-component-modal-edit"> data-hs-overlay="#employee-group-unit-component-modal-edit">
ย้อนกลับ ย้อนกลับ
</button> </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="#employee-group-unit-component-alert-modal">
บันทึกข้อมูล บันทึกข้อมูล
</a> </a>
</div> </div>
...@@ -212,6 +240,43 @@ ...@@ -212,6 +240,43 @@
</div> </div>
</div> </div>
</div> </div>
<div id="employee-group-unit-component-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">
<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="#employee-group-unit-component-alert-modal">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
</div>
</div>
<div class="ti-modal-body ">
<p class="mt-1 text-gray-800 dark:text-white/70">
ยืนยันการบันทึกข้อมูลหรือไม่
</p>
<div class="flex justify-end mt-2rem mb-1rem">
<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="#employee-group-unit-component-alert-modal">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#employee-group-unit-component-alert-modal" (click)="addEmp_group()">
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div id="employee-group-unit-component-modal-upload" class="hs-overlay hidden ti-modal"> <div id="employee-group-unit-component-modal-upload" 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="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-upload"> <div class="max-h-full overflow-hidden ti-modal-content-upload">
......
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { EmpGroupModel, MyEmpGroupModel } from 'src/app/shared/model/emp_group.model';
import { EmpGroupService } from 'src/app/shared/services/emp_group.service';
@Component({ @Component({
selector: 'app-employee-group-unit', selector: 'app-employee-group-unit',
templateUrl: './employee-group-unit.component.html', templateUrl: './employee-group-unit.component.html',
styleUrls: ['./employee-group-unit.component.scss'] styleUrls: ['./employee-group-unit.component.scss']
}) })
export class EmployeeGroupUnit { export class EmployeeGroupUnit implements OnInit {
@Input() pathTitle = ['การจัดการข้อมูลองค์กร', 'ข้อมูลลักษณะงาน', 'กลุ่มพนักงาน'] @Input() pathTitle = ['การจัดการข้อมูลองค์กร', 'ข้อมูลลักษณะงาน', 'กลุ่มพนักงาน']
@Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>(); @Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>();
activeTab: string = 'tab1'; // กำหนด tab เริ่มต้น activeTab: string = 'tab1'; // กำหนด tab เริ่มต้น
...@@ -15,6 +18,19 @@ export class EmployeeGroupUnit { ...@@ -15,6 +18,19 @@ export class EmployeeGroupUnit {
this.sendPathTitle.emit(['การจัดการข้อมูลองค์กร', 'ข้อมูลลักษณะงาน', tab.text]) this.sendPathTitle.emit(['การจัดการข้อมูลองค์กร', 'ข้อมูลลักษณะงาน', tab.text])
this.activeTab = tab.id; this.activeTab = tab.id;
} }
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
emp_groupList: EmpGroupModel[] = []
emp_group: EmpGroupModel = new MyEmpGroupModel({})
search = ""
constructor(private EmpGroupService: EmpGroupService,
private toastr: ToastrService
) { }
ngOnInit(): void {
this.getEmpGroupList()
}
modalOptions: { modalOptions: {
[nameModal: string]: { // ชื่อตรวจสอบการเปิดปิด [nameModal: string]: { // ชื่อตรวจสอบการเปิดปิด
isModalOpen: boolean; // เปิด/ปิด isModalOpen: boolean; // เปิด/ปิด
...@@ -58,5 +74,46 @@ export class EmployeeGroupUnit { ...@@ -58,5 +74,46 @@ export class EmployeeGroupUnit {
// Logic ตรวจสอบว่า Modal อื่นยังเปิดอยู่หรือไม่ // Logic ตรวจสอบว่า Modal อื่นยังเปิดอยู่หรือไม่
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // หากไม่มี Modal อื่นเปิด return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // หากไม่มี Modal อื่นเปิด
} }
getEmpGroupList() {
this.EmpGroupService.getList().subscribe(response => {
this.emp_groupList = response
this.searchChange()
})
}
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.emp_groupListFilter().length / 10) }, (_, i) => i + 1);
}
emp_groupListFilter() {
return this.emp_groupList.filter(x => x.groupId.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
}
selectEmp_group(emp_group: EmpGroupModel) {
// this.showSuccess()
this.emp_group = new MyEmpGroupModel(emp_group)
}
showSuccess() {
this.toastr.success('This is an example of tip', 'TIP', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
addEmp_group() {
// this.emp_groupService.post(this.emp_group).subscribe((response:any) => {
// if (response.success) {
// this.getemp_groupList()
// }
// })
}
deleteEmp_group(emp_group: EmpGroupModel) {
// this.emp_groupService.delete(new MyEmpGroupModel(emp_group)).subscribe((response:any) => {
// if (response.success) {
// this.getemp_groupList()
// }
// })
}
} }
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
<div class="page"> <div class="page">
<div class="border-b border-gray-200 dark:border-white/10"> <div class="border-b border-gray-200 dark:border-white/10">
<nav class="-mb-0.5 flex space-x-6 rtl:space-x-reverse"> <nav class="-mb-0.5 flex space-x-6 rtl:space-x-reverse">
<a class="pl-8 text-xxl font-bold hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 px-1 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary active" <a class="ml-8 text-xxl font-bold hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 px-1 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary active"
href="javascript:void(0);" id="underline-item-1" data-hs-tab="#underline-1" href="javascript:void(0);" id="underline-item-1" data-hs-tab="#underline-1"
aria-controls="underline-1" (click)="pathTitle = ['ข้อมูลลักษณะงาน','กลุ่มพนักงาน']"> aria-controls="underline-1" (click)="pathTitle = ['ข้อมูลลักษณะงาน','กลุ่มพนักงาน']">
กลุ่มพนักงาน กลุ่มพนักงาน
......
export interface EmpGroupModel{
groupId: string;
tdesc: string;
edesc: string;
companyId: string;
}
export class MyEmpGroupModel implements EmpGroupModel {
groupId: string;
tdesc: string;
edesc: string;
companyId: string;
constructor(data: Partial<EmpGroupModel>) {
this.groupId = data.groupId || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
this.companyId = data.companyId || ""
}
}
export interface EmpTypeModel{
codeId: string;
tdesc: string;
edesc: string;
companyId: string;
}
export class MyEmpTypeModel implements EmpTypeModel {
codeId: string;
tdesc: string;
edesc: string;
companyId: string;
constructor(data: Partial<EmpTypeModel>) {
this.codeId = data.codeId || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
this.companyId = data.companyId || ""
}
}
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { EmpGroupModel } from '../model/emp_group.model';
@Injectable({
providedIn: 'root'
})
export class EmpGroupService {
api = "/emp-group"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getList(): Observable<EmpGroupModel[]> {
return this.http.get<EmpGroupModel[]>(this.urlApi + "/lists")
}
getById(groupId: string): Observable<EmpGroupModel> {
return this.http.get<EmpGroupModel>(this.urlApi + "/" + groupId)
}
// post(body: Bu1Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu1Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
}
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { EmpTypeModel } from '../model/employee-type.model';
@Injectable({
providedIn: 'root'
})
export class EmpTypeService {
api = "/employee-type"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getList(): Observable<EmpTypeModel[]> {
return this.http.get<EmpTypeModel[]>(this.urlApi + "/lists")
}
getById(codeId: string): Observable<EmpTypeModel> {
return this.http.get<EmpTypeModel>(this.urlApi + "/" + codeId)
}
// post(body: Bu1Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu1Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
}
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