Commit 0612093e by Nattana Chaiyamat

การจัดการรายละเอียดงาน

parent b4ff8dbf
......@@ -4,7 +4,7 @@
<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()">
[(ngModel)]="search">
<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">
......@@ -20,74 +20,14 @@
import
</button>
</div>
<!-- <div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
data-hs-overlay="#sub-command-structure-alert-delete-modal">
<i class="ri-delete-bin-6-line"></i>
Delete
</button>
</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="page px-rem">
<div class="overflow-auto shadow-md rounded-t-md">
<table class="ti-custom-table ti-custom-table-head ti-custom-table-hover table-bordered">
<thead>
<tr>
<ng-container
*ngFor="let item of ['ลำดับ','รหัสงาน','ชื่อลักษณะงาน (ไทย)','ชื่อลักษณะงาน (อังกฤษ)','การจัดการ']; let f = first; let l = last; let i = index">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary !text-center">
<span class="font-size-12px font-weight-700">{{ item }}</span>
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l">
<i class="ti ti-dots-vertical fs-l"></i>
</div>
</th>
</ng-container>
</tr>
</thead>
<tbody *ngIf="loading">
<tr>
<td class="text-center" colspan="100%">
<div *ngFor="let item of [1,2,3]" class="ti-spinner w-8 h-8 text-secondary mx-1" role="status"
aria-label="loading">
<span class="sr-only">Loading...</span>
</div>
</td>
</tr>
</tbody>
<tbody *ngIf="!loading&&!jobcodeFilter().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="!loading&&jobcodeFilter().length">
<tr
*ngFor="let item of jobcodeFilter() |slice:((currentPage-1) * pageSize) : (((currentPage-1) * pageSize) + pageSize);let i = index">
<td class="text-center">
{{((currentPage-1) * pageSize)+(i+1)}}
</td>
<td class="text-center">{{item.jobcodeId}}</td>
<td>{{item.tdesc}}</td>
<td>{{item.edesc}}</td>
<td class="flex justify-center">
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1" (click)="modalStatus='edit';edit(item)"
data-hs-overlay="#sub-job-competency-component-modal-edit"></i>
</td>
</tr>
</tbody>
</table>
</div>
<app-pagination [totalItems]="jobcodeFilter().length" [pageSize]="pageSize" (pageChange)="currentPage = $event"
(pageSizeChange)="pageSize = $event;currentPage = 1"></app-pagination>
<app-datagrid-syncfution [searchSettings]="searchSettings" [searchText]="search" [dataSource]="jobCodeList"
[checkBoxSetting]='false' [columns]="columns" modalName="#sub-job-competency-component-modal-edit"
(sendSelectData)="currentModal='edit';edit($event)">
</app-datagrid-syncfution>
</div>
......@@ -182,16 +122,16 @@
</div>
<div class="ti-modal-body ">
<p class="mt-1 text-gray-800 dark:text-white/70">
<ng-container *ngIf="modalStatus=='add'||modalStatus=='edit'">
<ng-container *ngIf="currentModal=='add'||currentModal=='edit'">
ยืนยันการบันทึกข้อมูลหรือไม่
</ng-container>
<ng-container *ngIf="modalStatus=='delete'||modalStatus=='deleteGroup'">
<ng-container *ngIf="currentModal=='delete'">
ยืนยันการลบข้อมูลหรือไม่
</ng-container>
</p>
<div class="flex justify-end mt-2rem mb-1rem">
<ng-container *ngIf="modalStatus=='add'||modalStatus=='edit'">
<ng-container *ngIf="currentModal=='add'||currentModal=='edit'">
<button type="button"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#company-registration-page-alert-modal">
......@@ -202,7 +142,7 @@
บันทึกข้อมูล
</a>
</ng-container>
<ng-container *ngIf="modalStatus=='delete'||modalStatus=='deleteGroup'">
<ng-container *ngIf="currentModal=='delete'">
<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="#company-registration-page-alert-modal">
......
import { ChangeDetectorRef, Component} from '@angular/core';
import { ChangeDetectorRef, Component } from '@angular/core';
import { ColumnModel } from '@syncfusion/ej2-grids';
import { ToastrService } from 'ngx-toastr';
import { JobCodeModel, MyJobCodeModel } from 'src/app/shared/model/job-code.model';
import { FileService } from 'src/app/shared/services/file.service';
......@@ -13,16 +14,37 @@ import { JobCodeService } from 'src/app/shared/services/job-code.service';
export class SubJobCompetencyComponent {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
pageSize=10
pageSize = 10
search = ""
jobCodeList:JobCodeModel[]=[]
jobCodeList: JobCodeModel[] = []
loading = false
selectedFile: File | null = null;
selectedFileName: string = 'กรุณาเลือกไฟล์';
selectJob:JobCodeModel=new MyJobCodeModel({})
modalStatus=''
selectJob: JobCodeModel = new MyJobCodeModel({})
currentModal: 'add' | 'edit' | 'delete' = "add"
columns: ColumnModel[] = [{
field: "jobcodeId",
headerText: "ชื่อล็อกอิน",
type: "string",
isPrimaryKey: true,
},
{
field: "tdesc",
headerText: "ชื่อลักษณะงาน (ไทย)",
type: "string"
},
{
field: "edesc",
headerText: "ชื่อลักษณะงาน (อังกฤษ)",
type: "string"
}]
searchSettings = {
fields: ['jobcodeId', 'tdesc', 'edesc'],
operator: 'contains',
ignoreCase: false
}
constructor(
private toastr: ToastrService,
private fileService: FileService,
......@@ -32,7 +54,7 @@ export class SubJobCompetencyComponent {
ngOnInit(): void {
this.getListJob();
}
getListJob(){
getListJob() {
this.loading = false
this.jobcodeService.getList().subscribe({
next: response => {
......@@ -52,15 +74,15 @@ export class SubJobCompetencyComponent {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.jobcodeFilter().length / this.pageSize) }, (_, i) => i + 1);
}
edit(item :JobCodeModel){
edit(item: JobCodeModel) {
this.selectJob = new MyJobCodeModel({})
this.selectJob = new MyJobCodeModel(item)
}
clearValue(){
clearValue() {
this.selectJob.competencyWorkText = ''
}
save(){
this.jobcodeService.post(this.selectJob).subscribe((response:any) => {
save() {
this.jobcodeService.post(this.selectJob).subscribe((response: any) => {
if (response.success) {
this.showAlert(response.message, 'success')
this.selectJob = new MyJobCodeModel({})
......@@ -71,8 +93,8 @@ export class SubJobCompetencyComponent {
this.cdr.detectChanges()
})
}
deleteJob(){
this.jobcodeService.delete(this.selectJob).subscribe((response:any) => {
deleteJob() {
this.jobcodeService.delete(this.selectJob).subscribe((response: any) => {
if (response.success) {
this.showAlert(response.message, 'success')
this.selectJob = new MyJobCodeModel({})
......@@ -148,5 +170,5 @@ export class SubJobCompetencyComponent {
}
}
......@@ -4,7 +4,7 @@
<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()">
[(ngModel)]="search">
<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">
......@@ -20,76 +20,14 @@
import
</button>
</div>
<!-- <div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
data-hs-overlay="#sub-command-structure-alert-delete-modal">
<i class="ri-delete-bin-6-line"></i>
Delete
</button>
</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="page px-rem">
<div class="overflow-auto shadow-md rounded-t-md">
<table class="ti-custom-table ti-custom-table-head ti-custom-table-hover table-bordered">
<thead>
<tr>
<ng-container
*ngFor="let item of ['ลำดับ','รหัสงาน','ชื่อลักษณะงาน (ไทย)','ชื่อลักษณะงาน (อังกฤษ)','การจัดการ']; let f = first; let l = last; let i = index">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary !text-center">
<span class="font-size-12px font-weight-700">{{ item }}</span>
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l">
<i class="ti ti-dots-vertical fs-l"></i>
</div>
</th>
</ng-container>
</tr>
</thead>
<tbody *ngIf="loading">
<tr>
<td class="text-center" colspan="100%">
<div *ngFor="let item of [1,2,3]" class="ti-spinner w-8 h-8 text-secondary mx-1" role="status"
aria-label="loading">
<span class="sr-only">Loading...</span>
</div>
</td>
</tr>
</tbody>
<tbody *ngIf="!loading&&!jobcodeFilter().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="!loading&&jobcodeFilter().length">
<tr
*ngFor="let item of jobcodeFilter() |slice:((currentPage-1) * pageSize) : (((currentPage-1) * pageSize) + pageSize);let i = index">
<td class="text-center">
{{((currentPage-1) * pageSize)+(i+1)}}
</td>
<td class="text-center">{{item.jobcodeId}}</td>
<td>{{item.tdesc}}</td>
<td>{{item.edesc}}</td>
<td class="flex justify-center">
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1" (click)="modalStatus='edit';edit(item)"
data-hs-overlay="#sub-job-competency-component-modal-edit"></i>
<!-- <i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="modalStatus='delete';edit(item)"
data-hs-overlay="#company-registration-page-alert-modal"></i> -->
</td>
</tr>
</tbody>
</table>
</div>
<app-pagination [totalItems]="jobcodeFilter().length" [pageSize]="pageSize" (pageChange)="currentPage = $event"
(pageSizeChange)="pageSize = $event;currentPage = 1"></app-pagination>
<app-datagrid-syncfution [searchSettings]="searchSettings" [searchText]="search" [dataSource]="jobCodeList"
[checkBoxSetting]='false' [columns]="columns" modalName="#sub-job-competency-component-modal-edit"
(sendSelectData)="currentModal='edit';edit($event)">
</app-datagrid-syncfution>
</div>
......@@ -185,16 +123,16 @@
</div>
<div class="ti-modal-body ">
<p class="mt-1 text-gray-800 dark:text-white/70">
<ng-container *ngIf="modalStatus=='add'||modalStatus=='edit'">
<ng-container *ngIf="currentModal=='add'||currentModal=='edit'">
ยืนยันการบันทึกข้อมูลหรือไม่
</ng-container>
<ng-container *ngIf="modalStatus=='delete'||modalStatus=='deleteGroup'">
<ng-container *ngIf="currentModal=='delete'">
ยืนยันการลบข้อมูลหรือไม่
</ng-container>
</p>
<div class="flex justify-end mt-2rem mb-1rem">
<ng-container *ngIf="modalStatus=='add'||modalStatus=='edit'">
<ng-container *ngIf="currentModal=='add'||currentModal=='edit'">
<button type="button"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#company-registration-page-alert-modal">
......@@ -205,7 +143,7 @@
บันทึกข้อมูล
</a>
</ng-container>
<ng-container *ngIf="modalStatus=='delete'||modalStatus=='deleteGroup'">
<ng-container *ngIf="currentModal=='delete'">
<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="#company-registration-page-alert-modal">
......
import { ChangeDetectorRef, Component} from '@angular/core';
import { ChangeDetectorRef, Component } from '@angular/core';
import { ColumnModel } from '@syncfusion/ej2-grids';
import { ToastrService } from 'ngx-toastr';
import { JobCodeModel, MyJobCodeModel } from 'src/app/shared/model/job-code.model';
import { FileService } from 'src/app/shared/services/file.service';
......@@ -12,16 +13,37 @@ import { JobCodeService } from 'src/app/shared/services/job-code.service';
export class SubJobPositionIndicatorsComponent {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
pageSize=10
pageSize = 10
search = ""
jobCodeList:JobCodeModel[]=[]
jobCodeList: JobCodeModel[] = []
loading = false
selectedFile: File | null = null;
selectedFileName: string = 'กรุณาเลือกไฟล์';
selectJob:JobCodeModel=new MyJobCodeModel({})
modalStatus=''
selectJob: JobCodeModel = new MyJobCodeModel({})
currentModal: 'add' | 'edit' | 'delete' = "add"
columns: ColumnModel[] = [{
field: "jobcodeId",
headerText: "ชื่อล็อกอิน",
type: "string",
isPrimaryKey: true,
},
{
field: "tdesc",
headerText: "ชื่อลักษณะงาน (ไทย)",
type: "string"
},
{
field: "edesc",
headerText: "ชื่อลักษณะงาน (อังกฤษ)",
type: "string"
}]
searchSettings = {
fields: ['jobcodeId', 'tdesc', 'edesc'],
operator: 'contains',
ignoreCase: false
}
constructor(
private toastr: ToastrService,
private fileService: FileService,
......@@ -31,7 +53,7 @@ export class SubJobPositionIndicatorsComponent {
ngOnInit(): void {
this.getListJob();
}
getListJob(){
getListJob() {
this.loading = false
this.jobcodeService.getList().subscribe({
next: response => {
......@@ -51,15 +73,15 @@ export class SubJobPositionIndicatorsComponent {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.jobcodeFilter().length / this.pageSize) }, (_, i) => i + 1);
}
edit(item :JobCodeModel){
edit(item: JobCodeModel) {
this.selectJob = new MyJobCodeModel({})
this.selectJob = new MyJobCodeModel(item)
}
clearValue(){
clearValue() {
this.selectJob.kpiWorkText = ''
}
save(){
this.jobcodeService.post(this.selectJob).subscribe((response:any) => {
save() {
this.jobcodeService.post(this.selectJob).subscribe((response: any) => {
if (response.success) {
this.showAlert(response.message, 'success')
this.selectJob = new MyJobCodeModel({})
......@@ -70,8 +92,8 @@ export class SubJobPositionIndicatorsComponent {
this.cdr.detectChanges()
})
}
deleteJob(){
this.jobcodeService.delete(this.selectJob).subscribe((response:any) => {
deleteJob() {
this.jobcodeService.delete(this.selectJob).subscribe((response: any) => {
if (response.success) {
this.showAlert(response.message, 'success')
this.selectJob = new MyJobCodeModel({})
......@@ -145,5 +167,4 @@ export class SubJobPositionIndicatorsComponent {
})
}
}
\ No newline at end of file
}
......@@ -4,7 +4,7 @@
<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()">
[(ngModel)]="search">
<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">
......@@ -21,76 +21,14 @@
import
</button>
</div>
<!-- <div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
data-hs-overlay="#sub-command-structure-alert-delete-modal">
<i class="ri-delete-bin-6-line"></i>
Delete
</button>
</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="page px-rem">
<div class="overflow-auto shadow-md rounded-t-md">
<table class="ti-custom-table ti-custom-table-head ti-custom-table-hover table-bordered">
<thead>
<tr>
<ng-container
*ngFor="let item of ['ลำดับ','รหัสงาน','ชื่อลักษณะงาน (ไทย)','ชื่อลักษณะงาน (อังกฤษ)','การจัดการ']; let f = first; let l = last; let i = index">
<th scope="col" class="relative px-10px py-10px bg-soft-secondary text-primary !text-center">
<span class="font-size-12px font-weight-700">{{ item }}</span>
<div class="absolute top-1/2 transform -translate-y-1/2 right-0" *ngIf="!l">
<i class="ti ti-dots-vertical fs-l"></i>
</div>
</th>
</ng-container>
</tr>
</thead>
<tbody *ngIf="loading">
<tr>
<td class="text-center" colspan="100%">
<div *ngFor="let item of [1,2,3]" class="ti-spinner w-8 h-8 text-secondary mx-1" role="status"
aria-label="loading">
<span class="sr-only">Loading...</span>
</div>
</td>
</tr>
</tbody>
<tbody *ngIf="!loading&&!jobcodeFilter().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="!loading&&jobcodeFilter().length">
<tr
*ngFor="let item of jobcodeFilter() |slice:((currentPage-1) * pageSize) : (((currentPage-1) * pageSize) + pageSize);let i = index">
<td class="text-center">
{{((currentPage-1) * pageSize)+(i+1)}}
</td>
<td class="text-center">{{item.jobcodeId}}</td>
<td>{{item.tdesc}}</td>
<td>{{item.edesc}}</td>
<td class="flex justify-center">
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1" (click)="modalStatus='edit';edit(item)"
data-hs-overlay="#sub-job-competency-component-modal-edit"></i>
<!-- <i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="modalStatus='delete';edit(item)"
data-hs-overlay="#company-registration-page-alert-modal"></i> -->
</td>
</tr>
</tbody>
</table>
</div>
<app-pagination [totalItems]="jobcodeFilter().length" [pageSize]="pageSize" (pageChange)="currentPage = $event"
(pageSizeChange)="pageSize = $event;currentPage = 1"></app-pagination>
<app-datagrid-syncfution [searchSettings]="searchSettings" [searchText]="search" [dataSource]="jobCodeList"
[checkBoxSetting]='false' [columns]="columns" modalName="#sub-job-competency-component-modal-edit"
(sendSelectData)="currentModal='edit';edit($event)">
</app-datagrid-syncfution>
</div>
......@@ -196,16 +134,16 @@
</div>
<div class="ti-modal-body ">
<p class="mt-1 text-gray-800 dark:text-white/70">
<ng-container *ngIf="modalStatus=='add'||modalStatus=='edit'">
<ng-container *ngIf="currentModal=='add'||currentModal=='edit'">
ยืนยันการบันทึกข้อมูลหรือไม่
</ng-container>
<ng-container *ngIf="modalStatus=='delete'||modalStatus=='deleteGroup'">
<ng-container *ngIf="currentModal=='delete'">
ยืนยันการลบข้อมูลหรือไม่
</ng-container>
</p>
<div class="flex justify-end mt-2rem mb-1rem">
<ng-container *ngIf="modalStatus=='add'||modalStatus=='edit'">
<ng-container *ngIf="currentModal=='add'||currentModal=='edit'">
<button type="button"
class="hs-dropdown-toggle ti-btn ti-border font-medium bg-white text-gray-700 shadow-sm align-middle hover:bg-gray-50 focus:ring-offset-white focus:ring-primary dark:bg-bgdark dark:hover:bg-black/20 dark:border-white/10 dark:text-white/70 dark:hover:text-white dark:focus:ring-offset-white/10"
data-hs-overlay="#company-registration-page-alert-modal">
......@@ -216,7 +154,7 @@
บันทึกข้อมูล
</a>
</ng-container>
<ng-container *ngIf="modalStatus=='delete'||modalStatus=='deleteGroup'">
<ng-container *ngIf="currentModal=='delete'">
<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="#company-registration-page-alert-modal">
......
import { ChangeDetectorRef, Component} from '@angular/core';
import { ChangeDetectorRef, Component } from '@angular/core';
import { ColumnModel } from '@syncfusion/ej2-grids';
import { ToastrService } from 'ngx-toastr';
import { JobCodeModel, MyJobCodeModel } from 'src/app/shared/model/job-code.model';
import { FileService } from 'src/app/shared/services/file.service';
......@@ -13,16 +14,38 @@ import { JobCodeService } from 'src/app/shared/services/job-code.service';
export class SubJobQualificationsComponent {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
pageSize=10
pageSize = 10
search = ""
jobCodeList:JobCodeModel[]=[]
jobCodeList: JobCodeModel[] = []
loading = false
selectedFile: File | null = null;
selectedFileName: string = 'กรุณาเลือกไฟล์';
selectJob:JobCodeModel=new MyJobCodeModel({})
modalStatus=''
selectJob: JobCodeModel = new MyJobCodeModel({})
currentModal: 'add' | 'edit' | 'delete' = "add"
columns: ColumnModel[] = [{
field: "jobcodeId",
headerText: "ชื่อล็อกอิน",
type: "string",
isPrimaryKey: true,
},
{
field: "tdesc",
headerText: "ชื่อลักษณะงาน (ไทย)",
type: "string"
},
{
field: "edesc",
headerText: "ชื่อลักษณะงาน (อังกฤษ)",
type: "string"
}]
searchSettings = {
fields: ['jobcodeId', 'tdesc', 'edesc'],
operator: 'contains',
ignoreCase: false
}
constructor(
private toastr: ToastrService,
private fileService: FileService,
......@@ -32,12 +55,11 @@ export class SubJobQualificationsComponent {
ngOnInit(): void {
this.getListJob();
}
getListJob(){
getListJob() {
this.loading = false
this.jobcodeService.getList().subscribe({
next: response => {
this.jobCodeList = response.map((x: any) => new MyJobCodeModel(x))
this.jobCodeList = this.jobCodeList.sort((a, b) => a.jobcodeId.localeCompare(b.jobcodeId))
this.loading = false
this.searchChange()
this.cdr.detectChanges()
......@@ -52,18 +74,18 @@ export class SubJobQualificationsComponent {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.jobcodeFilter().length / this.pageSize) }, (_, i) => i + 1);
}
edit(item :JobCodeModel){
edit(item: JobCodeModel) {
this.selectJob = new MyJobCodeModel({})
this.selectJob = new MyJobCodeModel(item)
}
clearValue(){
clearValue() {
this.selectJob.educationExperienceText = ''
this.selectJob.cerLicensedText = ''
this.selectJob.especiallyTrainingText = ''
this.selectJob.otherAbilitiesText = ''
}
save(){
this.jobcodeService.post(this.selectJob).subscribe((response:any) => {
save() {
this.jobcodeService.post(this.selectJob).subscribe((response: any) => {
if (response.success) {
this.showAlert(response.message, 'success')
this.selectJob = new MyJobCodeModel({})
......@@ -74,8 +96,8 @@ export class SubJobQualificationsComponent {
this.cdr.detectChanges()
})
}
deleteJob(){
this.jobcodeService.delete(this.selectJob).subscribe((response:any) => {
deleteJob() {
this.jobcodeService.delete(this.selectJob).subscribe((response: any) => {
if (response.success) {
this.showAlert(response.message, 'success')
this.selectJob = new MyJobCodeModel({})
......@@ -150,5 +172,5 @@ export class SubJobQualificationsComponent {
}
}
}
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