Commit 59eeeefd by Nattana Chaiyamat

ทะเบียนบริษัท ลบหลายอัน

parent cdbb9d74
import { ChangeDetectorRef, Component } from '@angular/core'; import { ChangeDetectorRef, Component } from '@angular/core';
import { ToastrService } from 'ngx-toastr'; import { ToastrService } from 'ngx-toastr';
import { MyCompanyModel } from 'src/app/shared/model/company.model'; import { CompanyModel, MyCompanyModel } from 'src/app/shared/model/company.model';
import { CompanyService } from 'src/app/shared/services/company.service'; import { CompanyService } from 'src/app/shared/services/company.service';
export interface DataModel { export interface DataModel {
code: string code: string
...@@ -64,25 +64,42 @@ export class CompanyRegistrationPageComponent { ...@@ -64,25 +64,42 @@ export class CompanyRegistrationPageComponent {
addCompany() { addCompany() {
const body = new MyCompanyModel({ companyId: this.dataSelect.code, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, addressText: this.dataSelect.address, descOther: this.dataSelect.contact }) const body = new MyCompanyModel({ companyId: this.dataSelect.code, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, addressText: this.dataSelect.address, descOther: this.dataSelect.contact })
this.companyService.post(body).subscribe((response: any) => { this.companyService.post(body).subscribe({
next: response => {
if (response.success) { if (response.success) {
this.showSuccess() this.showAlert(response.message, 'success')
this.getCompanyList() this.getCompanyList()
} else {
this.showAlert(response.message, 'error')
}
}, error: error => {
this.showAlert(error.message, 'error')
} }
}) })
} }
deleteCompany() { deleteCompany() {
const body = new MyCompanyModel({ companyId: this.dataSelect.code, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, addressText: this.dataSelect.address, descOther: this.dataSelect.contact }) let body: CompanyModel | CompanyModel[] = []
this.companyService.delete(body).subscribe((response: any) => { if (this.dataSelect.code) {
body = new MyCompanyModel({ companyId: this.dataSelect.code, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, addressText: this.dataSelect.address, descOther: this.dataSelect.contact })
} else {
body = this.dataList.filter(x => x.check).map(x => new MyCompanyModel({ companyId: x.data.code, tdesc: x.data.tdesc, edesc: x.data.edesc, addressText: x.data.address, descOther: x.data.contact }))
}
this.companyService.delete(body).subscribe({
next: response => {
if (response.success) { if (response.success) {
this.showSuccess() this.showAlert(response.message, 'success')
this.getCompanyList() this.getCompanyList()
} else {
this.showAlert(response.message, 'error')
}
}, error: error => {
this.showAlert(error.message, 'error')
} }
}) })
} }
showSuccess() { showAlert(text: string, type: 'success' | 'error') {
this.toastr.success('บันทึกข้อมูลสำเร็จ', 'แจ้งเตือน', { this.toastr[type](text, 'แจ้งเตือน', {
timeOut: 3000, timeOut: 3000,
positionClass: 'toast-top-right', positionClass: 'toast-top-right',
}); });
......
...@@ -11,22 +11,23 @@ ...@@ -11,22 +11,23 @@
<a class="font-size-16px font-weight-500 hs-tab-active:font-weight-700 hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 hover:text-secondary active" <a class="font-size-16px font-weight-500 hs-tab-active:font-weight-700 hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 hover:text-secondary active"
href="javascript:void(0);" id="underline-item-1" data-hs-tab="#underline-1" href="javascript:void(0);" id="underline-item-1" data-hs-tab="#underline-1"
aria-controls="underline-1" aria-controls="underline-1"
(click)="pathTitle = ['การจัดการข้อมูลองค์กร', 'ทะเบียนบริษัท','ทะเบียนบริษัท']"> (click)="pathTitle = ['การจัดการข้อมูลองค์กร', 'ทะเบียนบริษัท','ทะเบียนบริษัท'];currentPath=1">
ทะเบียนบริษัท ทะเบียนบริษัท
</a> </a>
<a class="font-size-16px font-weight-500 hs-tab-active:font-weight-700 hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 px-1 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 hover:text-secondary" <a class="font-size-16px font-weight-500 hs-tab-active:font-weight-700 hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 px-1 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 hover:text-secondary"
href="javascript:void(0);" id="underline-item-2" data-hs-tab="#underline-2" href="javascript:void(0);" id="underline-item-2" data-hs-tab="#underline-2"
aria-controls="underline-2" aria-controls="underline-2"
(click)="pathTitle = ['การจัดการข้อมูลองค์กร', 'ทะเบียนบริษัท','สาขาและหน่วยธุรกิจ' ,'ทะเบียนฝ่าย']"> (click)="pathTitle = ['การจัดการข้อมูลองค์กร', 'ทะเบียนบริษัท','สาขาและหน่วยธุรกิจ' ,'ทะเบียนฝ่าย'];currentPath=2">
สาขาและหน่วยธุรกิจ สาขาและหน่วยธุรกิจ
</a> </a>
</nav> </nav>
</div> </div>
<div class="mt-3 px-2rem !-mt-3 pt-50px"> <div class="mt-3 px-2rem !-mt-3 pt-50px">
<div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1"> <div *ngIf="currentPath==1" id="underline-1" role="tabpanel" aria-labelledby="underline-item-1">
<app-company-registration-page></app-company-registration-page> <app-company-registration-page></app-company-registration-page>
</div> </div>
<div id="underline-2" class="hidden" role="tabpanel" aria-labelledby="underline-item-2"> <div *ngIf="currentPath==2" id="underline-2" class="hidden" role="tabpanel"
aria-labelledby="underline-item-2">
<app-branch-business-unit [pathTitle]="pathTitle" <app-branch-business-unit [pathTitle]="pathTitle"
(sendPathTitle)="pathTitle=$event"></app-branch-business-unit> (sendPathTitle)="pathTitle=$event"></app-branch-business-unit>
</div> </div>
......
...@@ -7,4 +7,5 @@ import { Component } from '@angular/core'; ...@@ -7,4 +7,5 @@ import { Component } from '@angular/core';
}) })
export class CompanyRegistrationComponent { export class CompanyRegistrationComponent {
pathTitle = ['การจัดการข้อมูลองค์กร', 'ทะเบียนบริษัท', 'ทะเบียนบริษัท'] pathTitle = ['การจัดการข้อมูลองค์กร', 'ทะเบียนบริษัท', 'ทะเบียนบริษัท']
currentPath = 1
} }
...@@ -17,8 +17,7 @@ ...@@ -17,8 +17,7 @@
</div> </div>
<div class="mt-3 px-3rem !-mt-3 pt-50px"> <div class="mt-3 px-3rem !-mt-3 pt-50px">
<div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1"> <div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1">
<app-sub-employee-registration [pathTitle]="pathTitle" <app-sub-employee-registration></app-sub-employee-registration>
(sendPathTitle)="pathTitle=$event"></app-sub-employee-registration>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -75,14 +75,14 @@ ...@@ -75,14 +75,14 @@
['KC001', 'กรวิภา','ชัยสวัสดิ์','Service Forkift','FAC Store R/M Unit'], ['KC001', 'กรวิภา','ชัยสวัสดิ์','Service Forkift','FAC Store R/M Unit'],
['KC002', 'กสินธร','สีปัญญา','พนักงานแนะนำสินค้า','หน่วย COC หยิบสินค้า-SLR']];let i = index"> ['KC002', 'กสินธร','สีปัญญา','พนักงานแนะนำสินค้า','หน่วย COC หยิบสินค้า-SLR']];let i = index">
<td class="text-center"> <td class="text-center">
<input type="checkbox" class="ti-form-checkbox cursor-pointer" id="checkbox-{{item[0]}}" > <input type="checkbox" class="ti-form-checkbox cursor-pointer" id="checkbox-{{item[0]}}">
<label for="checkbox-{{item[0]}}">&nbsp;{{item[0]}}</label> <label for="checkbox-{{item[0]}}">&nbsp;{{item[0]}}</label>
</td> </td>
<td >{{item[1]}}</td> <td>{{item[1]}}</td>
<td >{{item[2]}}</td> <td>{{item[2]}}</td>
<td >{{item[3]}}</td> <td>{{item[3]}}</td>
<td >{{item[4]}}</td> <td>{{item[4]}}</td>
<td class="flex justify-center"> <td class="flex justify-center">
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1" <i class="ti ti-edit cursor-pointer i-gray fs-l px-1"
data-hs-overlay="#sub-employee-registration-modal-edit"></i> data-hs-overlay="#sub-employee-registration-modal-edit"></i>
...@@ -623,7 +623,7 @@ ...@@ -623,7 +623,7 @@
ย้อนกลับ ย้อนกลับ
</button> </button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);" <a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-employee-registration-alert-edit-modal" (click)="addUser();showSuccessEdit()"> data-hs-overlay="#sub-employee-registration-alert-edit-modal" (click)="addUser()">
บันทึกข้อมูล บันทึกข้อมูล
</a> </a>
</div> </div>
......
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr'; import { ToastrService } from 'ngx-toastr';
import { EmployeeModel, MyEmployeeModel } from 'src/app/shared/model/employee.model';
import { EmployeeService } from 'src/app/shared/services/employee.service';
export interface DataEmployee {
loading: boolean
select: EmployeeModel
dataList: {
check: boolean
data: EmployeeModel
}[]
}
@Component({ @Component({
selector: 'app-sub-employee-registration', selector: 'app-sub-employee-registration',
templateUrl: './sub-employee-registration.component.html', templateUrl: './sub-employee-registration.component.html',
styleUrls: ['./sub-employee-registration.component.scss'] styleUrls: ['./sub-employee-registration.component.scss']
}) })
export class SubEmployeeRegistrationComponent {
@Input() pathTitle = ['การจัดการข้อมูลองค์กร', 'ตั้งค่าผู้ใช้งาน', 'ทะเบียนพนักงาน'];
@Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>();
activeTab: string = 'tab1'; // กำหนด tab เริ่มต้น
// ฟังก์ชันในการเปลี่ยนแท็บ export class SubEmployeeRegistrationComponent {
changeTab(tab: { id: string, text: string }) { employee: DataEmployee = { loading: false, select: new MyEmployeeModel({}), dataList: [] }
this.sendPathTitle.emit(['การจัดการข้อมูลองค์กร', 'ตั้งค่าผู้ใช้งาน', tab.text]); constructor(private toastr: ToastrService,
this.activeTab = tab.id; private employeeService: EmployeeService,
} private cdr: ChangeDetectorRef) { }
// การจัดการการเปิดปิด modal
modalOptions: {
[nameModal: string]: {
isModalOpen: boolean;
modalSize: string;
backdropClose: boolean;
};
} = {
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
};
openModal(name: string, size: string, closeOnBackdrop?: boolean) { ngOnInit(): void {
this.modalOptions[name].modalSize = size;
this.modalOptions[name].backdropClose = closeOnBackdrop || false;
this.modalOptions[name].isModalOpen = true;
this.currentModal = name; // ตั้งค่าค่าของ currentModal เป็น 'add' หรือ 'edit'
document.body.style.overflow = 'hidden';
}
closeModal(name: string) {
this.modalOptions[name].isModalOpen = false;
if (!this.isAnyModalOpen()) {
document.body.style.overflow = ''; // คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
} }
getPageList() {
this.employee.loading = false
this.employeeService.getPageList().subscribe({
next: response => {
this.employee.dataList = response.map(x => ({ check: false, data: new MyEmployeeModel(x) }))
this.employee.loading = false
this.cdr.detectChanges()
}, error: error => {
this.employee.loading = false
this.cdr.detectChanges()
} }
})
isAnyModalOpen(): boolean {
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // ตรวจสอบว่า modal อื่นยังเปิดอยู่หรือไม่
} }
// searchChange() {
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล // this.currentPage = 1
addUser() { // this.page = Array.from({ length: Math.ceil(this.emp_typeListFilter().length / 10) }, (_, i) => i + 1);
// }
} // emp_typeListFilter() {
// return this.emp_typeList.filter(x =>
currentModal = "" // x.codeId.includes(this.search) ||
constructor(private toastr: ToastrService) { } // x.tdesc.includes(this.search) ||
// x.edesc.includes(this.search))
// }
// selectEmp_type(emp_type?: EmpTypeModel) {
// // this.showSuccess()
// this.emp_type = new MyEmpTypeModel(emp_type || {})
// }
showSuccess() { showSuccess() {
this.toastr.success('บันทึกข้อมูลสำเร็จ', 'เเจ้งเตือน', { this.toastr.success('บันทึกข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000, timeOut: 3000,
positionClass: 'toast-top-right', positionClass: 'toast-top-right',
}); });
} }
showSuccessEdit() {
this.toastr.success('เเก้ไขข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
showSuccessDelete() { showSuccessDelete() {
this.toastr.success('ลบข้อมูลสำเร็จ', 'เเจ้งเตือน', { this.toastr.success('ลบข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000, timeOut: 3000,
positionClass: 'toast-top-right', positionClass: 'toast-top-right',
}); });
} }
addUser() {
}
} }
import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr'; import { ToastrService } from 'ngx-toastr';
import { EmpGroupModel, MyEmpGroupModel } from 'src/app/shared/model/emp_group.model'; import { EmpGroupModel, MyEmpGroupModel } from 'src/app/shared/model/emp-group.model';
import { EmpGroupService } from 'src/app/shared/services/emp_group.service'; import { EmpGroupService } from 'src/app/shared/services/emp-group.service';
@Component({ @Component({
selector: 'app-employee-group-unit', selector: 'app-employee-group-unit',
......
...@@ -41,7 +41,7 @@ import { Bu6Service } from 'src/app/shared/services/bu6.service'; ...@@ -41,7 +41,7 @@ import { Bu6Service } from 'src/app/shared/services/bu6.service';
import { Bu7Service } from 'src/app/shared/services/bu7.service'; import { Bu7Service } from 'src/app/shared/services/bu7.service';
import { PositionService } from 'src/app/shared/services/position.service'; import { PositionService } from 'src/app/shared/services/position.service';
import { PLService } from 'src/app/shared/services/pl.service'; import { PLService } from 'src/app/shared/services/pl.service';
import { EmpGroupService } from 'src/app/shared/services/emp_group.service'; import { EmpGroupService } from 'src/app/shared/services/emp-group.service';
import { EmpTypeService } from 'src/app/shared/services/employee-type.service'; import { EmpTypeService } from 'src/app/shared/services/employee-type.service';
import { JobDetailManagementComponent } from '../job-detail-components/job-detail-management/job-detail-management.component'; import { JobDetailManagementComponent } from '../job-detail-components/job-detail-management/job-detail-management.component';
import { ImportDataComponent } from '../job-detail-components/job-detail-management/import-data/import-data.component'; import { ImportDataComponent } from '../job-detail-components/job-detail-management/import-data/import-data.component';
...@@ -119,6 +119,7 @@ import { CompetencytypeService } from 'src/app/shared/services/competencytype.se ...@@ -119,6 +119,7 @@ import { CompetencytypeService } from 'src/app/shared/services/competencytype.se
import { CompetencytopicService } from 'src/app/shared/services/competencytopic.service'; import { CompetencytopicService } from 'src/app/shared/services/competencytopic.service';
import { AssessmentService } from 'src/app/shared/services/assessment.service'; import { AssessmentService } from 'src/app/shared/services/assessment.service';
import { CompetencycourseService } from 'src/app/shared/services/competencycourse.service'; import { CompetencycourseService } from 'src/app/shared/services/competencycourse.service';
import { EmployeeService } from 'src/app/shared/services/employee.service';
@NgModule({ @NgModule({
declarations: [ declarations: [
SalesComponent, SalesComponent,
...@@ -245,6 +246,7 @@ import { CompetencycourseService } from 'src/app/shared/services/competencycours ...@@ -245,6 +246,7 @@ import { CompetencycourseService } from 'src/app/shared/services/competencycours
CompetencytopicService, CompetencytopicService,
AssessmentService, AssessmentService,
CompetencycourseService, CompetencycourseService,
EmployeeService,
{ {
provide: HTTP_INTERCEPTORS, provide: HTTP_INTERCEPTORS,
useClass: HttpRequestInterceptor, useClass: HttpRequestInterceptor,
......
export interface AgeModel {
year: number
month: number
day: number
}
export class MyAgeModel implements AgeModel {
year: number
month: number
day: number
constructor(data: Partial<AgeModel>) {
this.year = data.year ?? 0
this.month = data.month ?? 0
this.day = data.day ?? 0
}
}
export interface AlertModel {
message: string
statusCode: number
resultObject: any
fail: boolean
actionStatus: string
none: boolean
success: boolean
}
\ No newline at end of file
export interface BranchModel {
branchId: string
tdesc: string
edesc: string
}
export class MyBranchModel implements BranchModel {
branchId: string
tdesc: string
edesc: string
constructor(data: Partial<BranchModel>) {
this.branchId = data.branchId || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
}
}
...@@ -2,16 +2,19 @@ export interface Bu1Model { ...@@ -2,16 +2,19 @@ export interface Bu1Model {
bu1id: string; bu1id: string;
tdesc: string; tdesc: string;
edesc: string; edesc: string;
companyId: string
} }
export class MyBu1Model implements Bu1Model { export class MyBu1Model implements Bu1Model {
bu1id: string; bu1id: string;
tdesc: string; tdesc: string;
edesc: string; edesc: string;
companyId: string
constructor(data: Partial<Bu1Model>) { constructor(data: Partial<Bu1Model>) {
this.bu1id = data.bu1id || "" this.bu1id = data.bu1id || ""
this.tdesc = data.tdesc || "" this.tdesc = data.tdesc || ""
this.edesc = data.edesc || "" this.edesc = data.edesc || ""
this.companyId = data.companyId || ""
} }
} }
import { AgeModel, MyAgeModel } from "./age.model"
import { JobCodeModel, MyJobCodeModel } from "./job-code.model"
import { MyNationalModel, NationalModel } from "./national.model"
import { MyNationalityModel, NationalityModel } from "./nationality.model"
import { MyPLModel, PLModel } from "./pl.model"
import { MyPositionModel, PositionModel } from "./position.model"
import { MyPrefixModel, PrefixModel } from "./prefix.model"
import { MyReligionModel, ReligionModel } from "./religion.model"
import { MyStatusModel, StatusModel } from "./status.model"
export interface EmployeeModel {
employeeId: string
prefix: PrefixModel
fname: string
lname: string
efname: string
elname: string
nickname: string
enickname: string
birthDate: string
status: StatusModel
age: AgeModel
swipeCardId: string
idPeople: string
idexpdate: string
passport_no: string
passport_expire_date: string
height: string
weight: string
blood: string
rh: string
eyeColor: string
hairColor: string
shirtSize: string
waistSize: string
national: NationalModel
nationality: NationalityModel
religion: ReligionModel
sex: string
email: string
emailMicrosoft365: string
emailPersonal: string
picture: string
telNo: string
mobile: string
position: PositionModel
jobCode: JobCodeModel
personalLevel: PLModel
}
export class MyEmployeeModel implements EmployeeModel {
employeeId: string
prefix: PrefixModel
fname: string
lname: string
efname: string
elname: string
nickname: string
enickname: string
birthDate: string
status: StatusModel
age: AgeModel
swipeCardId: string
idPeople: string
idexpdate: string
passport_no: string
passport_expire_date: string
height: string
weight: string
blood: string
rh: string
eyeColor: string
hairColor: string
shirtSize: string
waistSize: string
national: NationalModel
nationality: NationalityModel
religion: ReligionModel
sex: string
email: string
emailMicrosoft365: string
emailPersonal: string
picture: string
telNo: string
mobile: string
position: PositionModel
jobCode: JobCodeModel
personalLevel: PLModel
constructor(data: Partial<EmployeeModel>) {
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.nickname = data.nickname || ""
this.enickname = data.enickname || ""
this.birthDate = data.birthDate || ""
this.status = new MyStatusModel(data.status || {})
this.age = new MyAgeModel(data.age || {})
this.swipeCardId = data.swipeCardId || ""
this.idPeople = data.idPeople || ""
this.idexpdate = data.idexpdate || ""
this.passport_no = data.passport_no || ""
this.passport_expire_date = data.passport_expire_date || ""
this.height = data.height || ""
this.weight = data.weight || ""
this.blood = data.blood || ""
this.rh = data.rh || ""
this.eyeColor = data.eyeColor || ""
this.hairColor = data.hairColor || ""
this.shirtSize = data.shirtSize || ""
this.waistSize = data.waistSize || ""
this.national = new MyNationalModel(data.national || {})
this.nationality = new MyNationalityModel(data.nationality || {})
this.religion = new MyReligionModel(data.religion || {})
this.sex = data.sex || ""
this.email = data.email || ""
this.emailMicrosoft365 = data.emailMicrosoft365 || ""
this.emailPersonal = data.emailPersonal || ""
this.picture = data.picture || ""
this.telNo = data.telNo || ""
this.mobile = data.mobile || ""
this.position = new MyPositionModel(data.position || {})
this.jobCode = new MyJobCodeModel(data.jobCode || {})
this.personalLevel = new MyPLModel(data.personalLevel || {})
}
}
import { BranchModel, MyBranchModel } from "./branch.model"
import { Bu1Model, MyBu1Model } from "./bu1.model"
import { Bu2Model, MyBu2Model } from "./bu2.model"
import { Bu3Model, MyBu3Model } from "./bu3.model"
import { Bu4Model, MyBu4Model } from "./bu4.model"
import { Bu5Model, MyBu5Model } from "./bu5.model"
import { Bu6Model, MyBu6Model } from "./bu6.model"
import { Bu7Model, MyBu7Model } from "./bu7.model"
import { MyPositionModel, PositionModel } from "./position.model"
export interface JobCodeModel {
jobcodeId: string
tdesc: string
edesc: string
jobcodeLevel: string
age0: number
age1: number
experience: string
responsibility: string
qualification: string
position: PositionModel
bu1: Bu1Model
bu2: Bu2Model
bu3: Bu3Model
bu4: Bu4Model
bu5: Bu5Model
bu6: Bu6Model
bu7: Bu7Model
branch: BranchModel
eexperience: string
eresponsibility: string
equalification: string
}
export class MyJobCodeModel implements JobCodeModel {
jobcodeId: string
tdesc: string
edesc: string
jobcodeLevel: string
age0: number
age1: number
experience: string
responsibility: string
qualification: string
position: PositionModel
bu1: Bu1Model
bu2: Bu2Model
bu3: Bu3Model
bu4: Bu4Model
bu5: Bu5Model
bu6: Bu6Model
bu7: Bu7Model
branch: BranchModel
eexperience: string
eresponsibility: string
equalification: string
constructor(data: Partial<JobCodeModel>) {
this.jobcodeId = data.jobcodeId || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
this.jobcodeLevel = data.jobcodeLevel || ""
this.age0 = data.age0 ?? 0
this.age1 = data.age1 ?? 0
this.experience = data.experience || ""
this.responsibility = data.responsibility || ""
this.qualification = data.qualification || ""
this.position = new MyPositionModel(data.position || {})
this.bu1 = new MyBu1Model(data.bu1 || {})
this.bu2 = new MyBu2Model(data.bu2 || {})
this.bu3 = new MyBu3Model(data.bu3 || {})
this.bu4 = new MyBu4Model(data.bu4 || {})
this.bu5 = new MyBu5Model(data.bu5 || {})
this.bu6 = new MyBu6Model(data.bu6 || {})
this.bu7 = new MyBu7Model(data.bu7 || {})
this.branch = new MyBranchModel(data.branch || {})
this.eexperience = data.eexperience || ""
this.eresponsibility = data.eresponsibility || ""
this.equalification = data.equalification || ""
}
}
export interface NationalModel {
nationalId: string
tdesc: string
edesc: string
}
export class MyNationalModel implements NationalModel {
nationalId: string
tdesc: string
edesc: string
constructor(data: Partial<NationalModel>) {
this.nationalId = data.nationalId || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
}
}
export interface NationalityModel {
nationalityId: string
tdesc: string
edesc: string
}
export class MyNationalityModel implements NationalityModel {
nationalityId: string
tdesc: string
edesc: string
constructor(data: Partial<NationalityModel>) {
this.nationalityId = data.nationalityId || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
}
}
export interface PLModel { export interface PLModel {
plId: string; plId: string
tdesc: string; tdesc: string
edesc: string; edesc: string
companyId: string
} }
...@@ -9,10 +10,12 @@ export class MyPLModel implements PLModel { ...@@ -9,10 +10,12 @@ export class MyPLModel implements PLModel {
plId: string; plId: string;
tdesc: string; tdesc: string;
edesc: string; edesc: string;
companyId: string
constructor(data: Partial<PLModel>) { constructor(data: Partial<PLModel>) {
this.plId = data.plId || "" this.plId = data.plId || ""
this.tdesc = data.tdesc || "" this.tdesc = data.tdesc || ""
this.edesc = data.edesc || "" this.edesc = data.edesc || ""
this.companyId = data.companyId || ""
} }
} }
export interface PositionModel { export interface PositionModel {
positionId: string; positionId: string
tdesc: string; tdesc: string
edesc: string; edesc: string
consolidate: string
shortName: string
companyId: string
} }
export class MyPositionModel implements PositionModel { export class MyPositionModel implements PositionModel {
positionId: string; positionId: string
tdesc: string; tdesc: string
edesc: string; edesc: string
consolidate: string
shortName: string
companyId: string
constructor(data: Partial<PositionModel>) { constructor(data: Partial<PositionModel>) {
this.positionId = data.positionId || "" this.positionId = data.positionId || ""
this.tdesc = data.tdesc || "" this.tdesc = data.tdesc || ""
this.edesc = data.edesc || "" this.edesc = data.edesc || ""
this.consolidate = data.consolidate || ""
this.shortName = data.shortName || ""
this.companyId = data.companyId || ""
} }
} }
export interface PrefixModel {
prefixId: string;
tdesc: string;
edesc: string;
}
export class MyPrefixModel implements PrefixModel {
prefixId: string;
tdesc: string;
edesc: string;
constructor(data: Partial<PrefixModel>) {
this.prefixId = data.prefixId || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
}
}
export interface ReligionModel {
religionId: string
tdesc: string
edesc: string
}
export class MyReligionModel implements ReligionModel {
religionId: string
tdesc: string
edesc: string
constructor(data: Partial<ReligionModel>) {
this.religionId = data.religionId || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
}
}
export interface StatusModel {
statusCode: string
statusType: string
tdesc: string
edesc: string
}
export class MyStatusModel implements StatusModel {
statusCode: string
statusType: string
tdesc: string
edesc: string
constructor(data: Partial<StatusModel>) {
this.statusCode = data.statusCode || ""
this.statusType = data.statusType || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
}
}
...@@ -3,6 +3,7 @@ import { Injectable } from '@angular/core'; ...@@ -3,6 +3,7 @@ import { Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { CompanyModel } from '../model/company.model'; import { CompanyModel } from '../model/company.model';
import { AlertModel } from '../model/alert.model';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
...@@ -17,16 +18,16 @@ export class CompanyService { ...@@ -17,16 +18,16 @@ export class CompanyService {
getList(): Observable<CompanyModel[]> { getList(): Observable<CompanyModel[]> {
return this.http.get<CompanyModel[]>(this.urlApi + "/lists") return this.http.get<CompanyModel[]>(this.urlApi + "/lists")
} }
post(body: CompanyModel) { post(body: CompanyModel): Observable<AlertModel> {
return this.http.post(this.urlApi, body) return this.http.post<AlertModel>(this.urlApi, body)
} }
delete(body: CompanyModel) { delete(body: CompanyModel | CompanyModel[]): Observable<AlertModel> {
const options = { const options = {
headers: new HttpHeaders({ headers: new HttpHeaders({
"Content-Type": "application/json", "Content-Type": "application/json",
}), }),
body: body body: body
}; };
return this.http.delete(this.urlApi, options) return this.http.delete<AlertModel>(this.urlApi, options)
} }
} }
\ No newline at end of file
...@@ -2,7 +2,7 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; ...@@ -2,7 +2,7 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { EmpGroupModel } from '../model/emp_group.model'; import { EmpGroupModel } from '../model/emp-group.model';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
......
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { EmployeeModel } from '../model/employee.model';
@Injectable({
providedIn: 'root'
})
export class EmployeeService {
api = "/employee"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getPageList(): Observable<EmployeeModel[]> {
return this.http.get<EmployeeModel[]>(this.urlApi + "/profiles")
}
getById(employeeId: string): Observable<EmployeeModel> {
return this.http.get<EmployeeModel>(this.urlApi + "/profile?employeeId=" + employeeId)
}
add(body: EmployeeModel) {
return this.http.post(this.urlApi + '/profile-create', body)
}
update(body: EmployeeModel) {
return this.http.post(this.urlApi + '/profile-update', body)
}
delete(body: EmployeeModel) {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(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