import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; // Import Containers import { DefaultLayoutComponent, CustomerPortalLayoutComponent } from './containers'; import { P404Component } from './views/error/404.component'; import { P500Component } from './views/error/500.component'; import { LoginComponent } from './views/login/login.component'; import { RegisterComponent } from './views/register/register.component'; import { AuthAdminGuardService } from './guards/auth.admin.guard'; import { TestimonialsComponent } from './views/testimonials/testimonials.component'; import { FaqsComponent } from './views/faqs/faqs.component'; import { BlogComponent } from './views/blog/blog.component'; import { PoliciesComponent } from './views/returns-cancellation-policies/policies.component'; import { TermsAndConditionsComponent } from './views/terms-conditions/terms-conditions.component'; import { AboutUsComponent } from './views/about-us/about-us.component'; export const routes: Routes = [ { path: '', redirectTo: 'home', pathMatch: 'full', }, { path: 'admin', redirectTo: 'admin/dashboard', pathMatch: 'full', }, { path: 'testimonials', component: TestimonialsComponent, data: { title: 'Testimonials' } }, { path: 'faqs', component: FaqsComponent, data: { title: 'FAQs' } }, { path: 'about', component: AboutUsComponent, data: { title: 'About Us' } }, { path: 'conditions', component: TermsAndConditionsComponent, data: { title: 'Terms & Conditions' } }, { path: 'policies', component: PoliciesComponent, data: { title: 'Returns/Cancellation policy' } }, { path: 'blog', component: BlogComponent, data: { title: 'Blog' } }, { path: '404', component: P404Component, data: { title: 'Page 404' } }, { path: '500', component: P500Component, data: { title: 'Page 500' } }, { path: 'login', component: LoginComponent, data: { title: 'Login Page' } }, { path: '', component: CustomerPortalLayoutComponent, data: { title: 'Customer Page' }, children: [ { path: 'home', loadChildren: () => import('./views/custom-portal-pages/home-page/home-page.module').then(m => m.HomePageModule) }, { path: 'products', loadChildren: () => import('./views/custom-portal-pages/products-display-view/products-display-view.module').then(m => m.ProductsDisplayViewModule) }, ] }, { path: 'register', component: RegisterComponent, data: { title: 'Register Page' } }, { path: 'admin', component: DefaultLayoutComponent, canActivate : [AuthAdminGuardService], data: { title: 'Admin pages' }, children: [ { path: 'customers', loadChildren: () => import('./views/customers/customers.module').then(m => m.CustomersModule) }, { path: 'manageConfiguration', loadChildren: () => import('./views/categoryModals/category-modals.module').then(m => m.CategoryModalModule) }, { path: 'sales', loadChildren: () => import('./views/sales/sales.module').then(m => m.SalesModule) }, { path: 'accounts', loadChildren: () => import('./views/accounts/accounts.module').then(m => m.AccountsModule) }, { path: 'purchases', loadChildren: () => import('./views/buttons/buttons.module').then(m => m.ButtonsModule) }, { path: 'reports', loadChildren: () => import('./views/chartjs/chartjs.module').then(m => m.ChartJSModule) }, { path: 'dashboard', loadChildren: () => import('./views/dashboard/dashboard.module').then(m => m.DashboardModule) }, { path: 'invoices', loadChildren: () => import('./views/invoice/invoice.module').then(m => m.InvoiceModule) }, { path: 'vendor-payments', loadChildren: () => import('./views/vendor-payment/vendor-payment.module').then(m => m.VendorPaymentsModule) }, { path: 'bills', loadChildren: () => import('./views/bill/bill.module').then(m => m.BillModule) }, { path: 'items', loadChildren: () => import('./views/products/product.module').then(m => m.ProductsModule) }, { path: 'vendor-credits', loadChildren: () => import('./views/vendor-credit/vendor-credit.module').then(m => m.VendorCreditModule) }, { path: 'vendors', loadChildren: () => import('./views/vendor-info/vendor-info.module').then(m => m.VendorInfoModule) }, { path: 'referral-credits', loadChildren: () => import('./views/referral/referral.module').then(m => m.ReferralModule) }, { path: 'customer-issues', loadChildren: () => import('./views/customer-issue/customer-issues.module').then(m => m.CustomerIssuesModule) } ] }, { path: '**', component: P404Component } ]; @NgModule({ imports: [ RouterModule.forRoot(routes, {scrollPositionRestoration: 'enabled'}) ], exports: [ RouterModule ] }) export class AppRoutingModule {}