Commit d1d043a6 by Nattana Chaiyamat

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

parents ae904fcd c71538b8
......@@ -16,7 +16,7 @@ import { FileService } from 'src/app/shared/services/file.service';
import { PLService } from 'src/app/shared/services/pl.service';
import { PositionService } from 'src/app/shared/services/position.service';
import { BranchService } from 'src/app/shared/services/่branch.service';
import { JobCodeService } from 'src/app/shared/services/job-code.service';
import { JobCodeService } from 'src/app/shared/services/job-code.service';
export interface DataEmployee {
loading: boolean
select: EmployeeModel | any
......
......@@ -70,7 +70,6 @@ export class SetApproversComponent {
})
}
employee_listFilter() {
console.log(this.employee)
return this.employee_list.filter(x => x.fname.toLowerCase().includes(this.search.toLowerCase()) ||
x.lname.toLowerCase().includes(this.search.toLowerCase()))
}
......@@ -116,7 +115,6 @@ export class SetApproversComponent {
this.page = Array.from({ length: Math.ceil(this.groupapprove_listFilter().length / 10) }, (_, i) => i + 1);
}
groupapprove_listFilter() {
console.log(this.groupapprove)
return this.groupapprove_list.filter(x => x.apsapprove1.employeeId||x.apsapprove2.employeeId||x.apsapprove3.employeeId||x.apsapprove4.employeeId||x.apsapprove5.employeeId.toLowerCase().includes(this.search.toLowerCase()) ||
x.apsapprove1.fname || x.apsapprove1.lname.toLowerCase().includes(this.search.toLowerCase()) ||
x.apsapprove2.fname || x.apsapprove2.lname.toLowerCase().includes(this.search.toLowerCase()) ||
......
......@@ -129,7 +129,7 @@ import { MatInputModule } from '@angular/material/input';
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
import { NativeDateAdapter } from '@angular/material/core';
import { BranchService } from 'src/app/shared/services/่branch.service';
import { JobCodeService } from 'src/app/shared/services/job-code.service';
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';
......
......@@ -78,16 +78,16 @@
</tbody>
<tbody *ngIf="!loading&&jobcodeFilter().length">
<tr
*ngFor="let item of jobcodeFilter() |slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index">
*ngFor="let item of jobcodeFilter() |slice:((currentPage-1) * pageSize) : (((currentPage-1) * pageSize) + pageSize);let i = index">
<td class="text-center">
{{((currentPage-1) * 10)+(i+1)}}
{{((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"
data-hs-overlay="#section-registration-modal-edit"></i>
<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" currentModal='delete'
data-hs-overlay="#section-registration-alert-delete-modal"></i>
</td>
......@@ -125,11 +125,19 @@
<i class="ri-arrow-right-s-line align-middle rtl:rotate-180"></i>
</a>
</li>
<li>
<select class="ti-form-select" [(ngModel)]="pageSize" (ngModelChange)="searchChange()">
<option [value]="10">10</option>
<option [value]="20">20</option>
<option [value]="50">50</option>
<option [value]="100">100</option>
</select>
</li>
</ul>
<ul class="nav-tabs mt-3">
<span>Show {{((currentPage-1) * 10)+1}} to {{jobcodeFilter().length<10 ?jobcodeFilter().length:
(currentPage==page.length ? ((currentPage * 10) - ((currentPage * 10) - jobcodeFilter().length) )
:(currentPage * 10) ) }} of {{jobcodeFilter().length}} items</span>
<span>Show {{((currentPage-1) * pageSize)+1}} to {{(jobcodeFilter().length < pageSize) ?jobcodeFilter().length:
(currentPage==page.length ? ((currentPage * pageSize) - ((currentPage * pageSize) - jobcodeFilter().length) )
:(currentPage * pageSize) ) }} of {{jobcodeFilter().length}} items</span>
</ul>
</nav>
......@@ -180,17 +188,13 @@
</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="001">
<input type="text" id="input-label" class="ti-form-input w-1/2 bg-input-readonly" readonly [(ngModel)]="selectJob.jobcodeId">
<label for="detail_th" class="ti-form-label mt-1rem">ชื่อลักษณะงาน (ไทย)</label>
<input type="text" id="detail_th" class="ti-form-input w-2/3 bg-input-readonly" readonly value="Department Manager1">
<input type="text" id="detail_th" class="ti-form-input w-2/3 bg-input-readonly" readonly [(ngModel)]="selectJob.tdesc">
<label for="detail_eng" class="ti-form-label mt-1rem">ชื่อลักษณะงาน (อังกฤษ)</label>
<input type="text" id="detail_eng" class="ti-form-input w-2/3 bg-input-readonly" readonly value="Department Manager1">
<input type="text" id="detail_eng" class="ti-form-input w-2/3 bg-input-readonly" readonly [(ngModel)]="selectJob.edesc">
<label for="detail_eng" class="ti-form-label mt-2rem">ความรู้ ทักษะ ความสามารถในตำเเหน่งงาน ( Job Competency)</label>
<textarea type="text" id="detail_eng" class="ti-form-input font-bold" rows="5" cols="50">1.
2.
3.
4.
5.</textarea>
<textarea type="text" id="detail_eng" class="ti-form-input font-bold" rows="5" cols="50" [(ngModel)]="selectJob.competencyWorkText"></textarea>
<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"
......@@ -198,7 +202,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-job-competency-component-alert-edit-modal">
data-hs-overlay="#company-registration-page-alert-modal">
บันทึกข้อมูล
</a>
</div>
......@@ -208,16 +212,16 @@
</div>
</div>
<div id="sub-job-competency-component-alert-edit-modal" class="hs-overlay hidden ti-modal">
<div id="company-registration-page-alert-modal" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out h-[calc(100%-3.5rem)] flex items-center">
<div class="max-h-full overflow-hidden ti-modal-content-alert w-full">
<div class="max-h-full overflow-hidden ti-modal-content w-full">
<div class="ti-modal-header">
<h3 class="text-xxl font-bold text-primary">
แจ้งเตือน
</h3>
<div class="flex justify-end">
<button type="button" class="hs-dropdown-toggle ti-modal-clode-btn text-danger"
data-hs-overlay="#sub-job-competency-component-alert-edit-modal">
data-hs-overlay="#company-registration-page-alert-modal">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
......@@ -225,59 +229,42 @@
</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>
<ng-container *ngIf="modalStatus=='delete'||modalStatus=='deleteGroup'">
ยืนยันการลบข้อมูลหรือไม่
</ng-container>
</p>
<div class="flex justify-end mt-2rem mb-1rem">
<ng-container *ngIf="modalStatus=='add'||modalStatus=='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="#sub-job-competency-component-modal-edit">
data-hs-overlay="#company-registration-page-modal">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-job-competency-component-alert-edit-modal" (click)="showSuccessEdit()">
data-hs-overlay="#company-registration-page-alert-modal" (click)="save()">
บันทึกข้อมูล
</a>
</div>
</div>
</div>
</div>
</div>
<div id="sub-job-competency-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="#sub-job-competency-component-alert-delete-modal">
<span class="sr-only">Close</span>
<i class="ti ti-circle-x fs-xxl"></i>
</button>
</div>
</div>
<div class="ti-modal-body ">
<p class="mt-1 text-gray-800 dark:text-white/70">
ยืนยันการลบข้อมูลหรือไม่!
</p>
<div class="flex justify-end mt-2rem mb-1rem">
</ng-container>
<ng-container *ngIf="modalStatus=='delete'||modalStatus=='deleteGroup'">
<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="#sub-job-competency-component-alert-delete-modal">
data-hs-overlay="#company-registration-page-alert-modal">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-job-competency-component-alert-delete-modal" (click)="showSuccessDelete()">
<a class="ti-btn ti-btn-danger" href="javascript:void(0);"
data-hs-overlay="#company-registration-page-alert-modal" (click)="deleteCompany()">
ลบข้อมูล
</a>
</ng-container>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="supjob-upload-modal" class="hs-overlay hidden ti-modal">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
......
......@@ -3,7 +3,7 @@ import { ToastrService } from 'ngx-toastr';
import { JobCodeModel, MyJobCodeModel } from 'src/app/shared/model/job-code.model';
import { JobModel, MyJobModel } from 'src/app/shared/model/job.model';
import { FileService } from 'src/app/shared/services/file.service';
import { JobCodeService } from 'src/app/shared/services/job-code.service';
import { JobCodeService } from 'src/app/shared/services/job-code.service';
@Component({
......@@ -14,12 +14,16 @@ 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
search = ""
jobCodeList:JobCodeModel[]=[]
loading = false
selectedFile: File | null = null;
selectedFileName: string = 'กรุณาเลือกไฟล์';
selectJob:JobCodeModel=new MyJobCodeModel({})
modalStatus=''
constructor(
private toastr: ToastrService,
private fileService: FileService,
......@@ -34,7 +38,7 @@ export class SubJobCompetencyComponent {
this.jobcodeService.getList().subscribe({
next: response => {
this.jobCodeList = response.map((x: any) => new MyJobCodeModel(x))
console.log("🚀 ~ SubJobCompetencyComponent ~ this.jobcodeService.getList ~ this.jobCodeList:", this.jobCodeList)
this.jobCodeList = this.jobCodeList.sort((a, b) => a.jobcodeId.localeCompare(b.jobcodeId))
this.loading = false
this.searchChange()
this.cdr.detectChanges()
......@@ -47,9 +51,27 @@ export class SubJobCompetencyComponent {
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.jobcodeFilter().length / 10) }, (_, i) => i + 1);
this.page = Array.from({ length: Math.ceil(this.jobcodeFilter().length / this.pageSize) }, (_, i) => i + 1);
}
edit(item :JobCodeModel){
this.selectJob = new MyJobCodeModel({})
this.selectJob = new MyJobCodeModel(item)
}
save(){
this.jobcodeService.post(this.selectJob).subscribe((response:any) => {
if (response.success) {
this.showAlert(response.message, 'success')
this.selectJob = new MyJobCodeModel({})
this.getListJob();
} else {
this.showAlert(response.message, 'error')
}
this.cdr.detectChanges()
})
}
deleteCompany(){
}
jobcodeFilter() {
return this.jobCodeList.filter(x =>
x.tdesc.toLowerCase().includes(this.search.toLowerCase()) ||
......@@ -69,19 +91,19 @@ export class SubJobCompetencyComponent {
}
const formData = new FormData();
formData.append('file', this.selectedFile);
// this.bu3ListLoading = true
this.loading = true
this.fileService.upload(formData, 'MJOBCODE_COMPETENCY').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
// this.getBu3List()
this.getListJob();
} else {
this.showAlert(response.message, 'error')
// this.bu3ListLoading = false
this.loading = false
}
}, error: error => {
this.showAlert(error.message, 'error')
// this.bu3ListLoading = false
this.loading = false
}
})
}
......
......@@ -32,6 +32,7 @@ export interface JobCodeModel {
equalification: string
jobObjective: string
supervisor: string
competencyWorkText: string
}
export class MyJobCodeModel implements JobCodeModel {
......@@ -58,6 +59,7 @@ export class MyJobCodeModel implements JobCodeModel {
equalification: string
jobObjective: string
supervisor: string
competencyWorkText: string
constructor(data: Partial<JobCodeModel>) {
this.jobcodeId = data.jobcodeId || ""
this.tdesc = data.tdesc || ""
......@@ -82,6 +84,7 @@ export class MyJobCodeModel implements JobCodeModel {
this.equalification = data.equalification || ""
this.jobObjective = data.jobObjective || ""
this.supervisor = data.supervisor || ""
this.competencyWorkText = data.competencyWorkText || ""
}
}
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { HttpClient, HttpHeaders } from '@angular/common/http';
......@@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { JobCodeModel } from '../model/job-code.model';
import { AlertModel } from '../model/alert.model';
@Injectable({
providedIn: 'root'
......@@ -18,9 +19,9 @@ export class JobCodeService {
getById(jobcodeId: string): Observable<JobCodeModel> {
return this.http.get<JobCodeModel>(this.urlApi + "/" + jobcodeId)
}
// post(body: JobCodeModel): Observable<AlertModel> {
// return this.http.post<AlertModel>(this.urlApi, body)
// }
post(body: JobCodeModel): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
// delete(body: JobCodeModel | JobCodeModel[]): Observable<AlertModel> {
// const options = {
// headers: new HttpHeaders({
......
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