Commit fb87715a by Nattana Chaiyamat

การประเมินจัดการประสิทธิภาพ > รอบการประเมิน > รอบการประเมิน

parent 665ab5cd
......@@ -223,7 +223,7 @@
<div class="w-full flex justify-end">
<div class="absolute flex">
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md" (click)="clear()">
<svg class="svg-indigo" width="16" height="16" viewBox="0 0 64.00 64.00"
xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#595BEA" stroke-width="3.84"
transform="rotate(45)matrix(-1, 0, 0, 1, 0, 0)">
......
......@@ -163,6 +163,14 @@ export class EvaluationCycleComponent {
positionClass: 'toast-top-right',
});
}
clear() {
if (this.modalStatus == 'add') {
this.setData()
} else if (this.modalStatus == 'edit') {
this.setData(new MyEvaluationCycleModel({ evaluationRoundId: this.dataSelect.evaluationRoundId }))
}
}
}
......@@ -143,6 +143,7 @@ import { PmstopicService } from 'src/app/shared/services/pmstopic.service';
import { PmsGroupAssessmentService } from 'src/app/shared/services/pms-group-assessment.service';
import { PmsGroupApproveService } from 'src/app/shared/services/pms-group-approve.service';
import { PmsEaluationFactorsService } from 'src/app/shared/services/pms-ealuation-factors.service';
import { PmsMasfromEvaluationCycleService } from 'src/app/shared/services/pms-masfrom-evaluation.service';
export const MY_DATE_FORMATS = {
parse: {
......@@ -316,6 +317,7 @@ export class CustomDateAdapter extends NativeDateAdapter {
PmsGroupAssessmentService,
PmsGroupApproveService,
PmsEaluationFactorsService,
PmsMasfromEvaluationCycleService,
{
provide: HTTP_INTERCEPTORS,
useClass: HttpRequestInterceptor,
......
......@@ -80,22 +80,23 @@
</td>
</tr>
</tbody>
<tbody *ngIf="!dataLoading&&!evaluation_cycleListFilter().length">
<tbody *ngIf="!dataLoading&&!pmsMasfromEvaluationCycleFilter().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="!dataLoading&&evaluation_cycleListFilter().length">
<tbody *ngIf="!dataLoading&&pmsMasfromEvaluationCycleFilter().length">
<tr
*ngFor="let item of evaluation_cycleListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index">
*ngFor="let item of pmsMasfromEvaluationCycleFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index">
<td class="text-center">
<input type="checkbox" class="ti-form-checkbox cursor-pointer" id="checkbox-{{item.data.evaluationRoundId}}"
[(ngModel)]="item.check" (ngModelChange)="dataListCheck()">
<input type="checkbox" class="ti-form-checkbox cursor-pointer"
id="checkbox-{{item.data.pmsEvaluationRoundId}}" [(ngModel)]="item.check"
(ngModelChange)="dataListCheck()">
</td>
<td>
<label for="checkbox-{{item.data.evaluationRoundId}}">&nbsp;{{item.data.evaluationRoundId}}</label>
<label for="checkbox-{{item.data.pmsEvaluationRoundId}}">&nbsp;{{item.data.pmsEvaluationRoundId}}</label>
</td>
<td>{{item.data.tdesc}}</td>
<td>{{item.data.apsyear}}</td>
......@@ -136,7 +137,8 @@
<td class="flex justify-center items-center">
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1" (click)="modalStatus='edit';setData(item.data)"
data-hs-overlay="#management-evaluation-cycle-page-modal"></i>
<i class="ti ti-user cursor-pointer i-gray fs-l px-1" data-hs-overlay="#management-evaluation-cycle-person-modal"></i>
<i class="ti ti-user cursor-pointer i-gray fs-l px-1"
data-hs-overlay="#management-evaluation-cycle-person-modal"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="modalStatus='delete';setData(item.data)"
data-hs-overlay="#management-evaluation-cycle-page-alert-modal"></i>
<!-- <span class="badge text-white m-1" *ngIf="item.data.statusCode.code!='1'"
......@@ -197,10 +199,10 @@
</li>
</ul>
<ul class="nav-tabs mt-3">
<span>Show {{((currentPage-1) * 10)+1}} to {{evaluation_cycleListFilter().length<10
?evaluation_cycleListFilter().length: (currentPage==page.length ? ((currentPage * 10) - ((currentPage * 10) -
evaluation_cycleListFilter().length) ) :(currentPage * 10) ) }} of {{evaluation_cycleListFilter().length}}
items</span>
<span>Show {{((currentPage-1) * 10)+1}} to {{pmsMasfromEvaluationCycleFilter().length<10
?pmsMasfromEvaluationCycleFilter().length: (currentPage==page.length ? ((currentPage * 10) - ((currentPage *
10) - pmsMasfromEvaluationCycleFilter().length) ) :(currentPage * 10) ) }} of
{{pmsMasfromEvaluationCycleFilter().length}} items</span>
</ul>
</nav>
</div>
......@@ -223,7 +225,7 @@
<div class="w-full flex justify-end">
<div class="absolute flex">
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md" (click)="clear()">
<svg class="svg-indigo" width="16" height="16" viewBox="0 0 64.00 64.00"
xmlns="http://www.w3.org/2000/svg" fill="none" stroke="#595BEA" stroke-width="3.84"
transform="rotate(45)matrix(-1, 0, 0, 1, 0, 0)">
......@@ -251,7 +253,7 @@
<label for="input-label" class="ti-form-label mt-2rem">รหัส รอบการประเมิน*</label>
<input type="text" id="input-label" class="ti-form-input w-1/2"
[ngClass]="{'bg-input-readonly':modalStatus=='edit'}" [readonly]="modalStatus=='edit'"
[(ngModel)]="dataSelect.evaluationRoundId">
[(ngModel)]="dataSelect.pmsEvaluationRoundId">
<label for="detail_th" class="ti-form-label mt-2rem">รายละเอียดฝ่าย (ไทย)*</label>
<input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="dataSelect.tdesc">
......@@ -275,9 +277,10 @@
data-hs-overlay="#management-evaluation-cycle-page-modal">
ย้อนกลับ
</button>
<button type="button" class="ti-btn ti-btn-success" data-hs-overlay="#management-evaluation-cycle-page-alert-modal"
[class.ti-btn-disabled]="!dataSelect.evaluationRoundId||!dataSelect.tdesc||!dataSelect.apsyear||!dataSelect.apsPeriodStart||!dataSelect.apsPeriodEnd"
[disabled]="!dataSelect.evaluationRoundId||!dataSelect.tdesc||!dataSelect.apsyear||!dataSelect.apsPeriodStart||!dataSelect.apsPeriodEnd">
<button type="button" class="ti-btn ti-btn-success"
data-hs-overlay="#management-evaluation-cycle-page-alert-modal"
[class.ti-btn-disabled]="!dataSelect.pmsEvaluationRoundId||!dataSelect.tdesc||!dataSelect.apsyear||!dataSelect.apsPeriodStart||!dataSelect.apsPeriodEnd"
[disabled]="!dataSelect.pmsEvaluationRoundId||!dataSelect.tdesc||!dataSelect.apsyear||!dataSelect.apsPeriodStart||!dataSelect.apsPeriodEnd">
บันทึกข้อมูล
</button>
</div>
......@@ -328,7 +331,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#management-evaluation-cycle-page-alert-modal" (click)="addevaluation_cycle()">
data-hs-overlay="#management-evaluation-cycle-page-alert-modal" (click)="addPmsMasfromEvaluation()">
บันทึกข้อมูล
</a>
</ng-container>
......@@ -339,7 +342,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-danger" href="javascript:void(0);"
data-hs-overlay="#management-evaluation-cycle-page-alert-modal" (click)="deleteevaluation_cycle()">
data-hs-overlay="#management-evaluation-cycle-page-alert-modal" (click)="deletePmsMasfromEvaluation()">
ลบข้อมูล
</a>
</ng-container>
......
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { EvaluationCycleModel, MyEvaluationCycleModel } from 'src/app/shared/model/evaluation-cycle.model';
import { MyStatusCodeModel, StatusCodeModel } from 'src/app/shared/model/status-code.model';
import { EvaluationCycleService } from 'src/app/shared/services/evaluation-cycle.service';
export interface DataModel {
evaluationRoundId: string;
tdesc: string;
edesc: string;
apsyear: string;
apsPeriodStart: string;
apsPeriodEnd: string;
statusCode: StatusCodeModel;
}
import { MyPmsMasfromEvaluationModel, PmsMasfromEvaluationModel } from 'src/app/shared/model/pms-masfrom-evaluation.model';
import { PmsMasfromEvaluationCycleService } from 'src/app/shared/services/pms-masfrom-evaluation.service';
@Component({
selector: 'app-management-evaluation-cycle',
templateUrl: './management-evaluation-cycle.component.html',
......@@ -24,40 +15,32 @@ export class ManagementCycleComponent {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
search = ""
modalStatus = 'add'
evaluation_cyclelist: { check: boolean, data: DataModel }[] = []
evaluation_cycle: EvaluationCycleModel = new MyEvaluationCycleModel({})
modalStatus: 'add' | 'edit' | 'delete' | 'deleteGroup' = 'add'
pmsMasfromEvaluationlist: { check: boolean, data: PmsMasfromEvaluationModel }[] = []
pmsMasfromEvaluation: PmsMasfromEvaluationModel = new MyPmsMasfromEvaluationModel({})
dataLoading = false
dataSelect: DataModel = { evaluationRoundId: "", tdesc: "", edesc: "", apsyear: "", apsPeriodStart: "", apsPeriodEnd: "", statusCode: new MyStatusCodeModel({}) }
itemToDelete: EvaluationCycleModel | null = null;
dataSelect: PmsMasfromEvaluationModel = new MyPmsMasfromEvaluationModel()
itemToDelete: PmsMasfromEvaluationModel | null = null;
isDataListChecked = false
isDataListCheckedAll = false
numDataListChecked = 0
constructor(private evaluationCycleService: EvaluationCycleService,
constructor(private pmsMasfromEvaluationCycleService: PmsMasfromEvaluationCycleService,
private toastr: ToastrService,
private cdr: ChangeDetectorRef
) { }
ngOnInit(): void {
this.getEvaluationCycleList()
this.getPmsMasfromEvaluationCycleList()
}
getEvaluationCycleList() {
getPmsMasfromEvaluationCycleList() {
this.dataLoading = true
this.evaluationCycleService.getList().subscribe({
this.pmsMasfromEvaluationCycleService.getList().subscribe({
next: response => {
this.evaluation_cyclelist = response.map(x => ({
this.pmsMasfromEvaluationlist = 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 || {})
}
data: new MyPmsMasfromEvaluationModel(x)
}));
this.dataLoading = false
......@@ -74,47 +57,39 @@ export class ManagementCycleComponent {
}
dataListCheckAll() {
const selectAll = this.isDataListCheckedAll;
this.evaluation_cycleListFilter().forEach(x => x.check = selectAll);
this.pmsMasfromEvaluationCycleFilter().forEach(x => x.check = selectAll);
this.dataListCheck();
}
dataListCheck() {
const dataCheck = this.evaluation_cycleListFilter();
const dataCheck = this.pmsMasfromEvaluationCycleFilter();
this.isDataListCheckedAll = dataCheck.length ? dataCheck.every(x => x.check) : false;
this.numDataListChecked = this.evaluation_cyclelist.filter(x => x.check).length;
this.numDataListChecked = this.pmsMasfromEvaluationlist.filter(x => x.check).length;
this.isDataListChecked = Boolean(this.numDataListChecked)
}
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.evaluation_cycleListFilter().length / 10) }, (_, i) => i + 1);
this.page = Array.from({ length: Math.ceil(this.pmsMasfromEvaluationCycleFilter().length / 10) }, (_, i) => i + 1);
this.dataListCheck()
}
evaluation_cycleListFilter() {
return this.evaluation_cyclelist.filter(x => {
pmsMasfromEvaluationCycleFilter() {
return this.pmsMasfromEvaluationlist.filter(x => {
const data = x.data
const match = data.evaluationRoundId.toLowerCase().includes(this.search.toLowerCase()) || data.tdesc.toLowerCase().includes(this.search.toLowerCase()) || data.edesc.toLowerCase().includes(this.search.toLowerCase());
const match = data.pmsEvaluationRoundId.toLowerCase().includes(this.search.toLowerCase()) || data.tdesc.toLowerCase().includes(this.search.toLowerCase()) || data.edesc.toLowerCase().includes(this.search.toLowerCase());
return match;
});
}
setData(data?: DataModel) {
this.dataSelect = JSON.parse(JSON.stringify(data || {
evaluationRoundId: "",
tdesc: "",
edesc: "",
apsyear: "",
apsPeriodStart: "",
apsPeriodEnd: "",
statusCode: new MyStatusCodeModel({})
}));
setData(data?: PmsMasfromEvaluationModel) {
this.dataSelect = new MyPmsMasfromEvaluationModel(data)
}
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 })
addPmsMasfromEvaluation() {
const body = new MyPmsMasfromEvaluationModel(this.dataSelect)
this.dataLoading = true
this.evaluationCycleService.post(body).subscribe({
this.pmsMasfromEvaluationCycleService.post(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.getEvaluationCycleList()
this.getPmsMasfromEvaluationCycleList()
} else {
this.dataLoading = false
this.showAlert(response.message, 'error')
......@@ -128,19 +103,19 @@ export class ManagementCycleComponent {
})
}
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 })
deletePmsMasfromEvaluation() {
let body: PmsMasfromEvaluationModel | PmsMasfromEvaluationModel[] = []
if (this.dataSelect.pmsEvaluationRoundId) {
body = new MyPmsMasfromEvaluationModel(this.dataSelect)
} 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 }))
body = this.pmsMasfromEvaluationlist.filter(x => x.check).map(x => new MyPmsMasfromEvaluationModel(x.data))
}
this.dataLoading = true
this.evaluationCycleService.delete(body).subscribe({
this.pmsMasfromEvaluationCycleService.delete(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.getEvaluationCycleList()
this.getPmsMasfromEvaluationCycleList()
} else {
this.dataLoading = false
this.showAlert(response.message, 'error')
......@@ -161,6 +136,13 @@ export class ManagementCycleComponent {
positionClass: 'toast-top-right',
});
}
clear() {
if (this.modalStatus == 'add') {
this.setData()
} else if (this.modalStatus == 'edit') {
this.setData(new MyPmsMasfromEvaluationModel({ pmsEvaluationRoundId: this.dataSelect.pmsEvaluationRoundId }))
}
}
}
......@@ -57,14 +57,14 @@ export class DefineEvaluationFactorsComponent {
}
savePmsEaluationFactors() {
this.pmsEaluationFactors.loading = true
this.pmsEaluationFactors.dataList = this.pmsEaluationFactors.dataList.map(x => new MyPmsEvaluationFactorsModel({
const body = this.pmsEaluationFactors.dataList.map(x => new MyPmsEvaluationFactorsModel({
...x,
pmsEvaluationFactors1ModelList: x.pmsEvaluationFactors1ModelList.map(y => new MyPmsEaluationFactors1Model({
...y,
pmsScore: +(y.pmsScore)
}))
}))
this.pmsEaluationFactorsService.post(this.pmsEaluationFactors.dataList).subscribe({
this.pmsEaluationFactorsService.post(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
......
import { MyStatusCodeModel, StatusCodeModel } from "./status-code.model";
export interface PmsMasfromEvaluationModel {
pmsEvaluationRoundId: string
companyId: string
tdesc: string
edesc: string
apsyear: string
apsPeriodStart: string
apsPeriodEnd: string
statusCode: StatusCodeModel
}
export class MyPmsMasfromEvaluationModel implements PmsMasfromEvaluationModel {
pmsEvaluationRoundId: string
companyId: string
tdesc: string
edesc: string
apsyear: string
apsPeriodStart: string
apsPeriodEnd: string
statusCode: StatusCodeModel
constructor(data?: Partial<PmsMasfromEvaluationModel>) {
this.pmsEvaluationRoundId = data?.pmsEvaluationRoundId || "";
this.companyId = data?.companyId || "";
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)
}
}
......@@ -9,9 +9,9 @@ export class MyStatusCodeModel implements StatusCodeModel {
tdesc: string;
edesc: string;
constructor(data: Partial<StatusCodeModel>) {
this.code = data.code || "";
this.tdesc = data.tdesc || "";
this.edesc = data.edesc || "";
}
constructor(data?: Partial<StatusCodeModel>) {
this.code = data?.code || "";
this.tdesc = data?.tdesc || "";
this.edesc = data?.edesc || "";
}
}
\ No newline at end of file
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 { PmsMasfromEvaluationModel } from '../model/pms-masfrom-evaluation.model';
@Injectable({
providedIn: 'root'
})
export class PmsMasfromEvaluationCycleService {
api = "/pms-masfrom-evaluation"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getList(): Observable<PmsMasfromEvaluationModel[]> {
return this.http.get<PmsMasfromEvaluationModel[]>(this.urlApi + "/lists")
}
getById(pmsEvaluationRoundId: string): Observable<PmsMasfromEvaluationModel> {
return this.http.get<PmsMasfromEvaluationModel>(this.urlApi + "/" + pmsEvaluationRoundId)
}
post(body: PmsMasfromEvaluationModel): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: PmsMasfromEvaluationModel | PmsMasfromEvaluationModel[]): 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