import { CommonModule } from '@angular/common'; import { NgModule, inject } from '@angular/core'; import { ActivatedRouteSnapshot, RouterModule, RouterStateSnapshot, Routes } from '@angular/router'; import { AttendanceTypeResolver } from '../attendance/attendance-type-resolver.service'; import { AuthGuard } from '../auth/auth-guard.service'; import { EmployeeAttendanceResolver } from './employee-attendance-resolver.service'; import { EmployeeAttendanceComponent } from './employee-attendance.component'; const employeeEmployeeAttendanceRoutes: Routes = [ { path: '', component: EmployeeAttendanceComponent, canActivate: [ (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => inject(AuthGuard).canActivate(route, state), ], data: { permission: 'Attendance', }, resolve: { info: (route: ActivatedRouteSnapshot) => inject(EmployeeAttendanceResolver).resolve(route), attendanceTypes: () => inject(AttendanceTypeResolver).resolve(), }, runGuardsAndResolvers: 'always', }, { path: ':id', component: EmployeeAttendanceComponent, canActivate: [ (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => inject(AuthGuard).canActivate(route, state), ], data: { permission: 'Attendance', }, resolve: { info: (route: ActivatedRouteSnapshot) => inject(EmployeeAttendanceResolver).resolve(route), attendanceTypes: () => inject(AttendanceTypeResolver).resolve(), }, runGuardsAndResolvers: 'always', }, ]; @NgModule({ imports: [CommonModule, RouterModule.forChild(employeeEmployeeAttendanceRoutes)], exports: [RouterModule], providers: [EmployeeAttendanceResolver], }) export class EmployeeAttendanceRoutingModule {}