Commit 0c259e86 by Nattana Chaiyamat

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

parent 5b6fe696
......@@ -31,6 +31,7 @@ import { Bu6Model, MyBu6Model } from 'src/app/shared/model/bu6.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';
import { MyBossModel } from 'src/app/shared/model/boss.model';
export interface DataEmployee {
loading: boolean
select: EmployeeModel | any
......@@ -112,12 +113,6 @@ export class SubEmployeeRegistrationComponent {
this.getEmployeeList()
this.getEmpGroupList()
this.getBu1List()
this.getBu2List()
this.getBu3List()
this.getBu4List()
this.getBu5List()
this.getBu6List()
this.getBu7List()
this.getPositionList()
this.getJobcodeList()
this.getBranchList()
......@@ -304,10 +299,24 @@ export class SubEmployeeRegistrationComponent {
x.tdesc.toLowerCase().includes(this.modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.modal.search.toLowerCase()))
}
selectBu1(data?: Bu1Model) {
this.employee.select.bu1 = new MyBu1Model(data)
this.employee.select.bu2 = new MyBu2Model()
this.employee.select.bu3 = new MyBu3Model()
this.employee.select.bu4 = new MyBu4Model()
this.employee.select.bu5 = new MyBu5Model()
this.employee.select.bu6 = new MyBu6Model()
this.employee.select.bu7 = new MyBu7Model()
if (this.employee.select.bu1.bu1id) {
this.getBu2List()
} else {
this.bu2.dataList = []
}
}
getBu2List() {
this.bu2.loading = false
this.bu2Service.getList().subscribe({
this.bu2Service.getListByParent(this.employee.select.bu1.bu1id).subscribe({
next: response => {
this.bu2.dataList = response.map((x: any) => new MyBu2Model(x))
this.bu2.loading = false
......@@ -324,10 +333,23 @@ export class SubEmployeeRegistrationComponent {
x.tdesc.toLowerCase().includes(this.modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.modal.search.toLowerCase()))
}
selectBu2(data?: Bu2Model) {
this.employee.select.bu2 = new MyBu2Model(data)
this.employee.select.bu3 = new MyBu3Model()
this.employee.select.bu4 = new MyBu4Model()
this.employee.select.bu5 = new MyBu5Model()
this.employee.select.bu6 = new MyBu6Model()
this.employee.select.bu7 = new MyBu7Model()
if (this.employee.select.bu2.bu2id) {
this.getBu3List()
} else {
this.bu3.dataList = []
}
}
getBu3List() {
this.bu3.loading = false
this.bu3Service.getList().subscribe({
this.bu3Service.getListByParent(this.employee.select.bu2.bu2id).subscribe({
next: response => {
this.bu3.dataList = response.map((x: any) => new MyBu3Model(x))
this.bu3.loading = false
......@@ -344,10 +366,22 @@ export class SubEmployeeRegistrationComponent {
x.tdesc.toLowerCase().includes(this.modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.modal.search.toLowerCase()))
}
selectBu3(data?: Bu3Model) {
this.employee.select.bu3 = new MyBu3Model(data)
this.employee.select.bu4 = new MyBu4Model()
this.employee.select.bu5 = new MyBu5Model()
this.employee.select.bu6 = new MyBu6Model()
this.employee.select.bu7 = new MyBu7Model()
if (this.employee.select.bu3.bu3id) {
this.getBu4List()
} else {
this.bu4.dataList = []
}
}
getBu4List() {
this.bu4.loading = false
this.bu4Service.getList().subscribe({
this.bu4Service.getListByParent(this.employee.select.bu3.bu3id).subscribe({
next: response => {
this.bu4.dataList = response.map((x: any) => new MyBu4Model(x))
this.bu4.loading = false
......@@ -364,10 +398,21 @@ export class SubEmployeeRegistrationComponent {
x.tdesc.toLowerCase().includes(this.modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.modal.search.toLowerCase()))
}
selectBu4(data?: Bu4Model) {
this.employee.select.bu4 = new MyBu4Model(data)
this.employee.select.bu5 = new MyBu5Model()
this.employee.select.bu6 = new MyBu6Model()
this.employee.select.bu7 = new MyBu7Model()
if (this.employee.select.bu4.bu4id) {
this.getBu5List()
} else {
this.bu5.dataList = []
}
}
getBu5List() {
this.bu5.loading = false
this.bu5Service.getList().subscribe({
this.bu5Service.getListByParent(this.employee.select.bu4.bu4id).subscribe({
next: response => {
this.bu5.dataList = response.map((x: any) => new MyBu5Model(x))
this.bu5.loading = false
......@@ -384,10 +429,20 @@ export class SubEmployeeRegistrationComponent {
x.tdesc.toLowerCase().includes(this.modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.modal.search.toLowerCase()))
}
selectBu5(data?: Bu5Model) {
this.employee.select.bu5 = new MyBu5Model(data)
this.employee.select.bu6 = new MyBu6Model()
this.employee.select.bu7 = new MyBu7Model()
if (this.employee.select.bu5.bu5id) {
this.getBu6List()
} else {
this.bu6.dataList = []
}
}
getBu6List() {
this.bu6.loading = false
this.bu6Service.getList().subscribe({
this.bu6Service.getListByParent(this.employee.select.bu5.bu5id).subscribe({
next: response => {
this.bu6.dataList = response.map((x: any) => new MyBu6Model(x))
this.bu6.loading = false
......@@ -404,10 +459,19 @@ export class SubEmployeeRegistrationComponent {
x.tdesc.toLowerCase().includes(this.modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.modal.search.toLowerCase()))
}
selectBu6(data?: Bu6Model) {
this.employee.select.bu6 = new MyBu6Model(data)
this.employee.select.bu7 = new MyBu7Model()
if (this.employee.select.bu6.bu6id) {
this.getBu7List()
} else {
this.bu7.dataList = []
}
}
getBu7List() {
this.bu7.loading = false
this.bu7Service.getList().subscribe({
this.bu7Service.getListByParent(this.employee.select.bu6.bu6id).subscribe({
next: response => {
this.bu7.dataList = response.map((x: any) => new MyBu7Model(x))
this.bu7.loading = false
......@@ -424,6 +488,9 @@ export class SubEmployeeRegistrationComponent {
x.tdesc.toLowerCase().includes(this.modal.search.toLowerCase()) ||
x.edesc.toLowerCase().includes(this.modal.search.toLowerCase()))
}
selectBu7(data?: Bu7Model) {
this.employee.select.bu7 = new MyBu7Model(data)
}
getEmpGroupList() {
this.empGroup.loading = false
......@@ -518,15 +585,18 @@ export class SubEmployeeRegistrationComponent {
}
selectEmployee(data?: EmployeeModel) {
if (this.modalType == 'update' && !data) {
this.employee.select = { ...new MyEmployeeModel({ employeeId: this.employee.select.employeeId }), dateIso: '', dateEndIso: '' }
this.employee.select = { ...new MyEmployeeModel({ employeeId: this.employee.select.employeeId }), dateIso: '', dateEndIso: '2100-12-31' }
this.employee.select.status = new MyStatusModel(this.empStatus.dataList[0])
} else {
this.employee.select = { ...new MyEmployeeModel(data || {}), dateIso: this.toISODate(data?.firstHireDate), dateEndIso: this.toISODate(data?.resigndate) }
this.employee.select = { ...new MyEmployeeModel(data || {}), dateIso: this.toISODate(data?.firstHireDate), dateEndIso: this.toISODate(data?.resignDate || '2100-12-31') }
if (!this.employee.select.status.statusCode) {
this.employee.select.status = new MyStatusModel(this.empStatus.dataList[0])
}
}
}
selectBoss(data: any) {
this.employee.select.boss = new MyBossModel({ ...data, empType: data.empType.codeId })
}
changeDate(target: { [key: string]: any }, field: string, dateIso: string) {
target[field] = this.toYYYYMMDD(dateIso)
}
......@@ -555,6 +625,7 @@ export class SubEmployeeRegistrationComponent {
selectDataModal(target: { [key: string]: any }, field: string, data: any) {
target[field] = JSON.parse(JSON.stringify(data))
}
showAlert(text: string, type: 'success' | 'error') {
this.toastr[type](text, 'แจ้งเตือน', {
timeOut: 3000,
......@@ -586,7 +657,7 @@ export class SubEmployeeRegistrationComponent {
!this.employee.select.lname ||
!this.employee.select.empGroup.groupId ||
!this.employee.select.firstHireDate ||
!this.employee.select.resigndate ||
!this.employee.select.resignDate ||
!this.employee.select.bu1.bu1id ||
!this.employee.select.bu2.bu2id ||
!this.employee.select.bu3.bu3id ||
......
......@@ -27,18 +27,18 @@ export class MyBossModel implements BossModel {
job: JobCodeModel
thFullName: string
engFullName: string
constructor(data: Partial<BossModel>) {
this.employeeId = data.employeeId || ""
this.prefix = new MyPrefixModel(data.prefix || {})
this.fname = data.fname || ""
this.lname = data.lname || ""
this.efname = data.efname || ""
this.elname = data.elname || ""
this.empType = data.empType || ""
this.empPosition = data.empPosition || ""
this.job = new MyJobCodeModel(data.job || {})
this.thFullName = data.thFullName || ""
this.engFullName = data.engFullName || ""
constructor(data?: Partial<BossModel>) {
this.employeeId = data?.employeeId || ""
this.prefix = new MyPrefixModel(data?.prefix || {})
this.fname = data?.fname || ""
this.lname = data?.lname || ""
this.efname = data?.efname || ""
this.elname = data?.elname || ""
this.empType = data?.empType || ""
this.empPosition = data?.empPosition || ""
this.job = new MyJobCodeModel(data?.job || {})
this.thFullName = data?.thFullName || ""
this.engFullName = data?.engFullName || ""
}
}
......@@ -111,7 +111,7 @@ export interface EmployeeModel {
thFullName: string
engFullName: string
pl: PLModel
resigndate: string
resignDate: string
}
export class MyEmployeeModel implements EmployeeModel {
......@@ -201,7 +201,7 @@ export class MyEmployeeModel implements EmployeeModel {
thFullName: string
engFullName: string
pl: PLModel
resigndate: string
resignDate: string
constructor(data?: Partial<EmployeeModel>) {
this.employeeId = data?.employeeId || ""
this.prefix = new MyPrefixModel(data?.prefix || {})
......@@ -289,7 +289,7 @@ export class MyEmployeeModel implements EmployeeModel {
this.thFullName = data?.thFullName || ""
this.engFullName = data?.engFullName || ""
this.pl = new MyPLModel(data?.workarea || {})
this.resigndate = data?.resigndate || ""
this.resignDate = data?.resignDate || ""
}
}
......@@ -26,4 +26,8 @@ export class AppraisalService {
getBossList(): Observable<AppraisalSubordinateModel[]> {
return this.http.get<AppraisalSubordinateModel[]>(this.urlApi + "/boss/emp")
}
getFormPmsById(evaluationRoundId: string, apsassessy: string): Observable<AppraisalCompentencyModel2> {
return this.http.get<AppraisalCompentencyModel2>(this.urlApi + "/pms/" + evaluationRoundId + "/" + apsassessy)
}
}
\ No newline at end of file
......@@ -5,29 +5,32 @@ import { environment } from 'src/environments/environment';
import { Bu2Model } from '../model/bu2.model';
import { AlertModel } from '../model/alert.model';
@Injectable({
providedIn: 'root'
providedIn: 'root'
})
export class Bu2Service {
api = "/bu2"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getList(): Observable<Bu2Model[]> {
return this.http.get<Bu2Model[]>(this.urlApi + "/lists")
}
getById(bu2id: string): Observable<Bu2Model> {
return this.http.get<Bu2Model>(this.urlApi + "/" + bu2id)
}
post(body: Bu2Model): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: Bu2Model[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete<AlertModel>(this.urlApi, options)
}
api = "/bu2"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getList(): Observable<Bu2Model[]> {
return this.http.get<Bu2Model[]>(this.urlApi + "/lists")
}
getListByParent(bu1id: string): Observable<Bu2Model[]> {
return this.http.get<Bu2Model[]>(environment.baseUrl + "/bu1/parent/" + bu1id)
}
getById(bu2id: string): Observable<Bu2Model> {
return this.http.get<Bu2Model>(this.urlApi + "/" + bu2id)
}
post(body: Bu2Model): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: Bu2Model[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete<AlertModel>(this.urlApi, options)
}
}
......@@ -5,29 +5,32 @@ import { environment } from 'src/environments/environment';
import { Bu3Model } from '../model/bu3.model';
import { AlertModel } from '../model/alert.model';
@Injectable({
providedIn: 'root'
})
export class Bu3Service {
api = "/bu3"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getById(bu3id:string): Observable<Bu3Model> {
return this.http.get<Bu3Model>(this.urlApi + "/" + bu3id)
}
getList(): Observable<Bu3Model[]> {
return this.http.get<Bu3Model[]>(this.urlApi + "/lists")
}
post(body: Bu3Model): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: Bu3Model[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete<AlertModel>(this.urlApi, options)
}
}
\ No newline at end of file
providedIn: 'root'
})
export class Bu3Service {
api = "/bu3"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getById(bu3id: string): Observable<Bu3Model> {
return this.http.get<Bu3Model>(this.urlApi + "/" + bu3id)
}
getListByParent(bu2id: string): Observable<Bu3Model[]> {
return this.http.get<Bu3Model[]>(environment.baseUrl + "/bu2/parent/" + bu2id)
}
getList(): Observable<Bu3Model[]> {
return this.http.get<Bu3Model[]>(this.urlApi + "/lists")
}
post(body: Bu3Model): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: Bu3Model[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete<AlertModel>(this.urlApi, options)
}
}
\ No newline at end of file
......@@ -15,6 +15,9 @@ export class Bu4Service {
getList(): Observable<Bu4Model[]> {
return this.http.get<Bu4Model[]>(this.urlApi + "/lists")
}
getListByParent(bu3id: string): Observable<Bu4Model[]> {
return this.http.get<Bu4Model[]>(environment.baseUrl + "/bu3/parent/" + bu3id)
}
getById(bu4id: string): Observable<Bu4Model> {
return this.http.get<Bu4Model>(this.urlApi + "/" + bu4id)
}
......
......@@ -5,29 +5,32 @@ import { environment } from 'src/environments/environment';
import { Bu5Model } from '../model/bu5.model';
import { AlertModel } from '../model/alert.model';
@Injectable({
providedIn: 'root'
providedIn: 'root'
})
export class Bu5Service {
api = "/bu5"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getList(): Observable<Bu5Model[]> {
return this.http.get<Bu5Model[]>(this.urlApi + "/lists")
}
getById(bu5id: string): Observable<Bu5Model> {
return this.http.get<Bu5Model>(this.urlApi + "/" + bu5id)
}
post(body: Bu5Model): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: Bu5Model[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete<AlertModel>(this.urlApi, options)
}
api = "/bu5"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getList(): Observable<Bu5Model[]> {
return this.http.get<Bu5Model[]>(this.urlApi + "/lists")
}
getListByParent(bu4id: string): Observable<Bu5Model[]> {
return this.http.get<Bu5Model[]>(environment.baseUrl + "/bu4/parent/" + bu4id)
}
getById(bu5id: string): Observable<Bu5Model> {
return this.http.get<Bu5Model>(this.urlApi + "/" + bu5id)
}
post(body: Bu5Model): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
}
delete(body: Bu5Model[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete<AlertModel>(this.urlApi, options)
}
}
......@@ -15,6 +15,9 @@ export class Bu6Service {
getList(): Observable<Bu6Model[]> {
return this.http.get<Bu6Model[]>(this.urlApi + "/lists")
}
getListByParent(bu5id: string): Observable<Bu6Model[]> {
return this.http.get<Bu6Model[]>(environment.baseUrl + "/bu5/parent/" + bu5id)
}
getById(bu6id: string): Observable<Bu6Model> {
return this.http.get<Bu6Model>(this.urlApi + "/" + bu6id)
}
......
......@@ -15,8 +15,11 @@ export class Bu7Service {
getList(): Observable<Bu7Model[]> {
return this.http.get<Bu7Model[]>(this.urlApi + "/lists")
}
getListByParent(bu6id: string): Observable<Bu7Model[]> {
return this.http.get<Bu7Model[]>(environment.baseUrl + "/parent/" + bu6id)
}
getById(bu7id: string): Observable<Bu7Model> {
return this.http.get<Bu7Model>(this.urlApi + "/" + bu7id)
return this.http.get<Bu7Model>(environment.baseUrl + "/bu6/" + bu7id)
}
post(body: Bu7Model): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi, body)
......
......@@ -25033,3 +25033,7 @@ div:where(.swal2-container) div:where(.swal2-validation-message) {
.\!border-red {
border-color: red !important;
}
.\!bg-white{
background-color: white;
}
\ 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