import { NgModule } from '@angular/core'; import { Routes, RouterModule, PreloadAllModules } from '@angular/router'; import { Authguard } from './core/authguard'; import { Role } from './models/role'; import { MasterComponent } from "./views/master/master.component"; // import { LoginComponent } from './views/login/login.component'; import { UserprofileComponent } from './views/userprofile/userprofile.component'; import { AdminInformationComponent } from './views/admin-information/admin-information.component'; import { TermsofUseComponent } from './views/termsof-use/termsof-use.component'; import { PrivacyPolicyComponent } from './views/privacy-policy/privacy-policy.component'; import { AnnouncementsComponent } from './views/announcements/announcements.component'; import { LoginTermsofUseComponent } from './views/login-termsof-use/login-termsof-use.component'; import { LoginPrivacyPolicyComponent } from './views/login-privacy-policy/login-privacy-policy.component'; import { environment } from 'src/environments/environment'; const routes: Routes = [ //{ path: 'userslist', component: UserslistComponent, pathMatch: 'full', }, //{ path: 'usersform/:id', component: UsersformComponent, pathMatch: 'full', canActivate: [Authguard], data: { title: 'Users Form', roles: [Role.Quoting, Role.SuperAdmin] } }, //{ path : '', component : UserslistComponent} // { path: '', component: LoginComponent, pathMatch: 'full' }, // { path: 'login', component: LoginComponent, pathMatch: 'full' }, { path: 'login-termsof-use', component: LoginTermsofUseComponent, pathMatch: 'full' }, { path: 'login-privacy-policy', component: LoginPrivacyPolicyComponent, pathMatch: 'full' }, // { // // Needed for hash routing // path: 'code', // component: LoginComponent // }, { path: '', component: MasterComponent, data: { breadcrumb: '' }, children: [ //{ // path: 'admin', // loadChildren: () => import('./views/admin/admin.module').then(m => m.AdminModule), // data: // { // title: 'Admin', // breadcrumb: 'Admin', roles: [Role.Quoting, Role.SuperAdmin] // }, /*canActivate: [Authguard]*/ //}, { path: 'admin-information', component: AdminInformationComponent, pathMatch: 'full' }, { path: 'termsof-use', component: TermsofUseComponent, pathMatch: 'full', data: { title: 'TermsOfUse', breadcrumb: 'TermsOfUse' } }, { path: 'privacy-policy', component: PrivacyPolicyComponent, pathMatch: 'full', data: { title: 'Privacy-Ploicy', breadcrumb: 'Privacy-Ploicy' } }, { path: 'announcements', component: AnnouncementsComponent, pathMatch: 'full', data: { title: 'Announcements', breadcrumb: 'Announcements' } }, { path: 'order', loadChildren: () => import('./views/order/order.module').then(m => m.OrderModule), data: { title: 'order', breadcrumb: 'order', roles: [Role.Quoting, Role.SuperAdmin] }, canActivate: [Authguard] }, { path: 'dashboard', loadChildren: () => import('./views/dashboard/dashboard.module').then(m => m.DashboardModule), data: { title: 'Dashboard', breadcrumb: 'Dashboard', roles: [Role.Quoting, Role.SuperAdmin] }, canActivate: [Authguard] }, { path: 'customeradmin', loadChildren: () => import('./views/customer-administration/customer-administration.module').then(m => m.CustomerAdministrationModule), data: { title: 'Customeradmin', breadcrumb: 'Customeradmin', roles: [Role.Quoting, Role.SuperAdmin] }, /*canActivate: [Authguard]*/ }, { path: 'sidingadmin', loadChildren: () => import('./views/siding-administration/siding-administration.module').then(m => m.SidingAdministrationModule), data: { title: 'Sidingadmin', breadcrumb: 'Sidingadmin', roles: [Role.Quoting, Role.SuperAdmin] }, /*canActivate: [Authguard]*/ }, { path: 'resourcecenter', loadChildren: () => import('./views/resource-center/resource-center.module').then(m => m.ResourceCenterModule), data: { title: 'Sidingadmin', breadcrumb: 'Sidingadmin', roles: [Role.Quoting, Role.SuperAdmin] }, /*canActivate: [Authguard]*/ }, { path: 'marketingresource', loadChildren: () => import('./views/marketing-resource/marketing-resource.module').then(m => m.MarketingResourceModule), data: { title: 'ordersamplesandliterature', breadcrumb: 'ordersamplesandliterature', roles: [Role.Quoting, Role.SuperAdmin] }, /*canActivate: [Authguard]*/ }, { path: 'TrainingAndEvents', loadChildren: () => import('./views/TrainingAndEvents/training-and-events.routing.module').then(m => m.TrainingAndEventsRoutingModule), data: { title: 'training-events', breadcrumb: 'training-events', roles: [Role.Quoting, Role.SuperAdmin] }, /*canActivate: [Authguard]*/ }, { path: 'policies', loadChildren: () => import('./views/policies/policies-routing.module').then(m => m.PoliciesRoutingModule), data: { title: 'frieght-policies', breadcrumb: 'frieght-policies', roles: [Role.Quoting, Role.SuperAdmin] }, /*canActivate: [Authguard]*/ }, //{ // path: 'buildingproject', // loadChildren: () => import('./views/buildingproject/buildingproject.module').then(m => m.BuildingprojectModule), // data: // { // title: 'Building Project', // breadcrumb: 'Building Project', roles: [Role.Quoting, Role.SuperAdmin] // }, /*canActivate: [Authguard]*/ //}, { path: 'userprofile', component: UserprofileComponent,canActivate : [Authguard] }, { path: '**', redirectTo: environment.logoutURL, pathMatch: 'full' } ] }, ]; const isIframe = window !== window.parent && !window.opener; @NgModule({ imports: [RouterModule.forRoot(routes, { useHash: false, // Don't perform initial navigation in iframes initialNavigation: !isIframe ? 'enabled' : 'disabled', relativeLinkResolution: 'legacy', onSameUrlNavigation: 'reload', })], exports: [RouterModule] }) export class AppRoutingModule { }