@@ -29,7 +29,13 @@ import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-ro
2929import { CoreCourseIndexRoutingModule } from '@features/course/course-routing.module' ;
3030import { PARTICIPANTS_PAGE_NAME } from '@features/user/constants' ;
3131import { CORE_COURSE_PAGE_NAME } from '@features/course/constants' ;
32- import { ADDON_COMPETENCY_LEARNING_PLANS_PAGE , ADDON_COMPETENCY_COMPETENCIES_PAGE } from './constants' ;
32+ import {
33+ ADDON_COMPETENCY_LEARNING_PLANS_PAGE ,
34+ ADDON_COMPETENCY_COMPETENCIES_PAGE ,
35+ ADDON_COMPETENCY_SUMMARY_PAGE ,
36+ } from './constants' ;
37+ import { conditionalRoutes } from '@/app/app-routing.module' ;
38+ import { CoreScreen } from '@services/screen' ;
3339
3440/**
3541 * Get competency services.
@@ -46,18 +52,113 @@ export async function getCompetencyServices(): Promise<Type<unknown>[]> {
4652 ] ;
4753}
4854
55+ /**
56+ * Routes for competency learning plans.
57+ *
58+ * @returns Routes.
59+ */
60+ function getCompetencyLearningPlansRoutes ( ) : Routes {
61+ const mobileRoutes : Routes = [
62+ {
63+ path : '' ,
64+ pathMatch : 'full' ,
65+ loadComponent : ( ) => import ( './pages/planlist/planlist' ) ,
66+ } ,
67+ {
68+ path : `:planId/${ ADDON_COMPETENCY_COMPETENCIES_PAGE } ` ,
69+ loadComponent : ( ) => import ( './pages/plan/plan' ) ,
70+ } ,
71+ {
72+ path : `:planId/${ ADDON_COMPETENCY_COMPETENCIES_PAGE } /:competencyId` ,
73+ loadComponent : ( ) => import ( './pages/competency/competency' ) ,
74+ } ,
75+ ] ;
76+
77+ const tabletRoutes : Routes = [
78+ {
79+ path : '' ,
80+ loadComponent : ( ) => import ( './pages/planlist/planlist' ) ,
81+ children : [
82+ {
83+ path : `:planId/${ ADDON_COMPETENCY_COMPETENCIES_PAGE } ` ,
84+ loadComponent : ( ) => import ( './pages/plan/plan' ) ,
85+ } ,
86+ ] ,
87+ } ,
88+ {
89+ path : `:planId/${ ADDON_COMPETENCY_COMPETENCIES_PAGE } ` ,
90+ loadComponent : ( ) => import ( './pages/competencies/competencies' ) ,
91+ children : [
92+ {
93+ path : ':competencyId' ,
94+ loadComponent : ( ) => import ( './pages/competency/competency' ) ,
95+ } ,
96+ ] ,
97+ } ,
98+ ] ;
99+
100+ return [
101+ ...conditionalRoutes ( mobileRoutes , ( ) => CoreScreen . isMobile ) ,
102+ ...conditionalRoutes ( tabletRoutes , ( ) => CoreScreen . isTablet ) ,
103+ {
104+ path : `:planId/${ ADDON_COMPETENCY_COMPETENCIES_PAGE } /:competencyId/${ ADDON_COMPETENCY_SUMMARY_PAGE } ` ,
105+ loadComponent : ( ) => import ( './pages/competencysummary/competencysummary' ) ,
106+ } ,
107+ ] ;
108+ }
109+
110+ /**
111+ * Routes for competency course details.
112+ *
113+ * @returns Routes.
114+ */
115+ function getCompetencyCourseDetailsRoutes ( ) : Routes {
116+ const mobileRoutes : Routes = [
117+ {
118+ path : '' ,
119+ loadComponent : ( ) => import ( './pages/coursecompetencies/coursecompetencies' ) ,
120+ } ,
121+ {
122+ path : ':competencyId' ,
123+ loadComponent : ( ) => import ( './pages/competency/competency' ) ,
124+ } ,
125+ ] ;
126+
127+ const tabletRoutes : Routes = [
128+ {
129+ path : '' ,
130+ loadComponent : ( ) => import ( './pages/competencies/competencies' ) ,
131+ children : [
132+ {
133+ path : ':competencyId' ,
134+ loadComponent : ( ) => import ( './pages/competency/competency' ) ,
135+ } ,
136+ ] ,
137+ } ,
138+ ] ;
139+
140+ return [
141+ ...conditionalRoutes ( mobileRoutes , ( ) => CoreScreen . isMobile ) ,
142+ ...conditionalRoutes ( tabletRoutes , ( ) => CoreScreen . isTablet ) ,
143+ {
144+ path : `:competencyId/${ ADDON_COMPETENCY_SUMMARY_PAGE } ` ,
145+ loadComponent : ( ) => import ( './pages/competencysummary/competencysummary' ) ,
146+ } ,
147+ ] ;
148+ }
149+
49150const mainMenuChildrenRoutes : Routes = [
50151 {
51152 path : ADDON_COMPETENCY_LEARNING_PLANS_PAGE ,
52- loadChildren : ( ) => import ( './competency-learning-plans-lazy.module' ) ,
153+ children : getCompetencyLearningPlansRoutes ( ) ,
53154 } ,
54155 {
55156 path : `${ CORE_COURSE_PAGE_NAME } /:courseId/${ ADDON_COMPETENCY_COMPETENCIES_PAGE } ` ,
56- loadChildren : ( ) => import ( './competency-course-details-lazy.module' ) ,
157+ children : getCompetencyCourseDetailsRoutes ( ) ,
57158 } ,
58159 {
59160 path : `${ CORE_COURSE_PAGE_NAME } /:courseId/${ PARTICIPANTS_PAGE_NAME } /:userId/${ ADDON_COMPETENCY_COMPETENCIES_PAGE } ` ,
60- loadChildren : ( ) => import ( './competency-course-details-lazy.module' ) ,
161+ children : getCompetencyCourseDetailsRoutes ( ) ,
61162 } ,
62163] ;
63164
0 commit comments