Commit abb883fb by Ooh-Ao

router

parent 65615342
......@@ -114,7 +114,7 @@ export class LoginPageComponent {
this.tokenService.saveUser(this.decodeJWT(response.accessToken))
this.employeeService.getProfile().subscribe(result => {
this.tokenService.saveUserData(result)
this.router.navigate(['/myskill-x-home']);
this.router.navigate(['ess/my-skill-x-module']);
})
} else {
......
......@@ -69,39 +69,40 @@ const routes: Routes = [
// myComponent
{ path: "company-registration", title: 'ทะเบียนบริษัท', component: CompanyRegistrationComponent },
{ path: "job-description", title: 'ข้อมูลลักษณะงาน', component: JobDescriptionComponent },
{ path: "account-settings", title: 'ตั้งค่าผู้ใช้งาน', component: AccountSettingsComponent },
{ path: "name-registration", title: 'ทะเบียนกำหนดชื่อ', component: NameRegistrationComponent },
{ path: "tool-register", title: 'ทะเบียนเครื่องมือ', component: ToolRegisterComponent },
{ path: "competency-management", title: 'การจัดการสมรรถนะ', component: CompetencyManagementComponent },
{ path: "job-detail-management", title: 'การจัดการรายละเอียดงาน', component: JobDetailManagementComponent },
{ path: "course-registration", title: 'ทะเบียนหลักสูตร', component: CourseRegistrationComponent },
{ path: "edit-group-competencies", title: 'แก้ไขกลุ่มสมรรถนะ', component: EditGroupCompetenciesComponent },
{ path: "evaluation-cycle-manager", title: 'การจัดการรอบการประเมิน', component: EvaluationCycleManagerComponent },
{ path: "setting-competency", title: 'การตั้งค่า', component: SettingCompetencyComponent },
{ path: "idp-development-plan", title: 'เเผนพัฒนา IDP', component: IdpDevelopmentPlanComponent },
{ path: "job-competency", title: 'ความรู้ ทักษะ ความสามารถในตำเเหน่งงาน', component: JobCompetencyComponent },
{ path: "job-qualifications", title: 'คุณสมบัติที่จำเป็นต่อการปฏิบัติหน้าที่', component: JobQualificationsComponent },
{ path: "job-detail", title: 'รายละเอียดของงาน', component: JobDetailComponent },
{ path: "command-structure", title: 'โครงสร้างสายการบังคับบัญชา', component: CommandStructureComponent },
{ path: "assessment-management", title: 'การจัดการการประเมิน', component: AssessmentManagementComponent },
{ path: "job-position-indicators", title: 'ตัวชี้วัดของตำแหน่งงาน', component: JobPositionIndicatorsComponent },
{ path: "evaluation-cycle-performance", title: 'รอบการประเมิน', component: EvaluationCyclePerformanceComponent },
{ path: "supervisor-evaluation", title: 'ประเมินโดยหัวหน้า', component: SupervisorEvaluationComponent },
{ path: "pms-evaluation", title: 'ประเมินผล PMS', component: PmsFormEmployeeComponent },
{ path: "employee-registration", title: 'ทะเบียนพนักงาน', component: EmployeeRegistrationComponent },
{ path: "name-registration-perfomance", title: 'ทะเบียนกำหนดชื่อ', component: NameRegistrationPerfomanceComponent },
{ path: "evaluation-factors", title: 'การประเมินจัดการประสิทธิภาพ', component: EvaluationFactorsComponent },
{ path: "grade-registration", title: 'ทะเบียนเกรด', component: GradeRegistrationComponent },
{ path: "grade-registration-sub", title: 'ทะเบียนเกรด', component: PmsGradeRegistrationComponent },
{ path: "setting-performance-evalution", title: 'การตั้งค่า', component: SettingPerformanceEvalutionComponent },
{ path: "self-evaluation", title: 'ประเมินตนเอง', component: SelfEvaluationComponent },
{ path: "day-type-registry", title: 'ประเมินตนเอง', component: DayTypeRegistryComponent },
{ path: "time-attendance", title: 'ทะเบียนการประเมินเวลาทำงาน', component: TimeAttendanceComponent },
{ path: "role-permission-config", title: 'กำหนดสิทธิการเข้าใช้งาน', component: RolePermissionConfigComponent },
{ path: "employee-self-service", title: 'employee-self-service', component: EmployeeSelfServiceComponent },
{ path: "my-skill-x-module", title: 'my-skill-x-module', component: MySkillXModuleComponent }
{ path: "ess/self-evaluation", title: 'ประเมินตนเอง', component: SelfEvaluationComponent },
{ path: "ess/day-type-registry", title: 'ประเมินตนเอง', component: DayTypeRegistryComponent },
{ path: "admin/company-registration", title: 'ทะเบียนบริษัท', component: CompanyRegistrationComponent },
{ path: "admin/job-description", title: 'ข้อมูลลักษณะงาน', component: JobDescriptionComponent },
{ path: "admin/account-settings", title: 'ตั้งค่าผู้ใช้งาน', component: AccountSettingsComponent },
{ path: "admin/name-registration", title: 'ทะเบียนกำหนดชื่อ', component: NameRegistrationComponent },
{ path: "admin/tool-register", title: 'ทะเบียนเครื่องมือ', component: ToolRegisterComponent },
{ path: "admin/competency-management", title: 'การจัดการสมรรถนะ', component: CompetencyManagementComponent },
{ path: "admin/job-detail-management", title: 'การจัดการรายละเอียดงาน', component: JobDetailManagementComponent },
{ path: "admin/course-registration", title: 'ทะเบียนหลักสูตร', component: CourseRegistrationComponent },
{ path: "admin/edit-group-competencies", title: 'แก้ไขกลุ่มสมรรถนะ', component: EditGroupCompetenciesComponent },
{ path: "admin/evaluation-cycle-manager", title: 'การจัดการรอบการประเมิน', component: EvaluationCycleManagerComponent },
{ path: "admin/setting-competency", title: 'การตั้งค่า', component: SettingCompetencyComponent },
{ path: "ess/idp-development-plan", title: 'เเผนพัฒนา IDP', component: IdpDevelopmentPlanComponent },
{ path: "admin/job-competency", title: 'ความรู้ ทักษะ ความสามารถในตำเเหน่งงาน', component: JobCompetencyComponent },
{ path: "admin/job-qualifications", title: 'คุณสมบัติที่จำเป็นต่อการปฏิบัติหน้าที่', component: JobQualificationsComponent },
{ path: "admin/job-detail", title: 'รายละเอียดของงาน', component: JobDetailComponent },
{ path: "admin/command-structure", title: 'โครงสร้างสายการบังคับบัญชา', component: CommandStructureComponent },
{ path: "admin/assessment-management", title: 'การจัดการการประเมิน', component: AssessmentManagementComponent },
{ path: "admin/job-position-indicators", title: 'ตัวชี้วัดของตำแหน่งงาน', component: JobPositionIndicatorsComponent },
{ path: "admin/evaluation-cycle-performance", title: 'รอบการประเมิน', component: EvaluationCyclePerformanceComponent },
{ path: "ess/supervisor-evaluation", title: 'ประเมินโดยหัวหน้า', component: SupervisorEvaluationComponent },
{ path: "ess/pms-evaluation", title: 'ประเมินผล PMS', component: PmsFormEmployeeComponent },
{ path: "admin/employee-registration", title: 'ทะเบียนพนักงาน', component: EmployeeRegistrationComponent },
{ path: "admin/name-registration-perfomance", title: 'ทะเบียนกำหนดชื่อ', component: NameRegistrationPerfomanceComponent },
{ path: "admin/evaluation-factors", title: 'การประเมินจัดการประสิทธิภาพ', component: EvaluationFactorsComponent },
{ path: "admin/grade-registration", title: 'ทะเบียนเกรด', component: GradeRegistrationComponent },
{ path: "admin/grade-registration-sub", title: 'ทะเบียนเกรด', component: PmsGradeRegistrationComponent },
{ path: "admin/setting-performance-evalution", title: 'การตั้งค่า', component: SettingPerformanceEvalutionComponent },
{ path: "admin/time-attendance", title: 'ทะเบียนการประเมินเวลาทำงาน', component: TimeAttendanceComponent },
{ path: "admin/role-permission-config", title: 'กำหนดสิทธิการเข้าใช้งาน', component: RolePermissionConfigComponent },
{ path: "ess/employee-self-service", title: 'employee-self-service', component: EmployeeSelfServiceComponent },
{ path: "ess/my-skill-x-module", title: 'my-skill-x-module', component: MySkillXModuleComponent }
]
}
];
......
<app-header></app-header>
<main class="mx-auto max-w-[1400px] px-4 lg:px-8 py-8 mt-5rem">
<header class="flex flex-col items-center gap-3 text-center">
<!-- โลโก้ -->
<img src="./assets/img/brand-logos/mySkill-x.png"
alt="mySkillX"
class="h-32 w-auto" />
<!-- บรรทัดใหญ่ -->
</header>
<main class="mx-auto max-w-[1400px] px-4 lg:px-8 py-8">
<!-- ░░ FLEX WRAPPER ░░ -->
<div class="flex flex-col lg:flex-row gap-10">
......@@ -14,9 +24,9 @@
<h4 class="hero-label">One X</h4>
<h3 class="hero-title">Performance &<br/>Competency</h3>
<button class="hero-btn">Dashboard</button>
<button routerLink="/dashboard/projects" class="hero-btn">Dashboard</button>
<a routerLink="/myskill-x-home" class="back-link">
<a routerLink="/ess/my-skill-x-module" class="back-link">
<i class="ti ti-arrow-left"></i> กลับสู่เมนูหลัก
</a>
</aside>
......@@ -25,7 +35,7 @@
<section class="flex-grow">
<div class="grid gap-6 grid-cols-2 sm:grid-cols-3 md:grid-cols-4
xl:grid-cols-4 auto-rows-[150px]">
<div *ngFor="let m of modules" class="sub-card aspect-square">
<div *ngFor="let m of modules" class="sub-card aspect-square" routerLink="/ess/self-evaluation">
<p class="sub-title">{{ m.title }}</p>
</div>
</div>
......
<!-- header ------------------------------------------------------------>
<app-header></app-header>
<header class="flex flex-col items-center gap-3 text-center mt-5rem">
<header class="flex flex-col items-center gap-3 text-center">
<!-- โลโก้ -->
<img src="./assets/img/brand-logos/mySkill-XXX-h190.PNG"
......@@ -31,7 +30,7 @@
<div class="bp-grid">
<ng-container *ngFor="let m of hrdModules">
<div class="module-card" routerLink="/myskill-ess-pms">
<div class="module-card" routerLink="/ess/employee-self-service">
<img [src]="m.icon"
[alt]="m.title + ' icon'"
class="module-img"/>
......@@ -54,7 +53,7 @@
<div class="bp-grid">
<ng-container *ngFor="let m of hrmModules">
<div class="module-card">
<div class="module-card" routerLink="/ess/employee-self-service">
<img [src]="m.icon"
[alt]="m.title + ' icon'"
class="module-img"/>
......
......@@ -683,7 +683,7 @@
<!-- <img *ngIf="employeeProfile?.picture && employeeProfile.picture !== ''; else defaultImage"
class="inline-block rounded-full ring-2 h-full !ring-transparent"
[src]="employeeProfile.picture"
alt="Image Description"
alt="Image Description"
(error)="onImageError($event)"/>
<ng-template #defaultImage>
......@@ -704,7 +704,7 @@
<!-- <img *ngIf="employeeProfile?.picture && employeeProfile.picture !== ''; else defaultImage"
class="inline-block rounded-full ring-2 h-12 w-12 !ring-transparent"
[src]="employeeProfile.picture"
alt="Image Description"
alt="Image Description"
(error)="onImageError($event)"/>
<ng-template #defaultImage>
......@@ -738,12 +738,11 @@
<i class="ti ti-clipboard-check text-lg"></i>
Task Manager
</a> -->
<a *ngIf="!router.url.includes('/employee-self-service')"
(click)="onNextPartClick('/employee-self-service')" class="ti-dropdown-item cursor-pointer">
<i class="ti ti-settings text-lg"></i>
หน้าแรก
<a routerLink="/ess/my-skill-x-module" class="ti-dropdown-item cursor-pointer">
<i class="ti ti-home text-lg"></i>
หน้าหลัก
</a>
<a *ngIf="!router.url.includes('/self-evaluation')" (click)="onNextPartClick('/self-evaluation')"
<!-- <a *ngIf="!router.url.includes('/self-evaluation')" (click)="onNextPartClick('/self-evaluation')"
class="ti-dropdown-item cursor-pointer">
<i class="ti ti-settings text-lg"></i>
ประเมินตนเอง
......@@ -756,7 +755,7 @@
<a (click)="onNextPartClick('/company-registration')" class="ti-dropdown-item cursor-pointer">
<i class="ti ti-settings text-lg"></i>
หน้าผู้ดูแลระบบ
</a>
</a> -->
<!-- <a routerLink="/dashboard/crypto" class="ti-dropdown-item">
<i class="ti ti-wallet text-lg"></i>
Bal: $7,12,950
......@@ -921,4 +920,4 @@
</div>
</div>
</div>
<!-- ========== END Search Modal ========== -->
\ No newline at end of file
<!-- ========== END Search Modal ========== -->
......@@ -3,7 +3,7 @@
<!-- Start::main-sidebar-header -->
<div class="main-sidebar-header"
style="background-color: white;padding-top: 0px;padding-bottom: 0px;padding-left: 5px;padding-right: 5px;">
<a routerLink="/dashboard/sales" class="header-logo">
<a routerLink="/ess/employee-self-service" class="header-logo">
<img src="./assets/img/brand-logos/mySkill-x.png" alt="logo" class="main-logo desktop-logo"
style="height: 100%;object-fit: contain;" />
<img src="./assets/img/brand-logos/mySkill-x.png" alt="logo" class="main-logo toggle-logo"
......@@ -17,7 +17,7 @@
<!-- End::main-sidebar-header -->
<!-- ::main-sidebar -->
<ngx-simplebar [options]="options" style="background-color: #174dd3;">
<ngx-simplebar [options]="options" style="background-color: #174dd3;" *ngIf="!showSideMenu">
<div class="main-sidebar" id="sidebar-scroll">
<!-- Start::nav -->
<nav class="main-menu-container nav nav-pills flex-column sub-open active open">
......@@ -128,4 +128,4 @@
<!-- End::main-sidebar -->
</aside>
<!-- End::app-sidebar -->
\ No newline at end of file
<!-- End::app-sidebar -->
......@@ -17,6 +17,8 @@ export class SidebarComponent {
// Addding sticky-pin
scrolled = false;
screenWidth: number;
isCommonRoute: boolean = false;
isESSRoute: boolean = false;
eventTriggered: boolean = false;
public localdata = localStorage;
......@@ -65,7 +67,11 @@ export class SidebarComponent {
public menuitemsSubscribe$!: Subscription;
user_level? = ""
configPermission: { loading: boolean, data: ConfigPermissionModel } = { loading: false, data: new MyConfigPermissionModel() }
isEssRoute: boolean = false;
isAdminRoute: boolean = false;
previousUrl: string = '';
currentUrl: string = '';
showSideMenu: boolean = false;
constructor(
private navServices: NavService,
private sanitizer: DomSanitizer,
......@@ -74,24 +80,41 @@ export class SidebarComponent {
private elementRef: ElementRef,
private configPermissionService: ConfigPermissionService,
private cdr: ChangeDetectorRef,
private tokenService : TokenService
private tokenService: TokenService
) {
this.screenWidth = window.innerWidth;
this.user_level = this.tokenService.getUser()?.user_level
}
ngOnInit() {
this.currentUrl = this.router.url
this.isESSRoute = this.currentUrl.includes('/ess');
this.isAdminRoute = this.currentUrl.includes('/admin');
this.showSideMenu = this.currentUrl.includes('my-skill-x-module') || this.currentUrl.includes('employee-self-service')
if (this.showSideMenu) {
const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;;
html.style = '';
html.setAttribute('data-nav-layout', 'horizontal');
} else {
const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;
html.setAttribute('data-nav-layout', 'vertical');
}
// this.menuitemsSubscribe$ = this.navServices.items.subscribe((items) => {
// this.menuItems = items;
// });
// this.getConfigPermissionByUserLevel()
this.menuitemsSubscribe$ = this.navServices.items.subscribe((items) => {
this.menuItems = items;
this.changeMenu()
});
this.getConfigPermissionByUserLevel()
this.ParentActive();
this.router.events.subscribe((event) => {
sessionStorage.setItem('currentUrl', this.router.url)
if (event instanceof NavigationEnd) {
this.ParentActive();
}
});
this.checkUrlChanges();
// this.router.events.subscribe((event) => {
// sessionStorage.setItem('currentUrl', this.router.url)
// if (event instanceof NavigationEnd) {
// this.ParentActive();
// }
// });
if (window.innerWidth <= 992) {
document.documentElement?.setAttribute('toggled', 'close');
}
......@@ -106,11 +129,79 @@ export class SidebarComponent {
switcherArrowFn();
checkHoriMenu();
if (document.documentElement.getAttribute('data-nav-layout') == 'horizontal' && window.innerWidth > 992) {
console.log('Horizontal menu detected');
this.closeNavActive()
}
}
checkUrlChanges(): void {
this.router.events.subscribe((event) => {
if (event instanceof NavigationEnd) {
this.ParentActive();
}
});
this.router.events.subscribe((event) => {
if (event instanceof NavigationEnd) {
this.previousUrl = this.currentUrl; // Save the previous URL
this.currentUrl = event.url; // Update to the new URL
// Check if there's a change between /installer and /admin
if (
(this.previousUrl.includes('/ess') && this.currentUrl.includes('/admin')) ||
(this.previousUrl.includes('/admin') && this.currentUrl.includes('/ess'))
) {
console.log('URL changed between /installer and /admin.');
// Implement any logic needed when changing between /installer and /admin
}
// Update the boolean values
this.isESSRoute = this.currentUrl.includes('/ess');
this.isAdminRoute = this.currentUrl.includes('/admin');
this.showSideMenu = this.currentUrl.includes('my-skill-x-module') || this.currentUrl.includes('employee-self-service')
if (this.showSideMenu) {
const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;;
html.style = '';
html.setAttribute('data-nav-layout', 'horizontal');
} else {
const html: any = this.elementRef.nativeElement.ownerDocument.documentElement;
html.setAttribute('data-nav-layout', 'vertical');
}
// Log to console for verification
console.log('Current URL:', this.currentUrl);
console.log('Previous URL:', this.previousUrl);
this.changeMenu()
}
});
}
changeMenu() {
if (this.isESSRoute) {
this.menuitemsSubscribe$ = this.navServices.items.subscribe((items) => {
this.menuItems = this.navServices.getCustomerMenu();
});
// if(this.tokenService.getUser().role=='manager'){
// this.menuitemsSubscribe$ = this.navServices.items.subscribe((items) => {
// this.menuItems = this.navServices.getCommonMenu();
// });
// }
// else{
// this.menuitemsSubscribe$ = this.navServices.items.subscribe((items) => {
// this.menuItems = this.navServices.getProjectEmpMenu();
// });
// }
}
else {
this.menuitemsSubscribe$ = this.navServices.items.subscribe((items) => {
this.menuItems = this.navServices.getAdminMenu();
});
}
this.ParentActive()
}
getConfigPermissionByUserLevel() {
this.configPermission.loading = true
this.configPermissionService.getByUserLevel(this.user_level!).subscribe({
......
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