Commit 1208544f by Nattana Chaiyamat

ทะเบียนพนักงาน

parent 20018d57
...@@ -29,6 +29,8 @@ import { Bu4Model, MyBu4Model } from 'src/app/shared/model/bu4.model'; ...@@ -29,6 +29,8 @@ import { Bu4Model, MyBu4Model } from 'src/app/shared/model/bu4.model';
import { Bu5Model, MyBu5Model } from 'src/app/shared/model/bu5.model'; import { Bu5Model, MyBu5Model } from 'src/app/shared/model/bu5.model';
import { Bu6Model, MyBu6Model } from 'src/app/shared/model/bu6.model'; import { Bu6Model, MyBu6Model } from 'src/app/shared/model/bu6.model';
import { Bu7Model, MyBu7Model } from 'src/app/shared/model/bu7.model'; import { Bu7Model, MyBu7Model } from 'src/app/shared/model/bu7.model';
import { EmpStatusService } from 'src/app/shared/services/emp-status.service';
import { StatusModel, MyStatusModel } from 'src/app/shared/model/status.model';
export interface DataEmployee { export interface DataEmployee {
loading: boolean loading: boolean
select: EmployeeModel | any select: EmployeeModel | any
...@@ -83,6 +85,7 @@ export class SubEmployeeRegistrationComponent { ...@@ -83,6 +85,7 @@ export class SubEmployeeRegistrationComponent {
branch: { loading: boolean, dataList: BranchModel[] } = { loading: false, dataList: [] } branch: { loading: boolean, dataList: BranchModel[] } = { loading: false, dataList: [] }
empType: { loading: boolean, dataList: EmpTypeModel[] } = { loading: false, dataList: [] } empType: { loading: boolean, dataList: EmpTypeModel[] } = { loading: false, dataList: [] }
pl: { loading: boolean, dataList: PLModel[] } = { loading: false, dataList: [] } pl: { loading: boolean, dataList: PLModel[] } = { loading: false, dataList: [] }
empStatus: { loading: boolean, dataList: StatusModel[] } = { loading: false, dataList: [] }
constructor(private toastr: ToastrService, constructor(private toastr: ToastrService,
private employeeService: EmployeeService, private employeeService: EmployeeService,
private cdr: ChangeDetectorRef, private cdr: ChangeDetectorRef,
...@@ -98,6 +101,7 @@ export class SubEmployeeRegistrationComponent { ...@@ -98,6 +101,7 @@ export class SubEmployeeRegistrationComponent {
private jobcodeService: JobCodeService, private jobcodeService: JobCodeService,
private branchService: BranchService, private branchService: BranchService,
private empTypeService: EmpTypeService, private empTypeService: EmpTypeService,
private empStatusService: EmpStatusService,
private fileService: FileService, private fileService: FileService,
private pLService: PLService) { } private pLService: PLService) { }
...@@ -116,6 +120,7 @@ export class SubEmployeeRegistrationComponent { ...@@ -116,6 +120,7 @@ export class SubEmployeeRegistrationComponent {
this.getBranchList() this.getBranchList()
this.getEmpTypeList() this.getEmpTypeList()
this.getPlList() this.getPlList()
this.getEmpStatusList()
} }
onFileSelected(event: any) { onFileSelected(event: any) {
this.selectedFile = event.target.files.length > 0 ? event.target.files[0] : null; this.selectedFile = event.target.files.length > 0 ? event.target.files[0] : null;
...@@ -164,6 +169,19 @@ export class SubEmployeeRegistrationComponent { ...@@ -164,6 +169,19 @@ export class SubEmployeeRegistrationComponent {
}) })
} }
getEmpStatusList() {
this.empStatus.loading = false
this.empStatusService.getList().subscribe({
next: response => {
this.empStatus.dataList = response.map((x: any) => new MyStatusModel(x))
this.empStatus.loading = false
this.cdr.detectChanges()
}, error: error => {
this.empStatus.loading = false
this.cdr.detectChanges()
}
})
}
getPlList() { getPlList() {
this.pl.loading = false this.pl.loading = false
this.pLService.getList().subscribe({ this.pLService.getList().subscribe({
...@@ -497,9 +515,13 @@ export class SubEmployeeRegistrationComponent { ...@@ -497,9 +515,13 @@ export class SubEmployeeRegistrationComponent {
} }
selectEmployee(data?: EmployeeModel) { selectEmployee(data?: EmployeeModel) {
if (this.modalType == 'update' && !data) { if (this.modalType == 'update' && !data) {
this.employee.select = { ...new MyEmployeeModel({ employeeId: this.employee.select.employeeId }), dateIso: '' } this.employee.select = { ...new MyEmployeeModel({ employeeId: this.employee.select.employeeId }), dateIso: '', dateEndIso: '' }
this.employee.select.status = new MyStatusModel(this.empStatus.dataList[0])
} else { } else {
this.employee.select = { ...new MyEmployeeModel(data || {}), dateIso: this.toISODate(data?.firstHireDate) } this.employee.select = { ...new MyEmployeeModel(data || {}), dateIso: this.toISODate(data?.firstHireDate), dateEndIso: this.toISODate(data?.resigndate) }
if (!this.employee.select.status.statusCode) {
this.employee.select.status = new MyStatusModel(this.empStatus.dataList[0])
}
} }
} }
changeDate(target: { [key: string]: any }, field: string, dateIso: string) { changeDate(target: { [key: string]: any }, field: string, dateIso: string) {
......
...@@ -158,6 +158,7 @@ import { PmsEvaluationAssessmentService } from 'src/app/shared/services/pms-eval ...@@ -158,6 +158,7 @@ import { PmsEvaluationAssessmentService } from 'src/app/shared/services/pms-eval
import { TimeAttendanceComponent } from '../performance-management-evaluation/time-attendance/time-attendance.component'; import { TimeAttendanceComponent } from '../performance-management-evaluation/time-attendance/time-attendance.component';
import { PmsWorkingTimeService } from 'src/app/shared/services/pms-working-time.service'; import { PmsWorkingTimeService } from 'src/app/shared/services/pms-working-time.service';
import { EvaluationIdpService } from 'src/app/shared/services/evaluation-Idp.service'; import { EvaluationIdpService } from 'src/app/shared/services/evaluation-Idp.service';
import { EmpStatusService } from 'src/app/shared/services/emp-status.service';
export const MY_DATE_FORMATS = { export const MY_DATE_FORMATS = {
parse: { parse: {
...@@ -346,6 +347,7 @@ export class CustomDateAdapter extends NativeDateAdapter { ...@@ -346,6 +347,7 @@ export class CustomDateAdapter extends NativeDateAdapter {
PmsEvaluationAssessmentService, PmsEvaluationAssessmentService,
PmsWorkingTimeService, PmsWorkingTimeService,
EvaluationIdpService, EvaluationIdpService,
EmpStatusService,
{ {
provide: HTTP_INTERCEPTORS, provide: HTTP_INTERCEPTORS,
useClass: HttpRequestInterceptor, useClass: HttpRequestInterceptor,
......
...@@ -111,6 +111,7 @@ export interface EmployeeModel { ...@@ -111,6 +111,7 @@ export interface EmployeeModel {
thFullName: string thFullName: string
engFullName: string engFullName: string
pl: PLModel pl: PLModel
resigndate: string
} }
export class MyEmployeeModel implements EmployeeModel { export class MyEmployeeModel implements EmployeeModel {
...@@ -200,6 +201,7 @@ export class MyEmployeeModel implements EmployeeModel { ...@@ -200,6 +201,7 @@ export class MyEmployeeModel implements EmployeeModel {
thFullName: string thFullName: string
engFullName: string engFullName: string
pl: PLModel pl: PLModel
resigndate: string
constructor(data?: Partial<EmployeeModel>) { constructor(data?: Partial<EmployeeModel>) {
this.employeeId = data?.employeeId || "" this.employeeId = data?.employeeId || ""
this.prefix = new MyPrefixModel(data?.prefix || {}) this.prefix = new MyPrefixModel(data?.prefix || {})
...@@ -287,7 +289,7 @@ export class MyEmployeeModel implements EmployeeModel { ...@@ -287,7 +289,7 @@ export class MyEmployeeModel implements EmployeeModel {
this.thFullName = data?.thFullName || "" this.thFullName = data?.thFullName || ""
this.engFullName = data?.engFullName || "" this.engFullName = data?.engFullName || ""
this.pl = new MyPLModel(data?.workarea || {}) this.pl = new MyPLModel(data?.workarea || {})
this.resigndate = data?.resigndate || ""
} }
} }
...@@ -9,11 +9,11 @@ export class MyStatusModel implements StatusModel { ...@@ -9,11 +9,11 @@ export class MyStatusModel implements StatusModel {
statusType: string statusType: string
tdesc: string tdesc: string
edesc: string edesc: string
constructor(data: Partial<StatusModel>) { constructor(data?: Partial<StatusModel>) {
this.statusCode = data.statusCode || "" this.statusCode = data?.statusCode || ""
this.statusType = data.statusType || "" this.statusType = data?.statusType || ""
this.tdesc = data.tdesc || "" this.tdesc = data?.tdesc || ""
this.edesc = data.edesc || "" this.edesc = data?.edesc || ""
} }
} }
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { StatusModel } from '../model/status.model';
@Injectable({
providedIn: 'root'
})
export class EmpStatusService {
api = "/emp-status"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getList(): Observable<StatusModel[]> {
return this.http.get<StatusModel[]>(this.urlApi + "/lists")
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment