Commit 296dc2a1 by sawit

แยก module mySkill-X และแสดงเฉพาะ portal ที่ sidebar

parent c8b0be7c
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { MyskillXComponent } from './myskill-x.component'; import { MyskillXComponent } from './myskill-x.component';
import { RouterModule, Routes } from '@angular/router';
import { SharedModule } from '../../shared/shared.module';
import { QuillModule } from 'ngx-quill';
export const myportal: Routes = [
{
path: 'myportal', children: [
//////////////MyPortal/////////////////
{
path: 'portal-category-list',
loadComponent: () =>
import('../common/myportal/portal-category-list/portal-category-list.component').then((m) => m.PortalCategoryListComponent),
},
{
path: 'view-list-excel',
loadComponent: () =>
import('../common/myportal/view-list-excel/view-list-excel.component').then((m) => m.ViewListExcelComponent),
},
{
path: 'view-list-doc',
loadComponent: () =>
import('../common/myportal/view-list-doc/view-list-doc.component').then((m) => m.ViewListDocComponent),
},
{
path: 'view-list-course',
loadComponent: () =>
import('../common/myportal/view-list-course/view-list-course.component').then((m) => m.ViewListCourseComponent),
},
{
path: 'view-list-widgets',
loadComponent: () =>
import('../common/myportal/view-list-widgets/view-list-widgets.component').then((m) => m.ViewListWidgetsComponent),
},
{
path: 'excel-report',
loadComponent: () =>
import('../common/myportal/excel-report/excel-report.component').then((m) => m.ExcelReportComponent),
},
{
path: 'portal-create-category',
loadComponent: () =>
import('../common/myportal/portal-create-category/portal-create-category.component').then((m) => m.PortalCreateCategoryComponent),
},
{
path: 'list-excell',
loadComponent: () =>
import('../common/myportal/list-excell/list-excell.component').then((m) => m.ListExcelComponent),
},
{
path: 'list-course',
loadComponent: () =>
import('../common/myportal/list-course/list-course.component').then((m) => m.ListCourseComponent),
},
{
path: 'list-doc',
loadComponent: () =>
import('../common/myportal/list-doc/list-doc.component').then((m) => m.ListDocComponent),
},
{
path: 'list-widgets',
loadComponent: () =>
import('../common/myportal/list-widgets/list-widgets.component').then((m) => m.ListWidgetsComponent),
},
{
path: 'excel-list',
loadComponent: () =>
import('../common/myportal/set-excel-reports/excel-list/excel-list.component').then((m) => m.ExcelListComponent),
},
{
path: 'datasource-table',
loadComponent: () =>
import('../common/myportal/datasource-table/datasource-table.component').then((m) => m.DatasourceTableComponent),
},
{
path: 'excel-report-toggle',
loadComponent: () =>
import('../common/myportal/set-excel-reports/excel-report-toggle/excel-report-toggle.component').then((m) => m.ExcelReportToggleComponent),
},
{
path: 'management',
loadComponent: () =>
import('../common/myportal/management/management.component').then((m) => m.ManagementComponent),
},
{
path: 'portal-category-list-approve',
loadComponent: () =>
import('../common/myportal/management/portal-category-list-approve/portal-category-list-approve.component').then((m) => m.PortalCategoryListApproveComponent),
},
{
path: 'approve-excel',
loadComponent: () =>
import('../common/myportal/management/portal-category-list-approve/approve-excel/approve-excel.component').then((m) => m.ApproveExcelComponent),
},
{
path: 'approve-doc',
loadComponent: () =>
import('../common/myportal/management/portal-category-list-approve/approve-doc/approve-doc.component').then((m) => m.ApproveDocComponent),
},
{
path: 'approve-course',
loadComponent: () =>
import('../common/myportal/management/portal-category-list-approve/approve-course/approve-course.component').then((m) => m.ApproveCourseComponent),
},
{
path: 'approved-list',
loadComponent: () =>
import('../common/myportal/management/approved-list/approved-list.component').then((m) => m.ApprovedListComponent),
},
{
path: 'view-list-excel',
loadComponent: () =>
import('../common/myportal/management/approved-list/view-list-excel/view-list-excel.component').then((m) => m.ViewListExcelComponent),
},
{
path: 'view-list-excel/:type',
loadComponent: () =>
import('../common/myportal/management/approved-list/view-list-excel/view-list-excel.component').then((m) => m.ViewListExcelComponent),
},
{
path: 'view-list-doc',
loadComponent: () =>
import('../common/myportal/management/approved-list/view-list-doc/view-list-doc.component').then((m) => m.ViewListDocComponent),
},
{
path: 'view-list-doc/:type',
loadComponent: () =>
import('../common/myportal/management/approved-list/view-list-doc/view-list-doc.component').then((m) => m.ViewListDocComponent),
},
{
path: 'view-list-course',
loadComponent: () =>
import('../common/myportal/management/approved-list/view-list-course/view-list-course.component').then((m) => m.ViewListCourseComponent),
},
{
path: 'view-list-course/:type',
loadComponent: () =>
import('../common/myportal/management/approved-list/view-list-course/view-list-course.component').then((m) => m.ViewListCourseComponent),
},
]
}
];
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule CommonModule,
RouterModule.forChild(myportal),
QuillModule.forRoot(),
], ],
exports: [RouterModule],
declarations: [MyskillXComponent] declarations: [MyskillXComponent]
}) })
export class MyskillXModule { } export class MyskillXModule {
static routes = myportal;
}
\ No newline at end of file
...@@ -353,7 +353,7 @@ ...@@ -353,7 +353,7 @@
</div> </div>
<div class=""> <div class="">
<a routerLink="/admin" <a routerLink="/admin/member-manage"
class="p-4 items-center related-app block text-center rounded-sm hover:bg-gray-50 dark:hover:bg-black/20"> class="p-4 items-center related-app block text-center rounded-sm hover:bg-gray-50 dark:hover:bg-black/20">
<img src="./assets/images/logoallHR/logo_myjob.png" alt="miscrosoft" <img src="./assets/images/logoallHR/logo_myjob.png" alt="miscrosoft"
class="leading-[1.75] text-2xl !h-[1.75rem] align-middle flex justify-center mx-auto"> class="leading-[1.75] text-2xl !h-[1.75rem] align-middle flex justify-center mx-auto">
...@@ -363,7 +363,7 @@ ...@@ -363,7 +363,7 @@
</div> </div>
<div class=""> <div class="">
<a routerLink="/admin" <a routerLink="/myportal/portal-category-list"
class="p-4 items-center related-app block text-center rounded-sm hover:bg-gray-50 dark:hover:bg-black/20"> class="p-4 items-center related-app block text-center rounded-sm hover:bg-gray-50 dark:hover:bg-black/20">
<img src="./assets/images/logoallHR/mySkill-x.png" alt="miscrosoft" <img src="./assets/images/logoallHR/mySkill-x.png" alt="miscrosoft"
class="leading-[1.75] text-2xl !h-[1.75rem] align-middle flex justify-center mx-auto"> class="leading-[1.75] text-2xl !h-[1.75rem] align-middle flex justify-center mx-auto">
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
<!-- Start::main-sidebar-header --> <!-- Start::main-sidebar-header -->
<div class="main-sidebar-header" style="background-color: white !important;"> <div class="main-sidebar-header" style="background-color: white !important;">
<a class="header-logo"> <a class="header-logo">
<img src="./assets/images/brand-logos/logo.png" alt="logo" width="100%"> <img *ngIf="isCommonRoute" src="./assets/images/brand-logos/logo.png" alt="logo" width="100%">
<img *ngIf="isMyportalRoute" src="./assets/images/logoallHR/mySkill-x.png" alt="logo" width="100%">
</a> </a>
......
...@@ -69,6 +69,7 @@ export class SidebarComponent { ...@@ -69,6 +69,7 @@ export class SidebarComponent {
companyModel: CompanyModel = new CompanyModel() companyModel: CompanyModel = new CompanyModel()
isCommonRoute: boolean = false; isCommonRoute: boolean = false;
isInstallerRoute: boolean = false; isInstallerRoute: boolean = false;
isMyportalRoute: boolean = false;
previousUrl: string = ''; previousUrl: string = '';
currentUrl: string = ''; currentUrl: string = '';
...@@ -107,6 +108,10 @@ export class SidebarComponent { ...@@ -107,6 +108,10 @@ export class SidebarComponent {
this.currentUrl = this.router.url this.currentUrl = this.router.url
this.isCommonRoute = this.currentUrl.includes('/admin'); this.isCommonRoute = this.currentUrl.includes('/admin');
this.isInstallerRoute = this.currentUrl.includes('/company'); this.isInstallerRoute = this.currentUrl.includes('/company');
this.isMyportalRoute = this.currentUrl.includes('/myportal');
this.menuitemsSubscribe$ = this.navServices.items.subscribe((items) => {
this.changeMenu()
});
// ดึงข้อมูล Excel Report ก่อน แล้วค่อยอัปเดตเมนู // ดึงข้อมูล Excel Report ก่อน แล้วค่อยอัปเดตเมนู
this.fetchExcelReportsAndAddToMenu(); this.fetchExcelReportsAndAddToMenu();
...@@ -132,11 +137,13 @@ export class SidebarComponent { ...@@ -132,11 +137,13 @@ export class SidebarComponent {
checkInitialUrl(): void { checkInitialUrl(): void {
this.isCommonRoute = this.currentUrl.includes('/admin'); this.isCommonRoute = this.currentUrl.includes('/admin');
this.isInstallerRoute = this.currentUrl.includes('/company'); this.isInstallerRoute = this.currentUrl.includes('/company');
this.isMyportalRoute = this.currentUrl.includes('/myportal');
this.checkUrlChanges() this.checkUrlChanges()
// Log to console for verification // Log to console for verification
console.log('Initial URL:', this.currentUrl); console.log('Initial URL:', this.currentUrl);
console.log('Is Common Route:', this.isCommonRoute); console.log('Is Common Route:', this.isCommonRoute);
console.log('Is Installer Route:', this.isInstallerRoute); console.log('Is Installer Route:', this.isInstallerRoute);
console.log('Is Myportal Route:', this.isMyportalRoute);
} }
checkUrlChanges(): void { checkUrlChanges(): void {
...@@ -162,6 +169,7 @@ export class SidebarComponent { ...@@ -162,6 +169,7 @@ export class SidebarComponent {
// Update the boolean values // Update the boolean values
this.isCommonRoute = this.currentUrl.includes('/admin'); this.isCommonRoute = this.currentUrl.includes('/admin');
this.isInstallerRoute = this.currentUrl.includes('/company'); this.isInstallerRoute = this.currentUrl.includes('/company');
this.isMyportalRoute = this.currentUrl.includes('/myportal');
// Log to console for verification // Log to console for verification
console.log('Current URL:', this.currentUrl); console.log('Current URL:', this.currentUrl);
...@@ -186,6 +194,8 @@ export class SidebarComponent { ...@@ -186,6 +194,8 @@ export class SidebarComponent {
// กำหนดเมนูพื้นฐาน (Common หรือ Installer) // กำหนดเมนูพื้นฐาน (Common หรือ Installer)
if (this.isInstallerRoute) { if (this.isInstallerRoute) {
this.menuItems = this.navServices.getCompanyMenu(); this.menuItems = this.navServices.getCompanyMenu();
}else if (this.isMyportalRoute){
this.menuItems = this.navServices.getMyportalMenu();
} else { } else {
this.menuItems = this.navServices.getCommonMenu(); this.menuItems = this.navServices.getCommonMenu();
} }
......
...@@ -28,6 +28,7 @@ import { widgetsRoutingModule } from '../../components/widgets/widgets.routes'; ...@@ -28,6 +28,7 @@ import { widgetsRoutingModule } from '../../components/widgets/widgets.routes';
import { tablesRoutingModule } from '../../components/tables/tables.routes'; import { tablesRoutingModule } from '../../components/tables/tables.routes';
import { CommonManageModule } from '../../DPU/common/common.module'; import { CommonManageModule } from '../../DPU/common/common.module';
import { CompanyManagementModule } from '../../DPU/company-management/company-management.module'; import { CompanyManagementModule } from '../../DPU/company-management/company-management.module';
import { MyskillXModule } from '../../DPU/myskill-x/myskill-x.module';
export const content: Routes = [ export const content: Routes = [
...@@ -61,7 +62,8 @@ export const content: Routes = [ ...@@ -61,7 +62,8 @@ export const content: Routes = [
...widgetsRoutingModule.routes, ...widgetsRoutingModule.routes,
...tablesRoutingModule.routes, ...tablesRoutingModule.routes,
...CommonManageModule.routes, ...CommonManageModule.routes,
...CompanyManagementModule.routes ...CompanyManagementModule.routes,
...MyskillXModule.routes
] ]
} }
......
...@@ -218,5 +218,59 @@ export class NavService implements OnDestroy { ...@@ -218,5 +218,59 @@ export class NavService implements OnDestroy {
]; ];
} }
getMyportalMenu() {
return [
// Myportal
{ headTitle: 'MyPortal' },
{
icon: 'receipt',
path: '/myportal/portal-category-list',
title: 'รายการเอกสาร',
type: 'link',
},
{
icon: 'receipt',
path: '/myportal/portal-create-category',
title: 'รายการอัพโหลดเอกสาร',
type: 'link',
},
{
icon: 'cog',
path: '/myportal/management',
title: 'การจัดการ',
type: 'sub',
children: [
{ path: '/myportal/portal-category-list-approve', title: 'รายการรอการอนุมัติ', type: 'link' },
{ path: '/myportal/approved-list', title: 'รายการผ่านการอนุมัติ', type: 'link' }
],
},
{
icon: 'user',
path: '/myportal/set-excel-reports',
title: 'ตั้งรายงานเอ็กเซล',
type: 'sub',
children: [
{ path: '/myportal/excel-list', title: 'เพิ่มรายงาน Excel', type: 'link' },
{ path: '/myportal/excel-report-toggle', title: 'เปิด-ปิด การใช้รายงาน Excel', type: 'link' }
],
},
{
icon: 'data',
path: '/myportal/datasource-table',
title: 'DataSource Table',
type: 'link',
},
{
icon: 'file',
path: '/myportal/excel-report',
title: 'รายงาน Excel',
type: 'link',
},
// { headTitle: 'User Management' },
];
}
items = new BehaviorSubject<Menu[]>(this.MENUITEMS); items = new BehaviorSubject<Menu[]>(this.MENUITEMS);
} }
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