Commit 50f9a958 by Nattana Chaiyamat

Merge branch 'DEV' of https://mygit.myhr.co.th/angular/myAppraisal into DEV

# Conflicts:
#	src/app/components/dashboard/dashboard.module.ts
parents 78c4a887 8c21dd62
......@@ -680,7 +680,7 @@
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] 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 class="ti-modal-body max-h-full overflow-hidden ti-modal-content !rounded-t-none !rounded-b-sm">
......
......@@ -116,9 +116,9 @@ export class DepartmentListComponent implements OnInit {
this.bu2Table.page = Array.from({ length: Math.ceil(this.filterBu2Table().length / 10) }, (_, i) => i + 1);
}
filterBu2Table() {
return this.bu2List.filter(x => x.bu2id.includes(this.bu2Table.search) ||
x.tdesc.includes(this.bu2Table.search) ||
x.edesc.includes(this.bu2Table.search))
return this.bu2List.filter(x => x.bu2id.toLowerCase().includes(this.bu2Table.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu2Table.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu2Table.search.toLowerCase()))
}
selectBu2(bu2?: Bu2Model) {
this.bu2 = new MyBu2Model(bu2 || {})
......@@ -139,9 +139,9 @@ export class DepartmentListComponent implements OnInit {
this.bu2Modal.page = Array.from({ length: Math.ceil(this.filterBu2Modal().length / 10) }, (_, i) => i + 1);
}
filterBu2Modal() {
return this.bu2List.filter(x => x.bu2id.includes(this.bu2Modal.search) ||
x.tdesc.includes(this.bu2Modal.search) ||
x.edesc.includes(this.bu2Modal.search))
return this.bu2List.filter(x => x.bu2id.toLowerCase().includes(this.bu2Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu2Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu2Modal.search.toLowerCase()))
}
......@@ -160,9 +160,9 @@ export class DepartmentListComponent implements OnInit {
this.selectBu1(bu1 || new MyBu1Model({ bu1id: this.bu1.bu1id }))
}
filterBu1Modal() {
return this.bu1List.filter(x => x.bu1id.includes(this.bu1Modal.search) ||
x.tdesc.includes(this.bu1Modal.search) ||
x.edesc.includes(this.bu1Modal.search))
return this.bu1List.filter(x => x.bu1id.toLowerCase().includes(this.bu1Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu1Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu1Modal.search.toLowerCase()))
}
selectBu1(bu1?: Bu1Model) {
this.bu1 = new MyBu1Model(bu1 || {})
......
......@@ -340,7 +340,7 @@
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] 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 class="ti-modal-body max-h-full overflow-hidden ti-modal-content !rounded-t-none !rounded-b-sm">
......
......@@ -681,7 +681,7 @@
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] 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 class="ti-modal-body max-h-full overflow-hidden ti-modal-content !rounded-t-none !rounded-b-sm">
......
......@@ -117,9 +117,9 @@ export class SectionRegistrationComponent implements OnInit {
this.bu3Table.page = Array.from({ length: Math.ceil(this.filterBu3Table().length / 10) }, (_, i) => i + 1);
}
filterBu3Table() {
return this.bu3List.filter(x => x.bu3id.includes(this.bu3Table.search) ||
x.tdesc.includes(this.bu3Table.search) ||
x.edesc.includes(this.bu3Table.search))
return this.bu3List.filter(x => x.bu3id.toLowerCase().includes(this.bu3Table.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu3Table.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu3Table.search.toLowerCase()))
}
selectBu3(bu3?: Bu3Model) {
this.bu3 = new MyBu3Model(bu3 || {})
......@@ -140,9 +140,9 @@ export class SectionRegistrationComponent implements OnInit {
this.bu3Modal.page = Array.from({ length: Math.ceil(this.filterBu3Modal().length / 10) }, (_, i) => i + 1);
}
filterBu3Modal() {
return this.bu3List.filter(x => x.bu3id.includes(this.bu3Modal.search) ||
x.tdesc.includes(this.bu3Modal.search) ||
x.edesc.includes(this.bu3Modal.search))
return this.bu3List.filter(x => x.bu3id.toLowerCase().includes(this.bu3Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu3Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu3Modal.search.toLowerCase()))
}
addBu3() {
this.bu3Service.post({ ...this.bu3, parent: this.bu2.bu2id }).subscribe({
......@@ -188,9 +188,9 @@ export class SectionRegistrationComponent implements OnInit {
this.selectBu2(bu2 || new MyBu2Model({ bu2id: this.bu2.bu2id }))
}
filterBu2Modal() {
return this.bu2List.filter(x => x.bu2id.includes(this.bu2Modal.search) ||
x.tdesc.includes(this.bu2Modal.search) ||
x.edesc.includes(this.bu2Modal.search))
return this.bu2List.filter(x => x.bu2id.toLowerCase().includes(this.bu2Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu2Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu2Modal.search.toLowerCase()))
}
selectBu2(bu2?: Bu2Model) {
this.bu2 = new MyBu2Model(bu2 || {})
......
......@@ -676,7 +676,7 @@
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white">
นำเข้าฝ่าย
นำเข้าทะเบียนส่วน 4
</h5>
</div>
<div class="ti-modal-body max-h-full overflow-hidden ti-modal-content !rounded-t-none !rounded-b-sm">
......
......@@ -117,9 +117,9 @@ export class SubDepartmentFourComponent implements OnInit {
this.bu7Table.page = Array.from({ length: Math.ceil(this.filterBu7Table().length / 10) }, (_, i) => i + 1);
}
filterBu7Table() {
return this.bu7List.filter(x => x.bu7id.includes(this.bu7Table.search) ||
x.tdesc.includes(this.bu7Table.search) ||
x.edesc.includes(this.bu7Table.search))
return this.bu7List.filter(x => x.bu7id.toLowerCase().includes(this.bu7Table.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu7Table.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu7Table.search.toLowerCase()))
}
selectBu7(bu7?: Bu7Model) {
this.bu7 = new MyBu7Model(bu7 || {})
......@@ -140,9 +140,9 @@ export class SubDepartmentFourComponent implements OnInit {
this.bu7Modal.page = Array.from({ length: Math.ceil(this.filterBu7Modal().length / 10) }, (_, i) => i + 1);
}
filterBu7Modal() {
return this.bu7List.filter(x => x.bu7id.includes(this.bu7Modal.search) ||
x.tdesc.includes(this.bu7Modal.search) ||
x.edesc.includes(this.bu7Modal.search))
return this.bu7List.filter(x => x.bu7id.toLowerCase().includes(this.bu7Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu7Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu7Modal.search.toLowerCase()))
}
addBu7() {
this.bu7Service.post({ ...this.bu7, parent: this.bu6.bu6id }).subscribe({
......@@ -188,9 +188,9 @@ export class SubDepartmentFourComponent implements OnInit {
this.selectBu6(bu6 || new MyBu6Model({ bu6id: this.bu6.bu6id }))
}
filterBu6Modal() {
return this.bu6List.filter(x => x.bu6id.includes(this.bu6Modal.search) ||
x.tdesc.includes(this.bu6Modal.search) ||
x.edesc.includes(this.bu6Modal.search))
return this.bu6List.filter(x => x.bu6id.toLowerCase().includes(this.bu6Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu6Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu6Modal.search.toLowerCase()))
}
selectBu6(bu6?: Bu6Model) {
this.bu6 = new MyBu6Model(bu6 || {})
......
......@@ -696,7 +696,7 @@
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white">
นำเข้าฝ่าย
นำเข้าทะเบียนส่วน 1
</h5>
</div>
<div class="ti-modal-body max-h-full overflow-hidden ti-modal-content !rounded-t-none !rounded-b-sm">
......
......@@ -116,9 +116,9 @@ export class SubDepartmentOneComponent implements OnInit {
this.bu4Table.page = Array.from({ length: Math.ceil(this.filterBu4Table().length / 10) }, (_, i) => i + 1);
}
filterBu4Table() {
return this.bu4List.filter(x => x.bu4id.includes(this.bu4Table.search) ||
x.tdesc.includes(this.bu4Table.search) ||
x.edesc.includes(this.bu4Table.search))
return this.bu4List.filter(x => x.bu4id.toLowerCase().includes(this.bu4Table.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu4Table.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu4Table.search.toLowerCase()))
}
selectBu4(bu4?: Bu4Model) {
this.bu4 = new MyBu4Model(bu4 || {})
......@@ -139,9 +139,9 @@ export class SubDepartmentOneComponent implements OnInit {
this.bu4Modal.page = Array.from({ length: Math.ceil(this.filterBu4Modal().length / 10) }, (_, i) => i + 1);
}
filterBu4Modal() {
return this.bu4List.filter(x => x.bu4id.includes(this.bu4Modal.search) ||
x.tdesc.includes(this.bu4Modal.search) ||
x.edesc.includes(this.bu4Modal.search))
return this.bu4List.filter(x => x.bu4id.toLowerCase().includes(this.bu4Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu4Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu4Modal.search.toLowerCase()))
}
addBu4() {
this.bu4Service.post({ ...this.bu4, parent: this.bu3.bu3id }).subscribe({
......@@ -187,9 +187,9 @@ export class SubDepartmentOneComponent implements OnInit {
this.selectBu3(bu3 || new MyBu3Model({ bu3id: this.bu3.bu3id }))
}
filterBu3Modal() {
return this.bu3List.filter(x => x.bu3id.includes(this.bu3Modal.search) ||
x.tdesc.includes(this.bu3Modal.search) ||
x.edesc.includes(this.bu3Modal.search))
return this.bu3List.filter(x => x.bu3id.toLowerCase().includes(this.bu3Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu3Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu3Modal.search.toLowerCase()))
}
selectBu3(bu3?: Bu3Model) {
this.bu3 = new MyBu3Model(bu3 || {})
......
......@@ -676,7 +676,7 @@
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white">
นำเข้าฝ่าย
นำเข้าทะเบียนส่วน 3
</h5>
</div>
<div class="ti-modal-body max-h-full overflow-hidden ti-modal-content !rounded-t-none !rounded-b-sm">
......
......@@ -117,9 +117,9 @@ export class SubDepartmentThreeComponent implements OnInit {
this.bu6Table.page = Array.from({ length: Math.ceil(this.filterBu6Table().length / 10) }, (_, i) => i + 1);
}
filterBu6Table() {
return this.bu6List.filter(x => x.bu6id.includes(this.bu6Table.search) ||
x.tdesc.includes(this.bu6Table.search) ||
x.edesc.includes(this.bu6Table.search))
return this.bu6List.filter(x => x.bu6id.toLowerCase().includes(this.bu6Table.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu6Table.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu6Table.search.toLowerCase()))
}
selectBu6(bu6?: Bu6Model) {
this.bu6 = new MyBu6Model(bu6 || {})
......@@ -140,9 +140,9 @@ export class SubDepartmentThreeComponent implements OnInit {
this.bu6Modal.page = Array.from({ length: Math.ceil(this.filterBu6Modal().length / 10) }, (_, i) => i + 1);
}
filterBu6Modal() {
return this.bu6List.filter(x => x.bu6id.includes(this.bu6Modal.search) ||
x.tdesc.includes(this.bu6Modal.search) ||
x.edesc.includes(this.bu6Modal.search))
return this.bu6List.filter(x => x.bu6id.toLowerCase().includes(this.bu6Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu6Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu6Modal.search.toLowerCase()))
}
addBu6() {
this.bu6Service.post({ ...this.bu6, parent: this.bu5.bu5id }).subscribe({
......@@ -188,9 +188,9 @@ export class SubDepartmentThreeComponent implements OnInit {
this.selectBu5(bu5 || new MyBu5Model({ bu5id: this.bu5.bu5id }))
}
filterBu5Modal() {
return this.bu5List.filter(x => x.bu5id.includes(this.bu5Modal.search) ||
x.tdesc.includes(this.bu5Modal.search) ||
x.edesc.includes(this.bu5Modal.search))
return this.bu5List.filter(x => x.bu5id.toLowerCase().includes(this.bu5Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu5Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu5Modal.search.toLowerCase()))
}
selectBu5(bu5?: Bu5Model) {
this.bu5 = new MyBu5Model(bu5 || {})
......
......@@ -687,7 +687,7 @@
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white">
นำเข้าฝ่าย
นำเข้าทะเบียนส่วน 2
</h5>
</div>
<div class="ti-modal-body max-h-full overflow-hidden ti-modal-content !rounded-t-none !rounded-b-sm">
......
......@@ -116,9 +116,9 @@ export class SubDepartmentTwoComponent implements OnInit {
this.bu5Table.page = Array.from({ length: Math.ceil(this.filterBu5Table().length / 10) }, (_, i) => i + 1);
}
filterBu5Table() {
return this.bu5List.filter(x => x.bu5id.includes(this.bu5Table.search) ||
x.tdesc.includes(this.bu5Table.search) ||
x.edesc.includes(this.bu5Table.search))
return this.bu5List.filter(x => x.bu5id.toLowerCase().includes(this.bu5Table.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu5Table.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu5Table.search.toLowerCase()))
}
selectBu5(bu5?: Bu5Model) {
this.bu5 = new MyBu5Model(bu5 || {})
......@@ -139,9 +139,9 @@ export class SubDepartmentTwoComponent implements OnInit {
this.bu5Modal.page = Array.from({ length: Math.ceil(this.filterBu5Modal().length / 10) }, (_, i) => i + 1);
}
filterBu5Modal() {
return this.bu5List.filter(x => x.bu5id.includes(this.bu5Modal.search) ||
x.tdesc.includes(this.bu5Modal.search) ||
x.edesc.includes(this.bu5Modal.search))
return this.bu5List.filter(x => x.bu5id.toLowerCase().includes(this.bu5Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu5Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu5Modal.search.toLowerCase()))
}
addBu5() {
this.bu5Service.post({ ...this.bu5, parent: this.bu4.bu4id }).subscribe({
......@@ -187,9 +187,9 @@ export class SubDepartmentTwoComponent implements OnInit {
this.selectBu4(bu4 || new MyBu4Model({ bu4id: this.bu4.bu4id }))
}
filterBu4Modal() {
return this.bu4List.filter(x => x.bu4id.includes(this.bu4Modal.search) ||
x.tdesc.includes(this.bu4Modal.search) ||
x.edesc.includes(this.bu4Modal.search))
return this.bu4List.filter(x => x.bu4id.toLowerCase().includes(this.bu4Modal.search.toLowerCase()) ||
x.tdesc.toLowerCase().includes(this.bu4Modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.bu4Modal.search.toLowerCase()))
}
selectBu4(bu4?: Bu4Model) {
this.bu4 = new MyBu4Model(bu4 || {})
......
......@@ -3,12 +3,12 @@
<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="#employee-categories-page-upload-modal">
data-hs-overlay="#employee-categories-upload-modal">
<i class="ri-add-line"></i>
นำเข้าข้อมูล
</button>
<a class="mx-2 justify-center -mb-px inline-flex items-center gap-2 font-weight-500 font-size-12px text-center text-secondary border-secondary border-b-2 align-items-end"
href="javascript:void(0);">
href="javascript:void(0);" (click)="downloadFile()">
ดาวน์โหลดตัวอย่างไฟล์
</a>
</div>
......@@ -221,7 +221,7 @@
<div class="flex justify-end">
<ng-container *ngIf="modalStatus=='add'||modalStatus=='edit'">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#employee-categories-page-modal">
data-hs-overlay="#employee-categories-page-alert-modal">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
......@@ -273,3 +273,33 @@
</div>
</div>
</div>
<div id="employee-categories-upload-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)] 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 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 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 mb-1rem space-x-4">
<button type="submit" class="ti-btn ti-btn-secondary" (click)="uploadFile()"
[disabled]="!selectedFile">
อัปโหลด
</button>
</div>
</div>
</div>
</div>
</div>
......@@ -2,6 +2,7 @@ import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angu
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';
import { FileService } from 'src/app/shared/services/file.service';
export interface DataModel {
codeId: string
tdesc: string
......@@ -35,23 +36,75 @@ export class EmployeeCategories {
dataSelect: DataModel = { codeId: "", tdesc: "", edesc: "", companyId: "" }
itemToDelete: EmpTypeModel | null = null;
selectedFile: File | null = null;
selectedFileName: string = 'กรุณาเลือกไฟล์';
constructor(private empTypeService: EmpTypeService,
private toastr: ToastrService,
private cdr: ChangeDetectorRef
private cdr: ChangeDetectorRef,
private fileService: FileService
) { }
ngOnInit(): void {
this.getEmpTypeList()
}
onFileSelected(event: any) {
this.selectedFile = event.target.files.length > 0 ? event.target.files[0] : null;
this.selectedFileName = this.selectedFile?.name || "กรุณาเลือกไฟล์"
}
uploadFile() {
if (!this.selectedFile) {
alert('กรุณาเลือกไฟล์ก่อนอัปโหลด')
return
}
const formData = new FormData();
formData.append('file', this.selectedFile);
this.fileService.upload(formData, 'employment_type').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.getEmpTypeList()
} else {
this.showAlert(response.message, 'error')
}
}, error: error => {
this.showAlert(error.message, 'error')
}
})
}
downloadFile() {
const fileName = 'IMPORT_MEMPLOYMENTTYPE.xlsx'
this.fileService.download(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')
}
})
}
getEmpTypeList() {
this.dataLoading = true
this.empTypeService.getList().subscribe({
next: response => {
this.emp_typelist = response.map(x => ({ check: false, data: { codeId: x.codeId, tdesc: x.tdesc, edesc: x.edesc, companyId: x.companyId } }))
this.dataLoading = false
this.searchChange();
this.cdr.detectChanges();
},
error: err => {
console.error('Error fetching employee types:', err);
}, error: error => {
this.dataLoading = false
console.error('Error fetching employee types:', error);
this.cdr.detectChanges()
}
});
}
......@@ -63,17 +116,14 @@ export class EmployeeCategories {
emp_typeListFilter() {
return this.emp_typelist.filter(x => {
const data = x.data
const match = data.codeId.includes(this.search) || data.tdesc.includes(this.search) || data.edesc.includes(this.search);
const match = data.codeId.toLowerCase().includes(this.search) || data.tdesc.toLowerCase().includes(this.search) || data.edesc.toLowerCase().includes(this.search);
return match;
});
}
setData(data?: DataModel) {
this.dataSelect = JSON.parse(JSON.stringify(data || { code: "", tdesc: "", edesc: "", companyId: "" }));
}
// selectEmp_type(emp_type?: EmpTypeModel) {
// // this.showSuccess()
// this.emp_type = new MyEmpTypeModel(emp_type || {})
// }
addEmp_type() {
const body = new MyEmpTypeModel({ codeId: this.dataSelect.codeId, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, companyId: this.dataSelect.companyId })
this.empTypeService.post(body).subscribe({
......
......@@ -3,12 +3,12 @@
<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="#employee-level-modal-upload">
data-hs-overlay="#employee-level-upload-modal">
<i class="ri-add-line"></i>
นำเข้าข้อมูล
</button>
<a class="mx-2 justify-center -mb-px inline-flex items-center gap-2 font-weight-500 font-size-12px text-center text-secondary border-secondary border-b-2 align-items-end"
href="javascript:void(0);">
href="javascript:void(0);" (click)="downloadFile()">
ดาวน์โหลดตัวอย่างไฟล์
</a>
</div>
......@@ -210,31 +210,33 @@
</div>
</div>
<div id="employee-level-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="max-h-full overflow-hidden ti-modal-content h-96">
<div class="ti-modal-header bg-primary">
<h5 class="text-xxl font-bold text-white">
นำเข้าข้อมูลบริษัท
</h5>
<div id="employee-level-upload-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)] rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white">
นำเข้าระดับพนักงาน (PL)
</h5>
</div>
<h1 class="mt-2" style="text-align: center;">ไฟล์</h1>
<div class="mt-2 px-2">
<div class="flex rounded-md">
<input type="text" id="hs-trailing-button-add-on-with-icon" name="hs-trailing-button-add-on-with-icon"
class="ti-form-input rounded-none ltr:rounded-l-md rtl:rounded-r-md focus:z-10">
<button aria-label="button" type="button"
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-primary text-white hover:bg-primary focus:z-10 focus:outline-none focus:ring-0 focus:ring-primary transition-all text-sm">
<i class="ti ti-upload"></i>
</button>
</div>
<div class="flex justify-center mt-2rem mb-1rem space-x-4">
<a class="ti-btn ti-btn-primary" href="javascript:void(0);">
อัปโหลด
</a>
</div>
<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 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 mb-1rem space-x-4">
<button type="submit" class="ti-btn ti-btn-secondary" (click)="uploadFile()"
[disabled]="!selectedFile">
อัปโหลด
</button>
</div>
</div>
</div>
</div>
</div>
</div>
......@@ -248,7 +250,7 @@
<div class="flex justify-end">
<ng-container *ngIf="modalStatus=='add'||modalStatus=='edit'">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#employee-level-page-modal">
data-hs-overlay="#employee-level-page-alert-modal">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
......
import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { MyPLModel, PLModel } 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';
export interface DataModel {
plId: string
......@@ -34,24 +35,76 @@ export class EmployeeLevel implements OnInit {
dataSelect: DataModel = { plId: "", tdesc: "", edesc: "", companyId: "" }
itemToDelete: PLModel | null = null;
selectedFile: File | null = null;
selectedFileName: string = 'กรุณาเลือกไฟล์';
constructor(private plService: PLService,
private toastr: ToastrService,
private cdr: ChangeDetectorRef
private cdr: ChangeDetectorRef,
private fileService: FileService
) { }
ngOnInit(): void {
this.getPLList()
}
onFileSelected(event: any) {
this.selectedFile = event.target.files.length > 0 ? event.target.files[0] : null;
this.selectedFileName = this.selectedFile?.name || "กรุณาเลือกไฟล์"
}
uploadFile() {
if (!this.selectedFile) {
alert('กรุณาเลือกไฟล์ก่อนอัปโหลด')
return
}
const formData = new FormData();
formData.append('file', this.selectedFile);
this.fileService.upload(formData, 'pl').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.getPLList()
} else {
this.showAlert(response.message, 'error')
}
}, error: error => {
this.showAlert(error.message, 'error')
}
})
}
downloadFile() {
const fileName = 'IMPORT_PL.xlsx'
this.fileService.download(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')
}
})
}
getPLList() {
this.dataLoading = true
this.plService.getList().subscribe({
next: response => {
this.plList = response.map(x => ({ check: false, data: { plId: x.plId, tdesc: x.tdesc, edesc: x.edesc, companyId: x.companyId } }))
this.dataLoading = false
this.searchChange();
this.cdr.detectChanges();
},
error: err => {
console.error('Error fetching employee types:', err);
}, error: error => {
this.dataLoading = false
console.error('Error fetching employee types:', error);
this.cdr.detectChanges()
}
});
}
......@@ -64,7 +117,7 @@ export class EmployeeLevel implements OnInit {
plListFilter() {
return this.plList.filter(x => {
const data = x.data
const match = data.plId.includes(this.search) || data.tdesc.includes(this.search) || data.edesc.includes(this.search);
const match = data.plId.toLowerCase().includes(this.search) || data.tdesc.toLowerCase().includes(this.search) || data.edesc.toLowerCase().includes(this.search);
return match;
});
}
......
import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { MyPositionModel, PositionModel } from 'src/app/shared/model/position.model';
import { FileService } from 'src/app/shared/services/file.service';
import { PositionService } from 'src/app/shared/services/position.service';
export interface DataModel {
positionId: string
tdesc: string
edesc: string
consolidate: string
shortName: string
companyId: string
}
@Component({
selector: 'app-position-unit',
......@@ -20,22 +29,82 @@ export class PositionUnitComponent implements OnInit {
}
currentPage = 1
selectedItems: string[] = [];
search = ""
selectedFile: File | null = null;
selectedFileName: string = 'กรุณาเลือกไฟล์';
modalStatus = 'add'
page = Array.from({ length: 1 }, (_, i) => i + 1);
positionList: PositionModel[] = []
positionList: { check: boolean, data: DataModel }[] = []
position: PositionModel = new MyPositionModel({})
search = ""
dataLoading = false
dataSelect: DataModel = { positionId: "", tdesc: "", edesc: "", consolidate: "", shortName: "", companyId: "" }
constructor(private positionService: PositionService,
private toastr: ToastrService,
private cdr: ChangeDetectorRef
private cdr: ChangeDetectorRef,
private fileService: FileService
) { }
ngOnInit(): void {
this.getPositionList()
}
onFileSelected(event: any) {
this.selectedFile = event.target.files.length > 0 ? event.target.files[0] : null;
this.selectedFileName = this.selectedFile?.name || "กรุณาเลือกไฟล์"
}
uploadFile() {
if (!this.selectedFile) {
alert('กรุณาเลือกไฟล์ก่อนอัปโหลด')
return
}
const formData = new FormData();
formData.append('file', this.selectedFile);
this.fileService.upload(formData, 'mposition').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.getPositionList()
} else {
this.showAlert(response.message, 'error')
}
}, error: error => {
this.showAlert(error.message, 'error')
}
})
}
downloadFile() {
const fileName = 'IMPORT_MPOSITION.xlsx'
this.fileService.download(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')
}
})
}
getPositionList() {
this.positionService.getList().subscribe(response => {
this.positionList = response.map(x => new MyPositionModel(x))
this.searchChange()
this.cdr.detectChanges()
this.dataLoading = true
this.positionService.getList().subscribe({
next: response => {
this.positionList = response.map(x => ({ check: false, data: { positionId: x.positionId, tdesc: x.tdesc, edesc: x.edesc, consolidate: x.consolidate, shortName: x.shortName, companyId: x.companyId } }))
this.dataLoading = false
this.searchChange()
this.cdr.detectChanges();
}, error: error => {
this.dataLoading = false
console.error('Error fetching employee types:', error);
this.cdr.detectChanges()
}
})
}
searchChange() {
......@@ -43,83 +112,63 @@ export class PositionUnitComponent implements OnInit {
this.page = Array.from({ length: Math.ceil(this.positionListFilter().length / 10) }, (_, i) => i + 1);
}
positionListFilter() {
return this.positionList.filter(x => x.positionId.includes(this.search) ||
x.tdesc.includes(this.search) ||
x.edesc.includes(this.search))
}
selectPosition(position?: PositionModel) {
// this.showSuccess()
this.position = new MyPositionModel(position || {})
}
showSuccess() {
this.toastr.success('บันทึกข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
showSuccesssEdit() {
this.toastr.success('เเก้ไขข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
return this.positionList.filter(x => {
const data = x.data;
const searchLower = this.search.toLowerCase();
return (
(data.positionId?.toLowerCase() || '').includes(searchLower) ||
(data.tdesc?.toLowerCase() || '').includes(searchLower) ||
(data.edesc?.toLowerCase() || '').includes(searchLower) ||
(data.consolidate?.toLowerCase() || '').includes(searchLower) ||
(data.shortName?.toLowerCase() || '').includes(searchLower)
);
});
}
showSuccessDelete() {
this.toastr.success('ลบข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
setData(data?: DataModel) {
this.dataSelect = JSON.parse(JSON.stringify(data || { positionId: "", tdesc: "", edesc: "", consolidate: "", shortName: "", companyId: "" }));
}
addPosition() {
this.positionService.post(this.position).subscribe((response: any) => {
if (response.success) {
this.getPositionList()
this.showSuccess()
const body = new MyPositionModel({ positionId: this.dataSelect.positionId, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, consolidate: this.dataSelect.consolidate, shortName: this.dataSelect.shortName, companyId: this.dataSelect.companyId })
this.positionService.post(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.getPositionList()
} else {
this.showAlert(response.message, 'error')
}
}, error: error => {
this.showAlert(error.message, 'error')
}
})
}
deletePosition() {
this.positionService.delete(this.position).subscribe((response: any) => {
if (response.success) {
this.getPositionList()
this.showSuccessDelete()
}
})
}
toggleSelection(positionId: string, event: Event) {
const checked = (event.target as HTMLInputElement).checked;
if (checked) {
this.selectedItems.push(positionId);
let body: PositionModel | PositionModel[] = []
if (this.dataSelect.positionId) {
body = new MyPositionModel({ positionId: this.dataSelect.positionId, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, consolidate: this.dataSelect.consolidate, shortName: this.dataSelect.shortName, companyId: this.dataSelect.companyId })
} else {
this.selectedItems = this.selectedItems.filter(id => id !== positionId);
body = this.positionList.filter(x => x.check).map(x => new MyPositionModel({ positionId: x.data.positionId, tdesc: x.data.tdesc, edesc: x.data.edesc, consolidate: x.data.consolidate, shortName: x.data.shortName, companyId: x.data.companyId }))
}
}
toggleSelectAll(event: Event) {
const checked = (event.target as HTMLInputElement).checked;
if (checked) {
this.selectedItems = this.positionListFilter().map(item => item.positionId);
} else {
this.selectedItems = [];
}
}
deleteSelectedItems() {
if (this.selectedItems.length === 0) {
alert("เลือกข้อมูลก่อนลบ");
return;
}
const selectedGroups = this.positionListFilter().filter(item => this.selectedItems.includes(item.positionId));
this.positionService.delete(selectedGroups).subscribe({
next: (response) => {
console.log("ลบสำเร็จ", response);
this.selectedItems = [];
this.getPositionList();
this.showSuccessDelete()
},
error: (error) => {
console.error("เกิดข้อผิดพลาดในการลบ", error);
this.positionService.delete(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.getPositionList()
} else {
this.showAlert(response.message, 'error')
}
}, error: error => {
this.showAlert(error.message, 'error')
}
})
}
showAlert(text: string, type: 'success' | 'error') {
this.toastr[type](text, 'แจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
}
......
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ChangeDetectorRef, Component} from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { EvaluationCycleModel, MyEvaluationCycleModel } from 'src/app/shared/model/evaluation-cycle.model';
import { EvaluationCycleService } from 'src/app/shared/services/evaluation-cycle.service';
import { MyStatusCodeModel, StatusCodeModel } from 'src/app/shared/model/status-code.model';
export interface DataModel {
check: boolean,
code: string,
period: string,
year: string,
startDate: string,
endDate: string,
status: string
evaluationRoundId: string;
tdesc: string;
edesc: string;
apsyear: string;
apsPeriodStart: string;
apsPeriodEnd: string;
statusCode: StatusCodeModel;
}
@Component({
......@@ -17,94 +20,133 @@ export interface DataModel {
styleUrls: ['./evaluation-cycle.component.scss']
})
export class EvaluationCycleComponent {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
search = ""
numDataListChecked = 0
isDataListChecked = false
isDataListCheckedAll = false
dataList: DataModel[] = [
{
check: false,
code: "Y67P2",
period: "ช่วงเวลาที่ 2",
year: "2567",
startDate: "01-07-2567",
endDate: "31-12-2567",
status: "1"
},
{
check: false,
code: "Y68P1",
period: "ช่วงเวลาที่ 1",
year: "2568",
startDate: "01-01-2568",
endDate: "30-06-2568",
status: "2"
},
{
check: false,
code: "Y67P1",
period: "ช่วงเวลาที่ 1",
year: "2567",
startDate: "01-01-2567",
endDate: "30-06-2567",
status: "3"
},
]
dataSelect: DataModel = {
check: false,
code: "",
period: "",
year: "",
startDate: "",
endDate: "",
status: "",
}
modalStatus: "add" | "edit" = "add"
constructor(private cdr: ChangeDetectorRef) {
}
apsPeriodStart: string = '';
apsPeriodEnd: string = '';
dataListSelect(data?: DataModel) {
this.dataSelect = data || {
check: false,
code: "",
period: "",
year: "",
startDate: "",
endDate: "",
status: "",
}
this.cdr.detectChanges()
}
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
search = ""
modalStatus = 'add'
evaluation_cyclelist: { check: boolean, data: DataModel }[] = []
evaluation_cycle: EvaluationCycleModel = new MyEvaluationCycleModel({})
dataLoading = false
dataSelect: DataModel = { evaluationRoundId: "", tdesc: "", edesc: "", apsyear: "", apsPeriodStart: "", apsPeriodEnd: "", statusCode: new MyStatusCodeModel({})}
itemToDelete: EvaluationCycleModel | null = null;
isDataListChecked = false
isDataListCheckedAll = false
numDataListChecked = 0
dataListFilter() {
return this.dataList.filter(x => {
const match = x.code.includes(this.search) || x.period.includes(this.search);
if (!match) x.check = false;
return match;
});
}
constructor(private evaluationCycleService: EvaluationCycleService,
private toastr: ToastrService,
private cdr: ChangeDetectorRef
) { }
ngOnInit(): void {
this.getEvaluationCycleList()
}
dataListCheck() {
const dataCheck = this.dataListFilter();
this.isDataListChecked = dataCheck.some(x => x.check);
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every(x => x.check) : false;
this.numDataListChecked = dataCheck.filter(x => x.check).length;
}
getEvaluationCycleList() {
this.evaluationCycleService.getList().subscribe({
next: response => {
console.log('API response:', response);
this.evaluation_cyclelist = response.map(x => ({
check: false,
data: {
evaluationRoundId: x.evaluationRoundId,
tdesc: x.tdesc,
edesc: x.edesc,
apsyear: x.apsyear,
apsPeriodStart: x.apsPeriodStart,
apsPeriodEnd: x.apsPeriodEnd,
statusCode: new MyStatusCodeModel(x.statusCode || {})
}
}));
this.searchChange();
this.cdr.detectChanges();
},
error: err => {
console.error('Error fetching evaluation cycles:', err);
}
});
}
dataListCheck() {
const dataCheck = this.evaluation_cycleListFilter();
this.isDataListChecked = dataCheck.some(x => x.check);
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every(x => x.check) : false;
this.numDataListChecked = dataCheck.filter(x => x.check).length;
}
dataListCheckAll() {
const selectAll = this.isDataListCheckedAll;
this.evaluation_cyclelist.forEach(x => x.check = selectAll);
this.dataListCheck();
}
dataListCheckAll() {
const selectAll = this.isDataListCheckedAll;
this.dataList.forEach(x => x.check = selectAll);
this.dataListCheck();
}
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.evaluation_cycleListFilter().length / 10) }, (_, i) => i + 1);
}
evaluation_cycleListFilter() {
return this.evaluation_cyclelist.filter(x => {
const data = x.data
const match = data.evaluationRoundId.includes(this.search) || data.tdesc.includes(this.search) || data.edesc.includes(this.search);
return match;
});
}
setData(data?: DataModel) {
this.dataSelect = JSON.parse(JSON.stringify(data || {
evaluationRoundId: "",
tdesc: "",
edesc: "",
apsyear: "",
apsPeriodStart: "",
apsPeriodEnd: "",
statusCode: new MyStatusCodeModel({})
}));
}
addevaluation_cycle() {
const body = new MyEvaluationCycleModel({ evaluationRoundId: this.dataSelect.evaluationRoundId, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, apsyear: this.dataSelect.apsyear, apsPeriodStart: this.dataSelect.apsPeriodStart, apsPeriodEnd: this.dataSelect.apsPeriodEnd, statusCode: this.dataSelect.statusCode })
this.evaluationCycleService.post(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.getEvaluationCycleList()
} else {
this.showAlert(response.message, 'error')
}
}, error: error => {
this.showAlert(error.message, 'error')
}
})
}
searchChange() {
this.currentPage = 1;
const filteredData = this.dataListFilter();
this.page = Array.from({ length: Math.ceil(filteredData.length / 10) }, (_, i) => i + 1);
this.dataListCheck();
deleteevaluation_cycle() {
let body: EvaluationCycleModel | EvaluationCycleModel[] = []
if (this.dataSelect.evaluationRoundId) {
body = new MyEvaluationCycleModel({ evaluationRoundId: this.dataSelect.evaluationRoundId, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, apsyear: this.dataSelect.apsyear, apsPeriodStart: this.dataSelect.apsPeriodStart, apsPeriodEnd: this.dataSelect.apsPeriodEnd, statusCode: this.dataSelect.statusCode })
} else {
body = this.evaluation_cyclelist.filter(x => x.check).map(x => new MyEvaluationCycleModel({ evaluationRoundId: x.data.evaluationRoundId, tdesc: x.data.tdesc, edesc: x.data.edesc, apsyear: x.data.apsyear, apsPeriodStart: x.data.apsPeriodStart, apsPeriodEnd: x.data.apsPeriodEnd, statusCode: x.data.statusCode }))
}
this.evaluationCycleService.delete(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.getEvaluationCycleList()
} else {
this.showAlert(response.message, 'error')
}
}, error: error => {
this.showAlert(error.message, 'error')
}
})
}
showAlert(text: string, type: 'success' | 'error') {
this.toastr[type](text, 'แจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
}
......@@ -17,8 +17,7 @@
</div>
<div class="mt-3 px-3rem">
<div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1">
<app-set-idp-development-plan [pathTitle]="pathTitle"
(sendPathTitle)="pathTitle=$event"></app-set-idp-development-plan>
<app-set-idp-development-plan></app-set-idp-development-plan>
</div>
</div>
</div>
......
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { IdpDevelopmentModel, MyIdpDevelopmentModel } from 'src/app/shared/model/idp-development.model';
import { IdpDevelopmentService } from 'src/app/shared/services/idp-development.service';
@Component({
selector: 'app-set-idp-development-plan',
......@@ -7,66 +9,47 @@ import { ToastrService } from 'ngx-toastr';
styleUrls: ['./set-idp-development-plan.component.scss']
})
export class SetIdpDevelopmentPlanComponent {
@Input() pathTitle = ['การประเมินสมรรถนะ', 'ทะเบียนหลักสูตร', 'หลักสูตรการพัฒนา'];
@Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>();
activeTab: string = 'tab1'; // กำหนด tab เริ่มต้น
idpLoading = false
idpData: IdpDevelopmentModel = new MyIdpDevelopmentModel({})
constructor(private idpDevelopmentService: IdpDevelopmentService,
private toastr: ToastrService,
private cdr: ChangeDetectorRef
) { }
// ฟังก์ชันในการเปลี่ยนแท็บ
changeTab(tab: { id: string, text: string }) {
this.sendPathTitle.emit(['การประเมินสมรรถนะ', 'ตั้งค่าผู้ใช้งาน', tab.text]);
this.activeTab = tab.id;
ngOnInit(): void {
this.getIdpData()
}
// การจัดการการเปิดปิด modal
modalOptions: {
[nameModal: string]: {
isModalOpen: boolean;
modalSize: string;
backdropClose: boolean;
};
} = {
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
};
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';
}
closeModal(name: string) {
this.modalOptions[name].isModalOpen = false;
if (!this.isAnyModalOpen()) {
document.body.style.overflow = ''; // คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
}
getIdpData() {
this.idpLoading = true
this.idpDevelopmentService.getList().subscribe({
next: response => {
this.idpData = new MyIdpDevelopmentModel(response)
this.idpData.developmentPlan.sort((a, b) => +a.planId - +b.planId)
this.idpLoading = false
this.cdr.detectChanges()
}, error: error => {
this.idpLoading = false
this.cdr.detectChanges()
}
})
}
isAnyModalOpen(): boolean {
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // ตรวจสอบว่า modal อื่นยังเปิดอยู่หรือไม่
saveIdp() {
this.idpDevelopmentService.post(this.idpData).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.getIdpData()
} else {
this.showAlert(response.message, 'error')
}
}, error: error => {
this.showAlert(error.message, 'error')
}
})
}
// ฟังก์ชัน toggle checkbox
isChecked: boolean = false; // ใช้สำหรับตรวจสอบสถานะของ checkbox
toggleCheckbox() {
this.isChecked = !this.isChecked; // สลับสถานะ
}
currentModal = "";
constructor(private toastr: ToastrService) { }
showSuccess() {
this.toastr.success('บันทึกข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
......@@ -74,17 +57,10 @@ export class SetIdpDevelopmentPlanComponent {
});
}
showSuccessEdit() {
this.toastr.success('เเก้ไขข้อมูลสำเร็จ', 'เเจ้งเตือน', {
showAlert(text: string, type: 'success' | 'error') {
this.toastr[type](text, 'แจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
showSuccessDelete() {
this.toastr.success('ลบข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
})
}
}
......@@ -10,22 +10,22 @@
<nav class="-mb-0.5 flex space-x-6 rtl:space-x-reverse">
<a class="text-base font-medium hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 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"
aria-controls="underline-1" (click)="pathTitle = ['การประเมินสมรรถนะ','ทะเบียนกำหนดชื่อ','ประเภทสมรรถนะ']">
aria-controls="underline-1" (click)=" currentPage = 1;pathTitle = ['การประเมินสมรรถนะ','ทะเบียนกำหนดชื่อ','ประเภทสมรรถนะ']">
ประเภทสมรรถนะ
</a>
<a class="text-base font-medium hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary"
href="javascript:void(0);" id="underline-item-2" data-hs-tab="#underline-2"
aria-controls="underline-2" (click)="pathTitle = ['การประเมินสมรรถนะ','ทะเบียนกำหนดชื่อ','หัวข้อสมรรถนะ']">
aria-controls="underline-2" (click)="currentPage = 2;pathTitle = ['การประเมินสมรรถนะ','ทะเบียนกำหนดชื่อ','หัวข้อสมรรถนะ']">
หัวข้อสมรรถนะ
</a>
</nav>
</div>
<div class="mt-3 px-3rem !-mt-3 pt-50px">
<div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1">
<div *ngIf="currentPage == 1" id="underline-1" role="tabpanel" aria-labelledby="underline-item-1">
<app-type-registration [pathTitle]="pathTitle"
(sendPathTitle)="pathTitle=$event"></app-type-registration>
</div>
<div id="underline-2" class="hidden" role="tabpanel" aria-labelledby="underline-item-2">
<div *ngIf="currentPage == 2" id="underline-2" class="hidden" role="tabpanel" aria-labelledby="underline-item-2">
<app-competency-topic [pathTitle]="pathTitle"
(sendPathTitle)="pathTitle=$event"></app-competency-topic>
</div>
......
......@@ -7,4 +7,5 @@ import { Component } from '@angular/core';
})
export class NameRegistrationComponent {
pathTitle = ['การประเมินสมรรถนะ', 'ทะเบียนกำหนดชื่อ','ประเภทสมรรถนะ']
currentPage = 1
}
......@@ -25,7 +25,7 @@
</div>
<div class="grid grid-cols-3 gap-6">
<div class="col-span-1">
<input type="text" id="input-label" class="ti-form-input w-2/3 pr-10" value="2567">
<input type="text" id="input-label" class="ti-form-input w-2/3 pr-10" value="{{ setting.apsyear }}">
</div>
</div>
<div class="grid grid-cols-3 gap-6 mt-10">
......@@ -35,7 +35,7 @@
</div>
<div class="grid grid-cols-3 gap-6">
<div class="col-span-1">
<input type="text" id="input-label" class="ti-form-input w-2/3 pr-10" value="8">
<input type="text" id="input-label" class="ti-form-input w-2/3 pr-10" value="{{ setting.expectationLevel }}">
</div>
</div>
<label for="hs-trailing-button-add-on-with-icon" class="ti-form-label mt-10">จัดการสมรรถนะกับกลุ่ม *</label>
......@@ -43,13 +43,13 @@
<div class="grid grid-cols-6 flex gap-x-6">
<div class="flex col-span-1 mt-5">
<input type="radio" name="hs-radio-group" class="ti-form-radio" id="hs-radio-group-1" checked>
<label for="hs-radio-group-1" class="text-sm text-gray-500 ltr:ml-5 rtl:mr-2 dark:text-white/70">ระดับพนักงาน (PL)</label>
<label for="hs-radio-group-1" class="text-sm text-gray-500 ltr:ml-5 rtl:mr-2 dark:text-white/70">{{ setting.companyId }}</label>
</div>
<div class="flex col-span-2 mt-5 ml-4rem">
<!-- <div class="flex col-span-2 mt-5 ml-4rem">
<input type="radio" name="hs-radio-group" class="ti-form-radio" id="hs-radio-group-2">
<label for="hs-radio-group-2" class="text-sm text-gray-500 ltr:ml-5 rtl:mr-2 dark:text-white/70">ลักษณะงาน ( JD)</label>
</div>
</div> -->
</div>
</div>
......@@ -69,11 +69,11 @@
<tbody>
<tr>
<td>น้ำหนัก</td>
<td><span>1</span></td>
<td><span>0.8</span></td>
<td><span>0.6</span></td>
<td><span>0.4</span></td>
<td><span>0.2</span></td>
<td><span>{{ setting.settingScore5 }}</span></td>
<td><span>{{ setting.settingScore4 }}</span></td>
<td><span>{{ setting.settingScore3 }}</span></td>
<td><span>{{ setting.settingScore2 }}</span></td>
<td><span>{{ setting.settingScore1 }}</span></td>
</tr>
</tbody>
</table>
......
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { MySettingAssessmentModel, SettingAssessmentModel } from 'src/app/shared/model/setting-assessment.model';
import { SettingAssessmentService } from 'src/app/shared/services/setting-assessment.service';
@Component({
selector: 'app-competency-configuration',
......@@ -11,8 +13,63 @@ export class CompetencyConfigurationComponent {
@Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>();
activeTab: string = 'tab1'; // กำหนด tab เริ่มต้น
isChecked: boolean = false;
settingList: SettingAssessmentModel[] = []
settingListLoading = false
setting: SettingAssessmentModel = new MySettingAssessmentModel({})
search = ""
constructor(private settingAssessmentService: SettingAssessmentService,
private toastr: ToastrService,
private cdr: ChangeDetectorRef
) { }
ngOnInit(): void {
this.getSettingList()
}
getSettingList() {
this.settingListLoading = true
this.settingAssessmentService.getList().subscribe({
next: response => {
this.settingList = response
this.settingListLoading = false
this.cdr.detectChanges()
}, error: error => {
this.settingListLoading = false
this.cdr.detectChanges()
}
})
}
selectsetting(setting?: SettingAssessmentModel) {
this.setting = new MySettingAssessmentModel(setting || {})
}
// showSuccessAdd() {
// this.toastr.success('บันทึกข้อมูลสำเร็จ', 'แจ้งเตือน', {
// timeOut: 3000,
// positionClass: 'toast-top-right',
// });
// }
// showSuccessDelete() {
// this.toastr.success('ลบข้อมูลสำเร็จ', 'แจ้งเตือน', {
// timeOut: 3000,
// positionClass: 'toast-top-right',
// });
// }
// addsetting() {
// this.settingAssessmentService.post(this.setting).subscribe((response: any) => {
// if (response.success) {
// this.showSuccessAdd()
// this.getSettingList()
// }
// })
// }
// deletesetting() {
// this.settingAssessmentService.delete(this.setting).subscribe((response: any) => {
// if (response.success) {
// this.showSuccessDelete()
// this.getSettingList()
// }
// })
// }
// ฟังก์ชันในการเปลี่ยนแท็บ
changeTab(tab: { id: string, text: string }) {
this.sendPathTitle.emit(['การประเมินสมรรถนะ', 'การตั้งค่า', tab.text]);
this.activeTab = tab.id;
......@@ -22,69 +79,5 @@ export class CompetencyConfigurationComponent {
this.isChecked = !this.isChecked;
}
// การจัดการการเปิดปิด modal
modalOptions: {
[nameModal: string]: {
isModalOpen: boolean;
modalSize: string;
backdropClose: boolean;
};
} = {
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
};
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';
}
closeModal(name: string) {
this.modalOptions[name].isModalOpen = false;
if (!this.isAnyModalOpen()) {
document.body.style.overflow = ''; // คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
}
}
isAnyModalOpen(): boolean {
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // ตรวจสอบว่า modal อื่นยังเปิดอยู่หรือไม่
}
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล
addUser() {
}
currentModal = ""
constructor(private toastr: ToastrService) { }
showSuccess() {
this.toastr.success('บันทึกข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
showSuccessEdit() {
this.toastr.success('เเก้ไขข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
showSuccessDelete() {
this.toastr.success('ลบข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
}
......@@ -119,6 +119,8 @@ import { CompetencytopicService } from 'src/app/shared/services/competencytopic.
import { AssessmentService } from 'src/app/shared/services/assessment.service';
import { CompetencycourseService } from 'src/app/shared/services/competencycourse.service';
import { EmployeeService } from 'src/app/shared/services/employee.service';
import { EvaluationCycleService } from 'src/app/shared/services/evaluation-cycle.service';
import { SettingAssessmentService } from 'src/app/shared/services/setting-assessment.service';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material/core';
import { MatFormFieldModule } from '@angular/material/form-field';
......@@ -131,6 +133,7 @@ import { JobCodeService } from 'src/app/shared/services/่job-code.service';
import { FileService } from 'src/app/shared/services/file.service';
import { CompetencyGroupGradeService } from 'src/app/shared/services/competency-group-grade.service';
import { IndicatorsCoursesService } from 'src/app/shared/services/indicators-courses.service';
import { IdpDevelopmentService } from 'src/app/shared/services/idp-development.service';
export const MY_DATE_FORMATS = {
parse: {
......@@ -287,11 +290,14 @@ export class CustomDateAdapter extends NativeDateAdapter {
AssessmentService,
CompetencycourseService,
EmployeeService,
EvaluationCycleService,
SettingAssessmentService,
JobCodeService,
BranchService,
FileService,
CompetencyGroupGradeService,
IndicatorsCoursesService,
IdpDevelopmentService,
{
provide: HTTP_INTERCEPTORS,
useClass: HttpRequestInterceptor,
......
import { MyStatusCodeModel, StatusCodeModel } from "./status-code.model";
export interface EvaluationCycleModel {
evaluationRoundId: string;
tdesc: string;
edesc: string;
apsyear: string;
apsPeriodStart: string;
apsPeriodEnd: string;
statusCode: StatusCodeModel;
}
export class MyEvaluationCycleModel implements EvaluationCycleModel {
evaluationRoundId: string;
tdesc: string;
edesc: string;
apsyear: string;
apsPeriodStart: string;
apsPeriodEnd: string;
statusCode: StatusCodeModel;
constructor(data: Partial<EvaluationCycleModel>) {
this.evaluationRoundId = data.evaluationRoundId || "";
this.tdesc = data.tdesc || "";
this.edesc = data.edesc || "";
this.apsyear = data.apsyear || "";
this.apsPeriodStart = data.apsPeriodStart || "";
this.apsPeriodEnd = data.apsPeriodEnd || "";
this.statusCode =new MyStatusCodeModel(data.statusCode || {})
}
}
export interface DevelopmentPlan {
planId: string;
companyId: string;
ojtJobAssignment: boolean;
coachMentor: boolean;
training: boolean;
}
export interface IdpDevelopmentModel {
evaluationId: string;
companyId: string;
score: number;
developmentPlan: DevelopmentPlan[];
}
export class MyIdpDevelopmentModel implements IdpDevelopmentModel {
evaluationId: string;
companyId: string;
score: number;
developmentPlan: DevelopmentPlan[];
constructor(data: Partial<IdpDevelopmentModel>) {
this.evaluationId = data.evaluationId || '';
this.companyId = data.companyId || '';
this.score = data.score ?? 0;
this.developmentPlan = data.developmentPlan || [];
}
}
\ No newline at end of file
export interface SettingAssessmentModel {
apsyear: string;
companyId: string;
expectationLevel: number;
settingGroupAssessment: string;
settingScore5: number;
settingScore4: number;
settingScore3: number;
settingScore2: number;
settingScore1: number;
}
export class MySettingAssessmentModel implements SettingAssessmentModel {
apsyear: string;
companyId: string;
expectationLevel: number;
settingGroupAssessment: string;
settingScore5: number;
settingScore4: number;
settingScore3: number;
settingScore2: number;
settingScore1: number;
constructor(data: Partial<SettingAssessmentModel>) {
this.apsyear = data.apsyear || "";
this.companyId = data.companyId || "";
this.expectationLevel = data.expectationLevel ?? 0;
this.settingGroupAssessment = data.settingGroupAssessment || "";
this.settingScore5 = data.settingScore5 ?? 0;
this.settingScore4 = data.settingScore4 ?? 0;
this.settingScore3 = data.settingScore3 ?? 0;
this.settingScore2 = data.settingScore2 ?? 0;
this.settingScore1 = data.settingScore1 ?? 0;
}
}
\ No newline at end of file
export interface StatusCodeModel {
code: string;
tdesc: string;
edesc: string;
}
export class MyStatusCodeModel implements StatusCodeModel {
code: string;
tdesc: string;
edesc: string;
constructor(data: Partial<StatusCodeModel>) {
this.code = data.code || "";
this.tdesc = data.tdesc || "";
this.edesc = data.edesc || "";
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { CompetencytopicModel } from '../model/competencytopic.model';
import { AlertModel } from '../model/alert.model';
@Injectable({
providedIn: 'root'
})
......@@ -17,16 +18,16 @@ export class CompetencytopicService {
getList(): Observable<CompetencytopicModel[]> {
return this.http.get<CompetencytopicModel[]>(this.urlApi + "/lists")
}
post(body: CompetencytopicModel) {
return this.http.post(this.urlApi, body)
post(body: CompetencytopicModel): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: CompetencytopicModel) {
delete(body: CompetencytopicModel | CompetencytopicModel[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
return this.http.delete<AlertModel>(this.urlApi, options)
}
}
\ No newline at end of file
......@@ -3,6 +3,8 @@ import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { CompetencytypeModel } from '../model/competencytype.model';
import { AlertModel } from '../model/alert.model';
import { EmpGroupModel } from '../model/emp-group.model';
@Injectable({
providedIn: 'root'
})
......@@ -17,16 +19,16 @@ export class CompetencytypeService {
getList(): Observable<CompetencytypeModel[]> {
return this.http.get<CompetencytypeModel[]>(this.urlApi + "/lists")
}
post(body: CompetencytypeModel) {
return this.http.post(this.urlApi, body)
post(body: CompetencytypeModel ): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: CompetencytypeModel) {
delete(body: CompetencytypeModel | CompetencytypeModel[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
return this.http.delete<AlertModel>(this.urlApi, options)
}
}
\ No newline at end of file
......@@ -19,18 +19,6 @@ export class EmpGroupService {
getById(groupId: string): Observable<EmpGroupModel> {
return this.http.get<EmpGroupModel>(this.urlApi + "/" + groupId)
}
// post(body: EmpGroupModel) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: EmpGroupModel) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
post(body: EmpGroupModel): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
......
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { AlertModel } from '../model/alert.model';
import { EvaluationCycleModel } from '../model/evaluation-cycle.model';
@Injectable({
providedIn: 'root'
})
export class EvaluationCycleService {
api = "/evaluation-round"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getList(): Observable<EvaluationCycleModel[]> {
return this.http.get<EvaluationCycleModel[]>(this.urlApi + "/lists")
}
getById(evaluationRoundId: string): Observable<EvaluationCycleModel> {
return this.http.get<EvaluationCycleModel>(this.urlApi + "/" + evaluationRoundId)
}
post(body: EvaluationCycleModel): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: EvaluationCycleModel | EvaluationCycleModel[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete<AlertModel>(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 { AlertModel } from '../model/alert.model';
import { IdpDevelopmentModel } from '../model/idp-development.model';
@Injectable({
providedIn: 'root'
})
export class IdpDevelopmentService {
api = "/idp"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getList(): Observable<IdpDevelopmentModel> {
return this.http.get<IdpDevelopmentModel>(this.urlApi + "/lists")
}
// getById(companyId: string): Observable<IdpDevelopmentModel> {
// return this.http.get<IdpDevelopmentModel>(this.urlApi + "/" + companyId)
// }
post(body: IdpDevelopmentModel): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: IdpDevelopmentModel | IdpDevelopmentModel[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete<AlertModel>(this.urlApi, options)
}
}
......@@ -19,18 +19,6 @@ import { AlertModel } from '../model/alert.model';
getList(): Observable<PositionModel[]> {
return this.http.get<PositionModel[]>(this.urlApi + "/lists")
}
// post(body: PositionModel) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: PositionModel) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
post(body: PositionModel): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
......
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { AlertModel } from '../model/alert.model';
import { SettingAssessmentModel } from '../model/setting-assessment.model';
@Injectable({
providedIn: 'root'
})
export class SettingAssessmentService {
api = "/setting-assessment"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getList(): Observable<SettingAssessmentModel[]> {
return this.http.get<SettingAssessmentModel[]>(this.urlApi + "/lists")
}
// getById(companyId: string): Observable<SettingAssessmentModel> {
// return this.http.get<SettingAssessmentModel>(this.urlApi + "/" + companyId)
// }
post(body: SettingAssessmentModel): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: SettingAssessmentModel | SettingAssessmentModel[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete<AlertModel>(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