Commit 3acb518d by Nattana Chaiyamat

เพิ่มหน้าจัดการเอกสาร และการแสดงpop up ในหน้าESS

parent fd25bfe7
<app-page-header [pathTitle]="pathTitle"></app-page-header>
<div class="bg-card-white">
</div>
<div class="block-main-content">
<div class="text-lg font-bold py-2 px-8 text-primary">
{{'DocumentUploadManager' | translate}}
</div>
<div class="page">
<div class="border-b border-gray-200 dark:border-white/10 px-8">
<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"
href="javascript:void(0);" id="underline-item-1" data-hs-tab="#underline-1"
aria-controls="underline-1">
{{'DocumentUploadManager' | translate}}
</a>
</nav>
</div>
<div class="mt-3 px-2rem !-mt-3 pt-50px">
<div id="underline-1" role="tabpanel" aria-labelledby="underline-item-1">
<div class="w-full min-height-50px mb-10px justify-between items-center">
<div class="flex justify-end">
<div class="px-1">
<div class="relative shadow-md">
<input type="text" class="ti-form-input ltr:pl-11 rtl:pr-11 focus:z-10 "
[placeholder]="'SearchByNoOrName' | translate" [(ngModel)]="search">
<div
class="absolute inset-y-0 ltr:left-0 rtl:right-0 flex items-center pointer-events-none z-20 ltr:pl-4 rtl:pr-4">
<i class="ri-search-line text-gray"></i>
</div>
</div>
</div>
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-secondary h-45px m-0 shadow-md"
(click)="currentModal='add';selectDocumentManager();openDialog()">
<i class="ri-add-line"></i>
{{'Add' | translate}}
</button>
</div>
<div class="px-1">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-danger h-45px m-0 shadow-md"
(click)="currentModal='delete';selectDocumentManager();deleteDocumentManager()">
<i class="ri-delete-bin-6-line"></i>
{{'Delete' | translate}}
</button>
</div>
</div>
</div>
<div class="page px-rem">
<app-datagrid-syncfution [searchSettings]="searchSettings" [searchText]="search"
[dataSource]="syncfutionDataList" [columns]="columns" [selectedItems]="selectedItems"
(sendSelectData)="currentModal='edit';selectDocumentManager($event);openDialog()"
(sendSelectedItems)="onSelectItemChange($event)">
</app-datagrid-syncfution>
</div>
</div>
</div>
</div>
</div>
<ng-template #documentModal let-modal>
<h3 mat-dialog-title>
{{(currentModal=='add'?'AddDocument':'EditDocument') | translate}}
</h3>
<div class="w-full flex justify-end mb-1rem">
<div class="absolute flex">
<div class="px-1">
<button type="button" class="ti-btn ti-btn-soft-indigo h-45px m-0 shadow-md"
(click)="selectDocumentManager()">
<i class="ti ti-eraser text-base"></i>
{{'Clear' |translate}}
</button>
</div>
</div>
</div>
<mat-dialog-content>
<label for="input-label" class="ti-form-label mt-2rem">
{{'Code' | translate}}
<span class="text-danger">
*
<ng-container *ngIf="currentModal=='add'&&checkPrimary()">
{{'DuplicateCode' | translate}}
</ng-container>
</span></label>
<input type="text" id="input-label" class="ti-form-input w-1/2 "
[ngClass]="{'bg-input-readonly':currentModal=='edit'}" [readonly]="currentModal=='edit'"
[(ngModel)]="documentManager.select.documentId">
<label for="detail_th" class="ti-form-label mt-2rem">{{'DocumentNameThai' | translate}}<span
class="text-danger">*</span></label>
<input type="text" id="detail_th" class="ti-form-input h-16" [(ngModel)]="documentManager.select.tdesc">
<label for="detail_eng" class="ti-form-label mt-2rem">{{'DocumentNameEng' | translate}}<span
class="text-danger">*</span></label>
<input type="text" id="detail_eng" class="ti-form-input h-16" [(ngModel)]="documentManager.select.edesc">
<label for="detail_short" class="ti-form-label mt-2rem">{{'DisplayOrder' | translate}}</label>
<input type="number" id="detail_short" class="ti-form-input h-16" [(ngModel)]="documentManager.select.lineNo">
<label for="detail_short" class="ti-form-label mt-2rem">{{'Eva' | translate}}<span
class="text-danger">*</span></label>
<select class="ti-form-select h-16" [(ngModel)]="documentManager.select.status">
<option *ngFor="let item of [{data:0,text:'Close'},{data:1,text:'Open'}]" [ngValue]="item.data">
{{ item.text | translate}}
</option>
</select>
<label class="ti-form-label mt-2rem">
{{'AttachFile' | translate}}
<span class="text-danger">*</span></label>
<div class="flex rounded-md">
<label class="sr-only">{{'UploadFile' | translate}}</label>
<input #fileInputMedium id="fileInputMedium" accept=".pdf,.ppt,.pptx,.xls,.xlsx,.doc,.docx" type="file"
(change)="onFileSelected($event)" hidden>
<input type="text" [value]="selectedFileName | translate" readonly onclick="fileInputMedium.click();"
class=" cursor-pointer block w-full border border-gray-200 focus:shadow-sm dark:focus:shadow-white/10 ltr:rounded-l-md rtl:rounded-r-none text-sm focus:z-10 focus:outline-0 focus:border-gray-200 dark:focus:border-white/10 dark:border-white/10 dark:text-white/70 file:border-0 file:bg-gray-100 ltr:file:mr-4 rtl:file:ml-4 file:py-3 file:px-4 dark:file:bg-black/20 dark:file:text-white/70">
<span
class="px-4 inline-flex items-center min-w-fit ltr:rounded-r-md rtl:rounded-l-none border ltr:border-l-0 rtl:border-r-0 border-gray-200 bg-gray-50 text-sm dark:bg-black/20 dark:border-white/10">
<button class="text-sm text-gray-500 dark:text-white/70"
onclick="fileInputMedium.click();">Browse</button>
</span>
<div class="flex items-center ml-2">
<button href="javascript:void(0);" class="ti-btn ti-btn-soft-danger h-10px m-0 shadow-md rounded-md"
(click)="fileInputMedium.value = '';selectedFile=null;selectedFileName = 'PleaseSelectFile';documentManager.select.documentFiles=''">
<i class="ri-delete-bin-6-line"></i>
{{'Delete' | translate}}
</button>
</div>
</div>
<div class="flex" *ngIf="documentManager.select.documentFiles">
<h1 class="cursor-pointer justify-center -mb-px inline-flex items-center gap-2 font-weight-500 font-size-12px
text-center text-secondary border-secondary border-b-2 align-items-end"
(click)="downloadFile(documentManager.select.documentFiles)">
{{'DownloadFile' | translate}}</h1>
</div>
</mat-dialog-content>
<mat-dialog-actions align="end">
<button type="button" mat-button [mat-dialog-close]
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">
{{'Back' | translate}}
</button>
<button type="button" class="ti-btn ti-btn-success" mat-button (click)="addDocumentManager()"
[class.ti-btn-disabled]="!documentManager.select.documentId||!documentManager.select.tdesc||!documentManager.select.edesc||!documentManager.select.documentFiles ||(currentModal=='add'&&checkPrimary())"
[disabled]="!documentManager.select.documentId||!documentManager.select.tdesc||!documentManager.select.edesc||!documentManager.select.documentFiles ||(currentModal=='add'&&checkPrimary())">
{{'SaveData' | translate}}
</button>
</mat-dialog-actions>
</ng-template>
\ No newline at end of file
import { ChangeDetectorRef, Component, ViewChild } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { ConfigService } from '@ks89/angular-modal-gallery/lib/services/config.service';
import { TranslateService } from '@ngx-translate/core';
import { ColumnModel } from '@syncfusion/ej2-grids';
import { ToastrService } from 'ngx-toastr';
import { MenuBodyModel } from 'src/app/shared/model/config-permission.model';
import { DocumentManagerModel, MyDocumentManagerModel } from 'src/app/shared/model/document-manager.model';
import { ConfigPermissionService } from 'src/app/shared/services/config-permission.service';
import { DocumentManagerService } from 'src/app/shared/services/documents.service';
import { FileService } from 'src/app/shared/services/file.service';
import { NavService } from 'src/app/shared/services/navservice';
import Swal from 'sweetalert2';
@Component({
selector: 'app-document-upload-manager',
templateUrl: './document-upload-manager.component.html',
styleUrls: ['./document-upload-manager.component.scss']
})
export class DocumentUploadManagerComponent {
pathTitle = ['menu.Organization', 'menu.LeaveType', 'DocumentUploadManager']
@ViewChild("fileInputMedium") fileInputMedium: any;
selectedFile: File | null = null;
selectedFileName: string = 'PleaseSelectFile';
currentModal: 'add' | 'edit' | 'delete' = 'add'
documentManager: { loading: boolean, select: DocumentManagerModel, dataList: DocumentManagerModel[] } = { loading: false, select: new MyDocumentManagerModel(), dataList: [] }
syncfutionDataList: any[] = []
columns: ColumnModel[] = [{
field: "documentId",
headerText: "code",
type: "string",
isPrimaryKey: true,
},
{
field: "tdesc",
headerText: "DocumentNameThai",
type: "string"
},
{
field: "edesc",
headerText: "DocumentNameEng",
type: "string"
},
{
field: "lineNo",
headerText: "DisplayOrder",
type: "string"
},
{
field: "statusText",
headerText: "Eva",
type: "string"
}]
searchSettings = {
fields: ['documentId', 'tdesc', 'edesc', 'lineNo', 'statusText'],
operator: 'contains',
ignoreCase: false
};
search = ''
selectedItems: { key: string, count: number, data: Map<string, boolean> } = { key: '', count: 0, data: new Map<string, boolean>() };
@ViewChild("documentModal") documentModal: any;
dialogRef: any
constructor(private documentManagerService: DocumentManagerService,
private toastr: ToastrService,
private cdr: ChangeDetectorRef,
private fileService: FileService,
private dialog: MatDialog,
private translateService: TranslateService
) {
this.translateService.onLangChange.subscribe((event) => {
this.setSyncfutionDataList()
});
}
ngOnInit(): void {
this.getDocumentManagerList()
}
getDocumentManagerList() {
this.documentManager.loading = true
this.selectedItems.data.clear()
this.documentManagerService.getList().subscribe({
next: response => {
this.documentManager.dataList = response.map(x => {
this.selectedItems.data.set(x.documentId, false)
return new MyDocumentManagerModel(x)
})
this.setSyncfutionDataList()
this.selectedItems.key = 'documentId'
this.selectedItems.count = 0
this.documentManager.loading = false
this.cdr.detectChanges();
}, error: error => {
this.documentManager.loading = false
console.error('Error fetching employee types:', error);
this.cdr.detectChanges()
}
})
}
setSyncfutionDataList() {
this.syncfutionDataList = this.documentManager.dataList.map(e => (
({ ...e, statusText: e.status == 0 ? this.translateService.instant('Close') : this.translateService.instant('Open') })
))
}
openDialog() {
if (this.fileInputMedium) {
this.fileInputMedium.nativeElement.value = "";
}
this.selectedFileName = this.documentManager.select.documentFiles || 'PleaseSelectFile'
this.dialogRef = this.dialog.open(this.documentModal, {
width: '500px',
})
}
closeDialog() {
this.dialogRef.close()
}
selectDocumentManager(documentManager?: DocumentManagerModel) {
this.documentManager.select = new MyDocumentManagerModel(documentManager)
}
addDocumentManager() {
Swal.fire({
icon: 'question',
title: 'แจ้งเตือน',
text: 'ยืนยันการบันทึกข้อมูลหรือไม่',
showCancelButton: true,
confirmButtonText: 'ยืนยัน',
}).then((result) => {
if (result.isConfirmed) {
this.documentManager.loading = true
this.documentManagerService.post(this.documentManager.select).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.getDocumentManagerList()
this.closeDialog()
} else {
this.showAlert(response.message, 'error')
this.documentManager.loading = false
this.cdr.detectChanges()
this.closeDialog()
}
}, error: error => {
this.showAlert(error.message, 'error')
this.documentManager.loading = false
this.cdr.detectChanges()
this.closeDialog()
}
})
}
})
}
deleteDocumentManager() {
if (this.numSelectItem() == 0) {
this.showAlert('กรุณาเลือกข้อมูลที่จะลบ', 'error')
return
}
Swal.fire({
icon: 'question',
title: 'แจ้งเตือน',
text: 'ยืนยันการลบข้อมูลหรือไม่',
showCancelButton: true,
confirmButtonText: 'ลบข้อมูล',
}).then((result) => {
if (result.isConfirmed) {
this.documentManager.loading = true
const selectedKeys = Array.from(this.selectedItems.data.keys());
const body = this.documentManager.dataList.filter(x => selectedKeys.includes(x.documentId) && this.selectedItems.data.get(x.documentId)).map(x => new MyDocumentManagerModel(x))
this.documentManagerService.delete(body).subscribe({
next: response => {
if (response.success) {
this.showAlert(response.message, 'success')
this.getDocumentManagerList()
} else {
this.showAlert(response.message, 'error')
this.documentManager.loading = false
this.cdr.detectChanges()
}
}, error: error => {
this.showAlert(error.message, 'error')
this.documentManager.loading = false
this.cdr.detectChanges()
}
})
}
})
}
showAlert(text: string, type: 'success' | 'error') {
Swal.fire({
icon: type,
title: 'แจ้งเตือน',
text: text,
showCancelButton: false,
confirmButtonText: 'ยืนยัน',
})
}
checkPrimary() {
return this.documentManager.dataList.find(x => x.documentId == this.documentManager.select.documentId)
}
numSelectItem() {
const selectedKeys = Array.from(this.selectedItems.data.keys());
const num = this.documentManager.dataList.filter(x => selectedKeys.includes(x.documentId) && this.selectedItems.data.get(x.documentId)).length
return num
}
onSelectItemChange(arg: any) {
this.selectedItems = arg
}
onFileSelected(event: any) {
this.selectedFile = event.target.files.length > 0 ? event.target.files[0] : null;
this.selectedFileName = this.selectedFile?.name || "PleaseSelectFile"
this.uploadFile()
}
uploadFile() {
if (!this.selectedFile) return;
const formData = new FormData();
formData.append('file', this.selectedFile);
this.fileService.uploadFiles(formData).subscribe({
next: response => {
if (response.success) {
this.selectedFile = null;
this.documentManager.select.documentFiles = response.resultObject
} else {
this.showAlert(response.message, 'error');
this.cdr.detectChanges();
}
},
error: error => {
this.showAlert(error.message, 'error');
this.cdr.detectChanges();
}
});
}
downloadFile(fileName: string) {
this.fileService.downloadFiles(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);
this.cdr.detectChanges()
}, error: error => {
this.showAlert(error.message, 'error')
this.cdr.detectChanges()
}
})
}
}
......@@ -63,6 +63,7 @@ import { CompetencyMappingComponent } from '../competency-mapping/competency-map
import { Widget1Component } from '../widget1/widget1.component';
import { JobFamilyMappingComponent } from '../job-family-mapping/job-family-mapping.component';
import { JobFamilyMatrixComponent } from '../job-family-matrix/job-family-matrix.component';
import { DocumentUploadManagerComponent } from '../company-components/account-settings/document-upload-manager/document-upload-manager.component';
......@@ -122,6 +123,7 @@ const routes: Routes = [
{ path: "admin/time-attendance", title: 'ทะเบียนการประเมินเวลาทำงาน', component: TimeAttendanceComponent },
{ path: "admin/role-permission-config", title: 'กำหนดสิทธิการเข้าใช้งาน', component: RolePermissionConfigComponent },
{ path: "admin/document-upload-manager", title: 'จัดการอัพโหลดเอกสาร', component: DocumentUploadManagerComponent },
{ path: "ess/employee-self-service", title: 'employee-self-service', component: EmployeeSelfServiceComponent },
{ path: "ess/my-skill-x-module", title: 'my-skill-x-module', component: MySkillXModuleComponent },
{ path: "admin/report-competency-summary", title: 'รายงานสรุปผลการประเมินสมรรถนะ', component: ReportCompetencySummaryComponent },
......
......@@ -216,6 +216,7 @@ import { JobGradeComponent } from '../company-components/job-description/job-gra
import { JobGradeGroupComponent } from '../company-components/job-description/job-grade-group/job-grade-group.component';
import { JobFamilyMappingComponent } from '../job-family-mapping/job-family-mapping.component';
import { JobFamilyMatrixComponent } from '../job-family-matrix/job-family-matrix.component';
import { DocumentUploadManagerComponent } from '../company-components/account-settings/document-upload-manager/document-upload-manager.component';
export const MY_DATE_FORMATS = {
parse: {
......@@ -371,7 +372,8 @@ export class CustomDateAdapter extends NativeDateAdapter {
JobGradeComponent,
JobGradeGroupComponent,
JobFamilyMappingComponent,
JobFamilyMatrixComponent
JobFamilyMatrixComponent,
DocumentUploadManagerComponent
], imports: [
TranslateModule,
CommonModule,
......
......@@ -135,13 +135,12 @@
<ng-container *ngFor="let item of generalPages; let i = index">
<tbody class="table-link" [attr.data-disable-hover]="!item.link" style="line-height: 2.25rem;">
<td class="text-menu row-top w-auto">
<a [routerLink]="item.link?item.link:null" >
<a [routerLink]="item.link?item.link:null">
{{i + 1}}&nbsp;
</a>
</td>
<td class="text-menu">
<a class="table-link-link"
[routerLink]="item.link?item.link:null">
<a class="table-link-link" [routerLink]="item.link?item.link:null">
{{ item.text }}
</a>
</td>
......@@ -189,20 +188,40 @@
<div class="row col-12">
<ng-container *ngFor="let items of competencyPages; let i = index">
<ng-container *ngFor="let item of items; let l = index">
<div class="col-4 p-2 ">
<a [routerLink]="item.link?item.link:null" class="row sub-box-menu p-2 row-center"
[attr.data-disable-hover]="!item.link" style="min-height: 65px;">
<div class="col-2">
<span
class="flex align-items-center justify-content-center rounded-circle text-white bg-primary text-left text-no">
{{(i*3)+l+1}}
</span>
</div>
<div class="col text-menu">
{{item.text}}
</div>
</a>
</div>
<ng-container *ngIf="item.description == 'รายงาน Competency Base Pay'">
<div class=" col-4 p-2 ">
<a class="row sub-box-menu p-2 row-center"
[attr.data-disable-hover]="!documentManager.dataList.length"
[attr.data-hs-overlay]="documentManager.dataList.length ? '#download-file-manage-modal' : null"
style="min-height: 65px;">
<div class="col-2">
<span
class="flex align-items-center justify-content-center rounded-circle text-white bg-primary text-left text-no">
{{(i*3)+l+1}}
</span>
</div>
<div class="col text-menu">
{{item.text}}
</div>
</a>
</div>
</ng-container>
<ng-container *ngIf="item.description != 'รายงาน Competency Base Pay'">
<div class=" col-4 p-2 ">
<a [routerLink]=" item.link?item.link:null" class="row sub-box-menu p-2 row-center"
[attr.data-disable-hover]="!item.link" style="min-height: 65px;">
<div class="col-2">
<span
class="flex align-items-center justify-content-center rounded-circle text-white bg-primary text-left text-no">
{{(i*3)+l+1}}
</span>
</div>
<div class="col text-menu">
{{item.text}}
</div>
</a>
</div>
</ng-container>
</ng-container>
</ng-container>
</div>
......@@ -211,4 +230,42 @@
</div>
</div>
</div>
</ng-template>
\ No newline at end of file
</ng-template>
<div id="download-file-manage-modal"
class="hs-overlay fixed inset-0 flex items-center justify-center bg-black/10 hidden ti-modal z-[9999]">
<div class="hs-overlay-open:mt-7 ti-modal-box mt-0 ease-out rounded-md w-[800px] max-w-[95%]">
<div class="ti-modal-header !rounded-none !rounded-t-sm" style="background-color: white;">
<h5 class="text-xxl font-bold">
Download เอกสาร
</h5>
</div>
<div class="ti-modal-body max-h-full overflow-hidden ti-modal-content !rounded-none">
<div class="col-12" *ngFor="let item of documentManager.dataList">
<div class="row m-2">
<div class="col-auto">
<button type="button" class="hero-btn" style="width: 70px;height: 70px;border-radius: 20px;padding: 0;"
(click)="downloadFile(item.documentFiles)">
<i class="ti ti-download" style="font-size: 40px;"></i>
</button>
</div>
<div class="col-auto row" style="margin-left: 1rem;">
<div class="col-12">
<h5 class="text-xxl font-bold">{{translateText(item.tdesc,item.edesc)}}</h5>
</div>
<div class="col-12">
<h5 class="text-xl">{{item.createDate | date:'dd-MM-yyyy'}}</h5>
</div>
</div>
</div>
</div>
</div>
<div class="ti-modal-footer !rounded-t-none !rounded-b-sm" style="background-color: white;border-radius: 0 0 5px 5px;">
<button type="button" class="hs-dropdown-toggle ti-btn ti-btn-danger"
data-hs-overlay="#download-file-manage-modal">
{{'Close' | translate}}
</button>
</div>
</div>
</div>
\ No newline at end of file
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { TranslateService } from '@ngx-translate/core';
import { DocumentManagerModel, MyDocumentManagerModel } from 'src/app/shared/model/document-manager.model';
import { DocumentManagerService } from 'src/app/shared/services/documents.service';
import { FileService } from 'src/app/shared/services/file.service';
import Swal from 'sweetalert2';
interface SubModule {
title: SafeHtml;
route?: string;
......@@ -65,14 +70,77 @@ export class EmployeeSelfServiceComponent {
{ text: "Competency Base Pay", description: "รายงาน Competency Base Pay" }]
];
constructor(private sanitizer: DomSanitizer) {
documentManager: { loading: boolean, dataList: DocumentManagerModel[] } = { loading: false, dataList: [] }
constructor(private sanitizer: DomSanitizer,
private fileService: FileService,
private cdr: ChangeDetectorRef,
private translateService: TranslateService,
private documentManagerService: DocumentManagerService
) {
}
ngOnInit(): void {
this.getDocumentManagerList()
}
getDocumentManagerList() {
this.documentManager.loading = true
this.documentManagerService.getList().subscribe({
next: response => {
this.documentManager.dataList = response.map(x => {
return new MyDocumentManagerModel(x)
})
this.documentManager.loading = false
this.cdr.detectChanges();
}, error: error => {
this.documentManager.loading = false
console.error('Error fetching employee types:', error);
this.cdr.detectChanges()
}
})
}
openReport(file: string) {
const url = 'assets/reports/' + file;
window.open(url, '_blank');
}
downloadFile(fileName: string) {
this.fileService.downloadFiles(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);
this.cdr.detectChanges()
}, error: error => {
this.showAlert(error.message, 'error')
this.cdr.detectChanges()
}
})
}
showAlert(text: string, type: 'success' | 'error') {
Swal.fire({
icon: type,
title: 'แจ้งเตือน',
text: text,
showCancelButton: false,
confirmButtonText: 'ยืนยัน',
})
}
translateText(th?: string, en?: string) {
return this.translateService.getCurrentLang() == 'th' ? (th || '') : (en || '')
}
}
export interface DocumentManagerModel {
documentId: string
companyId: string
edesc: string
tdesc: string
status: number
documentFiles: string
lineNo: number
createDate: string
}
export class MyDocumentManagerModel implements DocumentManagerModel {
documentId: string
companyId: string
edesc: string
tdesc: string
status: number
documentFiles: string
lineNo: number
createDate: string
constructor(data?: Partial<DocumentManagerModel>) {
this.documentId = data?.documentId || ""
this.tdesc = data?.tdesc || ""
this.edesc = data?.edesc || ""
this.companyId = data?.companyId || ""
this.status = data?.status ?? 0
this.documentFiles = data?.documentFiles || ""
this.lineNo = data?.lineNo ?? 0
this.createDate = data?.createDate || ""
}
}
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 { DocumentManagerModel } from '../model/document-manager.model';
@Injectable({
providedIn: 'root'
})
export class DocumentManagerService {
api = "/documents"
urlApi = environment.baseUrl + this.api
constructor(private http: HttpClient) {
}
getById(userLevel: string): Observable<DocumentManagerModel> {
return this.http.get<DocumentManagerModel>(this.urlApi + "/" + userLevel)
}
getList(): Observable<DocumentManagerModel[]> {
return this.http.get<DocumentManagerModel[]>(this.urlApi + "/lists")
}
getListActive(): Observable<DocumentManagerModel[]> {
return this.http.get<DocumentManagerModel[]>(this.urlApi + "/documents/lists/active")
}
post(body: DocumentManagerModel): Observable<AlertModel> {
return this.http.post<AlertModel>(this.urlApi + '/', body)
}
delete(body: DocumentManagerModel[]): Observable<AlertModel> {
const options = {
headers: new HttpHeaders({
"Content-Type": "application/json",
}),
body: body
};
return this.http.delete<AlertModel>(this.urlApi + "/", options)
}
}
\ No newline at end of file
......@@ -186,6 +186,7 @@ export class NavService implements OnDestroy {
{ id: 'm24', path: 'admin/day-type-registry', title: 'menu.LeaveType', type: 'link', show: true },
{ id: 'm25', path: 'admin/account-settings', title: 'menu.UserSetting', type: 'link', show: true },
{ id: 'm26', path: 'admin/role-permission-config', title: 'menu.AccessPermissions', type: 'link', show: true },
{ id: 'm27', path: 'admin/document-upload-manager', title: 'DocumentUploadManager', type: 'link', show: true },
// { id: 'm27', path: 'admin/job-description-emp', title: 'ข้อมูลลักษณะงาน (JD)', type: 'link', show: true },
],
},
......
......@@ -24,6 +24,7 @@
"AssessmentTools": "Assessment Tools",
"CDR": "CDR",
"IDP": "IDP",
"Eva": "Status",
"CompetencyFactors": "Competency Factors",
"CompetencyManage": "Competency Manage",
"AssessmentPeriod": "Assessment Period",
......@@ -390,5 +391,18 @@
"CDR": "CDR",
"DevelopmentPeriod": "Development Period",
"Job": "Job",
"DivisionPart9": "Division"
"DivisionPart9": "Division",
"DuplicateCode": "Duplicate Code",
"DocumentNameThai": "Document Name (Thai)",
"DocumentNameEng": "Document Name (Eng)",
"DisplayOrder": "Display order",
"Close": "Close",
"Open": "Open",
"AttachFile": "Attach file",
"UploadFile": "Upload File",
"DownloadFile": "Download File",
"AddDocument": "Add Document",
"EditDocument": "Edit Document",
"Eva": "Status",
"DocumentUploadManager": "Document Upload Manager"
}
\ No newline at end of file
......@@ -392,5 +392,17 @@
"CDRPart9": "หลักสูตรพัฒนาตาม CDR",
"DevelopmentPeriod": "ระยะเวลาที่พัฒนา",
"Job": "งาน",
"DivisionPart9": "ฝ่าย"
"DivisionPart9": "ฝ่าย",
"DuplicateCode": "รหัสซ้ำ",
"DocumentNameThai": "ชื่อเอกสาร (ไทย)",
"DocumentNameEng": "ชื่อเอกสาร (อังกฤษ)",
"DisplayOrder": "ลำดับการแสดงผล",
"Close": "ปิด",
"Open": "เปิด",
"AttachFile": "แนบไฟล์",
"UploadFile": "อัปโหลดไฟล์",
"DownloadFile": "ดาวน์โหลดไฟล์",
"AddDocument": "เพิ่มเอกสาร",
"EditDocument": "แก้ไขเอกสาร",
"DocumentUploadManager": "จัดการอัพโหลดเอกสาร"
}
\ No newline at end of file
......@@ -3,7 +3,7 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false,
baseUrl: 'https://myskill-x-uat.myhr.co.th/api',
baseUrl: 'https://myskill-x-poc.myhr.co.th/api',
portal:'https://portal.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