Commit 84c08d57 by Nattana Chaiyamat

ตั้งค่าผู้ใช้งาน

parent 8cbf148f
...@@ -10,27 +10,30 @@ ...@@ -10,27 +10,30 @@
<nav class="-mb-0.5 flex space-x-6 rtl:space-x-reverse"> <nav class="-mb-0.5 flex space-x-6 rtl:space-x-reverse">
<a class="text-base font-medium hs-tab-active:text-lg hs-tab-active:font-bold hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary active" <a class="text-base font-medium hs-tab-active:text-lg hs-tab-active:font-bold hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary active"
href="javascript:void(0);" id="underline-item-1" data-hs-tab="#underline-1" href="javascript:void(0);" id="underline-item-1" data-hs-tab="#underline-1"
aria-controls="underline-1" (click)="pathTitle = ['การจัดการข้อมูลองค์กร', 'ตั้งค่าผู้ใช้งาน','สร้างชื่อผู้ใช้งาน']"> aria-controls="underline-1"
(click)="currentPage =1 ;pathTitle = ['การจัดการข้อมูลองค์กร', 'ตั้งค่าผู้ใช้งาน','สร้างชื่อผู้ใช้งาน']">
สร้างชื่อผู้ใช้งาน สร้างชื่อผู้ใช้งาน
</a> </a>
<a class="text-base font-medium hs-tab-active:text-lg hs-tab-active:font-bold hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 px-1 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary" <a class="text-base font-medium hs-tab-active:text-lg hs-tab-active:font-bold hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 px-1 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary"
href="javascript:void(0);" id="underline-item-2" data-hs-tab="#underline-2" href="javascript:void(0);" id="underline-item-2" data-hs-tab="#underline-2"
aria-controls="underline-2" (click)="pathTitle = ['การจัดการข้อมูลองค์กร', 'ตั้งค่าผู้ใช้งาน','กำหนดรหัสผ่าน']"> aria-controls="underline-2"
(click)="currentPage =2 ;pathTitle = ['การจัดการข้อมูลองค์กร', 'ตั้งค่าผู้ใช้งาน','กำหนดรหัสผ่าน']">
กำหนดรหัสผ่าน กำหนดรหัสผ่าน
</a> </a>
<a class="text-base font-medium hs-tab-active:text-lg hs-tab-active:font-bold hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 px-1 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary" <a class="text-base font-medium hs-tab-active:text-lg hs-tab-active:font-bold hs-tab-active:border-secondary hs-tab-active:text-secondary pb-3 px-1 inline-flex items-center gap-2 border-b-[3px] border-transparent whitespace-nowrap text-gray-500 dark:text-white/70 hover:text-secondary"
href="javascript:void(0);" id="underline-item-3" data-hs-tab="#underline-3" href="javascript:void(0);" id="underline-item-3" data-hs-tab="#underline-3"
aria-controls="underline-3" (click)="pathTitle = ['การจัดการข้อมูลองค์กร', 'ตั้งค่าผู้ใช้งาน','จัดการผู้ใช้งาน']"> aria-controls="underline-3"
(click)="currentPage =3 ;pathTitle = ['การจัดการข้อมูลองค์กร', 'ตั้งค่าผู้ใช้งาน','จัดการผู้ใช้งาน']">
จัดการผู้ใช้งาน จัดการผู้ใช้งาน
</a> </a>
</nav> </nav>
</div> </div>
<div class="mt-3 px-3rem !-mt-3 pt-50px"> <div class="mt-3 px-3rem !-mt-3 pt-50px">
<div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1"> <div *ngIf="currentPage==1" id="underline-1" role="tabpanel" aria-labelledby="underline-item-1">
<app-user-settings [pathTitle]="pathTitle" <app-user-settings></app-user-settings>
(sendPathTitle)="pathTitle=$event"></app-user-settings>
</div> </div>
<div id="underline-2" class="hidden" role="tabpanel" aria-labelledby="underline-item-2"> <div *ngIf="currentPage==2" id="underline-2" class="hidden" role="tabpanel"
aria-labelledby="underline-item-2">
<app-set-a-password [pathTitle]="pathTitle" (sendPathTitle)="pathTitle=$event"></app-set-a-password> <app-set-a-password [pathTitle]="pathTitle" (sendPathTitle)="pathTitle=$event"></app-set-a-password>
</div> </div>
</div> </div>
......
...@@ -6,5 +6,6 @@ import { Component } from '@angular/core'; ...@@ -6,5 +6,6 @@ import { Component } from '@angular/core';
styleUrls: ['./account-settings.component.scss'] styleUrls: ['./account-settings.component.scss']
}) })
export class AccountSettingsComponent { export class AccountSettingsComponent {
pathTitle = ['การจัดการข้อมูลองค์กร','ตั้งค่าผู้ใช้งาน', 'สร้างชื่อผู้ใช้งาน'] pathTitle = ['การจัดการข้อมูลองค์กร', 'ตั้งค่าผู้ใช้งาน', 'สร้างชื่อผู้ใช้งาน']
currentPage = 1
} }
import { Component, EventEmitter, Input, Output } from '@angular/core'; import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { ToastrService } from 'ngx-toastr'; import { ToastrService } from 'ngx-toastr';
import { MyUserModel, UserModel } from 'src/app/shared/model/user.model';
import { FileService } from 'src/app/shared/services/file.service';
import { UserService } from 'src/app/shared/services/user.service';
@Component({ @Component({
selector: 'app-user-settings', selector: 'app-user-settings',
...@@ -7,88 +10,82 @@ import { ToastrService } from 'ngx-toastr'; ...@@ -7,88 +10,82 @@ import { ToastrService } from 'ngx-toastr';
styleUrls: ['./user-settings.component.scss'] styleUrls: ['./user-settings.component.scss']
}) })
export class UserSettingsComponent { export class UserSettingsComponent {
@Input() pathTitle = ['การจัดการข้อมูลองค์กร', 'ตั้งค่าผู้ใช้งาน', 'สร้างรหัสผู้ใช้งาน']; selectedFile: File | null = null;
@Output() sendPathTitle: EventEmitter<string[]> = new EventEmitter<string[]>(); selectedFileName: string = 'กรุณาเลือกไฟล์';
activeTab: string = 'tab1'; // กำหนด tab เริ่มต้น currentModal: 'add' | 'edit' = "add"
// ฟังก์ชันในการเปลี่ยนแท็บ data: { loading: boolean, select: UserModel, dataList: { check: boolean, data: UserModel }[] } = { loading: false, select: new MyUserModel(), dataList: [] }
changeTab(tab: { id: string, text: string }) { constructor(private toastr: ToastrService,
this.sendPathTitle.emit(['การจัดการข้อมูลองค์กร', 'ตั้งค่าผู้ใช้งาน', tab.text]); private cdr: ChangeDetectorRef,
this.activeTab = tab.id; private userService: UserService,
private fileService: FileService) { }
ngOnInit(): void {
this.getUserList()
} }
getUserList() {
// การจัดการการเปิดปิด modal this.data.loading = true
modalOptions: { this.userService.getList().subscribe(response => {
[nameModal: string]: { this.data.dataList = response.map(x => ({ check: false, data: new MyUserModel(x) }))
isModalOpen: boolean; this.data.loading = false
modalSize: string; this.cdr.detectChanges()
backdropClose: boolean; }, error => {
}; this.data.loading = false
} = { this.cdr.detectChanges()
"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;
this.modalOptions[name].backdropClose = closeOnBackdrop || false;
this.modalOptions[name].isModalOpen = true;
this.currentModal = name; // ตั้งค่าค่าของ currentModal เป็น 'add' หรือ 'edit'
document.body.style.overflow = 'hidden';
} }
closeModal(name: string) { selectUser(data?: UserModel) {
this.modalOptions[name].isModalOpen = false; this.data.select = new MyUserModel(data)
if (!this.isAnyModalOpen()) {
document.body.style.overflow = ''; // คืนค่าการ Scroll เฉพาะเมื่อ Modal ทั้งหมดปิดแล้ว
}
} }
onFileSelected(event: any) {
isAnyModalOpen(): boolean { this.selectedFile = event.target.files.length > 0 ? event.target.files[0] : null;
return Object.values(this.modalOptions).some(modal => modal.isModalOpen); // ตรวจสอบว่า modal อื่นยังเปิดอยู่หรือไม่ this.selectedFileName = this.selectedFile?.name || "กรุณาเลือกไฟล์"
} }
uploadFile() {
// ฟังก์ชันสำหรับการเพิ่ม ลบ หรือแก้ไข ข้อมูล if (!this.selectedFile) {
addUser() { alert('กรุณาเลือกไฟล์ก่อนอัปโหลด')
// ฟังก์ชันสำหรับการเพิ่มผู้ใช้งาน return
console.log('เพิ่มผู้ใช้งาน'); }
const formData = new FormData();
formData.append('file', this.selectedFile);
this.data.loading = true
this.fileService.upload(formData, 'mbu1').subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
} else {
this.showAlert(response.message, 'error')
this.data.loading = false
}
}, error: error => {
this.showAlert(error.message, 'error')
this.data.loading = false
}
})
} }
downloadFile() {
const fileName = 'IMPORT_USER.xlsx'
this.fileService.download(fileName).subscribe({
next: response => {
const url = window.URL.createObjectURL(response);
const a = document.createElement("a");
a.href = url;
a.download = fileName;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
}, error: error => {
this.showAlert(error.message, 'error')
}
})
deleteUser() {
// ฟังก์ชันสำหรับการลบผู้ใช้งาน
console.log('ลบผู้ใช้งาน');
} }
editUser() { showAlert(text: string, type: 'success' | 'error') {
// ฟังก์ชันสำหรับการแก้ไขผู้ใช้งาน this.toastr[type](text, 'แจ้งเตือน', {
console.log('แก้ไขผู้ใช้งาน');
}
currentModal = ""
constructor(private toastr: ToastrService) { }
showSuccess() {
this.toastr.success('บันทึกข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
showSuccessEdit() {
this.toastr.success('เเก้ไขข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000,
positionClass: 'toast-top-right',
});
}
showSuccessDelete() {
this.toastr.success('ลบข้อมูลสำเร็จ', 'เเจ้งเตือน', {
timeOut: 3000, timeOut: 3000,
positionClass: 'toast-top-right', positionClass: 'toast-top-right',
}); })
} }
} }
...@@ -191,8 +191,9 @@ ...@@ -191,8 +191,9 @@
<div class="relative flex rounded-md"> <div class="relative flex rounded-md">
<input type="text" id="hs-leading-button-add-on-with-icon-and-button" <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
name="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button"
class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10" class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10 bg-input-readonly" readonly
style="padding-right: 3.5rem;" [(ngModel)]="bu1.bu1id" (ngModelChange)="bu1idChange()"> style="padding-right: 3.5rem;" [(ngModel)]="bu1.bu1id"
(ngModelChange)="bu1idChange()">
<div <div
class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2"> class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<button type="button" class="flex items-center text-red-500" (click)="selectBu1()"> <button type="button" class="flex items-center text-red-500" (click)="selectBu1()">
...@@ -293,7 +294,7 @@ ...@@ -293,7 +294,7 @@
<div class="relative flex rounded-md"> <div class="relative flex rounded-md">
<input type="text" id="hs-leading-button-add-on-with-icon-and-button" <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
name="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button"
class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10" class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10 bg-input-readonly" readonly
style="padding-right: 3.5rem;" [(ngModel)]="bu1.bu1id" (ngModelChange)="bu1idChange()"> style="padding-right: 3.5rem;" [(ngModel)]="bu1.bu1id" (ngModelChange)="bu1idChange()">
<div <div
class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2"> class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
...@@ -678,7 +679,7 @@ ...@@ -678,7 +679,7 @@
</div> </div>
<div id="department-list-upload-modal" class="hs-overlay hidden ti-modal"> <div id="department-list-upload-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)] rounded-md"> <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm"> <div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white"> <h5 class="text-xxl font-bold text-white">
นำเข้าทะเบียนแผนก นำเข้าทะเบียนแผนก
......
...@@ -344,7 +344,7 @@ ...@@ -344,7 +344,7 @@
</div> </div>
<div id="department-register-upload-modal" class="hs-overlay hidden ti-modal"> <div id="department-register-upload-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)] rounded-md"> <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm"> <div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white"> <h5 class="text-xxl font-bold text-white">
นำเข้าทะเบียนฝ่าย นำเข้าทะเบียนฝ่าย
......
...@@ -190,7 +190,7 @@ ...@@ -190,7 +190,7 @@
<div class="relative flex rounded-md"> <div class="relative flex rounded-md">
<input type="text" id="hs-leading-button-add-on-with-icon-and-button" <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
name="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button"
class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10" class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10 bg-input-readonly" readonly
style="padding-right: 3.5rem;" [(ngModel)]="bu2.bu2id" (ngModelChange)="bu2idChange()"> style="padding-right: 3.5rem;" [(ngModel)]="bu2.bu2id" (ngModelChange)="bu2idChange()">
<div <div
class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2"> class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
...@@ -297,7 +297,7 @@ ...@@ -297,7 +297,7 @@
<div class="relative flex rounded-md"> <div class="relative flex rounded-md">
<input type="text" id="hs-leading-button-add-on-with-icon-and-button" <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
name="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button"
class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10" class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10 bg-input-readonly" readonly
style="padding-right: 3.5rem;" [(ngModel)]="bu2.bu2id" (ngModelChange)="bu2idChange()"> style="padding-right: 3.5rem;" [(ngModel)]="bu2.bu2id" (ngModelChange)="bu2idChange()">
<div <div
class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2"> class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
...@@ -683,7 +683,7 @@ ...@@ -683,7 +683,7 @@
</div> </div>
<div id="section-registration-upload-modal" class="hs-overlay hidden ti-modal"> <div id="section-registration-upload-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)] rounded-md"> <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm"> <div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white"> <h5 class="text-xxl font-bold text-white">
นำเข้าทะเบียนส่วน นำเข้าทะเบียนส่วน
......
...@@ -190,7 +190,7 @@ ...@@ -190,7 +190,7 @@
<div class="relative flex rounded-md"> <div class="relative flex rounded-md">
<input type="text" id="hs-leading-button-add-on-with-icon-and-button" <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
name="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button"
class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10" class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10 bg-input-readonly" readonly
style="padding-right: 3.5rem;" [(ngModel)]="bu6.bu6id" (ngModelChange)="bu6idChange()"> style="padding-right: 3.5rem;" [(ngModel)]="bu6.bu6id" (ngModelChange)="bu6idChange()">
<div <div
class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2"> class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
...@@ -297,7 +297,7 @@ ...@@ -297,7 +297,7 @@
<div class="relative flex rounded-md"> <div class="relative flex rounded-md">
<input type="text" id="hs-leading-button-add-on-with-icon-and-button" <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
name="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button"
class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10" class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10 bg-input-readonly" readonly
style="padding-right: 3.5rem;" [(ngModel)]="bu6.bu6id" (ngModelChange)="bu6idChange()"> style="padding-right: 3.5rem;" [(ngModel)]="bu6.bu6id" (ngModelChange)="bu6idChange()">
<div <div
class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2"> class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
...@@ -683,7 +683,7 @@ ...@@ -683,7 +683,7 @@
</div> </div>
<div id="sub-department-four-upload-modal" class="hs-overlay hidden ti-modal"> <div id="sub-department-four-upload-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)] rounded-md"> <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm"> <div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white"> <h5 class="text-xxl font-bold text-white">
นำเข้าทะเบียนส่วนย่อย4 นำเข้าทะเบียนส่วนย่อย4
......
...@@ -192,7 +192,7 @@ ...@@ -192,7 +192,7 @@
<div class="relative flex rounded-md"> <div class="relative flex rounded-md">
<input type="text" id="hs-leading-button-add-on-with-icon-and-button" <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
name="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button"
class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10" class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10 bg-input-readonly" readonly
style="padding-right: 3.5rem;" [(ngModel)]="bu3.bu3id" (ngModelChange)="bu3idChange()"> style="padding-right: 3.5rem;" [(ngModel)]="bu3.bu3id" (ngModelChange)="bu3idChange()">
<div <div
class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2"> class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
...@@ -299,7 +299,7 @@ ...@@ -299,7 +299,7 @@
<div class="relative flex rounded-md"> <div class="relative flex rounded-md">
<input type="text" id="hs-leading-button-add-on-with-icon-and-button" <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
name="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button"
class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10" class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10 bg-input-readonly" readonly
style="padding-right: 3.5rem;" [(ngModel)]="bu3.bu3id" (ngModelChange)="bu3idChange()"> style="padding-right: 3.5rem;" [(ngModel)]="bu3.bu3id" (ngModelChange)="bu3idChange()">
<div <div
class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2"> class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
...@@ -690,7 +690,7 @@ ...@@ -690,7 +690,7 @@
</div> </div>
<div id="sub-department-one-upload-modal" class="hs-overlay hidden ti-modal"> <div id="sub-department-one-upload-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)] rounded-md"> <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm"> <div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white"> <h5 class="text-xxl font-bold text-white">
นำเข้าทะเบียนส่วนย่อย1 นำเข้าทะเบียนส่วนย่อย1
......
...@@ -190,7 +190,7 @@ ...@@ -190,7 +190,7 @@
<div class="relative flex rounded-md"> <div class="relative flex rounded-md">
<input type="text" id="hs-leading-button-add-on-with-icon-and-button" <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
name="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button"
class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10" class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10 bg-input-readonly" readonly
style="padding-right: 3.5rem;" [(ngModel)]="bu5.bu5id" (ngModelChange)="bu5idChange()"> style="padding-right: 3.5rem;" [(ngModel)]="bu5.bu5id" (ngModelChange)="bu5idChange()">
<div <div
class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2"> class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
...@@ -297,7 +297,7 @@ ...@@ -297,7 +297,7 @@
<div class="relative flex rounded-md"> <div class="relative flex rounded-md">
<input type="text" id="hs-leading-button-add-on-with-icon-and-button" <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
name="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button"
class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10" class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10 bg-input-readonly" readonly
style="padding-right: 3.5rem;" [(ngModel)]="bu5.bu5id" (ngModelChange)="bu5idChange()"> style="padding-right: 3.5rem;" [(ngModel)]="bu5.bu5id" (ngModelChange)="bu5idChange()">
<div <div
class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2"> class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
...@@ -685,7 +685,7 @@ ...@@ -685,7 +685,7 @@
</div> </div>
<div id="sub-department-three-upload-modal" class="hs-overlay hidden ti-modal"> <div id="sub-department-three-upload-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)] rounded-md"> <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm"> <div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white"> <h5 class="text-xxl font-bold text-white">
นำเข้าทะเบียนส่วนย่อย3 นำเข้าทะเบียนส่วนย่อย3
......
...@@ -190,8 +190,9 @@ ...@@ -190,8 +190,9 @@
<div class="relative flex rounded-md"> <div class="relative flex rounded-md">
<input type="text" id="hs-leading-button-add-on-with-icon-and-button" <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
name="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button"
class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10" class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10 bg-input-readonly"
style="padding-right: 3.5rem;" [(ngModel)]="bu4.bu4id" (ngModelChange)="bu4idChange()"> readonly style="padding-right: 3.5rem;" [(ngModel)]="bu4.bu4id"
(ngModelChange)="bu4idChange()">
<div <div
class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2"> class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<button type="button" class="flex items-center text-red-500" (click)="selectBu4()"> <button type="button" class="flex items-center text-red-500" (click)="selectBu4()">
...@@ -297,8 +298,9 @@ ...@@ -297,8 +298,9 @@
<div class="relative flex rounded-md"> <div class="relative flex rounded-md">
<input type="text" id="hs-leading-button-add-on-with-icon-and-button" <input type="text" id="hs-leading-button-add-on-with-icon-and-button"
name="hs-leading-button-add-on-with-icon-and-button" name="hs-leading-button-add-on-with-icon-and-button"
class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10" class="ti-form-input rounded-sm ltr:rounded-r-sm rtl:rounded-l-sm focus:z-10 bg-input-readonly"
style="padding-right: 3.5rem;" [(ngModel)]="bu4.bu4id" (ngModelChange)="bu4idChange()"> readonly style="padding-right: 3.5rem;" [(ngModel)]="bu4.bu4id"
(ngModelChange)="bu4idChange()">
<div <div
class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2"> class="absolute inset-y-0 ltr:right-0 rtl:left-0 flex items-center z-20 ltr:pr-4 rtl:pl-4 space-x-2">
<button type="button" class="flex items-center text-red-500" (click)="selectBu4()"> <button type="button" class="flex items-center text-red-500" (click)="selectBu4()">
...@@ -680,7 +682,7 @@ ...@@ -680,7 +682,7 @@
</div> </div>
<div id="sub-department-two-upload-modal" class="hs-overlay hidden ti-modal"> <div id="sub-department-two-upload-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)] rounded-md"> <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm"> <div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white"> <h5 class="text-xxl font-bold text-white">
นำเข้าทะเบียนส่วนย่อย2 นำเข้าทะเบียนส่วนย่อย2
......
...@@ -281,7 +281,7 @@ ...@@ -281,7 +281,7 @@
</div> </div>
<div id="company-registration-page-upload-modal" class="hs-overlay hidden ti-modal"> <div id="company-registration-page-upload-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)] rounded-md"> <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm"> <div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white"> <h5 class="text-xxl font-bold text-white">
นำเข้าข้อมูลบริษัท นำเข้าข้อมูลบริษัท
......
...@@ -347,7 +347,7 @@ ...@@ -347,7 +347,7 @@
</div> </div>
<div id="sub-employee-registration-modal-upload" class="hs-overlay hidden ti-modal"> <div id="sub-employee-registration-modal-upload" 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)] rounded-md"> <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm"> <div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white"> <h5 class="text-xxl font-bold text-white">
นำเข้าข้อมูลพนักงาน นำเข้าข้อมูลพนักงาน
......
...@@ -275,7 +275,7 @@ ...@@ -275,7 +275,7 @@
</div> </div>
<div id="employee-categories-upload-modal" class="hs-overlay hidden ti-modal"> <div id="employee-categories-upload-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)] rounded-md"> <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm"> <div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white"> <h5 class="text-xxl font-bold text-white">
นำเข้าประเภทพนักงาน นำเข้าประเภทพนักงาน
......
...@@ -276,7 +276,7 @@ ...@@ -276,7 +276,7 @@
</div> </div>
<div id="employee-group-unit-component-upload-modal" class="hs-overlay hidden ti-modal"> <div id="employee-group-unit-component-upload-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)] rounded-md"> <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm"> <div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white"> <h5 class="text-xxl font-bold text-white">
นำเข้ากลุ่มพนักงาน นำเข้ากลุ่มพนักงาน
......
...@@ -211,7 +211,7 @@ ...@@ -211,7 +211,7 @@
</div> </div>
<div id="employee-level-upload-modal" class="hs-overlay hidden ti-modal"> <div id="employee-level-upload-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)] rounded-md"> <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm"> <div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white"> <h5 class="text-xxl font-bold text-white">
นำเข้าระดับพนักงาน (PL) นำเข้าระดับพนักงาน (PL)
......
...@@ -272,7 +272,7 @@ ...@@ -272,7 +272,7 @@
</div> </div>
<div id="position-unit-component-upload-modal" class="hs-overlay hidden ti-modal"> <div id="position-unit-component-upload-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)] rounded-md"> <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm"> <div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white"> <h5 class="text-xxl font-bold text-white">
นำเข้าตำแหน่ง นำเข้าตำแหน่ง
......
...@@ -608,7 +608,7 @@ ...@@ -608,7 +608,7 @@
</div> </div>
<div id="competency-topic-upload-modal" class="hs-overlay hidden ti-modal"> <div id="competency-topic-upload-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)] rounded-md"> <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm"> <div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white"> <h5 class="text-xxl font-bold text-white">
นำเข้าหัวข้อสมรรถนะ นำเข้าหัวข้อสมรรถนะ
......
...@@ -293,7 +293,7 @@ ...@@ -293,7 +293,7 @@
</div> </div>
<div id="type-registration-component-upload-modal" class="hs-overlay hidden ti-modal"> <div id="type-registration-component-upload-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)] rounded-md"> <div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md">
<div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm"> <div class="ti-modal-header bg-primary !rounded-none !rounded-t-sm">
<h5 class="text-xxl font-bold text-white"> <h5 class="text-xxl font-bold text-white">
นำเข้าประเภทสมรรถนะ นำเข้าประเภทสมรรถนะ
......
...@@ -134,6 +134,7 @@ import { FileService } from 'src/app/shared/services/file.service'; ...@@ -134,6 +134,7 @@ import { FileService } from 'src/app/shared/services/file.service';
import { CompetencyGroupGradeService } from 'src/app/shared/services/competency-group-grade.service'; import { CompetencyGroupGradeService } from 'src/app/shared/services/competency-group-grade.service';
import { IndicatorsCoursesService } from 'src/app/shared/services/indicators-courses.service'; import { IndicatorsCoursesService } from 'src/app/shared/services/indicators-courses.service';
import { IdpDevelopmentService } from 'src/app/shared/services/idp-development.service'; import { IdpDevelopmentService } from 'src/app/shared/services/idp-development.service';
import { UserService } from 'src/app/shared/services/user.service';
export const MY_DATE_FORMATS = { export const MY_DATE_FORMATS = {
parse: { parse: {
...@@ -298,6 +299,7 @@ export class CustomDateAdapter extends NativeDateAdapter { ...@@ -298,6 +299,7 @@ export class CustomDateAdapter extends NativeDateAdapter {
CompetencyGroupGradeService, CompetencyGroupGradeService,
IndicatorsCoursesService, IndicatorsCoursesService,
IdpDevelopmentService, IdpDevelopmentService,
UserService,
{ {
provide: HTTP_INTERCEPTORS, provide: HTTP_INTERCEPTORS,
useClass: HttpRequestInterceptor, useClass: HttpRequestInterceptor,
......
...@@ -198,92 +198,92 @@ export class MyEmployeeModel implements EmployeeModel { ...@@ -198,92 +198,92 @@ export class MyEmployeeModel implements EmployeeModel {
ssoFlag: string ssoFlag: string
thFullName: string thFullName: string
engFullName: string engFullName: string
constructor(data: Partial<EmployeeModel>) { constructor(data?: Partial<EmployeeModel>) {
this.employeeId = data.employeeId || "" this.employeeId = data?.employeeId || ""
this.prefix = new MyPrefixModel(data.prefix || {}) this.prefix = new MyPrefixModel(data?.prefix || {})
this.fname = data.fname || "" this.fname = data?.fname || ""
this.lname = data.lname || "" this.lname = data?.lname || ""
this.efname = data.efname || "" this.efname = data?.efname || ""
this.elname = data.elname || "" this.elname = data?.elname || ""
this.nickname = data.nickname || "" this.nickname = data?.nickname || ""
this.enickname = data.enickname || "" this.enickname = data?.enickname || ""
this.birthDate = data.birthDate || "" this.birthDate = data?.birthDate || ""
this.status = new MyStatusModel(data.status || {}) this.status = new MyStatusModel(data?.status || {})
this.age = new MyAgeModel(data.age || {}) this.age = new MyAgeModel(data?.age || {})
this.swipeCardId = data.swipeCardId || "" this.swipeCardId = data?.swipeCardId || ""
this.idPeople = data.idPeople || "" this.idPeople = data?.idPeople || ""
this.idexpdate = data.idexpdate || "" this.idexpdate = data?.idexpdate || ""
this.passport_no = data.passport_no || "" this.passport_no = data?.passport_no || ""
this.passport_expire_date = data.passport_expire_date || "" this.passport_expire_date = data?.passport_expire_date || ""
this.height = data.height || "" this.height = data?.height || ""
this.weight = data.weight || "" this.weight = data?.weight || ""
this.blood = data.blood || "" this.blood = data?.blood || ""
this.rh = data.rh || "" this.rh = data?.rh || ""
this.eyeColor = data.eyeColor || "" this.eyeColor = data?.eyeColor || ""
this.hairColor = data.hairColor || "" this.hairColor = data?.hairColor || ""
this.shirtSize = data.shirtSize || "" this.shirtSize = data?.shirtSize || ""
this.waistSize = data.waistSize || "" this.waistSize = data?.waistSize || ""
this.national = new MyNationalModel(data.national || {}) this.national = new MyNationalModel(data?.national || {})
this.nationality = new MyNationalityModel(data.nationality || {}) this.nationality = new MyNationalityModel(data?.nationality || {})
this.religion = new MyReligionModel(data.religion || {}) this.religion = new MyReligionModel(data?.religion || {})
this.sex = data.sex || "" this.sex = data?.sex || ""
this.email = data.email || "" this.email = data?.email || ""
this.emailMicrosoft365 = data.emailMicrosoft365 || "" this.emailMicrosoft365 = data?.emailMicrosoft365 || ""
this.emailPersonal = data.emailPersonal || "" this.emailPersonal = data?.emailPersonal || ""
this.picture = data.picture || "" this.picture = data?.picture || ""
this.telNo = data.telNo || "" this.telNo = data?.telNo || ""
this.mobile = data.mobile || "" this.mobile = data?.mobile || ""
this.position = new MyPositionModel(data.position || {}) this.position = new MyPositionModel(data?.position || {})
this.jobCode = new MyJobCodeModel(data.jobCode || {}) this.jobCode = new MyJobCodeModel(data?.jobCode || {})
this.personalLevel = new MyPLModel(data.personalLevel || {}) this.personalLevel = new MyPLModel(data?.personalLevel || {})
this.companyId = data.companyId || "" this.companyId = data?.companyId || ""
this.idExpireDate = data.idExpireDate || "" this.idExpireDate = data?.idExpireDate || ""
this.passportNo = data.passportNo || "" this.passportNo = data?.passportNo || ""
this.passportExpireDate = data.passportExpireDate || "" this.passportExpireDate = data?.passportExpireDate || ""
this.bossId = data.bossId || "" this.bossId = data?.bossId || ""
this.boss = new MyBossModel(data.boss || {}) this.boss = new MyBossModel(data?.boss || {})
this.bu1 = new MyBu1Model(data.bu1 || {}) this.bu1 = new MyBu1Model(data?.bu1 || {})
this.bu2 = new MyBu2Model(data.bu2 || {}) this.bu2 = new MyBu2Model(data?.bu2 || {})
this.bu3 = new MyBu3Model(data.bu3 || {}) this.bu3 = new MyBu3Model(data?.bu3 || {})
this.bu4 = new MyBu4Model(data.bu4 || {}) this.bu4 = new MyBu4Model(data?.bu4 || {})
this.bu5 = new MyBu5Model(data.bu5 || {}) this.bu5 = new MyBu5Model(data?.bu5 || {})
this.bu6 = new MyBu6Model(data.bu6 || {}) this.bu6 = new MyBu6Model(data?.bu6 || {})
this.bu7 = new MyBu7Model(data.bu7 || {}) this.bu7 = new MyBu7Model(data?.bu7 || {})
this.empGroup = new MyEmpGroupModel(data.empGroup || {}) this.empGroup = new MyEmpGroupModel(data?.empGroup || {})
this.firstHireDate = data.firstHireDate || "" this.firstHireDate = data?.firstHireDate || ""
this.startDate = data.startDate || "" this.startDate = data?.startDate || ""
this.ageWork = new MyAgeModel(data.ageWork || {}) this.ageWork = new MyAgeModel(data?.ageWork || {})
this.empType = new MyEmpTypeModel(data.empType || {}) this.empType = new MyEmpTypeModel(data?.empType || {})
this.time0 = new MyTime0Model(data.time0 || {}) this.time0 = new MyTime0Model(data?.time0 || {})
this.publicHoliday = data.publicHoliday || "" this.publicHoliday = data?.publicHoliday || ""
this.proDate = data.proDate || "" this.proDate = data?.proDate || ""
this.proEvery = data.proEvery || "" this.proEvery = data?.proEvery || ""
this.approveDate = data.approveDate || "" this.approveDate = data?.approveDate || ""
this.workarea = new MyWorkareaModel(data.workarea || {}) this.workarea = new MyWorkareaModel(data?.workarea || {})
this.telExt = data.telExt || "" this.telExt = data?.telExt || ""
this.costcenter = new MyCostcenterModel(data.costcenter || {}) this.costcenter = new MyCostcenterModel(data?.costcenter || {})
this.branch = new MyBranchModel(data.branch || {}) this.branch = new MyBranchModel(data?.branch || {})
this.zeemeLogOnName = data.zeemeLogOnName || "" this.zeemeLogOnName = data?.zeemeLogOnName || ""
this.salatype = new MySalatypeModel(data.salatype || {}) this.salatype = new MySalatypeModel(data?.salatype || {})
this.effSalatype = data.effSalatype || "" this.effSalatype = data?.effSalatype || ""
this.salary = data.salary || "" this.salary = data?.salary || ""
this.empEvery = data.empEvery || "" this.empEvery = data?.empEvery || ""
this.curchgincDate = data.curchgincDate || "" this.curchgincDate = data?.curchgincDate || ""
this.receiverBankNo = data.receiverBankNo || "" this.receiverBankNo = data?.receiverBankNo || ""
this.receiverBank = data.receiverBank || "" this.receiverBank = data?.receiverBank || ""
this.receiverBankBranch = data.receiverBankBranch || "" this.receiverBankBranch = data?.receiverBankBranch || ""
this.banks = data.banks?.map(x => new MyBanksModel(x)) || [] this.banks = data?.banks?.map(x => new MyBanksModel(x)) || []
this.taxTable = data.taxTable || "" this.taxTable = data?.taxTable || ""
this.compenTaxTable = data.compenTaxTable || "" this.compenTaxTable = data?.compenTaxTable || ""
this.idTax = data.idTax || "" this.idTax = data?.idTax || ""
this.calTax = data.calTax || "" this.calTax = data?.calTax || ""
this.fixTax = data.fixTax || "" this.fixTax = data?.fixTax || ""
this.calSoc = data.calSoc || "" this.calSoc = data?.calSoc || ""
this.calPvf = data.calPvf || "" this.calPvf = data?.calPvf || ""
this.taxMethodAct = data.taxMethodAct || "" this.taxMethodAct = data?.taxMethodAct || ""
this.ssoFlag = data.ssoFlag || "" this.ssoFlag = data?.ssoFlag || ""
this.thFullName = data.thFullName || "" this.thFullName = data?.thFullName || ""
this.engFullName = data.engFullName || "" this.engFullName = data?.engFullName || ""
} }
} }
export interface LevelModel {
userLevel: string
tdesc: string
edesc: string
}
export class MyLevelModel implements LevelModel {
userLevel: string
tdesc: string
edesc: string
constructor(data?: Partial<LevelModel>) {
this.userLevel = data?.userLevel || ""
this.tdesc = data?.tdesc || ""
this.edesc = data?.edesc || ""
}
}
export interface RoleModel {
roleId: string
tdesc: string
edesc: string
}
export class MyRoleModel implements RoleModel {
roleId: string
tdesc: string
edesc: string
constructor(data?: Partial<RoleModel>) {
this.roleId = data?.roleId || ""
this.tdesc = data?.tdesc || ""
this.edesc = data?.edesc || ""
}
}
import { LevelModel, MyLevelModel } from "./level.model";
import { EmployeeModel, MyEmployeeModel } from "./employee.model";
import { MyRoleModel, RoleModel } from "./role.model";
export interface UserModel {
usernameId: string
empId: string
companyId: string
userRole: string
userLevel: string
lang: string
passwordStatus: string
expireDate: string
adAccount: string
status: string
role: RoleModel
level: LevelModel
employee: EmployeeModel
}
export class MyUserModel implements UserModel {
usernameId: string
empId: string
companyId: string
userRole: string
userLevel: string
lang: string
passwordStatus: string
expireDate: string
adAccount: string
status: string
role: RoleModel
level: LevelModel
employee: EmployeeModel
constructor(data?: Partial<UserModel>) {
this.usernameId = data?.usernameId || ""
this.empId = data?.empId || ""
this.companyId = data?.companyId || ""
this.userRole = data?.userRole || ""
this.userLevel = data?.userLevel || ""
this.lang = data?.lang || ""
this.passwordStatus = data?.passwordStatus || ""
this.expireDate = data?.expireDate || ""
this.adAccount = data?.adAccount || ""
this.status = data?.status || ""
this.role = new MyRoleModel(data?.role)
this.level = new MyLevelModel(data?.level)
this.employee = new MyEmployeeModel(data?.employee)
}
}
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { AlertModel } from '../model/alert.model';
import { UserModel } from '../model/user.model';
@Injectable({
providedIn: 'root'
})
export class UserService {
api = "/user"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getList(): Observable<UserModel[]> {
return this.http.get<UserModel[]>(this.urlApi + "/lists")
}
checkUser(username: string): Observable<AlertModel> {
return this.http.get<AlertModel>(this.urlApi + "/validate-username/" + username)
}
post(body: UserModel): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi + "/create", body)
}
delete(body: UserModel[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete<AlertModel>(this.urlApi+'/delete', options)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment