Commit 921acede by Nattana Chaiyamat

แก้ refresh-token

parent f6053f76
......@@ -183,9 +183,9 @@
</div>
<ng-container *ngIf="changePassword">
<label class="ti-form-label mt-2rem">รหัสผ่านเก่า*</label>
<input type="password" class="ti-form-input" [(ngModel)]="userPassword.oldPassword">
<input type="text" class="masked-input ti-form-input" [(ngModel)]="userPassword.oldPassword">
<label class="ti-form-label mt-2rem">รหัสผ่านใหม่*</label>
<input type="password" class="ti-form-input" [(ngModel)]="userPassword.newPassword">
<input type="text" class="masked-input ti-form-input" [(ngModel)]="userPassword.newPassword">
</ng-container>
<div class="flex justify-end mt-2rem mb-1rem">
<button type="button"
......
......@@ -159,7 +159,7 @@
<label class="ti-form-label mt-2rem">รหัสพนักงาน</label>
<input type="text" class="ti-form-input bg-input-readonly" readonly [(ngModel)]="userPassword.empId">
<label class="ti-form-label mt-2rem">กำหนดผ่านใหม่*</label>
<input type="password" class="ti-form-input" [(ngModel)]="userPassword.newPassword">
<input type="text" class="masked-input ti-form-input" [(ngModel)]="userPassword.newPassword">
<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"
......
<ng-container *ngIf="!editTab">
<div class="w-full min-height-50px mb-10px justify-between items-center">
<div class="flex">
</div>
<div class="flex justify-end">
<div class="px-1">
<div class="relative shadow-md">
......@@ -18,7 +15,7 @@
<div class="px-1">
<button type="button"
class="ti-btn ti-btn bg-pink-500/10 text-pink-500 hover:text-white hover:bg-pink-500 ring-offset-white focus:ring-pink-500 dark:focus:ring-offset-white/10 h-45px m-0 shadow-md"
data-hs-overlay="#group-competencies-modal-add"
data-hs-overlay="#group-competencies-upload-modal"
(click)="fileInput.value = '';selectedFile=null;selectedFileName = 'กรุณาเลือกไฟล์'">
<i class="ti ti-file-plus"></i>
import
......@@ -130,7 +127,7 @@
</ng-container>
<div id="group-competencies-modal-add" class="hs-overlay hidden ti-modal">
<div id="group-competencies-upload-modal" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white">
......@@ -156,7 +153,7 @@
</div>
<div class="flex justify-center mt-2rem mb-1rem space-x-4">
<button type="submit" class="ti-btn ti-btn-secondary"
data-hs-overlay="#group-competencies-modal-add" [class.ti-btn-disabled]="!selectedFile"
data-hs-overlay="#group-competencies-upload-modal" [class.ti-btn-disabled]="!selectedFile"
(click)="uploadFile()" [disabled]="!selectedFile" [disabled]="!selectedFile">
อัปโหลด
</button>
......
......@@ -58,6 +58,7 @@ export class GroupCompetenciesComponent {
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.dataLoading = false
} else {
this.showAlert(response.message, 'error')
this.dataLoading = false
......
......@@ -279,6 +279,7 @@ export class CompetencyTopic {
this.showAlert(response.message, 'success')
this.getCompetencytypeList()
this.getCompetencytopicList()
this.dataLoading = false
} else {
this.showAlert(response.message, 'error')
this.dataLoading = false
......
......@@ -140,6 +140,7 @@ import { UserService } from 'src/app/shared/services/user.service';
import { ManageUserComponent } from '../company-components/account-settings/manage-user/manage-user.component';
import { PmstypeService } from 'src/app/shared/services/pmstype.service';
import { PmstopicService } from 'src/app/shared/services/pmstopic.service';
import { PmsGroupAssessmentService } from 'src/app/shared/services/pms-group-assessment.service';
export const MY_DATE_FORMATS = {
parse: {
......@@ -310,6 +311,7 @@ export class CustomDateAdapter extends NativeDateAdapter {
UserService,
PmstypeService,
PmstopicService,
PmsGroupAssessmentService,
{
provide: HTTP_INTERCEPTORS,
useClass: HttpRequestInterceptor,
......
......@@ -26,16 +26,11 @@
<div class="mt-3 px-2rem !-mt-3 pt-50px">
<div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1"
*ngIf="activeTab === 'underline-1'">
<app-evaluation-grouping *ngIf="groupShow=='1'" [pathTitle]="pathTitle"
(sendPathTitle)="pathTitle=$event" (sendGroupShow)="groupShow=$event"></app-evaluation-grouping>
<app-edit-evaluation-grouping *ngIf="groupShow=='2'" [pathTitle]="pathTitle"
(sendPathTitle)="pathTitle=$event"
(sendGroupShow)="groupShow=$event"></app-edit-evaluation-grouping>
<app-evaluation-grouping (sendPathTitle)="pathTitle=$event"></app-evaluation-grouping>
</div>
<div id="underline-2" role="tabpanel" aria-labelledby="underline-item-2"
*ngIf="activeTab === 'underline-2'">
<app-assigning-approvers *ngIf="groupShow=='1'" [pathTitle]="pathTitle"
(sendPathTitle)="pathTitle=$event" (sendGroupShow)="groupShow=$event"></app-assigning-approvers>
<app-assigning-approvers></app-assigning-approvers>
</div>
</div>
</div>
......
......@@ -6,7 +6,6 @@ import { Component } from '@angular/core';
styleUrls: ['./assessment-management.component.scss']
})
export class AssessmentManagementComponent {
pathTitle = ['การประเมินจัดการประสิทธิภาพ', 'การจัดการประเมิน','จัดกลุ่มการประเมิน']
activeTab: string = 'underline-1';
groupShow = '1'
pathTitle = ['การประเมินจัดการประสิทธิภาพ', 'การจัดการประเมิน', 'จัดกลุ่มการประเมิน']
activeTab: string = 'underline-1'
}
<div class="flex items-center py-4 border-b-2 border-collapse ">
<button type="button" class="ti-btn ti-btn-outline ti-btn-outline-light h-20px m-0 shadow-md text-blue-500"
(click)="onBack()">
<i class="ri-arrow-left-s-line"></i> ย้อนกลับ
</button>
<div class="text-2xl font-bold py-2 text-primary px-4 ">
แก้ไขกลุ่มการประเมิน
<div class="w-full min-height-50px mb-10px justify-between items-center border-b-2 border-collapse">
<div class="flex justify-between">
<div class="flex">
<button type="button" class="ti-btn ti-btn-outline ti-btn-outline-light h-20px m-0 shadow-md text-blue-500"
(click)="onBack()">
<i class="ti ti-chevron-left"></i>
ย้อนกลับ
</button>
<div class="font-size-18px font-weight-700 align-center font-bold py-2 text-primary px-4">
แก้ไขกลุ่มการประเมิน
</div>
</div>
</div>
</div>
<div class="py-2 border-b-2 border-collapse ">
......@@ -14,10 +19,9 @@
</div>
</div>
<div class="grid">
<input type="text" id="input-label"
class="py-2 px-3 ltr:pr-11 rtl:pl-11 ti-form-input w-full rounded-md ltr:rounded-r-md rtl:rounded-l-md focus:z-10 bg-input-readonly"
readonly value="พนักงานระดับ 01-02">
<input type="text" id="input-label"
class="py-2 px-3 ltr:pr-11 rtl:pl-11 ti-form-input w-full rounded-md ltr:rounded-r-md rtl:rounded-l-md focus:z-10 w-1/2 bg-input-readonly"
readonly [(ngModel)]="pl.tdesc">
</div>
</div>
......@@ -33,11 +37,11 @@
</div>
<div class="flex items-center">
<i (click)="toggleCheckbox()"
<!-- <i (click)="toggleCheckbox()"
[ngClass]="{'ri-checkbox-multiple-line': !isChecked, 'ri-checkbox-multiple-fill': isChecked}"
class="ri-checkbox-multiple-line text-gray-500 dark:text-white/70"></i>
<label for="hs-checkbox-group-2" class="text-sm text-gray-500 ltr:ml-2 rtl:mr-2 dark:text-white/70"
(click)="toggleCheckbox()">Select All</label>
(click)="toggleCheckbox()">Select All</label> -->
</div>
</div>
</div>
......@@ -94,12 +98,12 @@
<thead>
<tr>
<ng-container
*ngFor="let item of ['รหัส','ชื่อหัวข้อ','ประเภท','น้ำหนัก','Action']; let f = first; let l = last; let i = index">
*ngFor="let item of ['รหัส','ชื่อหัวข้อ','ประเภท','น้ำหนัก','Action']; let f = first; let l = last; let i = index">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary"
[class.!text-center]="f||l">
<span class="text-sm">{{ item }}</span>
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l&&!f">
<svg class="head-table-icon" xmlns="http://www.w3.org/2000/svg" width="50"
<svg class="head-table-icon" xmlns="http://www.w3.org/2000/svg" width="50"
height="16" fill="currentColor" viewBox="0 0 16 16">
<path
d="M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z">
......@@ -111,7 +115,8 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let item of[
<tr
*ngFor="let item of[
['HS-01', 'C1 CUSTOMER ORIENTED (SQCOME)','HOSHIN','5.0'],
['HS-02', 'C2 MANUFACTURING OPTIMIZATION','HOSHIN','3.0'],
['HS-03', 'C3 INCREASE EMPLOYEE ENGAGEMENT','HOSHIN','3.0'],
......@@ -119,7 +124,8 @@
['HS-05', 'C5 RISK MANAGEMENT (TAXATION)','HOSHIN','1.0'],
['KP-01', 'ประสาทงานกับวิทยากร ผู้เข้ารับการอบรมทั้งภายในเเละภายนอกตามเเผนการฝึกอบรมพัฒนา','KPI','10.0']];let i = index">
<td style="font-size: 12px; width: 10%;" class="text-center">
<input style="margin-right: 20px;" type="checkbox" class="ti-form-checkbox cursor-pointer ">
<input style="margin-right: 20px;" type="checkbox"
class="ti-form-checkbox cursor-pointer ">
<label>{{item[0]}}</label>
</td>
<td style="font-size: 12px; width: 35%; word-break: break-word; white-space: normal;">
......@@ -243,21 +249,23 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let item of[
<tr
*ngFor="let item of[
['HS-01', 'C1 CUSTOMER ORIENTED (SQCOME)','HOSHIN','5.0'],
['HS-02', 'C2 MANUFACTURING OPTIMIZATION','HOSHIN','3.0'],
['HS-03', 'C3 INCREASE EMPLOYEE ENGAGEMENT','HOSHIN','3.0'],
['HS-04', 'C4 HEALTHY FINANCIAL','HOSHIN','3.0'],
['HS-05', 'C5 RISK MANAGEMENT (TAXATION)','HOSHIN','1.0'],
['KP-01', 'ประสาทงานกับวิทยากร ผู้เข้ารับการอบรมทั้งภายในเเละภายนอกตามเเผนการฝึกอบรมพัฒนา','KPI','10.0']];let i = index">
<td style="font-size: 12px; width: 10%;" class="text-center">
{{item[0]}}
</td>
<td style="font-size: 12px; width: 35%; word-break: break-word; white-space: normal;">
{{item[1]}}
</td>
<td style="font-size: 12px; width: 20%;">{{item[2]}}</td>
<td class="text-center" style="font-size: 12px; width: 15%;">{{item[3]}}</td>
<td style="font-size: 12px; width: 10%;" class="text-center">
{{item[0]}}
</td>
<td
style="font-size: 12px; width: 35%; word-break: break-word; white-space: normal;">
{{item[1]}}
</td>
<td style="font-size: 12px; width: 20%;">{{item[2]}}</td>
<td class="text-center" style="font-size: 12px; width: 15%;">{{item[3]}}</td>
<td class="flex justify-center">
<div class="px-1">
<button type="button"
......@@ -338,10 +346,10 @@
data-hs-overlay="#edit-evaluation-grouping-modal-add">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
<!-- <a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#edit-evaluation-grouping-alert-add-modal" (click)="addUser();showSuccess()">
บันทึกข้อมูล
</a>
</a> -->
</div>
</div>
</div>
......@@ -374,11 +382,11 @@
data-hs-overlay="#edit-evaluation-grouping-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="#edit-evaluation-grouping-alert-edit-modal"
(click)="addUser();showSuccessEdit()">
บันทึกข้อมูล
</a>
</a> -->
</div>
</div>
</div>
......@@ -410,11 +418,11 @@
data-hs-overlay="#edit-evaluation-grouping-alert-delete-modal">
ย้อนกลับ
</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="#edit-evaluation-grouping-alert-delete-modal"
(click)="addUser();showSuccessDelete()">
ลบข้อมูล
</a>
</a> -->
</div>
</div>
</div>
......
.button-clear {
position: absolute;
top: 96px;
z-index: 1;
right: 41vw;
}
.button-help {
position: absolute;
top: 0px;
z-index: 1;
right: 0vw;
margin: 4.2rem;
margin-right: 10px; /* เพิ่มใหม่ 12/16*/
}
table.ti-custom-table th {
height: 60px;
}
table.ti-custom-table thead {
height: 50px;
}
table.ti-custom-table thead th span {
font-size: 12px;
font-weight: bold;
}
a.custom-link {
padding: 10px 40px; /* ปรับ padding ให้เพิ่มขนาด */
}
/* สไตล์ของแถบเมนู */
.nav-tabs {
display: flex;
width: 100%;
cursor: pointer;
margin-bottom: 10px;
height: 20%;
}
.nav-item {
list-style: none;
margin-right: 10px; /* ช่องว่างระหว่างเมนู */
}
.nav-link {
text-decoration: none;
padding: 10px 20px;
display: inline-block;
font-size: large;
border-width: 2px 2px 0px 2px;
border-style: solid;
border-color: #ccc;
border-radius: 5px 5px 0px 0px;
}
.nav-link:hover {
background-color: #f0f0f0; /* เปลี่ยนสีเมื่อ hover */
}
.nav-link.active {
color: #ffffff; /* สีตัวอักษรในสถานะ active */
font-size: large;
border-bottom: 3.5px solid rgb(var(--color-primary)); /* เส้นใต้ */
background-color: rgb(var(--color-primary));
border-width: 2px 2px 0px 2px;
border-style: solid;
border-color: rgb(var(--color-primary));
border-radius: 5px 5px 0px 0px;
}
.tab-content {
margin-top: 20px;
}
.tab-pane.active {
display: block;
}
.nav-item-text {
list-style: none;
margin-right: 10px; /* ช่องว่างระหว่างเมนู */
}
.nav-link-text {
text-decoration: none;
display: inline-block;
font-size: large;
color: #569bf5;
border-bottom: 2px solid #569bf5;
line-height: 0.8;
}
.ti-pagination .page-link.active {
background-color: #569bf5;
color: white;
border-radius: 50%;
padding: 8px 12px;
}
.box-body{
padding: 0rem;
}
.page{
min-height: 0vh;
}
.ti-modal {
overflow: hidden;
}
.header-title-type {
width: 100%;
min-height: 50px; /* ใช้ min-height เพื่อให้มีความยืดหยุ่น */
// margin-top: 50px;
// margin-bottom: 16px;
justify-content: space-between; /* จัดเรียงองค์ประกอบภายใน */
align-items: center; /* จัดกลางแนวตั้ง */
padding-top: 50px;
padding-bottom: 1rem;
}
.bg-input-readonly{
background-color: rgb(241 245 249);
}
\ No newline at end of file
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { MyPLModel, PLModel } from 'src/app/shared/model/pl.model';
import { MyPmsGroupAssessment1Model, PmsGroupAssessment1Model } from 'src/app/shared/model/pms-group-assessment1.model';
import { PmsGroupAssessmentService } from 'src/app/shared/services/pms-group-assessment.service';
@Component({
selector: 'app-edit-evaluation-grouping',
templateUrl: './edit-evaluation-grouping.component.html',
styleUrls: ['./edit-evaluation-grouping.component.scss']
})
export class EditEvaluationGroupingComponent {
@Input() pathTitle = ['การประเมินจัดการประสิทธิภาพ', 'การจัดการประเมิน', 'จัดกลุ่มประเมิน'];
@Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>();
@Output() sendGroupShow: EventEmitter<string> = new EventEmitter<string>();
activeTab: string = 'tab1'; // กำหนด tab เริ่มต้น
@Output() sendOnEdit: EventEmitter<boolean> = new EventEmitter<boolean>();
@Input() pl: PLModel = new MyPLModel()
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
search = ""
currentModal: 'add' | 'edit' | 'delete' | 'deleteGroup' = "add"
// ฟังก์ชันในการเปลี่ยนแท็บ
changeTab(tab: { id: string, text: string }) {
this.sendPathTitle.emit(['การประเมินจัดการประสิทธิภาพ', 'การจัดการประเมิน', tab.text]);
this.activeTab = tab.id;
}
onBack() {
this.sendGroupShow.emit('1'); // เปลี่ยนกลับไปหน้า 1
}
// การจัดการการเปิดปิด modal
modalOptions: {
[nameModal: string]: {
isModalOpen: boolean;
modalSize: string;
backdropClose: boolean;
};
} = {
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
};
pmsGroupAssessment: { loading: boolean, select: PmsGroupAssessment1Model, dataList: { check: boolean, data: PmsGroupAssessment1Model }[] } = { loading: false, select: new MyPmsGroupAssessment1Model(), dataList: [] }
openModal(name: string, size: string, closeOnBackdrop?: boolean) {
this.modalOptions[name].modalSize = size;
this.modalOptions[name].backdropClose = closeOnBackdrop || false;
this.modalOptions[name].isModalOpen = true;
this.currentModal = name; // ตั้งค่าค่าของ currentModal เป็น 'add' หรือ 'edit'
document.body.style.overflow = 'hidden';
numDataListChecked = 0
isDataListChecked = false
isDataListCheckedAll = false
constructor(private toastr: ToastrService,
private pmsGroupAssessmentService: PmsGroupAssessmentService,
private cdr: ChangeDetectorRef
) { }
ngOnInit(): void {
this.getPmsGroupAssessmentBy_plId()
}
closeModal(name: string) {
this.modalOptions[name].isModalOpen = false;
if (!this.isAnyModalOpen()) {
document.body.style.overflow = ''; // คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
}
getPmsGroupAssessmentBy_plId() {
this.pmsGroupAssessment.loading = true
this.pmsGroupAssessmentService.getBy_plId(this.pl.plId).subscribe({
next: response => {
this.pmsGroupAssessment.dataList = response.pmsGroupAssessment1List.map(x => ({ check: false, data: new MyPmsGroupAssessment1Model(x) }))
this.pmsGroupAssessment.loading = false
this.isDataListCheckedAll = false
this.dataListCheckAll()
this.searchChange();
this.cdr.detectChanges();
}, error: error => {
this.pmsGroupAssessment.loading = false
this.cdr.detectChanges()
}
});
}
isAnyModalOpen(): boolean {
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // ตรวจสอบว่า modal อื่นยังเปิดอยู่หรือไม่
pmsGroupAssessmentListFilter() {
return this.pmsGroupAssessment.dataList.filter(x => {
const data = x.data
const match = data.pmsTopic.pmsTopicId.toLowerCase().includes(this.search.toLowerCase()) || data.pmsTopic.tdesc.toLowerCase().includes(this.search.toLowerCase())
return match;
});
}
// ฟังก์ชัน toggle checkbox
isChecked: boolean = false; // ใช้สำหรับตรวจสอบสถานะของ checkbox
toggleCheckbox() {
this.isChecked = !this.isChecked; // สลับสถานะ
selectPmsGroupAssessment(data: PmsGroupAssessment1Model) {
this.pmsGroupAssessment.select = new MyPmsGroupAssessment1Model(data)
}
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล
addUser() {
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.pmsGroupAssessmentListFilter().length / 10) }, (_, i) => i + 1)
this.dataListCheck();
this.cdr.detectChanges()
}
currentModal = "";
constructor(private toastr: ToastrService) { }
showSuccess() {
this.toastr.success('บันทึกข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
dataListCheckAll() {
const selectAll = this.isDataListCheckedAll;
this.pmsGroupAssessmentListFilter().forEach(x => x.check = selectAll);
this.dataListCheck();
}
showSuccessEdit() {
this.toastr.success('เเก้ไขข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
dataListCheck() {
const dataCheck = this.pmsGroupAssessmentListFilter();
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every(x => x.check) : false;
this.numDataListChecked = this.pmsGroupAssessment.dataList.filter(x => x.check).length
this.isDataListChecked = Boolean(this.numDataListChecked)
}
showSuccessDelete() {
this.toastr.success('ลบข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
onBack() {
this.sendOnEdit.emit(false);
}
}
<div class="header-title-type">
<div class="flex justify-end">
<div class="px-1">
<div class="relative shadow-md">
<input type="text" id="hs-leading-icon" name="hs-leading-icon"
class="ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 " placeholder="Search by No. or Name" style="height: 40px;">
<div
class="absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4">
<i class="ri-search-line text-gray"></i>
</div>
</div>
</div>
<div class="px-1">
<button type="button" class="ti-btn ti-btn bg-pink-500/10 text-pink-500 hover:text-white hover:bg-pink-500 ring-offset-white focus:ring-pink-500 dark:focus:ring-offset-white/10 h-10 m-0 shadow-md"
data-hs-overlay="#edit-group-indicators-modal-add">
<i class="ti ti-file-plus"></i>
import
</button>
</div>
<div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-warning h-10 m-0 shadow-md">
<i class="ti ti-book fs-l"></i>
Help
</button>
</div>
</div>
</div>
<div class="page px-rem">
<div class="overflow-auto table-bordered rounded-t-md">
<div id="card-type-1" role="tabpanel" aria-labelledby="card-type-item-1" >
<div class="overflow-auto shadow-md">
<table class="ti-custom-table ti-custom-table-head ti-custom-table-hover" >
<thead>
<tr>
<ng-container
*ngFor="let item of ['รหัส','ชื่อเครื่องมือประเมิน','Action']; let f = first; let l = last; let i = index">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary"
[class.!text-center]="f||l">
<span class="text-sm">{{ item }}</span>
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l&&!f">
<svg class="head-table-icon" xmlns="http://www.w3.org/2000/svg" width="50"
height="16" fill="currentColor" viewBox="0 0 16 16">
<path
d="M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z">
</path>
</svg>
</div>
</th>
</ng-container>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of[
['0102', 'พนักงานระดับ 01-02'],
['0304', 'พนักงานระดับ 03-04'],
['S1S2', 'พนักงานระดับ S1-S2'],
['S3S4', 'พนักงานระดับ S3-S4'],
['M1M2', 'พนักงานระดับ M1-M2'],
['M3M4', 'พนักงานระดับ M3-M4'],
['E1E2', 'พนักงานระดับ E1-E2'],
['E3E4', 'พนักงานระดับ E3-E4']];let i = index">
<td style="font-size: 12px; padding-left: 4rem;">{{item[0]}}</td>
<td style="font-size: 12px; padding-left: 1.5rem; width: 600px;">{{item[1]}}</td>
<td class="flex justify-center">
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1" (click)="onEdit()"></i>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="body-content" style="margin-top: 20px;">
<ul class="nav-tabs">
<div class="px-1 py-1 bg-white rounded-2 shadow justify-content-center align-items-center">
<div class="box-body">
<nav class="pagination-style-3 overflow-auto">
<ul class="ti-pagination">
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);">
<i class="ri-arrow-left-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
<li><a class="page-link active" href="javascript:void(0);" aria-current="page">1</a></li>
<li><a class="page-link" href="javascript:void(0);">2</a></li>
<li><a class="page-link" href="javascript:void(0);">3</a></li>
<li><a class="page-link" href="javascript:void(0);">4</a></li>
<li><a class="page-link" href="javascript:void(0);">5</a></li>
<li><a class="page-link" href="javascript:void(0);">...</a></li>
<li><a class="page-link" href="javascript:void(0);">31</a></li>
<li>
<a aria-label="anchor" class="page-link" href="javascript:void(0);">
<i class="ri-arrow-right-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
</ul>
</nav>
</div>
</div>
</ul>
<ul class="nav-tabs">
<p>Show 1 to 10 of 50 items</p>
</ul>
</div>
</div>
<div id="evaluation-grouping-component-modal-add" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)]">
<div class="max-h-full overflow-hidden ti-modal-content">
<div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary">
เพิ่มเครื่องมือประเมิน
</h3>
<ng-container *ngIf="!onEdit">
<div class="header-title-type">
<div class="w-full min-height-50px mb-10px justify-between items-center">
<div class="flex justify-end">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#evaluation-grouping-component-modal-add">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
</div>
</div>
<div class="ti-modal-center">
<div class="flex justify-end" style="padding-right: 1rem;">
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md">
<svg class="svg-indigo" width="16" height="16" viewBox="0 0 64.00 64.00"
xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#595BEA" stroke-width="3.84"
transform="rotate(45)matrix(-1, 0, 0, 1, 0, 0)">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
<g id="SVGRepo_iconCarrier">
<path d="M15 49A24 24 0 0 1 32 8"></path>
<path d="M49 15a24 24 0 0 1-17 41"></path>
<polyline points="15.03 40 15.03 48.97 8 48.97"></polyline>
<polyline points="48.97 24 48.97 15.03 56 15.03"></polyline>
</g>
</svg>
Clear
</button>
<div class="relative shadow-md">
<input type="text" id="hs-leading-icon" name="hs-leading-icon"
class="ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 " placeholder="Search by No. or Name"
[(ngModel)]="search" (ngModelChange)="searchChange()">
<div
class="absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4">
<i class="ri-search-line text-gray"></i>
</div>
</div>
</div>
<div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-warning h-45px m-0 shadow-md">
<i class="ti ti-book fs-l"></i>
Help
</button>
</div>
</div>
</div>
<div class="ti-modal-body" style="padding-top: 0px;">
<label for="input-label" class="ti-form-label mt-1rem">รหัส *</label>
<input type="text" id="input-label" class="ti-form-input w-1/2">
<label for="detail_th" class="ti-form-label mt-1rem">ชื่อเครื่องมือประเมิน (ไทย)*</label>
<input type="text" id="detail_th" class="ti-form-input w-full">
<label for="detail_eng" class="ti-form-label mt-1rem">ชื่อเครื่องมือประเมิน (อังกฤษ)</label>
<input type="text" id="detail_eng" class="ti-form-input w-full">
<label for="detail_eng" class="ti-form-label mt-1rem">ชื่อที่ใช้เเสดง *</label>
<input type="text" id="showname" class="ti-form-input w-full">
<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="#evaluation-grouping-component-modal-add">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#evaluation-grouping-component-alert-modal">
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div id="evaluation-grouping-component-modal-edit" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)]">
<div class="max-h-full overflow-hidden ti-modal-content">
<div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary">
เเก้ไขเครื่องมือประเมิน
</h3>
<div class="flex justify-end">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#evaluation-grouping-component-modal-edit">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
</div>
</div>
<div class="ti-modal-center">
<div class="flex justify-end" style="padding-right: 1rem;">
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md">
<svg class="svg-indigo" width="16" height="16" viewBox="0 0 64.00 64.00"
xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#595BEA" stroke-width="3.84"
transform="rotate(45)matrix(-1, 0, 0, 1, 0, 0)">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
<g id="SVGRepo_iconCarrier">
<path d="M15 49A24 24 0 0 1 32 8"></path>
<path d="M49 15a24 24 0 0 1-17 41"></path>
<polyline points="15.03 40 15.03 48.97 8 48.97"></polyline>
<polyline points="48.97 24 48.97 15.03 56 15.03"></polyline>
</g>
</svg>
Clear
<button type="button"
class="ti-btn ti-btn bg-pink-500/10 text-pink-500 hover:text-white hover:bg-pink-500 ring-offset-white focus:ring-pink-500 dark:focus:ring-offset-white/10 h-45px m-0 shadow-md"
data-hs-overlay="#evaluation-grouping-upload-modal"
(click)="fileInput.value = '';selectedFile=null;selectedFileName = 'กรุณาเลือกไฟล์'">
<i class="ti ti-file-plus"></i>
import
</button>
</div>
<div class="px-1">
......@@ -216,65 +30,121 @@
</div>
</div>
</div>
<div class="ti-modal-body" style="padding-top: 0px;">
<label for="input-label" class="ti-form-label mt-1rem">รหัส *</label>
<input type="text" id="input-label" class="ti-form-input w-1/2 bg-input-readonly" readonly value="01">
<label for="detail_th" class="ti-form-label mt-1rem">ชื่อเครื่องมือประเมิน (ไทย)*</label>
<input type="text" id="detail_th" class="ti-form-input w-full" value="แบบสังเกต">
<label for="detail_eng" class="ti-form-label mt-1rem">ชื่อเครื่องมือประเมิน (อังกฤษ)</label>
<input type="text" id="detail_eng" class="ti-form-input w-full" value="แบบสังเกต">
<label for="detail_eng" class="ti-form-label mt-1rem">ชื่อที่ใช้เเสดง *</label>
<input type="text" id="showname" class="ti-form-input w-full" value="O">
<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="#evaluation-grouping-component-modal-edit">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#evaluation-grouping-component-alert-edit-modal">
บันทึกข้อมูล
</a>
</div>
<div class="page px-rem">
<div class="overflow-auto table-bordered rounded-t-md">
<div class="overflow-auto shadow-md">
<table class="ti-custom-table ti-custom-table-head ti-custom-table-hover">
<thead>
<tr>
<ng-container
*ngFor="let item of ['รหัส','ชื่อเครื่องมือประเมิน','Action']; let f = first; let l = last; let i = index">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary"
[class.!text-center]="f||l">
<span class="text-sm">{{ item }}</span>
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l&&!f">
<svg class="head-table-icon" xmlns="http://www.w3.org/2000/svg" width="50"
height="16" fill="currentColor" viewBox="0 0 16 16">
<path
d="M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z">
</path>
</svg>
</div>
</th>
</ng-container>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of pl.dataList;let i = index">
<td style="font-size: 12px; padding-left: 4rem;">{{item.data.plId}}</td>
<td style="font-size: 12px; padding-left: 1.5rem; width: 600px;">{{item.data.tdesc}}
</td>
<td class="flex justify-center">
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1"
(click)="selectPl(item.data);onEdit=true;onSendPathTitle()"></i>
</td>
</tr>
</tbody>
</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 !pl-0" 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;let f = first;let l = last">
<ng-container *ngIf="item==3&&currentPage!=1&&currentPage!=2&&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==currentPage-1||item==currentPage||item==currentPage+1)">
<a class="page-link" href="javascript:void(0);" [class.active]="item==currentPage"
(click)="currentPage=item">{{item}}
</a>
</ng-container>
<ng-container
*ngIf="item==page.length-2&&currentPage!=page.length&&currentPage!=page.length-1&&currentPage!=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)="currentPage = (currentPage > page.length-1 ? currentPage: currentPage+1 )">
<i class="ri-arrow-right-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
</ul>
<ul class="nav-tabs mt-3">
<span>Show {{((currentPage-1) * 10)+1}} to {{plListFilter().length<10 ?plListFilter().length:
(currentPage==page.length ? ((currentPage * 10) - ((currentPage * 10) - plListFilter().length) )
:(currentPage * 10) ) }} of {{plListFilter().length}} items</span>
</ul>
</nav>
</div>
</div>
</div>
<div id="evaluation-grouping-component-alert-delete-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-alert 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="#evaluation-grouping-component-alert-delete-modal">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
<div id="evaluation-grouping-upload-modal" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white">
นำเข้ากลุ่มการประเมิน
</h5>
</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="#evaluation-grouping-component-alert-delete-modal">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#evaluation-grouping-component-alert-delete-modal" (click)="addUser();showSuccessDelete()">
ลบข้อมูล
</a>
<div class="ti-modal-body max-h-full overflow-hidden ti-modal-content !rounded-t-none !rounded-b-sm">
<h1 class="mt-2" style="text-align: center;">ไฟล์</h1>
<div class="mt-2 p-2">
<div class="flex rounded-md">
<input #fileInput id="fileInput" type="file" (change)="onFileSelected($event)" hidden>
<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">
<button type="button" (click)="fileInput.click()"
class="inline-flex flex-shrink-0 justify-center items-center h-[2.875rem] w-[2.875rem] ltr:rounded-r-md rtl:rounded-l-md border border-transparent font-semibold bg-secondary text-white hover:bg-secondary focus:z-10 focus:outline-none focus:ring-0 focus:ring-secondary transition-all text-sm">
<i class="ti ti-upload"></i>
</button>
</div>
<div class="flex justify-center mt-2rem ">
<h1 class="cursor-pointer 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"
(click)="downloadFile()">
ดาวน์โหลดตัวอย่างไฟล์</h1>
</div>
<div class="flex justify-center mt-2rem mb-1rem space-x-4">
<button type="submit" class="ti-btn ti-btn-secondary"
data-hs-overlay="#evaluation-grouping-upload-modal" [class.ti-btn-disabled]="!selectedFile"
(click)="uploadFile()" [disabled]="!selectedFile" [disabled]="!selectedFile">
อัปโหลด
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
</ng-container>
<ng-container *ngIf="onEdit">
<app-edit-evaluation-grouping [pl]="pl.select"
(sendOnEdit)="onEdit=$event;onSendPathTitle()"></app-edit-evaluation-grouping>
</ng-container>
\ No newline at end of file
.button-clear {
position: absolute;
top: 96px;
z-index: 1;
right: 41vw;
}
.button-help {
position: absolute;
top: 0px;
z-index: 1;
right: 0vw;
margin: 4.2rem;
margin-right: 10px; /* เพิ่มใหม่ 12/16*/
}
table.ti-custom-table thead {
height: 60px;
}
table.ti-custom-table thead th span {
font-size: 12px;
font-weight: bold;
}
.ti-custom-table td{
padding-left: 0.9rem;
padding-right: 1rem;
}
.ti-custom-table thead th:first-child {
width: 105px; /* ปรับความกว้างตามที่ต้องการ */
text-align: left; /* จัดตำแหน่งข้อความถ้าต้องการ */
}
.ti-custom-table thead th:last-child {
width: 150px; /* ปรับความกว้างตามที่ต้องการ */
}
a.custom-link {
padding: 10px 40px; /* ปรับ padding ให้เพิ่มขนาด */
}
/* สไตล์ของแถบเมนู */
.nav-tabs {
display: flex;
width: 100%;
cursor: pointer;
margin-bottom: 10px;
height: 20%;
}
.nav-item {
list-style: none;
margin-right: 10px; /* ช่องว่างระหว่างเมนู */
}
.nav-link {
text-decoration: none;
padding: 10px 20px;
display: inline-block;
font-size: large;
border-width: 2px 2px 0px 2px;
border-style: solid;
border-color: #ccc;
border-radius: 5px 5px 0px 0px;
}
.nav-link:hover {
background-color: #f0f0f0; /* เปลี่ยนสีเมื่อ hover */
}
.nav-link.active {
color: #ffffff; /* สีตัวอักษรในสถานะ active */
font-size: large;
border-bottom: 3.5px solid rgb(var(--color-primary)); /* เส้นใต้ */
background-color: rgb(var(--color-primary));
border-width: 2px 2px 0px 2px;
border-style: solid;
border-color: rgb(var(--color-primary));
border-radius: 5px 5px 0px 0px;
}
.tab-content {
margin-top: 20px;
}
.tab-pane.active {
display: block;
}
.nav-item-text {
list-style: none;
margin-right: 10px; /* ช่องว่างระหว่างเมนู */
}
.nav-link-text {
text-decoration: none;
display: inline-block;
font-size: large;
color: #569bf5;
border-bottom: 2px solid #569bf5;
line-height: 0.8;
}
.ti-pagination .page-link.active {
background-color: #569bf5;
color: white;
border-radius: 50%;
padding: 8px 12px;
}
.box-body{
padding: 0rem;
}
.page{
min-height: 0vh;
}
.ti-modal-content-alert{
width: 35%; /* ความกว้างที่คุณต้องการ */
position: absolute; /* ทำให้สามารถจัดตำแหน่งได้ */
top: 50%; /* ให้อยู่กลางในแนวตั้ง */
left: 50%; /* ให้อยู่กลางในแนวนอน */
transform: translate(-50%, -50%); /* เคลื่อนที่ modal กลับมาให้ตรงกลาง */
background-color: #ffffff;
}
.header-title-type {
width: 100%;
min-height: 50px; /* ใช้ min-height เพื่อให้มีความยืดหยุ่น */
// margin-top: 50px;
// margin-bottom: 10px;
justify-content: space-between; /* จัดเรียงองค์ประกอบภายใน */
align-items: center; /* จัดกลางแนวตั้ง */
padding-top: 50px;
padding-bottom: 1rem;
}
\ No newline at end of file
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { PLModel, MyPLModel } from 'src/app/shared/model/pl.model';
import { FileService } from 'src/app/shared/services/file.service';
import { PLService } from 'src/app/shared/services/pl.service';
@Component({
selector: 'app-evaluation-grouping',
templateUrl: './evaluation-grouping.component.html',
styleUrls: ['./evaluation-grouping.component.scss']
selector: 'app-evaluation-grouping',
templateUrl: './evaluation-grouping.component.html',
styleUrls: ['./evaluation-grouping.component.scss']
})
export class EvaluationGroupingComponent {
@Input() pathTitle = ['การประเมินจัดการประสิทธิภาพ', 'การจัดการประเมิน', 'จัดกลุ่มประเมิน'];
@Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>();
@Output() sendGroupShow: EventEmitter<string> = new EventEmitter<string>();
activeTab: string = 'tab1'; // กำหนด tab เริ่มต้น
isChecked: boolean = false;
onEdit = false
// ฟังก์ชันในการเปลี่ยนแท็บ
changeTab(tab: { id: string, text: string }) {
this.sendPathTitle.emit(['การประเมินจัดการประสิทธิภาพ', 'การจัดการประเมิน', tab.text]);
this.activeTab = tab.id;
}
onEdit(){
this.sendGroupShow.emit('2');
}
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
search = ""
currentModal: 'add' | 'edit' | 'delete' | 'deleteGroup' = "add"
toggleCheckbox(): void {
this.isChecked = !this.isChecked;
}
selectedFile: File | null = null;
selectedFileName: string = 'กรุณาเลือกไฟล์';
// การจัดการการเปิดปิด modal
modalOptions: {
[nameModal: string]: {
isModalOpen: boolean;
modalSize: string;
backdropClose: boolean;
};
} = {
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
};
numDataListChecked = 0
isDataListChecked = false
isDataListCheckedAll = false
openModal(name: string, size: string, closeOnBackdrop?: boolean) {
this.modalOptions[name].modalSize = size;
this.modalOptions[name].backdropClose = closeOnBackdrop || false;
this.modalOptions[name].isModalOpen = true;
this.currentModal = name; // ตั้งค่าค่าของ currentModal เป็น 'add' หรือ 'edit'
document.body.style.overflow = 'hidden';
pl: { loading: boolean, select: PLModel, dataList: { check: boolean, data: PLModel }[] } = { loading: false, select: new MyPLModel(), dataList: [] }
constructor(private toastr: ToastrService, private plService: PLService, private cdr: ChangeDetectorRef, private fileService: FileService) { }
ngOnInit(): void {
this.onSendPathTitle()
this.getPLList()
}
onFileSelected(event: any) {
this.selectedFile = event.target.files.length > 0 ? event.target.files[0] : null;
this.selectedFileName = this.selectedFile?.name || "กรุณาเลือกไฟล์"
}
closeModal(name: string) {
this.modalOptions[name].isModalOpen = false;
if (!this.isAnyModalOpen()) {
document.body.style.overflow = ''; // คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
uploadFile() {
if (!this.selectedFile) {
alert('กรุณาเลือกไฟล์ก่อนอัปโหลด')
return
}
const formData = new FormData();
formData.append('file', this.selectedFile);
this.pl.loading = true
this.fileService.uploadExcel(formData, '').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.pl.loading = false
} else {
this.showAlert(response.message, 'error')
this.pl.loading = false
this.cdr.detectChanges()
}
}, error: error => {
this.showAlert(error.message, 'error')
this.pl.loading = false
this.cdr.detectChanges()
}
})
}
downloadFile() {
const fileName = '.xlsx'
this.fileService.downloadTemplate(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
a.href = url;
a.download = fileName;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
}, error: error => {
this.showAlert(error.message, 'error')
}
})
isAnyModalOpen(): boolean {
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // ตรวจสอบว่า modal อื่นยังเปิดอยู่หรือไม่
}
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล
addUser() {
// ฟังก์ชันสำหรับการเพิ่มผู้ใช้งาน
console.log('เพิ่มผู้ใช้งาน');
getPLList() {
this.pl.loading = true
this.plService.getList().subscribe({
next: response => {
this.pl.dataList = response.map(x => ({ check: false, data: new MyPLModel(x) }))
this.pl.loading = false
this.isDataListCheckedAll = false
this.dataListCheckAll()
this.searchChange();
this.cdr.detectChanges();
}, error: error => {
this.pl.loading = false
console.error('Error fetching employee types:', error);
this.cdr.detectChanges()
}
});
}
deleteUser() {
// ฟังก์ชันสำหรับการลบผู้ใช้งาน
console.log('ลบผู้ใช้งาน');
plListFilter() {
return this.pl.dataList.filter(x => {
const data = x.data
const match = data.plId.toLowerCase().includes(this.search.toLowerCase()) || data.tdesc.toLowerCase().includes(this.search.toLowerCase()) || data.edesc.toLowerCase().includes(this.search.toLowerCase());
return match;
});
}
editUser() {
// ฟังก์ชันสำหรับการแก้ไขผู้ใช้งาน
console.log('แก้ไขผู้ใช้งาน');
selectPl(data: PLModel) {
this.pl.select = new MyPLModel(data)
}
currentModal = ""
constructor(private toastr: ToastrService) { }
showSuccess() {
this.toastr.success('บันทึกข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.plListFilter().length / 10) }, (_, i) => i + 1)
this.dataListCheck();
this.cdr.detectChanges()
}
showSuccessEdit() {
this.toastr.success('เเก้ไขข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
dataListCheckAll() {
const selectAll = this.isDataListCheckedAll;
this.plListFilter().forEach(x => x.check = selectAll);
this.dataListCheck();
}
dataListCheck() {
const dataCheck = this.plListFilter();
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every(x => x.check) : false;
this.numDataListChecked = this.pl.dataList.filter(x => x.check).length
this.isDataListChecked = Boolean(this.numDataListChecked)
}
showSuccessDelete() {
this.toastr.success('ลบข้อมูลสำเร็จ', 'เเจ้งเตือน', {
onSendPathTitle() {
if (this.onEdit) {
this.sendPathTitle.emit(['การประเมินจัดการประสิทธิภาพ', 'การจัดการประเมิน', 'จัดกลุ่มประเมิน', 'แก้ไขกลุ่มการประเมิน']);
} else if (!this.onEdit) {
this.sendPathTitle.emit(['การประเมินจัดการประสิทธิภาพ', 'การจัดการประเมิน', 'จัดกลุ่มประเมิน']);
}
}
showAlert(text: string, type: 'success' | 'error') {
this.toastr[type](text, 'แจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
})
}
}
import { MyPLModel, PLModel } from "./pl.model"
import { MyPmsGroupAssessment1Model, PmsGroupAssessment1Model } from "./pms-group-assessment1.model"
export interface PmsGroupAssessmentModel {
personalLevel: PLModel
companyId: string
pmsGroupAssessment1List: PmsGroupAssessment1Model[]
}
export class MyPmsGroupAssessmentModel implements PmsGroupAssessmentModel {
personalLevel: PLModel
companyId: string
pmsGroupAssessment1List: PmsGroupAssessment1Model[]
constructor(data?: Partial<PmsGroupAssessmentModel>) {
this.personalLevel = new MyPLModel(data?.personalLevel)
this.companyId = data?.companyId || ""
this.pmsGroupAssessment1List = data?.pmsGroupAssessment1List?.map(x => new MyPmsGroupAssessment1Model(x)) || []
}
}
import { MyPmstopicModel, PmstopicModel } from "./pmstopic.model"
export interface PmsGroupAssessment1Model {
companyId: string
pmsTopic: PmstopicModel
}
export class MyPmsGroupAssessment1Model implements PmsGroupAssessment1Model {
companyId: string
pmsTopic: PmstopicModel
constructor(data?: Partial<PmsGroupAssessment1Model>) {
this.companyId = data?.companyId || ""
this.pmsTopic = new MyPmstopicModel(data?.pmsTopic)
}
}
......@@ -16,7 +16,7 @@ export class HttpRequestInterceptor {
private refreshTokenSubject: BehaviorSubject<string | null> = new BehaviorSubject<string | null>(null);
private responseCache = new Map<string, any>(); // ใช้เก็บ cache ของ response
constructor(private authService: AuthService) {}
constructor(private authService: AuthService) { }
// intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
// if (req.url.startsWith("./") || !sessionStorage.getItem("accessToken")) {
......@@ -36,7 +36,7 @@ export class HttpRequestInterceptor {
// }
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
if (req.url.includes('/api/authen/refresh-token') ||req.url.startsWith('./') || !sessionStorage.getItem('accessToken')) {
if (req.url.includes('/api/auth/refresh-token') || req.url.startsWith('./') || !sessionStorage.getItem('accessToken')) {
return next.handle(req);
}
const authHeader = 'Bearer ' + sessionStorage.getItem('accessToken');
......
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { PLModel } from '../model/pl.model';
import { AlertModel } from '../model/alert.model';
import { PmsGroupAssessmentModel } from '../model/pms-group-assessment.model';
@Injectable({
providedIn: 'root'
})
export class PmsGroupAssessmentService {
api = "/pms-group-assessment"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getBy_plId(plId: string): Observable<PmsGroupAssessmentModel> {
return this.http.get<PmsGroupAssessmentModel>(this.urlApi + "/" + plId)
}
getList(): Observable<PmsGroupAssessmentModel[]> {
return this.http.get<PmsGroupAssessmentModel[]>(this.urlApi + "/lists")
}
post(body: PmsGroupAssessmentModel): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: PmsGroupAssessmentModel | PmsGroupAssessmentModel[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete<AlertModel>(this.urlApi, options)
}
}
\ No newline at end of file
......@@ -24915,4 +24915,8 @@ div:where(.swal2-container) div:where(.swal2-validation-message) {
.rounded-t-none {
border-top-left-radius: 0rem;
border-top-right-radius: 0rem;
}
.masked-input {
-webkit-text-security: disc; /* Safari, Chrome */
}
\ No newline at end of file
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