Commit 034da90d by Nattana Chaiyamat

ทะเบียนฝ่าย

ทะเบียนแผนก
ทะเบียนส่วน
ทะเบียนส่วนย่อย1 2 3 4
กลุ่มพนักงาน
ตำแหน่ง
ทะเบียนประเภทพนักงาน
ทะเบียนระดับพนักงาน
ประเภทสมรรถนะ
หัวข้อสมรรถนะ
เครื่องมือประเมิน
หลักสูตรการพัฒนา
parent 815f2cbb
......@@ -6,6 +6,9 @@ import { LoginPageComponent } from './login-page/login-page.component';
import { RegisterPageComponent } from './register-page/register-page.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { AngularFireAuthModule } from '@angular/fire/compat/auth';
import { HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
import { AuthService } from '../shared/services/auth.service';
import { HttpRequestInterceptor } from '../shared/services/http-request.interceptor';
@NgModule({
declarations: [LoginPageComponent, RegisterPageComponent],
......@@ -15,6 +18,12 @@ import { AngularFireAuthModule } from '@angular/fire/compat/auth';
AngularFireAuthModule,
FormsModule,
ReactiveFormsModule,
HttpClientModule
],
providers: [AuthService, {
provide: HTTP_INTERCEPTORS,
useClass: HttpRequestInterceptor,
multi: true,
},]
})
export class AuthenticationModule {}
export class AuthenticationModule { }
......@@ -16,13 +16,13 @@ export class LoginPageComponent {
constructor(@Inject(DOCUMENT)
private document: Document,
private elementRef: ElementRef,
private renderer: Renderer2,
private formBuilder: FormBuilder,
private router: Router,
private authservice: AuthService,) {
private elementRef: ElementRef,
private renderer: Renderer2,
private formBuilder: FormBuilder,
private router: Router,
private authservice: AuthService,) {
const bodyElement = this.renderer.selectRootElement('body', true);
this.renderer.setAttribute(bodyElement, 'class', 'cover1 justify-center');
this.renderer.setAttribute(bodyElement, 'class', 'cover1 justify-center');
}
ngOnInit(): void {
this.loginForm = this.formBuilder.group({
......@@ -37,15 +37,15 @@ export class LoginPageComponent {
this.renderer.addClass(this.document.body, 'bg-white');
this.renderer.addClass(this.document.body, 'dark:bg-bgdark');
const html : any = this.elementRef.nativeElement.ownerDocument.documentElement;
const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;
html.removeAttribute('data-header-styles', 'light');
//html.removeAttribute('data-nav-layout','vertical');
html.classList.add('h-full', 'light');
if (localStorage.getItem('synto-header-mode') == 'dark') {
const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;
html.classList.add('h-full', 'dark');
}
if (localStorage.getItem('synto-header-mode') == 'dark') {
const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;
html.classList.add('h-full', 'dark');
}
}
// firebase
......@@ -105,11 +105,26 @@ export class LoginPageComponent {
}
Submit() {
if (
this.loginForm.controls['username'].value === 'spruko@admin.com' &&
this.loginForm.controls['password'].value === 'sprukoadmin'
) {
this.router.navigate(['/self-evaluation']);
// if (
// this.loginForm.controls['username'].value === 'spruko@admin.com' &&
// this.loginForm.controls['password'].value === 'sprukoadmin'
// ) {
// this.router.navigate(['/self-evaluation']);
// } else {
// this.error = 'Please check email and passowrd';
// }
if (this.loginForm.controls['username'].value &&
this.loginForm.controls['password'].value) {
sessionStorage.clear()
this.authservice.loginWithUserPass(this.loginForm.controls['username'].value,
this.loginForm.controls['password'].value).subscribe({
next: response => {
sessionStorage.setItem("accessToken", response.accessToken)
this.router.navigate(['/self-evaluation']);
}, error: error => {
this.error = 'Please check email and passowrd';
}
})
} else {
this.error = 'Please check email and passowrd';
}
......@@ -126,12 +141,12 @@ export class LoginPageComponent {
this.renderer.removeClass(this.document.body, '!py-0');
this.renderer.removeClass(this.document.body, 'bg-white');
this.renderer.removeClass(this.document.body, 'dark:bg-bgdark');
if (localStorage.getItem('synto-header-mode') == 'dark') {
const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;
html.classList.remove('h-full', 'dark');
}
if (localStorage.getItem('synto-header-mode') == 'dark') {
const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;
html.classList.remove('h-full', 'dark');
}
const authe: any = document.querySelector('.h-full');
authe.removeAttribute('class', 'h-full');
const authe: any = document.querySelector('.h-full');
authe.removeAttribute('class', 'h-full');
}
}
......@@ -74,14 +74,15 @@
</div>
</div>
<!-- End Checkbox -->
<a routerLink="/self-evaluation"
<button type="submit" (click)="Submit()"
class="py-2 px-3 inline-flex justify-center items-center gap-2 rounded-sm border border-transparent font-semibold bg-primary text-white hover:bg-primary focus:outline-none focus:ring-0 focus:ring-primary focus:ring-offset-0 transition-all text-sm dark:focus:ring-offset-white/10">Sign
in</a>
in</button>
<div class="text-center">
<p class="mt-3 text-sm text-gray-600 dark:text-white/70">
Don't have an account yet?
(คุณมีบัญชีเเล้วหรือยัง?)
<a class="text-primary decoration-2 hover:underline font-medium" routerLink="/auth/register">
<a class="text-primary decoration-2 hover:underline font-medium"
routerLink="/auth/register">
Sign up here
(กรุณาลงทะเบียนที่นี่ หากคุณยังไม่มีบัญชีเข้าใช้)
</a>
......@@ -100,4 +101,4 @@
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
......@@ -85,7 +85,7 @@
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1"
(click)="selectBu2(item);currentModal='edit'"
data-hs-overlay="#department-list-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="deleteBu2(item)" data-hs-overlay="#department-list-alert-delete-modal"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="selectBu2(item)" data-hs-overlay="#department-list-alert-delete-modal"></i>
</td>
</tr>
</tbody>
......@@ -575,7 +575,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#department-list-alert-modal" (click)="addBu2();showSuccess()">
data-hs-overlay="#department-list-alert-modal" (click)="addBu2()">
บันทึกข้อมูล
</a>
</div>
......@@ -616,7 +616,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#department-list-alert-edit-modal" (click)="addBu2();showSuccessEdit()">
data-hs-overlay="#department-list-alert-edit-modal" (click)="addBu2()">
บันทึกข้อมูล
</a>
</div>
......@@ -656,7 +656,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#department-list-alert-delete-modal" (click)="addBu2();showSuccessDelete()">
data-hs-overlay="#department-list-alert-delete-modal" (click)="deleteBu2()">
ลบข้อมูล
</a>
</div>
......
......@@ -48,6 +48,7 @@ export class DepartmentListComponent implements OnInit {
this.bu2Service.getList().subscribe(response => {
this.bu2List = response
this.onBu2TableSearchChange()
this.cdr.detectChanges()
})
}
onBu2TableSearchChange() {
......@@ -55,9 +56,9 @@ export class DepartmentListComponent implements OnInit {
this.bu2Table.page = Array.from({ length: Math.ceil(this.filterBu2Table().length / 10) }, (_, i) => i + 1);
}
filterBu2Table() {
return this.bu2List.filter(x => x.bu2id.toLowerCase().includes(this.bu2Table.search) ||
x.tdesc.toLowerCase().includes(this.bu2Table.search) ||
x.edesc.toLowerCase().includes(this.bu2Table.search))
return this.bu2List.filter(x => x.bu2id.includes(this.bu2Table.search) ||
x.tdesc.includes(this.bu2Table.search) ||
x.edesc.includes(this.bu2Table.search))
}
selectBu2(bu2?: Bu2Model) {
this.bu2 = new MyBu2Model(bu2 || {})
......@@ -78,25 +79,12 @@ export class DepartmentListComponent implements OnInit {
this.bu2Modal.page = Array.from({ length: Math.ceil(this.filterBu2Modal().length / 10) }, (_, i) => i + 1);
}
filterBu2Modal() {
return this.bu2List.filter(x => x.bu2id.toLowerCase().includes(this.bu2Modal.search) ||
x.tdesc.toLowerCase().includes(this.bu2Modal.search) ||
x.edesc.toLowerCase().includes(this.bu2Modal.search))
}
addBu2() {
// this.bu2Service.post(this.bu2).subscribe((response:any) => {
// if (response.success) {
// this.getBu2List()
// }
// })
}
deleteBu2(bu2: Bu2Model) {
// this.bu2Service.delete(new MyBu2Model(bu2)).subscribe((response:any) => {
// if (response.success) {
// this.getBu2List()
// }
// })
return this.bu2List.filter(x => x.bu2id.includes(this.bu2Modal.search) ||
x.tdesc.includes(this.bu2Modal.search) ||
x.edesc.includes(this.bu2Modal.search))
}
getBu1List() {
this.bu1Service.getList().subscribe(response => {
this.bu1List = response
......@@ -112,9 +100,9 @@ export class DepartmentListComponent implements OnInit {
this.selectBu1(bu1 || new MyBu1Model({ bu1id: this.bu1.bu1id }))
}
filterBu1Modal() {
return this.bu1List.filter(x => x.bu1id.toLowerCase().includes(this.bu1Modal.search) ||
x.tdesc.toLowerCase().includes(this.bu1Modal.search) ||
x.edesc.toLowerCase().includes(this.bu1Modal.search))
return this.bu1List.filter(x => x.bu1id.includes(this.bu1Modal.search) ||
x.tdesc.includes(this.bu1Modal.search) ||
x.edesc.includes(this.bu1Modal.search))
}
selectBu1(bu1?: Bu1Model) {
this.bu1 = new MyBu1Model(bu1 || {})
......@@ -126,17 +114,33 @@ export class DepartmentListComponent implements OnInit {
positionClass: 'toast-top-right',
});
}
showSuccessEdit() {
this.toastr.success('เเก้ไขข้อมูลสำเร็จ', 'เเจ้งเตือน', {
showSuccessDelete() {
this.toastr.success('ลบข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
showSuccessDelete() {
this.toastr.success('ลบข้อมูลสำเร็จ', 'เเจ้งเตือน', {
showSuccessEdit() {
this.toastr.success('เเก้ไขข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
addBu2() {
this.bu2Service.post({ ...this.bu2, parent: this.bu1.bu1id }).subscribe((response: any) => {
if (response.success) {
this.showSuccess()
this.getBu2List()
}
})
}
deleteBu2() {
this.bu2Service.delete(this.bu2).subscribe((response: any) => {
if (response.success) {
this.showSuccessDelete()
this.getBu2List()
}
})
}
}
......@@ -26,7 +26,7 @@
</div>
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
data-hs-overlay="#department-register-modal-add">
data-hs-overlay="#department-register-modal-add" (click)="selectBu1()">
<i class="ri-add-line"></i>
Add
</button>
......@@ -63,14 +63,24 @@
</ng-container>
</tr>
</thead>
<tbody *ngIf="!bu1ListFilter().length">
<tbody *ngIf="bu1ListLoading">
<tr>
<td class="text-center" colspan="100%">
<div *ngFor="let item of [1,2,3]" class="ti-spinner w-8 h-8 text-secondary mx-1" role="status"
aria-label="loading">
<span class="sr-only">Loading...</span>
</div>
</td>
</tr>
</tbody>
<tbody *ngIf="!bu1ListLoading&&!bu1ListFilter().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="bu1ListFilter().length">
<tbody *ngIf="!bu1ListLoading&&bu1ListFilter().length">
<tr
*ngFor="let item of bu1ListFilter() | slice:((currentPage-1) * 10) : (((currentPage-1) * 10) + 10);let i = index">
<td class="text-center">{{((currentPage-1) * 10)+(i+1)}}</td>
......@@ -80,7 +90,8 @@
<td class="flex justify-center">
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1" (click)="selectBu1(item)"
data-hs-overlay="#department-register-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="deleteBu1(item)"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="selectBu1(item)"
data-hs-overlay="#department-register-delete-alert-modal"></i>
</td>
</tr>
</tbody>
......@@ -176,10 +187,10 @@
data-hs-overlay="#department-register-modal-add">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
<button type="button" class="ti-btn ti-btn-success"
data-hs-overlay="#department-register-alert-modal">
บันทึกข้อมูล
</a>
</button>
</div>
</div>
</div>
......@@ -239,13 +250,13 @@
<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"
data-hs-overlay="#department-register-modal-edit" data-hs-overlay-close>
data-hs-overlay="#department-register-modal-edit">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#department-register-alert-modal" data-hs-overlay-close>
<button type="button" class="ti-btn ti-btn-success"
data-hs-overlay="#department-register-alert-modal">
บันทึกข้อมูล
</a>
</button>
</div>
</div>
</div>
......@@ -278,10 +289,46 @@
data-hs-overlay="#department-register-alert-modal">
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#department-register-alert-modal" (click)="addBu1()">
<button type="button" class="ti-btn ti-btn-success" (click)="addBu1()"
data-hs-overlay="#department-register-alert-modal">
บันทึกข้อมูล
</a>
</button>
</div>
</div>
</div>
</div>
</div>
<div id="department-register-delete-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 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="#department-register-delete-alert-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">
<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="#department-register-delete-alert-modal">
ย้อนกลับ
</button>
<button type="button" class="ti-btn ti-btn-success" (click)="deleteBu1()"
data-hs-overlay="#department-register-delete-alert-modal">
ลบข้อมูล
</button>
</div>
</div>
</div>
......
import { Component, EventEmitter, Input, OnInit, } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { Bu1Model, MyBu1Model } from 'src/app/shared/model/bu1.model';
import { Bu1Service } from 'src/app/shared/services/bu1.service';
......@@ -12,18 +12,28 @@ export class DepartmentRegisterComponent implements OnInit {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
bu1List: Bu1Model[] = []
bu1ListLoading = false
bu1: Bu1Model = new MyBu1Model({})
search = ""
constructor(private bu1Service: Bu1Service,
private toastr: ToastrService
private toastr: ToastrService,
private cdr: ChangeDetectorRef
) { }
ngOnInit(): void {
this.getBu1List()
}
getBu1List() {
this.bu1Service.getList().subscribe(response => {
this.bu1List = response
this.searchChange()
this.bu1ListLoading = true
this.bu1Service.getList().subscribe({
next: response => {
this.bu1List = response
this.bu1ListLoading = false
this.searchChange()
this.cdr.detectChanges()
}, error: error => {
this.bu1ListLoading = false
this.cdr.detectChanges()
}
})
}
searchChange() {
......@@ -31,34 +41,41 @@ export class DepartmentRegisterComponent implements OnInit {
this.page = Array.from({ length: Math.ceil(this.bu1ListFilter().length / 10) }, (_, i) => i + 1);
}
bu1ListFilter() {
return this.bu1List.filter(x => x.bu1id.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
return this.bu1List.filter(x => x.bu1id.includes(this.search) ||
x.tdesc.includes(this.search) ||
x.edesc.includes(this.search))
}
selectBu1(bu1: Bu1Model) {
// this.showSuccess()
this.bu1 = new MyBu1Model(bu1)
selectBu1(bu1?: Bu1Model) {
this.bu1 = new MyBu1Model(bu1 || {})
}
showSuccess() {
this.toastr.success('This is an example of tip', 'TIP', {
showSuccessAdd() {
this.toastr.success('บันทึกข้อมูลสำเร็จ', 'แจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
showSuccessDelete() {
this.toastr.success('ลบข้อมูลสำเร็จ', 'แจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
addBu1() {
// this.bu1Service.post(this.bu1).subscribe((response:any) => {
// if (response.success) {
// this.getBu1List()
// }
// })
this.bu1Service.post(this.bu1).subscribe((response: any) => {
if (response.success) {
this.showSuccessAdd()
this.getBu1List()
}
})
}
deleteBu1(bu1: Bu1Model) {
// this.bu1Service.delete(new MyBu1Model(bu1)).subscribe((response:any) => {
// if (response.success) {
// this.getBu1List()
// }
// })
deleteBu1() {
this.bu1Service.delete(this.bu1).subscribe((response: any) => {
if (response.success) {
this.showSuccessDelete()
this.getBu1List()
}
})
}
......
......@@ -85,7 +85,7 @@
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1"
(click)="selectBu3(item);currentModal='edit'"
data-hs-overlay="#section-registration-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="deleteBu3(item)" data-hs-overlay="#section-registration-alert-delete-modal"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="selectBu3(item)" data-hs-overlay="#section-registration-alert-delete-modal"></i>
</td>
</tr>
</tbody>
......@@ -575,7 +575,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#section-registration-alert-modal" (click)="addBu3();showSuccess()">
data-hs-overlay="#section-registration-alert-modal" (click)="addBu3()">
บันทึกข้อมูล
</a>
</div>
......@@ -616,7 +616,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#section-registration-alert-edit-modal" (click)="addBu3();showSuccessEdit()">
data-hs-overlay="#section-registration-alert-edit-modal" (click)="addBu3()">
บันทึกข้อมูล
</a>
</div>
......@@ -657,7 +657,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#section-registration-alert-delete-modal" (click)="addBu3();showSuccessDelete()">
data-hs-overlay="#section-registration-alert-delete-modal" (click)="deleteBu3()">
ลบข้อมูล
</a>
</div>
......
......@@ -48,6 +48,7 @@ export class SectionRegistrationComponent implements OnInit {
this.bu3Service.getList().subscribe(response => {
this.bu3List = response
this.onBu3TableSearchChange()
this.cdr.detectChanges()
})
}
onBu3TableSearchChange() {
......@@ -55,9 +56,9 @@ export class SectionRegistrationComponent implements OnInit {
this.bu3Table.page = Array.from({ length: Math.ceil(this.filterBu3Table().length / 10) }, (_, i) => i + 1);
}
filterBu3Table() {
return this.bu3List.filter(x => x.bu3id.toLowerCase().includes(this.bu3Table.search) ||
x.tdesc.toLowerCase().includes(this.bu3Table.search) ||
x.edesc.toLowerCase().includes(this.bu3Table.search))
return this.bu3List.filter(x => x.bu3id.includes(this.bu3Table.search) ||
x.tdesc.includes(this.bu3Table.search) ||
x.edesc.includes(this.bu3Table.search))
}
selectBu3(bu3?: Bu3Model) {
this.bu3 = new MyBu3Model(bu3 || {})
......@@ -78,23 +79,25 @@ export class SectionRegistrationComponent implements OnInit {
this.bu3Modal.page = Array.from({ length: Math.ceil(this.filterBu3Modal().length / 10) }, (_, i) => i + 1);
}
filterBu3Modal() {
return this.bu3List.filter(x => x.bu3id.toLowerCase().includes(this.bu3Modal.search) ||
x.tdesc.toLowerCase().includes(this.bu3Modal.search) ||
x.edesc.toLowerCase().includes(this.bu3Modal.search))
return this.bu3List.filter(x => x.bu3id.includes(this.bu3Modal.search) ||
x.tdesc.includes(this.bu3Modal.search) ||
x.edesc.includes(this.bu3Modal.search))
}
addBu3() {
// this.bu3Service.post(this.bu3).subscribe((response:any) => {
// if (response.success) {
// this.getBu3List()
// }
// })
}
deleteBu3(bu3: Bu3Model) {
// this.bu3Service.delete(new MyBu3Model(bu3)).subscribe((response:any) => {
// if (response.success) {
// this.getBu3List()
// }
// })
this.bu3Service.post({ ...this.bu3, parent: this.bu2.bu2id }).subscribe((response:any) => {
if (response.success) {
this.getBu3List()
this.showSuccess()
}
})
}
deleteBu3() {
this.bu3Service.delete(this.bu3).subscribe((response:any) => {
if (response.success) {
this.getBu3List()
this.showSuccessDelete()
}
})
}
getBu2List() {
......@@ -112,9 +115,9 @@ export class SectionRegistrationComponent implements OnInit {
this.selectBu2(bu2 || new MyBu2Model({ bu2id: this.bu2.bu2id }))
}
filterBu2Modal() {
return this.bu2List.filter(x => x.bu2id.toLowerCase().includes(this.bu2Modal.search) ||
x.tdesc.toLowerCase().includes(this.bu2Modal.search) ||
x.edesc.toLowerCase().includes(this.bu2Modal.search))
return this.bu2List.filter(x => x.bu2id.includes(this.bu2Modal.search) ||
x.tdesc.includes(this.bu2Modal.search) ||
x.edesc.includes(this.bu2Modal.search))
}
selectBu2(bu2?: Bu2Model) {
this.bu2 = new MyBu2Model(bu2 || {})
......
......@@ -84,7 +84,7 @@
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1"
(click)="selectBu7(item);currentModal='edit'"
data-hs-overlay="#sub-department-four-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="deleteBu7(item)"
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="selectBu7(item)"
data-hs-overlay="#sub-department-four-alert-delete-modal"></i>
</td>
</tr>
......@@ -575,7 +575,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-department-four-alert-add-modal" (click)="addBu7(); showSuccessAdd()">
data-hs-overlay="#sub-department-four-alert-add-modal" (click)="addBu7();">
บันทึกข้อมูล
</a>
</div>
......@@ -616,7 +616,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-department-four-alert-edit-modal" (click)="addBu7(); showSuccessAdd()">
data-hs-overlay="#sub-department-four-alert-edit-modal" (click)="addBu7();">
บันทึกข้อมูล
</a>
</div>
......@@ -652,7 +652,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-department-four-alert-delete-modal" (click)="addBu7(); showSuccessDelete()">
data-hs-overlay="#sub-department-four-alert-delete-modal" (click)="deleteBu7();">
ลบข้อมูล
</a>
</div>
......
import { ChangeDetectorRef ,Component, EventEmitter, Input, OnInit } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { Bu6Model, MyBu6Model } from 'src/app/shared/model/bu6.model';
import { Bu7Model, MyBu7Model } from 'src/app/shared/model/bu7.model';
......@@ -49,6 +49,7 @@ export class SubDepartmentFourComponent implements OnInit {
this.bu7Service.getList().subscribe(response => {
this.bu7List = response
this.onBu7TableSearchChange()
this.cdr.detectChanges()
})
}
onBu7TableSearchChange() {
......@@ -56,9 +57,9 @@ export class SubDepartmentFourComponent implements OnInit {
this.bu7Table.page = Array.from({ length: Math.ceil(this.filterBu7Table().length / 10) }, (_, i) => i + 1);
}
filterBu7Table() {
return this.bu7List.filter(x => x.bu7id.toLowerCase().includes(this.bu7Table.search) ||
x.tdesc.toLowerCase().includes(this.bu7Table.search) ||
x.edesc.toLowerCase().includes(this.bu7Table.search))
return this.bu7List.filter(x => x.bu7id.includes(this.bu7Table.search) ||
x.tdesc.includes(this.bu7Table.search) ||
x.edesc.includes(this.bu7Table.search))
}
selectBu7(bu7?: Bu7Model) {
this.bu7 = new MyBu7Model(bu7 || {})
......@@ -79,23 +80,25 @@ export class SubDepartmentFourComponent implements OnInit {
this.bu7Modal.page = Array.from({ length: Math.ceil(this.filterBu7Modal().length / 10) }, (_, i) => i + 1);
}
filterBu7Modal() {
return this.bu7List.filter(x => x.bu7id.toLowerCase().includes(this.bu7Modal.search) ||
x.tdesc.toLowerCase().includes(this.bu7Modal.search) ||
x.edesc.toLowerCase().includes(this.bu7Modal.search))
return this.bu7List.filter(x => x.bu7id.includes(this.bu7Modal.search) ||
x.tdesc.includes(this.bu7Modal.search) ||
x.edesc.includes(this.bu7Modal.search))
}
addBu7() {
// this.bu7Service.post(this.bu7).subscribe((response:any) => {
// if (response.success) {
// this.getBu7List()
// }
// })
}
deleteBu7(bu7: Bu7Model) {
// this.bu7Service.delete(new MyBu7Model(bu7)).subscribe((response:any) => {
// if (response.success) {
// this.getBu7List()
// }
// })
this.bu7Service.post({ ...this.bu7, parent: this.bu6.bu6id }).subscribe((response: any) => {
if (response.success) {
this.getBu7List()
this.showSuccessAdd()
}
})
}
deleteBu7() {
this.bu7Service.delete(this.bu7).subscribe((response: any) => {
if (response.success) {
this.getBu7List()
this.showSuccessDelete()
}
})
}
getBu6List() {
......@@ -113,9 +116,9 @@ export class SubDepartmentFourComponent implements OnInit {
this.selectBu6(bu6 || new MyBu6Model({ bu6id: this.bu6.bu6id }))
}
filterBu6Modal() {
return this.bu6List.filter(x => x.bu6id.toLowerCase().includes(this.bu6Modal.search) ||
x.tdesc.toLowerCase().includes(this.bu6Modal.search) ||
x.edesc.toLowerCase().includes(this.bu6Modal.search))
return this.bu6List.filter(x => x.bu6id.includes(this.bu6Modal.search) ||
x.tdesc.includes(this.bu6Modal.search) ||
x.edesc.includes(this.bu6Modal.search))
}
selectBu6(bu6?: Bu6Model) {
this.bu6 = new MyBu6Model(bu6 || {})
......
......@@ -48,6 +48,7 @@ export class SubDepartmentOneComponent implements OnInit {
this.bu4Service.getList().subscribe(response => {
this.bu4List = response
this.onBu4TableSearchChange()
this.cdr.detectChanges()
})
}
onBu4TableSearchChange() {
......@@ -55,9 +56,9 @@ export class SubDepartmentOneComponent implements OnInit {
this.bu4Table.page = Array.from({ length: Math.ceil(this.filterBu4Table().length / 10) }, (_, i) => i + 1);
}
filterBu4Table() {
return this.bu4List.filter(x => x.bu4id.toLowerCase().includes(this.bu4Table.search) ||
x.tdesc.toLowerCase().includes(this.bu4Table.search) ||
x.edesc.toLowerCase().includes(this.bu4Table.search))
return this.bu4List.filter(x => x.bu4id.includes(this.bu4Table.search) ||
x.tdesc.includes(this.bu4Table.search) ||
x.edesc.includes(this.bu4Table.search))
}
selectBu4(bu4?: Bu4Model) {
this.bu4 = new MyBu4Model(bu4 || {})
......@@ -78,23 +79,25 @@ export class SubDepartmentOneComponent implements OnInit {
this.bu4Modal.page = Array.from({ length: Math.ceil(this.filterBu4Modal().length / 10) }, (_, i) => i + 1);
}
filterBu4Modal() {
return this.bu4List.filter(x => x.bu4id.toLowerCase().includes(this.bu4Modal.search) ||
x.tdesc.toLowerCase().includes(this.bu4Modal.search) ||
x.edesc.toLowerCase().includes(this.bu4Modal.search))
return this.bu4List.filter(x => x.bu4id.includes(this.bu4Modal.search) ||
x.tdesc.includes(this.bu4Modal.search) ||
x.edesc.includes(this.bu4Modal.search))
}
addBu4() {
// this.bu4Service.post(this.bu4).subscribe((response:any) => {
// if (response.success) {
// this.getBu4List()
// }
// })
}
deleteBu4(bu4: Bu4Model) {
// this.bu4Service.delete(new MyBu4Model(bu4)).subscribe((response:any) => {
// if (response.success) {
// this.getBu4List()
// }
// })
this.bu4Service.post({ ...this.bu4, parent: this.bu3.bu3id }).subscribe((response: any) => {
if (response.success) {
this.getBu4List()
this.showSuccess()
}
})
}
deleteBu4() {
this.bu4Service.delete(this.bu4).subscribe((response: any) => {
if (response.success) {
this.getBu4List()
this.showSuccessDelete()
}
})
}
getBu3List() {
......@@ -112,9 +115,9 @@ export class SubDepartmentOneComponent implements OnInit {
this.selectBu3(bu3 || new MyBu3Model({ bu3id: this.bu3.bu3id }))
}
filterBu3Modal() {
return this.bu3List.filter(x => x.bu3id.toLowerCase().includes(this.bu3Modal.search) ||
x.tdesc.toLowerCase().includes(this.bu3Modal.search) ||
x.edesc.toLowerCase().includes(this.bu3Modal.search))
return this.bu3List.filter(x => x.bu3id.includes(this.bu3Modal.search) ||
x.tdesc.includes(this.bu3Modal.search) ||
x.edesc.includes(this.bu3Modal.search))
}
selectBu3(bu3?: Bu3Model) {
this.bu3 = new MyBu3Model(bu3 || {})
......
......@@ -84,7 +84,7 @@
<i class="ti ti-edit cursor-pointer i-gray fs-l px-1"
(click)="selectBu6(item);currentModal='edit'"
data-hs-overlay="#sub-department-three-modal-edit"></i>
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="deleteBu6(item)"
<i class="ti ti-trash cursor-pointer i-gray fs-l px-1" (click)="selectBu6(item)"
data-hs-overlay="#sub-department-three-alert-delete-modal"></i>
</td>
</tr>
......@@ -575,7 +575,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-department-three-alert-add-modal" (click)="addBu6(); showSuccessAdd()">
data-hs-overlay="#sub-department-three-alert-add-modal" (click)="addBu6();">
บันทึกข้อมูล
</a>
</div>
......@@ -616,7 +616,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-department-three-alert-edit-modal" (click)="addBu6(); showSuccessEdit()">
data-hs-overlay="#sub-department-three-alert-edit-modal" (click)="addBu6();">
บันทึกข้อมูล
</a>
</div>
......@@ -652,7 +652,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#sub-department-three-alert-delete-modal" (click)="addBu6(); showSuccessDelete()">
data-hs-overlay="#sub-department-three-alert-delete-modal" (click)="deleteBu6()">
ลบข้อมูล
</a>
</div>
......
......@@ -49,6 +49,7 @@ export class SubDepartmentThreeComponent implements OnInit {
this.bu6Service.getList().subscribe(response => {
this.bu6List = response
this.onBu6TableSearchChange()
this.cdr.detectChanges()
})
}
onBu6TableSearchChange() {
......@@ -56,9 +57,9 @@ export class SubDepartmentThreeComponent implements OnInit {
this.bu6Table.page = Array.from({ length: Math.ceil(this.filterBu6Table().length / 10) }, (_, i) => i + 1);
}
filterBu6Table() {
return this.bu6List.filter(x => x.bu6id.toLowerCase().includes(this.bu6Table.search) ||
x.tdesc.toLowerCase().includes(this.bu6Table.search) ||
x.edesc.toLowerCase().includes(this.bu6Table.search))
return this.bu6List.filter(x => x.bu6id.includes(this.bu6Table.search) ||
x.tdesc.includes(this.bu6Table.search) ||
x.edesc.includes(this.bu6Table.search))
}
selectBu6(bu6?: Bu6Model) {
this.bu6 = new MyBu6Model(bu6 || {})
......@@ -79,23 +80,25 @@ export class SubDepartmentThreeComponent implements OnInit {
this.bu6Modal.page = Array.from({ length: Math.ceil(this.filterBu6Modal().length / 10) }, (_, i) => i + 1);
}
filterBu6Modal() {
return this.bu6List.filter(x => x.bu6id.toLowerCase().includes(this.bu6Modal.search) ||
x.tdesc.toLowerCase().includes(this.bu6Modal.search) ||
x.edesc.toLowerCase().includes(this.bu6Modal.search))
return this.bu6List.filter(x => x.bu6id.includes(this.bu6Modal.search) ||
x.tdesc.includes(this.bu6Modal.search) ||
x.edesc.includes(this.bu6Modal.search))
}
addBu6() {
// this.bu6Service.post(this.bu6).subscribe((response:any) => {
// if (response.success) {
// this.getBu6List()
// }
// })
}
deleteBu6(bu6: Bu6Model) {
// this.bu6Service.delete(new MyBu6Model(bu6)).subscribe((response:any) => {
// if (response.success) {
// this.getBu6List()
// }
// })
this.bu6Service.post({ ...this.bu6, parent: this.bu5.bu5id }).subscribe((response: any) => {
if (response.success) {
this.getBu6List()
this.showSuccessAdd()
}
})
}
deleteBu6() {
this.bu6Service.delete(this.bu6).subscribe((response: any) => {
if (response.success) {
this.getBu6List()
this.showSuccessDelete()
}
})
}
getBu5List() {
......@@ -113,9 +116,9 @@ export class SubDepartmentThreeComponent implements OnInit {
this.selectBu5(bu5 || new MyBu5Model({ bu5id: this.bu5.bu5id }))
}
filterBu5Modal() {
return this.bu5List.filter(x => x.bu5id.toLowerCase().includes(this.bu5Modal.search) ||
x.tdesc.toLowerCase().includes(this.bu5Modal.search) ||
x.edesc.toLowerCase().includes(this.bu5Modal.search))
return this.bu5List.filter(x => x.bu5id.includes(this.bu5Modal.search) ||
x.tdesc.includes(this.bu5Modal.search) ||
x.edesc.includes(this.bu5Modal.search))
}
selectBu5(bu5?: Bu5Model) {
this.bu5 = new MyBu5Model(bu5 || {})
......
......@@ -48,6 +48,7 @@ export class SubDepartmentTwoComponent implements OnInit {
this.bu5Service.getList().subscribe(response => {
this.bu5List = response
this.onBu5TableSearchChange()
this.cdr.detectChanges()
})
}
onBu5TableSearchChange() {
......@@ -55,9 +56,9 @@ export class SubDepartmentTwoComponent implements OnInit {
this.bu5Table.page = Array.from({ length: Math.ceil(this.filterBu5Table().length / 10) }, (_, i) => i + 1);
}
filterBu5Table() {
return this.bu5List.filter(x => x.bu5id.toLowerCase().includes(this.bu5Table.search) ||
x.tdesc.toLowerCase().includes(this.bu5Table.search) ||
x.edesc.toLowerCase().includes(this.bu5Table.search))
return this.bu5List.filter(x => x.bu5id.includes(this.bu5Table.search) ||
x.tdesc.includes(this.bu5Table.search) ||
x.edesc.includes(this.bu5Table.search))
}
selectBu5(bu5?: Bu5Model) {
this.bu5 = new MyBu5Model(bu5 || {})
......@@ -78,23 +79,25 @@ export class SubDepartmentTwoComponent implements OnInit {
this.bu5Modal.page = Array.from({ length: Math.ceil(this.filterBu5Modal().length / 10) }, (_, i) => i + 1);
}
filterBu5Modal() {
return this.bu5List.filter(x => x.bu5id.toLowerCase().includes(this.bu5Modal.search) ||
x.tdesc.toLowerCase().includes(this.bu5Modal.search) ||
x.edesc.toLowerCase().includes(this.bu5Modal.search))
return this.bu5List.filter(x => x.bu5id.includes(this.bu5Modal.search) ||
x.tdesc.includes(this.bu5Modal.search) ||
x.edesc.includes(this.bu5Modal.search))
}
addBu5() {
// this.bu5Service.post(this.bu5).subscribe((response:any) => {
// if (response.success) {
// this.getBu5List()
// }
// })
}
deleteBu5(bu5: Bu5Model) {
// this.bu5Service.delete(new MyBu5Model(bu5)).subscribe((response:any) => {
// if (response.success) {
// this.getBu5List()
// }
// })
this.bu5Service.post({ ...this.bu5, parent: this.bu4.bu4id }).subscribe((response: any) => {
if (response.success) {
this.getBu5List()
this.showSuccessAdd()
}
})
}
deleteBu5() {
this.bu5Service.delete(this.bu5).subscribe((response: any) => {
if (response.success) {
this.getBu5List()
this.showSuccessDelete()
}
})
}
getBu4List() {
......@@ -112,9 +115,9 @@ export class SubDepartmentTwoComponent implements OnInit {
this.selectBu4(bu4 || new MyBu4Model({ bu4id: this.bu4.bu4id }))
}
filterBu4Modal() {
return this.bu4List.filter(x => x.bu4id.toLowerCase().includes(this.bu4Modal.search) ||
x.tdesc.toLowerCase().includes(this.bu4Modal.search) ||
x.edesc.toLowerCase().includes(this.bu4Modal.search))
return this.bu4List.filter(x => x.bu4id.includes(this.bu4Modal.search) ||
x.tdesc.includes(this.bu4Modal.search) ||
x.edesc.includes(this.bu4Modal.search))
}
selectBu4(bu4?: Bu4Model) {
this.bu4 = new MyBu4Model(bu4 || {})
......
......@@ -66,18 +66,29 @@
</ng-container>
</tr>
</thead>
<tbody *ngIf="!dataListFilter().length">
<tbody *ngIf="dataLoading">
<tr>
<td class="text-center" colspan="100%">
<div *ngFor="let item of [1,2,3]" class="ti-spinner w-8 h-8 text-secondary mx-1" role="status"
aria-label="loading">
<span class="sr-only">Loading...</span>
</div>
</td>
</tr>
</tbody>
<tbody *ngIf="!dataLoading&&!dataListFilter().length">
<tr>
<td class="text-center" colspan="100%">
ไม่พบข้อมูล
</td>
</tr>
</tbody>
<tbody *ngIf="dataListFilter().length">
<tbody *ngIf="!dataLoading&&dataListFilter().length">
<tr
*ngFor="let item of dataListFilter() | 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.code}}" [(ngModel)]="item.check">
<input type="checkbox" class="ti-form-checkbox cursor-pointer" id="checkbox-{{item.data.code}}"
[(ngModel)]="item.check">
<label for="checkbox-{{item.data.code}}">&nbsp;{{item.data.code}}</label>
</td>
<td>{{item.data.tdesc}}</td>
......@@ -248,7 +259,7 @@
ย้อนกลับ
</button>
<a class="ti-btn ti-btn-success" href="javascript:void(0);"
data-hs-overlay="#company-registration-page-alert-modal">
data-hs-overlay="#company-registration-page-alert-modal" (click)="addCompany()">
บันทึกข้อมูล
</a>
</ng-container>
......
import { Component } from '@angular/core';
import { ChangeDetectorRef, Component } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { MyCompanyModel } from 'src/app/shared/model/company.model';
import { CompanyService } from 'src/app/shared/services/company.service';
export interface DataModel {
code: string
tdesc: string
......@@ -17,13 +19,32 @@ export class CompanyRegistrationPageComponent {
page = Array.from({ length: 1 }, (_, i) => i + 1);
search = ""
modalStatus = 'add'
dataList: { check: boolean, data: DataModel }[] = [
{ check: false, data: { code: "CC-01", tdesc: "บริษัท มายเอชอาร์ จำกัด", edesc: "MYHR COMPANY LIMITED", address: "1", contact: "2" } },
]
dataList: { check: boolean, data: DataModel }[] = []
dataLoading = false
dataSelect: DataModel = { code: "", tdesc: "", edesc: "", address: "", contact: "" }
constructor(private toastr: ToastrService) {
this.searchChange()
constructor(private toastr: ToastrService,
private companyService: CompanyService,
private cdr: ChangeDetectorRef
) {
}
ngOnInit(): void {
this.getCompanyList()
}
getCompanyList() {
this.dataLoading = true
this.companyService.getList().subscribe({
next: response => {
this.dataList = response.map(x => ({ check: false, data: { code: x.companyId, tdesc: x.tdesc, edesc: x.edesc, address: x.taddr, contact: x.descOther } }))
this.dataLoading = false
this.searchChange()
this.cdr.detectChanges()
}, error: error => {
this.dataLoading = false
this.cdr.detectChanges()
}
})
}
searchChange() {
......@@ -40,4 +61,22 @@ export class CompanyRegistrationPageComponent {
setData(data?: DataModel) {
this.dataSelect = JSON.parse(JSON.stringify(data || { code: "", tdesc: "", edesc: "", address: "", contact: "" }));
}
addCompany() {
const body = new MyCompanyModel({ companyId: this.dataSelect.code, tdesc: this.dataSelect.tdesc, edesc: this.dataSelect.edesc, taddr: this.dataSelect.address, descOther: this.dataSelect.contact })
this.companyService.post(body).subscribe((response: any) => {
if (response.success) {
this.showSuccess()
this.getCompanyList()
}
})
}
showSuccess() {
this.toastr.success('บันทึกข้อมูลสำเร็จ', 'แจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
}
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { EmpTypeModel, MyEmpTypeModel } from 'src/app/shared/model/employee-type.model';
import { EmpTypeService } from 'src/app/shared/services/employee-type.service';
......@@ -25,8 +25,9 @@ export class EmployeeCategories {
emp_type: EmpTypeModel = new MyEmpTypeModel({})
search = ""
itemToDelete: EmpTypeModel | null = null;
constructor(private EmpTypeService: EmpTypeService,
private toastr: ToastrService
constructor(private empTypeService: EmpTypeService,
private toastr: ToastrService,
private cdr: ChangeDetectorRef
) { }
ngOnInit(): void {
this.getEmpTypeList()
......@@ -49,7 +50,7 @@ export class EmployeeCategories {
modalSize: 'm',
backdropClose: true,
},
"upload":{
"upload": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
......@@ -76,9 +77,10 @@ export class EmployeeCategories {
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // หากไม่มี Modal อื่นเปิด
}
getEmpTypeList() {
this.EmpTypeService.getList().subscribe(response => {
this.emp_typeList = response
this.empTypeService.getList().subscribe(response => {
this.emp_typeList = response.map(x => new MyEmpTypeModel(x))
this.searchChange()
this.cdr.detectChanges()
})
}
searchChange() {
......@@ -86,28 +88,30 @@ export class EmployeeCategories {
this.page = Array.from({ length: Math.ceil(this.emp_typeListFilter().length / 10) }, (_, i) => i + 1);
}
emp_typeListFilter() {
return this.emp_typeList.filter(x =>
x.codeId.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
return this.emp_typeList.filter(x =>
x.codeId.includes(this.search) ||
x.tdesc.includes(this.search) ||
x.edesc.includes(this.search))
}
selectEmp_type(emp_type: EmpTypeModel) {
selectEmp_type(emp_type?: EmpTypeModel) {
// this.showSuccess()
this.emp_type = new MyEmpTypeModel(emp_type)
this.emp_type = new MyEmpTypeModel(emp_type || {})
}
addEmp_type() {
// this.emp_typeService.post(this.emp_type).subscribe((response:any) => {
// if (response.success) {
// this.getemp_typeList()
// }
// })
}
deleteEmp_type(emp_type: EmpTypeModel) {
// this.emp_typeService.delete(new MyEmpTypeModel(emp_type)).subscribe((response:any) => {
// if (response.success) {
// this.getemp_typeList()
// }
// })
this.empTypeService.post(this.emp_type).subscribe((response: any) => {
if (response.success) {
this.getEmpTypeList()
this.showSuccessAdd()
}
})
}
deleteEmp_type() {
this.empTypeService.delete(this.emp_type).subscribe((response: any) => {
if (response.success) {
this.getEmpTypeList()
this.showSuccessDelete()
}
})
}
......
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { EmpGroupModel, MyEmpGroupModel } from 'src/app/shared/model/emp_group.model';
import { EmpGroupService } from 'src/app/shared/services/emp_group.service';
......@@ -17,10 +17,11 @@ export class EmployeeGroupUnit implements OnInit {
page = Array.from({ length: 1 }, (_, i) => i + 1);
emp_groupList: EmpGroupModel[] = []
emp_group: EmpGroupModel = new MyEmpGroupModel({})
search = ""
constructor(private EmpGroupService: EmpGroupService,
private toastr: ToastrService
search = ""
constructor(private empGroupService: EmpGroupService,
private toastr: ToastrService,
private cdr: ChangeDetectorRef
) { }
// ฟังก์ชันในการเปลี่ยนแท็บ
......@@ -52,7 +53,7 @@ export class EmployeeGroupUnit implements OnInit {
modalSize: 'm',
backdropClose: true,
},
"upload":{
"upload": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
......@@ -79,9 +80,10 @@ export class EmployeeGroupUnit implements OnInit {
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // หากไม่มี Modal อื่นเปิด
}
getEmpGroupList() {
this.EmpGroupService.getList().subscribe(response => {
this.empGroupService.getList().subscribe(response => {
this.emp_groupList = response
this.searchChange()
this.cdr.detectChanges()
})
}
searchChange() {
......@@ -89,14 +91,13 @@ export class EmployeeGroupUnit implements OnInit {
this.page = Array.from({ length: Math.ceil(this.emp_groupListFilter().length / 10) }, (_, i) => i + 1);
}
emp_groupListFilter() {
return this.emp_groupList.filter(x => x.groupId.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
return this.emp_groupList.filter(x => x.groupId.includes(this.search) ||
x.tdesc.includes(this.search) ||
x.edesc.includes(this.search))
}
selectEmp_group(emp_group: EmpGroupModel) {
// this.showSuccess()
this.emp_group = new MyEmpGroupModel(emp_group)
selectEmp_group(emp_group?: EmpGroupModel) {
this.emp_group = new MyEmpGroupModel(emp_group || {})
}
showSuccess() {
......@@ -118,19 +119,20 @@ export class EmployeeGroupUnit implements OnInit {
});
}
addEmp_group() {
// this.emp_groupService.post(this.emp_group).subscribe((response:any) => {
// if (response.success) {
// this.getemp_groupList()
// }
// })
this.empGroupService.post(this.emp_group).subscribe((response: any) => {
if (response.success) {
this.getEmpGroupList()
this.showSuccess()
}
})
}
deleteEmp_group(emp_group: EmpGroupModel) {
// this.emp_groupService.delete(new MyEmpGroupModel(emp_group)).subscribe((response:any) => {
// if (response.success) {
// this.getemp_groupList()
// }
// })
deleteEmp_group() {
this.empGroupService.delete(this.emp_group).subscribe((response: any) => {
if (response.success) {
this.getEmpGroupList()
this.showSuccessDelete()
}
})
}
......
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { MyPLModel, PLModel } from 'src/app/shared/model/pl.model';
import { PLService } from 'src/app/shared/services/pl.service';
......@@ -24,15 +24,17 @@ export class EmployeeLevel implements OnInit {
pl: PLModel = new MyPLModel({})
search = ""
constructor(private plService: PLService,
private toastr: ToastrService
private toastr: ToastrService,
private cdr: ChangeDetectorRef
) { }
ngOnInit(): void {
this.getPLList()
}
getPLList() {
this.plService.getList().subscribe(response => {
this.plList = response
this.plList = response.map(x => new MyPLModel(x))
this.searchChange()
this.cdr.detectChanges()
})
}
searchChange() {
......@@ -40,27 +42,29 @@ export class EmployeeLevel implements OnInit {
this.page = Array.from({ length: Math.ceil(this.plListFilter().length / 10) }, (_, i) => i + 1);
}
plListFilter() {
return this.plList.filter(x => x.plId.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
return this.plList.filter(x => x.plId.includes(this.search) ||
x.tdesc.includes(this.search) ||
x.edesc.includes(this.search))
}
selectPL(pl: PLModel) {
selectPL(pl?: PLModel) {
// this.showSuccess()
this.pl = new MyPLModel(pl)
this.pl = new MyPLModel(pl || {})
}
addPL() {
// this.plService.post(this.pl).subscribe((response:any) => {
// if (response.success) {
// this.getPLList()
// }
// })
this.plService.post(this.pl).subscribe((response: any) => {
if (response.success) {
this.getPLList()
this.showSuccessAdd()
}
})
}
deletePL(pl: PLModel) {
// this.plService.delete(new MyPLModel(pl)).subscribe((response:any) => {
// if (response.success) {
// this.getPLList()
// }
// })
deletePL() {
this.plService.delete(this.pl).subscribe((response: any) => {
if (response.success) {
this.getPLList()
this.showSuccessDelete()
}
})
}
showSuccessAdd() {
this.toastr.success('บันทึกข้อมูลสำเร็จ', 'แจ้งเตือน', {
......
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { MyPositionModel, PositionModel } from 'src/app/shared/model/position.model';
import { PositionService } from 'src/app/shared/services/position.service';
......@@ -24,15 +24,17 @@ export class PositionUnitComponent implements OnInit {
position: PositionModel = new MyPositionModel({})
search = ""
constructor(private positionService: PositionService,
private toastr: ToastrService
private toastr: ToastrService,
private cdr: ChangeDetectorRef
) { }
ngOnInit(): void {
this.getPositionList()
}
getPositionList() {
this.positionService.getList().subscribe(response => {
this.positionList = response
this.positionList = response.map(x => new MyPositionModel(x))
this.searchChange()
this.cdr.detectChanges()
})
}
searchChange() {
......@@ -40,13 +42,13 @@ export class PositionUnitComponent implements OnInit {
this.page = Array.from({ length: Math.ceil(this.positionListFilter().length / 10) }, (_, i) => i + 1);
}
positionListFilter() {
return this.positionList.filter(x => x.positionId.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
return this.positionList.filter(x => x.positionId.includes(this.search) ||
x.tdesc.includes(this.search) ||
x.edesc.includes(this.search))
}
selectPosition(position: PositionModel) {
selectPosition(position?: PositionModel) {
// this.showSuccess()
this.position = new MyPositionModel(position)
this.position = new MyPositionModel(position || {})
}
showSuccess() {
......@@ -68,18 +70,20 @@ export class PositionUnitComponent implements OnInit {
});
}
addPosition() {
// this.positionService.post(this.position).subscribe((response:any) => {
// if (response.success) {
// this.getPositionList()
// }
// })
this.positionService.post(this.position).subscribe((response: any) => {
if (response.success) {
this.getPositionList()
this.showSuccess()
}
})
}
deletePosition(position: PositionModel) {
// this.positionService.delete(new MyPositionModel(position)).subscribe((response:any) => {
// if (response.success) {
// this.getPositionList()
// }
// })
deletePosition() {
this.positionService.delete(this.position).subscribe((response: any) => {
if (response.success) {
this.getPositionList()
this.showSuccessDelete()
}
})
}
}
......
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { MyCompetencycourseModel } from 'src/app/shared/model/competencycourse.model';
import { CompetencycourseService } from 'src/app/shared/services/competencycourse.service';
export interface DataModel {
id: string
name: string
edesc: string
detail: string
topic: string
checked: boolean
}
@Component({
selector: 'app-development-course',
templateUrl: './development-course.component.html',
......@@ -11,6 +20,10 @@ export class DevelopmentCourseComponent {
@Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>();
activeTab: string = 'tab1'; // กำหนด tab เริ่มต้น
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
search = ""
// ฟังก์ชันในการเปลี่ยนแท็บ
changeTab(tab: { id: string, text: string }) {
this.sendPathTitle.emit(['การประเมินสมรรถนะ', 'ตั้งค่าผู้ใช้งาน', tab.text]);
......@@ -25,17 +38,17 @@ export class DevelopmentCourseComponent {
backdropClose: boolean;
};
} = {
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
};
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
};
openModal(name: string, size: string, closeOnBackdrop?: boolean) {
this.modalOptions[name].modalSize = size;
......@@ -58,7 +71,7 @@ export class DevelopmentCourseComponent {
// ฟังก์ชัน toggle checkbox
isChecked: boolean = false; // ใช้สำหรับตรวจสอบสถานะของ checkbox
toggleCheckbox() {
this.isChecked = !this.isChecked;
this.mockData.forEach((item) => {
......@@ -69,25 +82,69 @@ export class DevelopmentCourseComponent {
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล
addUser() {
const body = new MyCompetencycourseModel({ competencyCourseId: this.dataSelect.id, tdesc: this.dataSelect.name, edesc: this.dataSelect.edesc, courseTopic: this.dataSelect.topic, courseDetail: this.dataSelect.detail })
this.competencycourseService.post(body).subscribe((response: any) => {
if (response.success) {
this.showSuccess()
this.getCompetencycourseList()
}
})
}
deleteUser() {
const body = new MyCompetencycourseModel({ competencyCourseId: this.dataSelect.id, tdesc: this.dataSelect.name, edesc: this.dataSelect.edesc, courseTopic: this.dataSelect.topic, courseDetail: this.dataSelect.detail })
this.competencycourseService.delete(body).subscribe((response: any) => {
if (response.success) {
this.showSuccessDelete()
this.getCompetencycourseList()
}
})
}
currentModal = "";
mockData = [
{ 'id': 'CC-01-01', 'name': 'จิตสำนึกด้านความปลอดภัยและคุณภาพ (Safety & Quality) สำหรับพนักงานระดับ O1-O2', 'code': '1', 'checked': false },
{ 'id': 'CC-01-02', 'name': 'จิตสำนึกด้านความปลอดภัยและคุณภาพ (Safety & Quality) สำหรับพนักงานระดับ O3-O4', 'code': '2', 'checked': false },
{ 'id': 'CC-01-03', 'name': 'จิตสำนึกด้านความปลอดภัยและคุณภาพ (Safety & Quality) สำหรับพนักงานระดับ S1-S2', 'code': '3', 'checked': false },
{ 'id': 'CC-01-04', 'name': 'จิตสำนึกด้านความปลอดภัยและคุณภาพ (Safety & Quality) สำหรับพนักงานระดับ S3-S4', 'code': '4', 'checked': false },
{ 'id': 'CC-01-05', 'name': 'จิตสำนึกด้านความปลอดภัยและคุณภาพ (Safety & Quality) สำหรับพนักงานระดับ M1-M2', 'code': '5', 'checked': false },
{ 'id': 'CC-01-06', 'name': 'จิตสำนึกด้านความปลอดภัยและคุณภาพ (Safety & Quality) สำหรับพนักงานระดับ M3-M4', 'code': '6', 'checked': false },
{ 'id': 'CC-01-07', 'name': 'จิตสำนึกด้านความปลอดภัยและคุณภาพ (Safety & Quality) สำหรับพนักงานระดับ E1-E2', 'code': '7', 'checked': false }
]
mockDataSelect:any =[]
mockData: DataModel[] = []
dataLoading = false
dataSelect: DataModel = { id: "", name: "", edesc: "", topic: "", detail: "", checked: false }
mockDataSelect: any = []
constructor(private toastr: ToastrService) { }
checkSelect(){
constructor(private toastr: ToastrService,
private cdr: ChangeDetectorRef,
private competencycourseService: CompetencycourseService
) { }
ngOnInit(): void {
this.getCompetencycourseList()
}
getCompetencycourseList() {
this.dataLoading = true
this.competencycourseService.getList().subscribe({
next: response => {
this.mockData = response.map(x => ({ id: x.competencyCourseId, name: x.tdesc, edesc: x.edesc, topic: x.courseTopic, detail: x.courseDetail, checked: false }))
this.dataLoading = false
this.searchChange()
this.cdr.detectChanges()
}, error: error => {
this.dataLoading = false
this.cdr.detectChanges()
}
})
}
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.dataListFilter().length / 10) }, (_, i) => i + 1);
}
dataListFilter() {
return this.mockData.filter(x => {
const data = x
const match = data.id.includes(this.search) || data.name.includes(this.search)
return match;
});
}
selectCompetencycourse(data?: DataModel) {
this.dataSelect = JSON.parse(JSON.stringify(data || { id: "", name: "", edesc: "", topic: "", detail: "", checked: false }));
}
checkSelect() {
this.mockDataSelect = this.mockData.filter(item => item.checked);
}
showSuccess() {
......
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { MyCompetencytopicModel } from 'src/app/shared/model/competencytopic.model';
import { MyCompetencytypeModel } from 'src/app/shared/model/competencytype.model';
import { CompetencytopicService } from 'src/app/shared/services/competencytopic.service';
import { CompetencytypeService } from 'src/app/shared/services/competencytype.service';
export interface DataModel {
id: string
name: string
edesc: string
code: string
definition: string
type: DataModel2
checked: boolean
}
export interface DataModel2 {
id: string
name: string
edesc: string
code: string
level: string
}
@Component({
selector: 'app-competency-topic',
templateUrl: './competency-topic.component.html',
styleUrls: ['./competency-topic.component.scss']
})
export class CompetencyTopic {
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
search = ""
currentPageModal = 1
pageModal = Array.from({ length: 1 }, (_, i) => i + 1);
searchModal = ""
@Input() pathTitle = ['การประเมินสมรรถนะ', 'ทะเบียนกำหนดชื่อ', 'หัวข้อสมรรถนะ'];
@Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>();
activeTab: string = 'tab1'; // กำหนด tab เริ่มต้น
......@@ -25,17 +53,17 @@ export class CompetencyTopic {
backdropClose: boolean;
};
} = {
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
};
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
};
// [
// ['CC-01', 'จิตสำนึกด้านความปลอดภัยและคุณภาพ (Safety & Quality)','CC'],
// ['CC-02', 'การทำงานเป็นทีมแบบ TAT (TAT Teamwork)','CC'],
......@@ -44,15 +72,12 @@ export class CompetencyTopic {
// ['MC-02', 'การมีทัศนคติเชิงบวก (Mindset-Growth)','MC'],
// ['PC-01', 'ความรู้ด้านกฏหมายแรงงาน, กฏหมายแพ่งภาณิชย์, กฏหมายอาญา','PC']
mockData = [
{ 'id': 'CC-01', 'name': 'จิตสำนึกด้านความปลอดภัยและคุณภาพ (Safety & Quality)', 'code': 'CC', 'checked': false },
{ 'id': 'CC-02', 'name': 'การทำงานเป็นทีมแบบ TAT (TAT Teamwork)', 'code': 'CC', 'checked': false },
{ 'id': 'CC-03', 'name': 'ความรับผิดชอบในหน้าที่และโปร่งใส (Accountability & Ethics)', 'code': 'CC', 'checked': false },
{ 'id': 'MC-01', 'name': 'การคิดเชิงกลยุทธิ์ (Strategic Thinking)', 'code': 'MC', 'checked': false },
{ 'id': 'MC-02', 'name': 'การมีทัศนคติเชิงบวก (Mindset-Growth)', 'code': 'MC', 'checked': false },
{ 'id': 'PC-01', 'name': 'ความรู้ด้านกฏหมายแรงงาน, กฏหมายแพ่งภาณิชย์, กฏหมายอาญา', 'code': 'PC', 'checked': false }
]
mockDataSelect:any =[]
mockData: DataModel[] = []
dataLoading = false
dataSelect: DataModel = { id: "", name: "", edesc: "", code: "", definition: "", type: { id: "", name: "", edesc: "", code: "", level: "" }, checked: false }
competencytypeListLoading = false
competencytypeList: DataModel2[] = []
mockDataSelect: any = []
openModal(name: string, size: string, closeOnBackdrop?: boolean) {
this.modalOptions[name].modalSize = size;
this.modalOptions[name].backdropClose = closeOnBackdrop || false;
......@@ -74,7 +99,7 @@ export class CompetencyTopic {
// ฟังก์ชัน toggle checkbox
isChecked: boolean = false; // ใช้สำหรับตรวจสอบสถานะของ checkbox
toggleCheckbox() {
this.isChecked = !this.isChecked; // สลับสถานะ'
this.mockData.forEach((item) => {
......@@ -83,19 +108,106 @@ export class CompetencyTopic {
this.checkSelect();
}
checkSelect(){
checkSelect() {
this.mockDataSelect = this.mockData.filter(item => item.checked);
}
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล
addUser() {
const body = new MyCompetencytopicModel({
competencyTopicId: this.dataSelect.id, tdesc: this.dataSelect.name, edesc: this.dataSelect.edesc, competencyDetail: this.dataSelect.definition,
competencyType: new MyCompetencytypeModel({ competencyTypeId: this.dataSelect.type.id, tdesc: this.dataSelect.type.name, edesc: this.dataSelect.type.edesc, shortName: this.dataSelect.type.code, expectationLevel: this.dataSelect.type.level }),
})
this.competencytopicService.post(body).subscribe((response: any) => {
if (response.success) {
this.showSuccess()
this.getCompetencytopicList()
}
})
}
deleteUser() {
const body = new MyCompetencytopicModel({
competencyTopicId: this.dataSelect.id, tdesc: this.dataSelect.name, edesc: this.dataSelect.edesc, competencyDetail: this.dataSelect.definition,
competencyType: new MyCompetencytypeModel({ competencyTypeId: this.dataSelect.type.id, tdesc: this.dataSelect.type.name, edesc: this.dataSelect.type.edesc, shortName: this.dataSelect.type.code, expectationLevel: this.dataSelect.type.level }),
})
this.competencytopicService.delete(body).subscribe((response: any) => {
if (response.success) {
this.showSuccessDelete()
this.getCompetencytopicList()
}
})
}
currentModal = "";
constructor(private toastr: ToastrService) { }
constructor(private toastr: ToastrService,
private cdr: ChangeDetectorRef,
private competencytopicService: CompetencytopicService,
private competencytypeService: CompetencytypeService
) { }
ngOnInit(): void {
this.getCompetencytopicList()
this.getCompetencytypeList()
}
getCompetencytypeList() {
this.competencytypeListLoading = true
this.competencytypeService.getList().subscribe({
next: response => {
this.competencytypeList = response.map(x => ({ id: x.competencyTypeId, name: x.tdesc, edesc: x.edesc, code: x.shortName, level: x.expectationLevel, checked: false }))
this.competencytypeListLoading = false
this.searchChange()
this.cdr.detectChanges()
}, error: error => {
this.competencytypeListLoading = false
this.cdr.detectChanges()
}
})
}
searchCompetencytypeChange() {
this.currentPageModal = 1
this.pageModal = Array.from({ length: Math.ceil(this.competencytypeListFilter().length / 10) }, (_, i) => i + 1);
}
competencytypeListFilter() {
return this.competencytypeList.filter(x => {
const data = x
const match = data.id.includes(this.searchModal) || data.name.includes(this.searchModal) || data.code.includes(this.searchModal);
return match;
});
}
selectCompetencytype(data: DataModel2) {
this.dataSelect.type = JSON.parse(JSON.stringify(data));
}
getCompetencytopicList() {
this.dataLoading = true
this.competencytopicService.getList().subscribe({
next: response => {
this.mockData = response.map(x => ({
id: x.competencyTopicId, name: x.tdesc, edesc: x.edesc, code: x.competencyType.shortName, definition: x.competencyDetail,
type: { id: x.competencyType.competencyTypeId, name: x.competencyType.tdesc, edesc: x.competencyType.edesc, code: x.competencyType.shortName, level: x.expectationLevel },
checked: false
}))
this.dataLoading = false
this.searchChange()
this.cdr.detectChanges()
}, error: error => {
this.dataLoading = false
this.cdr.detectChanges()
}
})
}
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.dataListFilter().length / 10) }, (_, i) => i + 1);
}
dataListFilter() {
return this.mockData.filter(x => {
const data = x
const match = data.id.includes(this.search) || data.name.includes(this.search) || data.code.includes(this.search);
return match;
});
}
selectCompetencytopic(data?: DataModel) {
this.dataSelect = JSON.parse(JSON.stringify(data || { id: "", name: "", edesc: "", code: "", definition: "", type: { id: "", name: "", edesc: "", code: "", level: "" }, checked: false }));
}
showSuccess() {
this.toastr.success('บันทึกข้อมูลสำเร็จ', 'เเจ้งเตือน', {
......
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { MyCompetencytypeModel } from 'src/app/shared/model/competencytype.model';
import { CompetencytypeService } from 'src/app/shared/services/competencytype.service';
export interface DataModel {
id: string
name: string
edesc: string
code: string
level: string
checked: boolean
}
@Component({
selector: 'app-type-registration',
templateUrl: './type-registration.component.html',
styleUrls: ['./type-registration.component.scss']
selector: 'app-type-registration',
templateUrl: './type-registration.component.html',
styleUrls: ['./type-registration.component.scss']
})
export class TypeRegistration {
@Input() pathTitle = ['การประเมินสมรรถนะ', 'ทะเบียนกำหนดชื่อ', 'ประเภทสมรรถนะ'];
......@@ -12,6 +21,12 @@ export class TypeRegistration {
activeTab: string = 'tab1'; // กำหนด tab เริ่มต้น
isChecked: boolean = false;
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
search = ""
// ฟังก์ชันในการเปลี่ยนแท็บ
changeTab(tab: { id: string, text: string }) {
this.sendPathTitle.emit(['การประเมินสมรรถนะ', 'ทะเบียนกำหนดชื่อ', tab.text]);
......@@ -28,17 +43,17 @@ export class TypeRegistration {
backdropClose: boolean;
};
} = {
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
};
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
};
toggleCheckbox(): void {
......@@ -49,14 +64,12 @@ export class TypeRegistration {
this.checkSelect();
}
mockData = [
{ 'id': '01', 'name': 'Core Competency', 'code': 'CC','checked': false },
{ 'id': '02', 'name': 'Management Competency', 'code': 'MC','checked': false },
{ 'id': '03', 'name': 'Position Competency', 'code': 'PC','checked': false },
]
mockDataSelect:any =[]
mockData: DataModel[] = []
dataLoading = false
dataSelect: DataModel = { id: "", name: "", edesc: "", code: "", level: "", checked: false }
mockDataSelect: any = []
checkSelect(){
checkSelect() {
this.mockDataSelect = this.mockData.filter(item => item.checked);
}
......@@ -81,10 +94,60 @@ export class TypeRegistration {
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล
addUser() {
const body = new MyCompetencytypeModel({ competencyTypeId: this.dataSelect.id, tdesc: this.dataSelect.name, edesc: this.dataSelect.edesc, shortName: this.dataSelect.code, expectationLevel: this.dataSelect.level })
this.competencytypeService.post(body).subscribe((response: any) => {
if (response.success) {
this.showSuccess()
this.getCompetencytypeList()
}
})
}
deleteUser() {
const body = new MyCompetencytypeModel({ competencyTypeId: this.dataSelect.id, tdesc: this.dataSelect.name, edesc: this.dataSelect.edesc, shortName: this.dataSelect.code, expectationLevel: this.dataSelect.level })
this.competencytypeService.delete(body).subscribe((response: any) => {
if (response.success) {
this.showSuccessDelete()
this.getCompetencytypeList()
}
})
}
currentModal = ""
constructor(private toastr: ToastrService) { }
constructor(private toastr: ToastrService,
private cdr: ChangeDetectorRef,
private competencytypeService: CompetencytypeService
) { }
ngOnInit(): void {
this.getCompetencytypeList()
}
getCompetencytypeList() {
this.dataLoading = true
this.competencytypeService.getList().subscribe({
next: response => {
this.mockData = response.map(x => ({ id: x.competencyTypeId, name: x.tdesc, edesc: x.edesc, code: x.shortName, level: x.expectationLevel, checked: false }))
this.dataLoading = false
this.searchChange()
this.cdr.detectChanges()
}, error: error => {
this.dataLoading = false
this.cdr.detectChanges()
}
})
}
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.dataListFilter().length / 10) }, (_, i) => i + 1);
}
dataListFilter() {
return this.mockData.filter(x => {
const data = x
const match = data.id.includes(this.search) || data.name.includes(this.search) || data.code.includes(this.search);
return match;
});
}
selectCompetencytype(data?: DataModel) {
this.dataSelect = JSON.parse(JSON.stringify(data || { id: "", name: "", edesc: "", code: "", level: "", checked: false }));
}
showSuccess() {
this.toastr.success('บันทึกข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
......
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
import { MyAssessmentModel } from 'src/app/shared/model/assessment.model';
import { AssessmentService } from 'src/app/shared/services/assessment.service';
export interface DataModel {
id: string
name: string
edesc: string
code: string
checked: boolean
}
@Component({
selector: 'app-assessment-tool',
templateUrl: './assessment-tool.component.html',
styleUrls: ['./assessment-tool.component.scss']
selector: 'app-assessment-tool',
templateUrl: './assessment-tool.component.html',
styleUrls: ['./assessment-tool.component.scss']
})
export class AssessmentToolComponent {
@Input() pathTitle = ['การประเมินสมรรถนะ', 'ทะเบียนเครื่องมือ', 'เครื่องมือประเมิน'];
......@@ -12,6 +20,12 @@ export class AssessmentToolComponent {
activeTab: string = 'tab1'; // กำหนด tab เริ่มต้น
isChecked: boolean = false;
currentPage = 1
page = Array.from({ length: 1 }, (_, i) => i + 1);
search = ""
// ฟังก์ชันในการเปลี่ยนแท็บ
changeTab(tab: { id: string, text: string }) {
this.sendPathTitle.emit(['การประเมินสมรรถนะ', 'ทะเบียนเครื่องมือ', tab.text]);
......@@ -28,17 +42,17 @@ export class AssessmentToolComponent {
backdropClose: boolean;
};
} = {
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
};
"add": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
},
"edit": {
isModalOpen: false,
modalSize: 'm',
backdropClose: true,
}
};
openModal(name: string, size: string, closeOnBackdrop?: boolean) {
this.modalOptions[name].modalSize = size;
......@@ -61,11 +75,61 @@ export class AssessmentToolComponent {
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล
addUser() {
const body = new MyAssessmentModel({ assessmentId: this.dataSelect.id, tdesc: this.dataSelect.name, edesc: this.dataSelect.edesc, shortName: this.dataSelect.code })
this.assessmentService.post(body).subscribe((response: any) => {
if (response.success) {
this.showSuccess()
this.getAssessmentList()
}
})
}
deleteUser() {
const body = new MyAssessmentModel({ assessmentId: this.dataSelect.id, tdesc: this.dataSelect.name, edesc: this.dataSelect.edesc, shortName: this.dataSelect.code })
this.assessmentService.delete(body).subscribe((response: any) => {
if (response.success) {
this.showSuccessDelete()
this.getAssessmentList()
}
})
}
currentModal = ""
constructor(private toastr: ToastrService) { }
constructor(private toastr: ToastrService,
private cdr: ChangeDetectorRef,
private assessmentService: AssessmentService
) { }
ngOnInit(): void {
this.getAssessmentList()
}
getAssessmentList() {
this.dataLoading = true
this.assessmentService.getList().subscribe({
next: response => {
this.mockData = response.map(x => ({ id: x.assessmentId, name: x.tdesc, edesc: x.edesc, code: x.shortName, checked: false }))
this.dataLoading = false
this.searchChange()
this.cdr.detectChanges()
}, error: error => {
this.dataLoading = false
this.cdr.detectChanges()
}
})
}
searchChange() {
this.currentPage = 1
this.page = Array.from({ length: Math.ceil(this.dataListFilter().length / 10) }, (_, i) => i + 1);
}
dataListFilter() {
return this.mockData.filter(x => {
const data = x
const match = data.id.includes(this.search) || data.name.includes(this.search) || data.code.includes(this.search);
return match;
});
}
selectAssessment(data?: DataModel) {
this.dataSelect = JSON.parse(JSON.stringify(data || { id: "", name: "", edesc: "", code: "", checked: false }));
}
toggleCheckbox(): void {
this.isChecked = !this.isChecked;
......@@ -74,16 +138,15 @@ export class AssessmentToolComponent {
});
this.checkSelect();
}
mockData = [
{ 'id': '01', 'name': 'เเบบสังเกต', 'code': 'O','checked': false },
{ 'id': '02', 'name': 'เเบบการปฏิบัติงาน', 'code': 'D','checked': false },
{ 'id': '03', 'name': 'การบันทึก/เอกสาร', 'code': 'P','checked': false },
{ 'id': '04', 'name': 'การสัมภาษณ์', 'code': 'I','checked': false },
{ 'id': '05', 'name': 'เเบบทดสอบ', 'code': 'T','checked': false },
]
mockDataSelect:any =[]
checkSelect(){
mockData: DataModel[] = []
dataLoading = false
dataSelect: DataModel = { id: "", name: "", edesc: "", code: "", checked: false }
mockDataSelect: any = []
checkSelect() {
this.mockDataSelect = this.mockData.filter(item => item.checked);
}
......
......@@ -114,6 +114,11 @@ import { CompanyRegistrationPageComponent } from '../company-components/company-
import { IdpEvalutionComponent } from '../performance-evaluation/idp-evaluation/idp-evalution.component';
import { PmsEvalutionComponent } from '../performance-evaluation/pms-evaluation/pms-evalution.component';
import { CEvaluationComponent } from '../performance-evaluation/c-evaluation/c-evaluation.component';
import { CompanyService } from 'src/app/shared/services/company.service';
import { CompetencytypeService } from 'src/app/shared/services/competencytype.service';
import { CompetencytopicService } from 'src/app/shared/services/competencytopic.service';
import { AssessmentService } from 'src/app/shared/services/assessment.service';
import { CompetencycourseService } from 'src/app/shared/services/competencycourse.service';
@NgModule({
declarations: [
SalesComponent,
......@@ -223,10 +228,27 @@ import { CEvaluationComponent } from '../performance-evaluation/c-evaluation/c-e
FormsModule,
NgxDaterangepickerMd.forRoot(),
],
providers: [Bu1Service, Bu2Service, Bu3Service, Bu4Service, Bu5Service, Bu6Service, Bu7Service, PositionService, PLService, EmpGroupService, EmpTypeService, {
provide: HTTP_INTERCEPTORS,
useClass: HttpRequestInterceptor,
multi: true,
},]
providers: [
Bu1Service,
Bu2Service,
Bu3Service,
Bu4Service,
Bu5Service,
Bu6Service,
Bu7Service,
PositionService,
PLService,
EmpGroupService,
EmpTypeService,
CompanyService,
CompetencytypeService,
CompetencytopicService,
AssessmentService,
CompetencycourseService,
{
provide: HTTP_INTERCEPTORS,
useClass: HttpRequestInterceptor,
multi: true,
},]
})
export class DashboardModule { }
......@@ -25,9 +25,9 @@ export class SubCommandStructureComponent {
this.page = Array.from({ length: Math.ceil(this.jobListFilter().length / 10) }, (_, i) => i + 1);
}
jobListFilter() {
return this.jobList.filter(x => x.jobid.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
return this.jobList.filter(x => x.jobid.includes(this.search) ||
x.tdesc.includes(this.search) ||
x.edesc.includes(this.search))
}
selectJob(job: JobModel) {
// this.showSuccess()
......
......@@ -25,9 +25,9 @@ export class SubJobCompetencyComponent {
this.page = Array.from({ length: Math.ceil(this.jobListFilter().length / 10) }, (_, i) => i + 1);
}
jobListFilter() {
return this.jobList.filter(x => x.jobid.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
return this.jobList.filter(x => x.jobid.includes(this.search) ||
x.tdesc.includes(this.search) ||
x.edesc.includes(this.search))
}
selectJob(job: JobModel) {
// this.showSuccess()
......
......@@ -24,9 +24,9 @@ export class ImportDataComponent {
this.page = Array.from({ length: Math.ceil(this.jobListFilter().length / 10) }, (_, i) => i + 1);
}
jobListFilter() {
return this.jobList.filter(x => x.jobid.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
return this.jobList.filter(x => x.jobid.includes(this.search) ||
x.tdesc.includes(this.search) ||
x.edesc.includes(this.search))
}
selectJob(job: JobModel) {
// this.showSuccess()
......
......@@ -24,9 +24,9 @@ export class WorkDetailComponent {
this.page = Array.from({ length: Math.ceil(this.jobListFilter().length / 10) }, (_, i) => i + 1);
}
jobListFilter() {
return this.jobList.filter(x => x.jobid.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
return this.jobList.filter(x => x.jobid.includes(this.search) ||
x.tdesc.includes(this.search) ||
x.edesc.includes(this.search))
}
selectJob(job: JobModel) {
// this.showSuccess()
......
......@@ -25,9 +25,9 @@ export class SubJobPositionIndicatorsComponent {
this.page = Array.from({ length: Math.ceil(this.jobListFilter().length / 10) }, (_, i) => i + 1);
}
jobListFilter() {
return this.jobList.filter(x => x.jobid.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
return this.jobList.filter(x => x.jobid.includes(this.search) ||
x.tdesc.includes(this.search) ||
x.edesc.includes(this.search))
}
selectJob(job: JobModel) {
// this.showSuccess()
......
......@@ -25,9 +25,9 @@ export class SubJobQualificationsComponent {
this.page = Array.from({ length: Math.ceil(this.jobListFilter().length / 10) }, (_, i) => i + 1);
}
jobListFilter() {
return this.jobList.filter(x => x.jobid.toLowerCase().includes(this.search) ||
x.tdesc.toLowerCase().includes(this.search) ||
x.edesc.toLowerCase().includes(this.search))
return this.jobList.filter(x => x.jobid.includes(this.search) ||
x.tdesc.includes(this.search) ||
x.edesc.includes(this.search))
}
selectJob(job: JobModel) {
// this.showSuccess()
......
export interface AssessmentModel {
assessmentId: string
companyId: string
edesc: string
tdesc: string
shortName: string
}
export class MyAssessmentModel implements AssessmentModel {
assessmentId: string
companyId: string
edesc: string
tdesc: string
shortName: string
constructor(data: Partial<AssessmentModel>) {
this.assessmentId = data.assessmentId || ""
this.companyId = data.companyId || ""
this.edesc = data.edesc || ""
this.tdesc = data.tdesc || ""
this.shortName = data.shortName || ""
}
}
export interface CompanyModel {
companyId: string
tdesc: string
edesc: string
companyGroup: string
amphur: string
tvillage: string
troomno: string
tfloor: string
taddr: string
tmoo: string
tsoi: string
troad: string
tdistrict: string
evillage: string
eroomno: string
efloor: string
eaddr: string
emoo: string
esoi: string
eroad: string
edistrict: string
zipcode: string
tel: string
fax: string
website: string
insType: string
companyType: string
noOfEmployee: number
empDaily: number
noOfDaily: number
empMonthly: number
noOfMonthly: number
empOther: number
noOfOther: number
officeWorkTime: string
probation: number
descOther: string
noOfBranch: number
payCash: number
payCheque: number
payBank: number
payOther: number
compensationTax: string
companyAbb: string
brandTdesc: string
brandEdesc: string
logo: string
}
export class MyCompanyModel implements CompanyModel {
companyId: string
tdesc: string
edesc: string
companyGroup: string
amphur: string
tvillage: string
troomno: string
tfloor: string
taddr: string
tmoo: string
tsoi: string
troad: string
tdistrict: string
evillage: string
eroomno: string
efloor: string
eaddr: string
emoo: string
esoi: string
eroad: string
edistrict: string
zipcode: string
tel: string
fax: string
website: string
insType: string
companyType: string
noOfEmployee: number
empDaily: number
noOfDaily: number
empMonthly: number
noOfMonthly: number
empOther: number
noOfOther: number
officeWorkTime: string
probation: number
descOther: string
noOfBranch: number
payCash: number
payCheque: number
payBank: number
payOther: number
compensationTax: string
companyAbb: string
brandTdesc: string
brandEdesc: string
logo: string
constructor(data: Partial<CompanyModel>) {
this.companyId = data.companyId || ""
this.tdesc = data.tdesc || ""
this.edesc = data.edesc || ""
this.companyGroup = data.companyGroup || ""
this.amphur = data.amphur || ""
this.tvillage = data.tvillage || ""
this.troomno = data.troomno || ""
this.tfloor = data.tfloor || ""
this.taddr = data.taddr || ""
this.tmoo = data.tmoo || ""
this.tsoi = data.tsoi || ""
this.troad = data.troad || ""
this.tdistrict = data.tdistrict || ""
this.evillage = data.evillage || ""
this.eroomno = data.eroomno || ""
this.efloor = data.efloor || ""
this.eaddr = data.eaddr || ""
this.emoo = data.emoo || ""
this.esoi = data.esoi || ""
this.eroad = data.eroad || ""
this.edistrict = data.edistrict || ""
this.zipcode = data.zipcode || ""
this.tel = data.tel || ""
this.fax = data.fax || ""
this.website = data.website || ""
this.insType = data.insType || ""
this.companyType = data.companyType || ""
this.noOfEmployee = data.noOfEmployee ?? 0
this.empDaily = data.empDaily ?? 0
this.noOfDaily = data.noOfDaily ?? 0
this.empMonthly = data.empMonthly ?? 0
this.noOfMonthly = data.noOfMonthly ?? 0
this.empOther = data.empOther ?? 0
this.noOfOther = data.noOfOther ?? 0
this.officeWorkTime = data.officeWorkTime || ""
this.probation = data.probation ?? 0
this.descOther = data.descOther || ""
this.noOfBranch = data.noOfBranch ?? 0
this.payCash = data.payCash ?? 0
this.payCheque = data.payCheque ?? 0
this.payBank = data.payBank ?? 0
this.payOther = data.payOther ?? 0
this.compensationTax = data.compensationTax || ""
this.companyAbb = data.companyAbb || ""
this.brandTdesc = data.brandTdesc || ""
this.brandEdesc = data.brandEdesc || ""
this.logo = data.logo || ""
}
}
export interface CompetencycourseModel {
competencyCourseId: string
companyId: string
edesc: string
tdesc: string
courseDetail: string
courseTopic: string
}
export class MyCompetencycourseModel implements CompetencycourseModel {
competencyCourseId: string
companyId: string
edesc: string
tdesc: string
courseDetail: string
courseTopic: string
constructor(data: Partial<CompetencycourseModel>) {
this.competencyCourseId = data.competencyCourseId || ""
this.companyId = data.companyId || ""
this.edesc = data.edesc || ""
this.tdesc = data.tdesc || ""
this.courseDetail = data.courseDetail || ""
this.courseTopic = data.courseTopic || ""
}
}
import { CompetencytypeModel, MyCompetencytypeModel } from "./competencytype.model"
export interface CompetencytopicModel {
competencyTopicId: string
competencyType: CompetencytypeModel
companyId: string
edesc: string
tdesc: string
competencyDetail: string
competencyFiles: string
lineNo: number
expectationLevel: string
}
export class MyCompetencytopicModel implements CompetencytopicModel {
competencyTopicId: string
competencyType: CompetencytypeModel
companyId: string
edesc: string
tdesc: string
competencyDetail: string
competencyFiles: string
lineNo: number
expectationLevel: string
constructor(data: Partial<CompetencytopicModel>) {
this.competencyTopicId = data.competencyTopicId || ""
this.competencyType = new MyCompetencytypeModel(data.competencyType || {})
this.companyId = data.companyId || ""
this.edesc = data.edesc || ""
this.tdesc = data.tdesc || ""
this.competencyDetail = data.competencyDetail || ""
this.competencyFiles = data.competencyFiles || ""
this.lineNo = data.lineNo ?? 0
this.expectationLevel = data.expectationLevel || ""
}
}
export interface CompetencytypeModel {
competencyTypeId: string
companyId: string
edesc: string
tdesc: string
shortName: string
expectationLevel: string
}
export class MyCompetencytypeModel implements CompetencytypeModel {
competencyTypeId: string
companyId: string
edesc: string
tdesc: string
shortName: string
expectationLevel: string
constructor(data: Partial<CompetencytypeModel>) {
this.competencyTypeId = data.competencyTypeId || ""
this.companyId = data.companyId || ""
this.edesc = data.edesc || ""
this.tdesc = data.tdesc || ""
this.shortName = data.shortName || ""
this.expectationLevel = data.expectationLevel || ""
}
}
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { AssessmentModel } from '../model/assessment.model';
@Injectable({
providedIn: 'root'
})
export class AssessmentService {
api = "/assessment"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getById(competencyTypeId: string): Observable<AssessmentModel> {
return this.http.get<AssessmentModel>(this.urlApi + "/" + competencyTypeId)
}
getList(): Observable<AssessmentModel[]> {
return this.http.get<AssessmentModel[]>(this.urlApi + "/lists")
}
post(body: AssessmentModel) {
return this.http.post(this.urlApi, body)
}
delete(body: AssessmentModel) {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
}
}
\ No newline at end of file
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { AngularFireAuth } from '@angular/fire/compat/auth';
import { Router } from '@angular/router';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
@Injectable({
providedIn: 'root',
})
export class AuthService {
authState: any;
constructor(private afu: AngularFireAuth, private router: Router) {
api = "/authen"
urlApi = environment.baseUrl + this.api
constructor(private afu: AngularFireAuth, private router: Router, private http: HttpClient) {
this.afu.authState.subscribe((auth: any) => {
this.authState = auth;
});
......@@ -64,6 +68,15 @@ export class AuthService {
});
}
loginWithUserPass(username: string, password: string): Observable<{ accessToken: string }> {
const body = {
username: username,
password: password
}
return this.http.post<{ accessToken: string }>(this.urlApi + "/login", body)
}
singout(): void {
this.afu.signOut();
this.router.navigate(['/login']);
......
......@@ -14,19 +14,19 @@ export class Bu1Service {
getList(): Observable<Bu1Model[]> {
return this.http.get<Bu1Model[]>(this.urlApi + "/lists")
}
getById(bu1id:string): Observable<Bu1Model> {
return this.http.get<Bu1Model>(this.urlApi + "/"+bu1id)
getById(bu1id: string): Observable<Bu1Model> {
return this.http.get<Bu1Model>(this.urlApi + "/" + bu1id)
}
post(body: Bu1Model) {
return this.http.post(this.urlApi, body)
}
delete(body: Bu1Model) {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
}
// post(body: Bu1Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu1Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
}
......@@ -17,16 +17,16 @@ export class Bu2Service {
getById(bu2id: string): Observable<Bu2Model> {
return this.http.get<Bu2Model>(this.urlApi + "/" + bu2id)
}
// post(body: Bu1Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu1Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
post(body: Bu2Model) {
return this.http.post(this.urlApi, body)
}
delete(body: Bu2Model) {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
}
}
......@@ -17,16 +17,16 @@ import { Bu3Model } from '../model/bu3.model';
getList(): Observable<Bu3Model[]> {
return this.http.get<Bu3Model[]>(this.urlApi + "/lists")
}
// post(body: Bu3Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu3Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
post(body: Bu3Model) {
return this.http.post(this.urlApi, body)
}
delete(body: Bu3Model) {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
}
}
\ No newline at end of file
......@@ -17,16 +17,16 @@ export class Bu4Service {
getById(bu4id: string): Observable<Bu4Model> {
return this.http.get<Bu4Model>(this.urlApi + "/" + bu4id)
}
// post(body: Bu1Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu1Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
post(body: Bu4Model) {
return this.http.post(this.urlApi, body)
}
delete(body: Bu4Model) {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
}
}
......@@ -17,16 +17,16 @@ export class Bu5Service {
getById(bu5id: string): Observable<Bu5Model> {
return this.http.get<Bu5Model>(this.urlApi + "/" + bu5id)
}
// post(body: Bu1Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu1Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
post(body: Bu5Model) {
return this.http.post(this.urlApi, body)
}
delete(body: Bu5Model) {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
}
}
......@@ -17,16 +17,16 @@ export class Bu6Service {
getById(bu6id: string): Observable<Bu6Model> {
return this.http.get<Bu6Model>(this.urlApi + "/" + bu6id)
}
// post(body: Bu1Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu1Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
post(body: Bu6Model) {
return this.http.post(this.urlApi, body)
}
delete(body: Bu6Model) {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
}
}
......@@ -17,16 +17,16 @@ export class Bu7Service {
getById(bu7id: string): Observable<Bu7Model> {
return this.http.get<Bu7Model>(this.urlApi + "/" + bu7id)
}
// post(body: Bu1Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu1Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
post(body: Bu7Model) {
return this.http.post(this.urlApi, body)
}
delete(body: Bu7Model) {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
}
}
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { CompanyModel } from '../model/company.model';
@Injectable({
providedIn: 'root'
})
export class CompanyService {
api = "/company"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getById(companyId: string): Observable<CompanyModel> {
return this.http.get<CompanyModel>(this.urlApi + "/" + companyId)
}
getList(): Observable<CompanyModel[]> {
return this.http.get<CompanyModel[]>(this.urlApi + "/lists")
}
post(body: CompanyModel) {
return this.http.post(this.urlApi, body)
}
// delete(body: CompanyModel) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
}
\ 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 { CompetencycourseModel } from '../model/competencycourse.model';
@Injectable({
providedIn: 'root'
})
export class CompetencycourseService {
api = "/competencycourse"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getById(competencyTypeId: string): Observable<CompetencycourseModel> {
return this.http.get<CompetencycourseModel>(this.urlApi + "/" + competencyTypeId)
}
getList(): Observable<CompetencycourseModel[]> {
return this.http.get<CompetencycourseModel[]>(this.urlApi + "/lists")
}
post(body: CompetencycourseModel) {
return this.http.post(this.urlApi, body)
}
delete(body: CompetencycourseModel) {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
}
}
\ 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 { CompetencytopicModel } from '../model/competencytopic.model';
@Injectable({
providedIn: 'root'
})
export class CompetencytopicService {
api = "/competencytopic"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getById(competencyTopicId: string): Observable<CompetencytopicModel> {
return this.http.get<CompetencytopicModel>(this.urlApi + "/" + competencyTopicId)
}
getList(): Observable<CompetencytopicModel[]> {
return this.http.get<CompetencytopicModel[]>(this.urlApi + "/lists")
}
post(body: CompetencytopicModel) {
return this.http.post(this.urlApi, body)
}
delete(body: CompetencytopicModel) {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
}
}
\ 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 { CompetencytypeModel } from '../model/competencytype.model';
@Injectable({
providedIn: 'root'
})
export class CompetencytypeService {
api = "/competencytype"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getById(competencyTypeId: string): Observable<CompetencytypeModel> {
return this.http.get<CompetencytypeModel>(this.urlApi + "/" + competencyTypeId)
}
getList(): Observable<CompetencytypeModel[]> {
return this.http.get<CompetencytypeModel[]>(this.urlApi + "/lists")
}
post(body: CompetencytypeModel) {
return this.http.post(this.urlApi, body)
}
delete(body: CompetencytypeModel) {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
}
}
\ No newline at end of file
......@@ -18,16 +18,16 @@ export class EmpGroupService {
getById(groupId: string): Observable<EmpGroupModel> {
return this.http.get<EmpGroupModel>(this.urlApi + "/" + groupId)
}
// post(body: Bu1Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu1Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
post(body: EmpGroupModel) {
return this.http.post(this.urlApi, body)
}
delete(body: EmpGroupModel) {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
}
}
......@@ -18,16 +18,16 @@ export class EmpTypeService {
getById(codeId: string): Observable<EmpTypeModel> {
return this.http.get<EmpTypeModel>(this.urlApi + "/" + codeId)
}
// post(body: Bu1Model) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: Bu1Model) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
post(body: EmpTypeModel) {
return this.http.post(this.urlApi, body)
}
delete(body: EmpTypeModel) {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
}
}
......@@ -15,10 +15,10 @@ export class HttpRequestInterceptor {
constructor() { }
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
if (req.url.startsWith("./")) {
if (req.url.startsWith("./") || !sessionStorage.getItem("accessToken")) {
return next.handle(req);
} else {
const authHeader = 'Bearer ' + "eyJhbGciOiJIUzI1NiJ9.eyJzY2hlbWEiOiJkYm8iLCJlbmNvZGUiOiIyIiwic3ViIjoiQXV0aCIsImNvbXBhbnlOYW1lIjoi4Lia4Lij4Li04Lip4Lix4LiXIOC4oeC4suC4ouC5gOC4reC4iuC4reC4suC4o-C5jCDguIjguLPguIHguLHguJQiLCJkYk5hbWUiOiJNWUhSUExVUyIsInJvbGVzIjpbIlVTRVIiXSwid29ya2FyZWEiOiJUS1ciLCJpc3MiOiJDb21wdXRlciBTY2llbmNlIENvcnBvcmF0aW9uIExpbWl0ZWQiLCJ6bWxvZ2luIjoiZmFsc2UiLCJyb2xlX2xldmVsIjoiNiIsImVtcGxveWVlaWQiOiIxMDAwMDA4MiIsImJyYW5jaCI6Im15aHIzIiwiZW1wX3Bvc2l0aW9uIjoiMDk3IiwidXNlcl9yb2xlIjoiQWxsIiwidWlkIjoiMTAwMDAwODIiLCJjb21wYW55aWQiOiIxMDAiLCJhY3RvcmlkIjoiMTAwMDAwODIiLCJsYW5nIjoidGgiLCJhZCI6ImZhbHNlIiwiZmlyc3Rsb2dpbiI6ImZhbHNlIiwidXJsX215aHIiOiJodHRwOi8vaHJwbHVzLXN0ZC5teWhyLmNvLnRoL2hyIiwiYXBwX25hbWUiOiJteWhyIiwicmVnaW9uYWxsdHkiOiJFTkciLCJ0b2tlbl96ZWVtZSI6IiIsInVzZXJfbGV2ZWwiOiJNWUhSIiwiZnVsbG5hbWUiOiLguJnguLLguKLguK3guJ7guLTguKPguLHguJXguJnguYwgIOC4l-C4lOC4quC4reC4miIsImNvbWlkIjoiIiwiam9iIjoiMDk3LTI0NjkiLCJ1c2VyIjoibXlociIsInptX3VzZXIiOiIiLCJ1c2VybmFtZSI6Im15aHIiLCJtZW1iZXJpZCI6IiJ9.5VUk7ZilGchdTTm-5YC0xIL53cEYX6AkfEW4d8Xd-1g";
const authHeader = 'Bearer ' + sessionStorage.getItem("accessToken")
const overideReq = {
headers: req.headers.set('Authorization', authHeader),
url: req.url,
......
......@@ -4,29 +4,29 @@ import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { PLModel } from '../model/pl.model';
@Injectable({
providedIn: 'root'
})
export class PLService {
api = "/pl"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getById(plId:string): Observable<PLModel> {
return this.http.get<PLModel>(this.urlApi + "/" + plId)
}
getList(): Observable<PLModel[]> {
return this.http.get<PLModel[]>(this.urlApi + "/lists")
}
// post(body: PLModel) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: PLModel) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
}
\ No newline at end of file
providedIn: 'root'
})
export class PLService {
api = "/pl"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getById(plId: string): Observable<PLModel> {
return this.http.get<PLModel>(this.urlApi + "/" + plId)
}
getList(): Observable<PLModel[]> {
return this.http.get<PLModel[]>(this.urlApi + "/lists")
}
post(body: PLModel) {
return this.http.post(this.urlApi, body)
}
delete(body: PLModel) {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
}
}
\ No newline at end of file
......@@ -17,16 +17,16 @@ import { PositionModel } from '../model/position.model';
getList(): Observable<PositionModel[]> {
return this.http.get<PositionModel[]>(this.urlApi + "/lists")
}
// post(body: PositionModel) {
// return this.http.post(this.urlApi, body)
// }
// delete(body: PositionModel) {
// const options = {
// headers: new HttpHeaders({
// "Content-Type": "application/json",
// }),
// body: body
// };
// return this.http.delete(this.urlApi, options)
// }
post(body: PositionModel) {
return this.http.post(this.urlApi, body)
}
delete(body: PositionModel) {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete(this.urlApi, options)
}
}
\ No newline at end of file
......@@ -12,8 +12,9 @@ export const environment = {
appId: '********************************',
measurementId: '********************************',
},
baseUrl: 'https://hrplus-std.myhr.co.th/plus',
// baseUrl: 'https://hrplus-std.myhr.co.th/plus',
// baseUrl: 'https://192.168.10.165/plus',
baseUrl: ' https://myskill-x.myhr.co.th/api',
};
/*
......
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