diff --git a/src/app/app.routing.ts b/src/app/app.routing.ts
index 54c4863e..8e12d145 100644
--- a/src/app/app.routing.ts
+++ b/src/app/app.routing.ts
@@ -8,15 +8,15 @@ import { InitialDataResolver } from 'app/app.resolvers';
// tslint:disable:max-line-length
export const appRoutes: Route[] = [
- // Redirect empty path to '/dashboards/project'
- {path: '', pathMatch : 'full', redirectTo: 'dashboards/project'},
+ // Redirect empty path to '/example'
+ {path: '', pathMatch : 'full', redirectTo: 'example'},
- // Redirect signed in user to the '/dashboards/project'
+ // Redirect signed in user to the '/example'
//
// After the user signs in, the sign in page will redirect the user to the 'signed-in-redirect'
// path. Below is another redirection for that path to redirect the user to the desired
// location. This is a small convenience to keep all main routes together here on this file.
- {path: 'signed-in-redirect', pathMatch : 'full', redirectTo: 'dashboards/project'},
+ {path: 'signed-in-redirect', pathMatch : 'full', redirectTo: 'example'},
// Auth routes for guests
{
@@ -73,119 +73,7 @@ export const appRoutes: Route[] = [
initialData: InitialDataResolver,
},
children : [
-
- // Dashboards
- {path: 'dashboards', children: [
- {path: 'project', loadChildren: () => import('app/modules/admin/dashboards/project/project.module').then(m => m.ProjectModule)},
- {path: 'analytics', loadChildren: () => import('app/modules/admin/dashboards/analytics/analytics.module').then(m => m.AnalyticsModule)},
- ]},
-
- // Apps
- {path: 'apps', children: [
- {path: 'calendar', loadChildren: () => import('app/modules/admin/apps/calendar/calendar.module').then(m => m.CalendarModule)},
- {path: 'contacts', loadChildren: () => import('app/modules/admin/apps/contacts/contacts.module').then(m => m.ContactsModule)},
- {path: 'ecommerce', loadChildren: () => import('app/modules/admin/apps/ecommerce/ecommerce.module').then(m => m.ECommerceModule)},
- {path: 'file-manager', loadChildren: () => import('app/modules/admin/apps/file-manager/file-manager.module').then(m => m.FileManagerModule)},
- {path: 'help-center', loadChildren: () => import('app/modules/admin/apps/help-center/help-center.module').then(m => m.HelpCenterModule)},
- {path: 'mailbox', loadChildren: () => import('app/modules/admin/apps/mailbox/mailbox.module').then(m => m.MailboxModule)},
- {path: 'tasks', loadChildren: () => import('app/modules/admin/apps/tasks/tasks.module').then(m => m.TasksModule)},
- ]},
-
- // Pages
- {path: 'pages', children: [
-
- // Authentication
- {path: 'authentication', loadChildren: () => import('app/modules/admin/pages/authentication/authentication.module').then(m => m.AuthenticationModule)},
-
- // Coming soon
- {path: 'coming-soon', loadChildren: () => import('app/modules/admin/pages/coming-soon/coming-soon.module').then(m => m.ComingSoonModule)},
-
- // Error
- {path: 'error', children: [
- {path: '404', loadChildren: () => import('app/modules/admin/pages/error/error-404/error-404.module').then(m => m.Error404Module)},
- {path: '500', loadChildren: () => import('app/modules/admin/pages/error/error-500/error-500.module').then(m => m.Error500Module)}
- ]},
-
- // Invoice
- {path: 'invoice', children: [
- {path: 'printable', children: [
- {path: 'compact', loadChildren: () => import('app/modules/admin/pages/invoice/printable/compact/compact.module').then(m => m.CompactModule)},
- {path: 'modern', loadChildren: () => import('app/modules/admin/pages/invoice/printable/modern/modern.module').then(m => m.ModernModule)}
- ]}
- ]},
-
- // Maintenance
- {path: 'maintenance', loadChildren: () => import('app/modules/admin/pages/maintenance/maintenance.module').then(m => m.MaintenanceModule)},
-
- // Pricing
- {path: 'pricing', children: [
- {path: 'modern', loadChildren: () => import('app/modules/admin/pages/pricing/modern/modern.module').then(m => m.PricingModernModule)},
- {path: 'simple', loadChildren: () => import('app/modules/admin/pages/pricing/simple/simple.module').then(m => m.PricingSimpleModule)},
- {path: 'single', loadChildren: () => import('app/modules/admin/pages/pricing/single/single.module').then(m => m.PricingSingleModule)},
- {path: 'table', loadChildren: () => import('app/modules/admin/pages/pricing/table/table.module').then(m => m.PricingTableModule)}
- ]},
-
- // Profile
- {path: 'profile', loadChildren: () => import('app/modules/admin/pages/profile/profile.module').then(m => m.ProfileModule)},
- ]},
-
- // User interface
- {path: 'ui', children: [
-
- // Angular Material
- {path: 'angular-material', loadChildren: () => import('app/modules/admin/ui/angular-material/angular-material.module').then(m => m.AngularMaterialModule)},
-
- // TailwindCSS
- {path: 'tailwindcss', loadChildren: () => import('app/modules/admin/ui/tailwindcss/tailwindcss.module').then(m => m.TailwindCSSModule)},
-
- // Animations
- {path: 'animations', loadChildren: () => import('app/modules/admin/ui/animations/animations.module').then(m => m.AnimationsModule)},
-
- // Cards
- {path: 'cards', loadChildren: () => import('app/modules/admin/ui/cards/cards.module').then(m => m.CardsModule)},
-
- // Colors
- {path: 'colors', loadChildren: () => import('app/modules/admin/ui/colors/colors.module').then(m => m.ColorsModule)},
-
- // Datatable
- {path: 'datatable', loadChildren: () => import('app/modules/admin/ui/datatable/datatable.module').then(m => m.DatatableModule)},
-
- // Forms
- {path: 'forms', children: [
- {path: 'fields', loadChildren: () => import('app/modules/admin/ui/forms/fields/fields.module').then(m => m.FormsFieldsModule)},
- {path: 'layouts', loadChildren: () => import('app/modules/admin/ui/forms/layouts/layouts.module').then(m => m.FormsLayoutsModule)},
- {path: 'wizards', loadChildren: () => import('app/modules/admin/ui/forms/wizards/wizards.module').then(m => m.FormsWizardsModule)}
- ]},
-
- // Icons
- {path: 'icons', loadChildren: () => import('app/modules/admin/ui/icons/icons.module').then(m => m.IconsModule)},
-
- // Page layouts
- {path: 'page-layouts', loadChildren: () => import('app/modules/admin/ui/page-layouts/page-layouts.module').then(m => m.PageLayoutsModule)},
-
- // Typography
- {path: 'typography', loadChildren: () => import('app/modules/admin/ui/typography/typography.module').then(m => m.TypographyModule)}
- ]},
-
- // Documentation
- {path: 'docs', children: [
-
- // Changelog
- {path: 'changelog', loadChildren: () => import('app/modules/admin/docs/changelog/changelog.module').then(m => m.ChangelogModule)},
-
- // Guides
- {path: 'guides', loadChildren: () => import('app/modules/admin/docs/guides/guides.module').then(m => m.GuidesModule)},
-
- // Core features
- {path: 'core-features', loadChildren: () => import('app/modules/admin/docs/core-features/core-features.module').then(m => m.CoreFeaturesModule)},
-
- // Other components
- {path: 'other-components', loadChildren: () => import('app/modules/admin/docs/other-components/other-components.module').then(m => m.OtherComponentsModule)},
- ]},
-
- // 404 & Catch all
- {path: '404-not-found', pathMatch: 'full', loadChildren: () => import('app/modules/admin/pages/error/error-404/error-404.module').then(m => m.Error404Module)},
- {path: '**', redirectTo: '404-not-found'}
+ {path: 'example', loadChildren: () => import('app/modules/admin/example/example.module').then(m => m.ExampleModule)},
]
}
];
diff --git a/src/app/mock-api/common/navigation/data.ts b/src/app/mock-api/common/navigation/data.ts
index d1274e38..bdce1485 100644
--- a/src/app/mock-api/common/navigation/data.ts
+++ b/src/app/mock-api/common/navigation/data.ts
@@ -1,1284 +1,39 @@
-
/* tslint:disable:max-line-length */
import { FuseNavigationItem } from '@fuse/components/navigation';
export const defaultNavigation: FuseNavigationItem[] = [
{
- id : 'dashboards',
- title : 'Dashboards',
- subtitle: 'Unique dashboard designs',
- type : 'group',
- icon : 'heroicons_outline:home',
- children: [
- {
- id : 'dashboards.project',
- title: 'Project',
- type : 'basic',
- icon : 'heroicons_outline:clipboard-check',
- link : '/dashboards/project'
- },
- {
- id : 'dashboards.analytics',
- title: 'Analytics',
- type : 'basic',
- icon : 'heroicons_outline:chart-pie',
- link : '/dashboards/analytics'
- }
- ]
- },
- {
- id : 'apps',
- title : 'Applications',
- subtitle: 'Custom made application designs',
- type : 'group',
- icon : 'heroicons_outline:home',
- children: [
- {
- id : 'apps.calendar',
- title : 'Calendar',
- subtitle: '3 upcoming events',
- type : 'basic',
- icon : 'heroicons_outline:calendar',
- link : '/apps/calendar'
- },
- {
- id : 'apps.contacts',
- title: 'Contacts',
- type : 'basic',
- icon : 'heroicons_outline:user-group',
- link : '/apps/contacts'
- },
- {
- id : 'apps.ecommerce',
- title : 'ECommerce',
- type : 'collapsable',
- icon : 'heroicons_outline:shopping-cart',
- children: [
- {
- id : 'apps.ecommerce.inventory',
- title: 'Inventory',
- type : 'basic',
- link : '/apps/ecommerce/inventory'
- }
- ]
- },
- {
- id : 'apps.file-manager',
- title: 'File manager',
- type : 'basic',
- icon : 'heroicons_outline:cloud',
- link : '/apps/file-manager'
- },
- {
- id : 'apps.help-center',
- title : 'Help center',
- type : 'collapsable',
- icon : 'heroicons_outline:support',
- link : '/apps/help-center',
- children: [
- {
- id : 'apps.help-center.home',
- title : 'Home',
- type : 'basic',
- link : '/apps/help-center',
- exactMatch: true
- },
- {
- id : 'apps.help-center.faqs',
- title: 'FAQs',
- type : 'basic',
- link : '/apps/help-center/faqs'
- },
- {
- id : 'apps.help-center.guides',
- title: 'Guides',
- type : 'basic',
- link : '/apps/help-center/guides'
- },
- {
- id : 'apps.help-center.support',
- title: 'Support',
- type : 'basic',
- link : '/apps/help-center/support'
- }
- ]
- },
- {
- id : 'apps.mailbox',
- title: 'Mailbox',
- type : 'basic',
- icon : 'heroicons_outline:mail',
- link : '/apps/mailbox',
- badge: {
- title : '27',
- classes: 'px-2 bg-pink-600 text-white rounded-full'
- }
- },
- {
- id : 'apps.tasks',
- title: 'Tasks',
- type : 'basic',
- icon : 'heroicons_outline:check-circle',
- link : '/apps/tasks'
- }
-
- ]
- },
- {
- id : 'pages',
- title : 'Pages',
- subtitle: 'Custom made page designs',
- type : 'group',
- icon : 'heroicons_outline:document',
- children: [
- {
- id : 'pages.authentication',
- title : 'Authentication',
- type : 'collapsable',
- icon : 'heroicons_outline:lock-closed',
- children: [
- {
- id : 'pages.authentication.sign-in',
- title : 'Sign in',
- type : 'collapsable',
- children: [
- {
- id : 'pages.authentication.sign-in.classic',
- title: 'Classic',
- type : 'basic',
- link : '/pages/authentication/sign-in/classic'
- },
- {
- id : 'pages.authentication.sign-in.modern',
- title: 'Modern',
- type : 'basic',
- link : '/pages/authentication/sign-in/modern'
- },
- {
- id : 'pages.authentication.sign-in.modern-reversed',
- title: 'Modern Reversed',
- type : 'basic',
- link : '/pages/authentication/sign-in/modern-reversed'
- },
- {
- id : 'pages.authentication.sign-in.split-screen',
- title: 'Split Screen',
- type : 'basic',
- link : '/pages/authentication/sign-in/split-screen'
- },
- {
- id : 'pages.authentication.sign-in.split-screen-reversed',
- title: 'Split Screen Reversed',
- type : 'basic',
- link : '/pages/authentication/sign-in/split-screen-reversed'
- },
- {
- id : 'pages.authentication.sign-in.fullscreen',
- title: 'Fullscreen',
- type : 'basic',
- link : '/pages/authentication/sign-in/fullscreen'
- },
- {
- id : 'pages.authentication.sign-in.fullscreen-reversed',
- title: 'Fullscreen Reversed',
- type : 'basic',
- link : '/pages/authentication/sign-in/fullscreen-reversed'
- }
- ]
- },
- {
- id : 'pages.authentication.sign-up',
- title : 'Sign up',
- type : 'collapsable',
- link : '/pages/authentication/sign-up',
- children: [
- {
- id : 'pages.authentication.sign-up.classic',
- title: 'Classic',
- type : 'basic',
- link : '/pages/authentication/sign-up/classic'
- },
- {
- id : 'pages.authentication.sign-up.modern',
- title: 'Modern',
- type : 'basic',
- link : '/pages/authentication/sign-up/modern'
- },
- {
- id : 'pages.authentication.sign-up.modern-reversed',
- title: 'Modern Reversed',
- type : 'basic',
- link : '/pages/authentication/sign-up/modern-reversed'
- },
- {
- id : 'pages.authentication.sign-up.split-screen',
- title: 'Split Screen',
- type : 'basic',
- link : '/pages/authentication/sign-up/split-screen'
- },
- {
- id : 'pages.authentication.sign-up.split-screen-reversed',
- title: 'Split Screen Reversed',
- type : 'basic',
- link : '/pages/authentication/sign-up/split-screen-reversed'
- },
- {
- id : 'pages.authentication.sign-up.fullscreen',
- title: 'Fullscreen',
- type : 'basic',
- link : '/pages/authentication/sign-up/fullscreen'
- },
- {
- id : 'pages.authentication.sign-up.fullscreen-reversed',
- title: 'Fullscreen Reversed',
- type : 'basic',
- link : '/pages/authentication/sign-up/fullscreen-reversed'
- }
- ]
- },
- {
- id : 'pages.authentication.sign-out',
- title : 'Sign out',
- type : 'collapsable',
- link : '/pages/authentication/sign-out',
- children: [
- {
- id : 'pages.authentication.sign-out.classic',
- title: 'Classic',
- type : 'basic',
- link : '/pages/authentication/sign-out/classic'
- },
- {
- id : 'pages.authentication.sign-out.modern',
- title: 'Modern',
- type : 'basic',
- link : '/pages/authentication/sign-out/modern'
- },
- {
- id : 'pages.authentication.sign-out.modern-reversed',
- title: 'Modern Reversed',
- type : 'basic',
- link : '/pages/authentication/sign-out/modern-reversed'
- },
- {
- id : 'pages.authentication.sign-out.split-screen',
- title: 'Split Screen',
- type : 'basic',
- link : '/pages/authentication/sign-out/split-screen'
- },
- {
- id : 'pages.authentication.sign-out.split-screen-reversed',
- title: 'Split Screen Reversed',
- type : 'basic',
- link : '/pages/authentication/sign-out/split-screen-reversed'
- },
- {
- id : 'pages.authentication.sign-out.fullscreen',
- title: 'Fullscreen',
- type : 'basic',
- link : '/pages/authentication/sign-out/fullscreen'
- },
- {
- id : 'pages.authentication.sign-out.fullscreen-reversed',
- title: 'Fullscreen Reversed',
- type : 'basic',
- link : '/pages/authentication/sign-out/fullscreen-reversed'
- }
- ]
- },
- {
- id : 'pages.authentication.forgot-password',
- title : 'Forgot password',
- type : 'collapsable',
- link : '/pages/authentication/forgot-password',
- children: [
- {
- id : 'pages.authentication.forgot-password.classic',
- title: 'Classic',
- type : 'basic',
- link : '/pages/authentication/forgot-password/classic'
- },
- {
- id : 'pages.authentication.forgot-password.modern',
- title: 'Modern',
- type : 'basic',
- link : '/pages/authentication/forgot-password/modern'
- },
- {
- id : 'pages.authentication.forgot-password.modern-reversed',
- title: 'Modern Reversed',
- type : 'basic',
- link : '/pages/authentication/forgot-password/modern-reversed'
- },
- {
- id : 'pages.authentication.forgot-password.split-screen',
- title: 'Split Screen',
- type : 'basic',
- link : '/pages/authentication/forgot-password/split-screen'
- },
- {
- id : 'pages.authentication.forgot-password.split-screen-reversed',
- title: 'Split Screen Reversed',
- type : 'basic',
- link : '/pages/authentication/forgot-password/split-screen-reversed'
- },
- {
- id : 'pages.authentication.forgot-password.fullscreen',
- title: 'Fullscreen',
- type : 'basic',
- link : '/pages/authentication/forgot-password/fullscreen'
- },
- {
- id : 'pages.authentication.forgot-password.fullscreen-reversed',
- title: 'Fullscreen Reversed',
- type : 'basic',
- link : '/pages/authentication/forgot-password/fullscreen-reversed'
- }
- ]
- },
- {
- id : 'pages.authentication.reset-password',
- title : 'Reset password',
- type : 'collapsable',
- link : '/pages/authentication/reset-password',
- children: [
- {
- id : 'pages.authentication.reset-password.classic',
- title: 'Classic',
- type : 'basic',
- link : '/pages/authentication/reset-password/classic'
- },
- {
- id : 'pages.authentication.reset-password.modern',
- title: 'Modern',
- type : 'basic',
- link : '/pages/authentication/reset-password/modern'
- },
- {
- id : 'pages.authentication.reset-password.modern-reversed',
- title: 'Modern Reversed',
- type : 'basic',
- link : '/pages/authentication/reset-password/modern-reversed'
- },
- {
- id : 'pages.authentication.reset-password.split-screen',
- title: 'Split Screen',
- type : 'basic',
- link : '/pages/authentication/reset-password/split-screen'
- },
- {
- id : 'pages.authentication.reset-password.split-screen-reversed',
- title: 'Split Screen Reversed',
- type : 'basic',
- link : '/pages/authentication/reset-password/split-screen-reversed'
- },
- {
- id : 'pages.authentication.reset-password.fullscreen',
- title: 'Fullscreen',
- type : 'basic',
- link : '/pages/authentication/reset-password/fullscreen'
- },
- {
- id : 'pages.authentication.reset-password.fullscreen-reversed',
- title: 'Fullscreen Reversed',
- type : 'basic',
- link : '/pages/authentication/reset-password/fullscreen-reversed'
- }
- ]
- },
- {
- id : 'pages.authentication.unlock-session',
- title : 'Unlock session',
- type : 'collapsable',
- link : '/pages/authentication/unlock-session',
- children: [
- {
- id : 'pages.authentication.unlock-session.classic',
- title: 'Classic',
- type : 'basic',
- link : '/pages/authentication/unlock-session/classic'
- },
- {
- id : 'pages.authentication.unlock-session.modern',
- title: 'Modern',
- type : 'basic',
- link : '/pages/authentication/unlock-session/modern'
- },
- {
- id : 'pages.authentication.unlock-session.modern-reversed',
- title: 'Modern Reversed',
- type : 'basic',
- link : '/pages/authentication/unlock-session/modern-reversed'
- },
- {
- id : 'pages.authentication.unlock-session.split-screen',
- title: 'Split Screen',
- type : 'basic',
- link : '/pages/authentication/unlock-session/split-screen'
- },
- {
- id : 'pages.authentication.unlock-session.split-screen-reversed',
- title: 'Split Screen Reversed',
- type : 'basic',
- link : '/pages/authentication/unlock-session/split-screen-reversed'
- },
- {
- id : 'pages.authentication.unlock-session.fullscreen',
- title: 'Fullscreen',
- type : 'basic',
- link : '/pages/authentication/unlock-session/fullscreen'
- },
- {
- id : 'pages.authentication.unlock-session.fullscreen-reversed',
- title: 'Fullscreen Reversed',
- type : 'basic',
- link : '/pages/authentication/unlock-session/fullscreen-reversed'
- }
- ]
- },
- {
- id : 'pages.authentication.confirmation-required',
- title : 'Confirmation required',
- type : 'collapsable',
- link : '/pages/authentication/confirmation-required',
- children: [
- {
- id : 'pages.authentication.confirmation-required.classic',
- title: 'Classic',
- type : 'basic',
- link : '/pages/authentication/confirmation-required/classic'
- },
- {
- id : 'pages.authentication.confirmation-required.modern',
- title: 'Modern',
- type : 'basic',
- link : '/pages/authentication/confirmation-required/modern'
- },
- {
- id : 'pages.authentication.confirmation-required.modern-reversed',
- title: 'Modern Reversed',
- type : 'basic',
- link : '/pages/authentication/confirmation-required/modern-reversed'
- },
- {
- id : 'pages.authentication.confirmation-required.split-screen',
- title: 'Split Screen',
- type : 'basic',
- link : '/pages/authentication/confirmation-required/split-screen'
- },
- {
- id : 'pages.authentication.confirmation-required.split-screen-reversed',
- title: 'Split Screen Reversed',
- type : 'basic',
- link : '/pages/authentication/confirmation-required/split-screen-reversed'
- },
- {
- id : 'pages.authentication.confirmation-required.fullscreen',
- title: 'Fullscreen',
- type : 'basic',
- link : '/pages/authentication/confirmation-required/fullscreen'
- },
- {
- id : 'pages.authentication.confirmation-required.fullscreen-reversed',
- title: 'Fullscreen Reversed',
- type : 'basic',
- link : '/pages/authentication/confirmation-required/fullscreen-reversed'
- }
- ]
- }
- ]
- },
- {
- id : 'pages.coming-soon',
- title : 'Coming soon',
- type : 'collapsable',
- icon : 'heroicons_outline:clock',
- link : '/pages/coming-soon',
- children: [
- {
- id : 'pages.coming-soon.classic',
- title: 'Classic',
- type : 'basic',
- link : '/pages/coming-soon/classic'
- },
- {
- id : 'pages.coming-soon.modern',
- title: 'Modern',
- type : 'basic',
- link : '/pages/coming-soon/modern'
- },
- {
- id : 'pages.coming-soon.modern-reversed',
- title: 'Modern Reversed',
- type : 'basic',
- link : '/pages/coming-soon/modern-reversed'
- },
- {
- id : 'pages.coming-soon.split-screen',
- title: 'Split Screen',
- type : 'basic',
- link : '/pages/coming-soon/split-screen'
- },
- {
- id : 'pages.coming-soon.split-screen-reversed',
- title: 'Split Screen Reversed',
- type : 'basic',
- link : '/pages/coming-soon/split-screen-reversed'
- },
- {
- id : 'pages.coming-soon.fullscreen',
- title: 'Fullscreen',
- type : 'basic',
- link : '/pages/coming-soon/fullscreen'
- },
- {
- id : 'pages.coming-soon.fullscreen-reversed',
- title: 'Fullscreen Reversed',
- type : 'basic',
- link : '/pages/coming-soon/fullscreen-reversed'
- }
- ]
- },
- {
- id : 'pages.error',
- title : 'Error',
- type : 'collapsable',
- icon : 'heroicons_outline:exclamation-circle',
- children: [
- {
- id : 'pages.error.404',
- title: '404',
- type : 'basic',
- link : '/pages/error/404'
- },
- {
- id : 'pages.error.500',
- title: '500',
- type : 'basic',
- link : '/pages/error/500'
- }
- ]
- },
- {
- id : 'pages.invoice',
- title : 'Invoice',
- type : 'collapsable',
- icon : 'heroicons_outline:exclamation-circle',
- children: [
- {
- id : 'pages.invoice.printable',
- title : 'Printable',
- type : 'collapsable',
- children: [
- {
- id : 'pages.invoice.printable.compact',
- title: 'Compact',
- type : 'basic',
- link : '/pages/invoice/printable/compact'
- },
- {
- id : 'pages.invoice.printable.modern',
- title: 'Modern',
- type : 'basic',
- link : '/pages/invoice/printable/modern'
- }
- ]
- }
- ]
- },
- {
- id : 'pages.maintenance',
- title: 'Maintenance',
- type : 'basic',
- icon : 'heroicons_outline:exclamation',
- link : '/pages/maintenance'
- },
- {
- id : 'pages.pricing',
- title : 'Pricing',
- type : 'collapsable',
- icon : 'heroicons_outline:cash',
- children: [
- {
- id : 'pages.pricing.modern',
- title: 'Modern',
- type : 'basic',
- link : '/pages/pricing/modern'
- },
- {
- id : 'pages.pricing.simple',
- title: 'Simple',
- type : 'basic',
- link : '/pages/pricing/simple'
- },
- {
- id : 'pages.pricing.single',
- title: 'Single',
- type : 'basic',
- link : '/pages/pricing/single'
- },
- {
- id : 'pages.pricing.table',
- title: 'Table',
- type : 'basic',
- link : '/pages/pricing/table'
- }
- ]
- },
- {
- id : 'pages.profile',
- title: 'Profile',
- type : 'basic',
- icon : 'heroicons_outline:user-circle',
- link : '/pages/profile'
- }
- ]
- },
- {
- id : 'user-interface',
- title : 'User Interface',
- subtitle: 'Building blocks of the UI & UX',
- type : 'group',
- icon : 'heroicons_outline:collection',
- children: [
- {
- id : 'user-interface.angular-material',
- title: 'Angular Material',
- type : 'basic',
- icon : 'heroicons_outline:shield-check',
- link : '/ui/angular-material'
- },
- {
- id : 'user-interface.tailwindcss',
- title: 'TailwindCSS',
- type : 'basic',
- icon : 'heroicons_outline:sparkles',
- link : '/ui/tailwindcss'
- },
- {
- id : 'user-interface.animations',
- title: 'Animations',
- type : 'basic',
- icon : 'heroicons_outline:play',
- link : '/ui/animations'
- },
- {
- id : 'user-interface.cards',
- title: 'Cards',
- type : 'basic',
- icon : 'heroicons_outline:duplicate',
- link : '/ui/cards'
- },
- {
- id : 'user-interface.colors',
- title: 'Colors',
- type : 'basic',
- icon : 'heroicons_outline:color-swatch',
- link : '/ui/colors'
- },
- {
- id : 'user-interface.datatable',
- title: 'Datatable',
- type : 'basic',
- icon : 'heroicons_outline:view-list',
- link : '/ui/datatable'
- },
- {
- id : 'user-interface.forms',
- title : 'Forms',
- type : 'collapsable',
- icon : 'heroicons_outline:pencil-alt',
- children: [
- {
- id : 'user-interface.forms.fields',
- title: 'Fields',
- type : 'basic',
- link : '/ui/forms/fields'
- },
- {
- id : 'user-interface.forms.layouts',
- title: 'Layouts',
- type : 'basic',
- link : '/ui/forms/layouts'
- },
- {
- id : 'user-interface.forms.wizards',
- title: 'Wizards',
- type : 'basic',
- link : '/ui/forms/wizards'
- }
- ]
- },
- {
- id : 'user-interface.icons',
- title : 'Icons',
- type : 'collapsable',
- icon : 'heroicons_outline:lightning-bolt',
- children: [
- {
- id : 'user-interface.icons.heroicons-outline',
- title: 'Heroicons Outline',
- type : 'basic',
- link : '/ui/icons/heroicons-outline'
- },
- {
- id : 'user-interface.icons.heroicons-solid',
- title: 'Heroicons Solid',
- type : 'basic',
- link : '/ui/icons/heroicons-solid'
- },
- {
- id : 'user-interface.icons.material-outline',
- title: 'Material Outline',
- type : 'basic',
- link : '/ui/icons/material-outline'
- },
- {
- id : 'user-interface.icons.material-twotone',
- title: 'Material Twotone',
- type : 'basic',
- link : '/ui/icons/material-twotone'
- },
- {
- id : 'user-interface.icons.iconsmind',
- title: 'Iconsmind',
- type : 'basic',
- link : '/ui/icons/iconsmind'
- },
- {
- id : 'user-interface.icons.feather',
- title: 'Feather',
- type : 'basic',
- link : '/ui/icons/feather'
- }
- ]
- },
- {
- id : 'user-interface.page-layouts',
- title : 'Page layouts',
- type : 'collapsable',
- icon : 'heroicons_outline:template',
- children: [
- {
- id : 'user-interface.page-layouts.overview',
- title: 'Overview',
- type : 'basic',
- link : '/ui/page-layouts/overview'
- },
- {
- id : 'user-interface.page-layouts.empty',
- title: 'Empty',
- type : 'basic',
- link : '/ui/page-layouts/empty'
- },
- {
- id: 'user-interface.page-layouts.carded',
-
- title : 'Carded',
- type : 'collapsable',
- children: [
- {
- id : 'user-interface.page-layouts.carded.fullwidth',
- title: 'Fullwidth',
- type : 'basic',
- link : '/ui/page-layouts/carded/fullwidth'
- },
- {
- id : 'user-interface.page-layouts.carded.left-sidebar-1',
- title: 'Left Sidebar #1',
- type : 'basic',
- link : '/ui/page-layouts/carded/left-sidebar-1'
- },
- {
- id : 'user-interface.page-layouts.carded.left-sidebar-2',
- title: 'Left Sidebar #2',
- type : 'basic',
- link : '/ui/page-layouts/carded/left-sidebar-2'
- },
- {
- id : 'user-interface.page-layouts.carded.right-sidebar-1',
- title: 'Right Sidebar #1',
- type : 'basic',
- link : '/ui/page-layouts/carded/right-sidebar-1'
- },
- {
- id : 'user-interface.page-layouts.carded.right-sidebar-2',
- title: 'Right Sidebar #2',
- type : 'basic',
- link : '/ui/page-layouts/carded/right-sidebar-2'
- }
- ]
- },
- {
- id : 'user-interface.page-layouts.simple',
- title : 'Simple',
- type : 'collapsable',
- children: [
- {
- id : 'user-interface.page-layouts.simple.fullwidth',
- title: 'Fullwidth',
- type : 'basic',
- link : '/ui/page-layouts/simple/fullwidth'
- },
- {
- id : 'user-interface.page-layouts.simple.left-sidebar-1',
- title: 'Left Sidebar #1',
- type : 'basic',
- link : '/ui/page-layouts/simple/left-sidebar-1'
- },
- {
- id : 'user-interface.page-layouts.simple.left-sidebar-2',
- title: 'Left Sidebar #2',
- type : 'basic',
- link : '/ui/page-layouts/simple/left-sidebar-2'
- },
- {
- id : 'user-interface.page-layouts.simple.left-sidebar-3',
- title: 'Left Sidebar #3',
- type : 'basic',
- link : '/ui/page-layouts/simple/left-sidebar-3'
- },
- {
- id : 'user-interface.page-layouts.simple.right-sidebar-1',
- title: 'Right Sidebar #1',
- type : 'basic',
- link : '/ui/page-layouts/simple/right-sidebar-1'
- },
- {
- id : 'user-interface.page-layouts.simple.right-sidebar-2',
- title: 'Right Sidebar #2',
- type : 'basic',
- link : '/ui/page-layouts/simple/right-sidebar-2'
- },
- {
- id : 'user-interface.page-layouts.simple.right-sidebar-3',
- title: 'Right Sidebar #3',
- type : 'basic',
- link : '/ui/page-layouts/simple/right-sidebar-3'
- }
- ]
- }
- ]
- },
- {
- id : 'user-interface.typography',
- title: 'Typography',
- type : 'basic',
- icon : 'heroicons_outline:pencil',
- link : '/ui/typography'
- }
- ]
- },
- {
- id : 'divider-1',
- type: 'divider'
- },
- {
- id : 'documentation',
- title : 'Documentation',
- subtitle: 'Everything you need to know about Fuse',
- type : 'group',
- icon : 'heroicons_outline:support',
- children: [
- {
- id : 'documentation.changelog',
- title: 'Changelog',
- type : 'basic',
- icon : 'heroicons_outline:speakerphone',
- link : '/docs/changelog',
- badge: {
- title : '12.0.0',
- classes: 'px-2 bg-yellow-300 text-black rounded-full'
- }
- },
- {
- id : 'documentation.guides',
- title: 'Guides',
- type : 'basic',
- icon : 'heroicons_outline:book-open',
- link : '/docs/guides'
- },
- {
- id : 'documentation.core-features',
- title: 'Core features',
- type : 'basic',
- icon : 'heroicons_outline:book-open',
- link : '/docs/core-features'
- },
- {
- id : 'documentation.other-components',
- title: 'Other components',
- type : 'basic',
- icon : 'heroicons_outline:book-open',
- link : '/docs/other-components'
- }
- ]
- },
- {
- id : 'divider-2',
- type: 'divider'
- },
- {
- id : 'navigation-features',
- title : 'Navigation features',
- subtitle: 'Collapsable levels & badge styles',
- type : 'group',
- icon : 'heroicons_outline:menu',
- children: [
- {
- id : 'navigation-features.level.0',
- title : 'Level 0',
- icon : 'heroicons_outline:check-circle',
- type : 'collapsable',
- children: [
- {
- id : 'navigation-features.level.0.1',
- title : 'Level 1',
- type : 'collapsable',
- children: [
- {
- id : 'navigation-features.level.0.1.2',
- title : 'Level 2',
- type : 'collapsable',
- children: [
- {
- id : 'navigation-features.level.0.1.2.3',
- title : 'Level 3',
- type : 'collapsable',
- children: [
- {
- id : 'navigation-features.level.0.1.2.3.4',
- title : 'Level 4',
- type : 'collapsable',
- children: [
- {
- id : 'navigation-features.level.0.1.2.3.4.5',
- title : 'Level 5',
- type : 'collapsable',
- children: [
- {
- id : 'navigation-features.level.0.1.2.3.4.5.6',
- title: 'Level 6',
- type : 'basic'
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- id : 'navigation-features.level.0',
- title : 'Level 0',
- subtitle: 'With subtitle',
- icon : 'heroicons_outline:check-circle',
- type : 'collapsable',
- children: [
- {
- id : 'navigation-features.level.0.1-1',
- title: 'Level 1.1',
- type : 'basic'
- },
- {
- id : 'navigation-features.level.0.1-2',
- title: 'Level 1.2',
- type : 'basic'
- }
- ]
- },
- {
- id : 'navigation-features.active',
- title : 'Active item',
- subtitle: 'Manually marked as active',
- icon : 'heroicons_outline:check-circle',
- type : 'basic',
- active : true
- },
- {
- id : 'navigation-features.disabled-collapsable',
- title : 'Disabled collapsable',
- subtitle: 'Some subtitle',
- icon : 'heroicons_outline:check-circle',
- type : 'collapsable',
- disabled: true,
- children: [
- {
- id : 'navigation-features.disabled-collapsable.child',
- title: 'You shouldn\'t be able to see this child',
- type : 'basic'
- }
- ]
- },
- {
- id : 'navigation-features.disabled-basic',
- title : 'Disabled basic',
- subtitle: 'Some subtitle',
- icon : 'heroicons_outline:check-circle',
- type : 'basic',
- disabled: true
- },
- {
- id : 'navigation-features.badge-style-oval',
- title: 'Oval badge',
- icon : 'heroicons_outline:tag',
- type : 'basic',
- badge: {
- title : '8',
- classes: 'w-5 h-5 bg-teal-400 text-black rounded-full'
- }
- },
- {
- id : 'navigation-features.badge-style-rectangle',
- title: 'Rectangle badge',
- icon : 'heroicons_outline:tag',
- type : 'basic',
- badge: {
- title : 'Updated!',
- classes: 'px-2 bg-teal-400 text-black rounded'
- }
- },
- {
- id : 'navigation-features.badge-style-rounded',
- title: 'Rounded badge',
- icon : 'heroicons_outline:tag',
- type : 'basic',
- badge: {
- title : 'NEW',
- classes: 'px-2.5 bg-teal-400 text-black rounded-full'
- }
- },
- {
- id : 'navigation-features.badge-style-simple',
- title: 'Simple badge',
- icon : 'heroicons_outline:tag',
- type : 'basic',
- badge: {
- title : '87 Unread',
- classes: 'text-teal-500'
- }
- },
- {
- id : 'navigation-features.multi-line',
- title: 'A multi line navigation item title example which works just fine',
- icon : 'heroicons_outline:check-circle',
- type : 'basic'
- }
- ]
+ id : 'example',
+ title: 'Example',
+ type : 'basic',
+ icon : 'heroicons_outline:chart-pie',
+ link : '/example'
}
];
export const compactNavigation: FuseNavigationItem[] = [
{
- id : 'dashboards',
- title : 'Dashboards',
- type : 'aside',
- icon : 'heroicons_outline:home',
- children: [] // This will be filled from defaultNavigation so we don't have to manage multiple sets of the same navigation
- },
- {
- id : 'apps',
- title : 'Apps',
- type : 'aside',
- icon : 'heroicons_outline:qrcode',
- children: [] // This will be filled from defaultNavigation so we don't have to manage multiple sets of the same navigation
- },
- {
- id : 'pages',
- title : 'Pages',
- type : 'aside',
- icon : 'heroicons_outline:document-duplicate',
- children: [] // This will be filled from defaultNavigation so we don't have to manage multiple sets of the same navigation
- },
- {
- id : 'user-interface',
- title : 'UI',
- type : 'aside',
- icon : 'heroicons_outline:collection',
- children: [] // This will be filled from defaultNavigation so we don't have to manage multiple sets of the same navigation
- },
- {
- id : 'navigation-features',
- title : 'Navigation',
- type : 'aside',
- icon : 'heroicons_outline:menu',
- children: [] // This will be filled from defaultNavigation so we don't have to manage multiple sets of the same navigation
+ id : 'example',
+ title: 'Example',
+ type : 'basic',
+ icon : 'heroicons_outline:chart-pie',
+ link : '/example'
}
];
export const futuristicNavigation: FuseNavigationItem[] = [
{
- id : 'apps',
- title : 'APPS',
- type : 'group',
- children: [
- {
- id : 'apps.dashboards.analytics',
- title: 'Analytics',
- type : 'basic',
- icon : 'heroicons_outline:chart-pie',
- link : '/dashboards/analytics'
- },
- {
- id : 'apps.dashboards.project',
- title: 'Project',
- type : 'basic',
- icon : 'heroicons_outline:clipboard-check',
- link : '/dashboards/project'
- },
- {
- id : 'apps.calendar',
- title: 'Calendar',
- type : 'basic',
- icon : 'heroicons_outline:calendar',
- link : '/apps/calendar'
- },
- {
- id : 'apps.contacts',
- title: 'Contacts',
- type : 'basic',
- icon : 'heroicons_outline:user-group',
- link : '/apps/contacts'
- },
- {
- id : 'apps.ecommerce',
- title : 'ECommerce',
- type : 'collapsable',
- icon : 'heroicons_outline:shopping-cart',
- children: [
- {
- id : 'apps.ecommerce.inventory',
- title: 'Inventory',
- type : 'basic',
- link : '/apps/ecommerce/inventory'
- }
- ]
- },
- {
- id : 'apps.file-manager',
- title: 'File manager',
- type : 'basic',
- icon : 'heroicons_outline:shopping-cart',
- link : '/apps/file-manager'
- },
- {
- id : 'apps.help-center',
- title : 'Help center',
- type : 'collapsable',
- icon : 'heroicons_outline:support',
- link : '/apps/help-center',
- children: [
- {
- id : 'apps.help-center.home',
- title : 'Home',
- type : 'basic',
- link : '/apps/help-center',
- exactMatch: true
- },
- {
- id : 'apps.help-center.faqs',
- title: 'FAQs',
- type : 'basic',
- link : '/apps/help-center/faqs'
- },
- {
- id : 'apps.help-center.guides',
- title: 'Guides',
- type : 'basic',
- link : '/apps/help-center/guides'
- },
- {
- id : 'apps.help-center.support',
- title: 'Support',
- type : 'basic',
- link : '/apps/help-center/support'
- }
- ]
- },
- {
- id : 'apps.mailbox',
- title: 'Mailbox',
- type : 'basic',
- icon : 'heroicons_outline:mail',
- link : '/apps/mailbox',
- badge: {
- title : '27',
- classes: 'px-2 bg-black bg-opacity-25 text-white rounded-full'
- }
- },
- {
- id : 'apps.tasks',
- title: 'Tasks',
- type : 'basic',
- icon : 'heroicons_outline:check-circle',
- link : '/apps/tasks'
- }
- ]
- },
- {
- id : 'others',
- title: 'OTHERS',
- type : 'group'
- },
- {
- id : 'pages',
- title : 'Pages',
- type : 'aside',
- icon : 'heroicons_outline:document-duplicate',
- children: [] // This will be filled from defaultNavigation so we don't have to manage multiple sets of the same navigation
- },
- {
- id : 'user-interface',
- title : 'User Interface',
- type : 'aside',
- icon : 'heroicons_outline:collection',
- children: [] // This will be filled from defaultNavigation so we don't have to manage multiple sets of the same navigation
- },
- {
- id : 'navigation-features',
- title : 'Navigation Features',
- type : 'aside',
- icon : 'heroicons_outline:menu',
- children: [] // This will be filled from defaultNavigation so we don't have to manage multiple sets of the same navigation
+ id : 'example',
+ title: 'Example',
+ type : 'basic',
+ icon : 'heroicons_outline:chart-pie',
+ link : '/example'
}
];
export const horizontalNavigation: FuseNavigationItem[] = [
{
- id : 'dashboards',
- title : 'Dashboards',
- type : 'group',
- icon : 'heroicons_outline:home',
- children: [] // This will be filled from defaultNavigation so we don't have to manage multiple sets of the same navigation
- },
- {
- id : 'apps',
- title : 'Apps',
- type : 'group',
- icon : 'heroicons_outline:qrcode',
- children: [] // This will be filled from defaultNavigation so we don't have to manage multiple sets of the same navigation
- },
- {
- id : 'pages',
- title : 'Pages',
- type : 'group',
- icon : 'heroicons_outline:document-duplicate',
- children: [] // This will be filled from defaultNavigation so we don't have to manage multiple sets of the same navigation
- },
- {
- id : 'user-interface',
- title : 'UI',
- type : 'group',
- icon : 'heroicons_outline:collection',
- children: [] // This will be filled from defaultNavigation so we don't have to manage multiple sets of the same navigation
- },
- {
- id : 'navigation-features',
- title : 'Misc',
- type : 'group',
- icon : 'heroicons_outline:menu',
- children: [] // This will be filled from defaultNavigation so we don't have to manage multiple sets of the same navigation
+ id : 'example',
+ title: 'Example',
+ type : 'basic',
+ icon : 'heroicons_outline:chart-pie',
+ link : '/example'
}
];
diff --git a/src/app/modules/admin/apps/calendar/calendar.component.html b/src/app/modules/admin/apps/calendar/calendar.component.html
deleted file mode 100644
index 76e92f33..00000000
--- a/src/app/modules/admin/apps/calendar/calendar.component.html
+++ /dev/null
@@ -1,386 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{viewTitle}}
-
-
-
-
-
-
-
-
-
-
-
- Month
- Week
- Day
- Schedule
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{event.title || '(No title)'}}
-
{{event.start | date:'EEEE, MMMM d'}}
-
{{recurrenceStatus}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- This event
-
-
- This and following events
-
-
- All events
-
-
-
-
-
-
-
-
- This event
-
-
- This and following events
-
-
- All events
-
-
-
-
-
-
-
-
-
-
-
{{event.description}}
-
-
-
-
-
-
-
-
{{getCalendar(event.calendarId).title}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/app/modules/admin/apps/calendar/calendar.component.scss b/src/app/modules/admin/apps/calendar/calendar.component.scss
deleted file mode 100644
index 59754831..00000000
--- a/src/app/modules/admin/apps/calendar/calendar.component.scss
+++ /dev/null
@@ -1,121 +0,0 @@
-calendar {
-
- /* Tweak: FullCalendar CSS only height to improve resize performance */
- /* With this tweak, we can disable "handleWindowResize" option of FullCalendar */
- /* which disables the height calculations on window resize and increases the */
- /* overall performance. */
- /* This tweak only affects the Calendar app's FullCalendar. */
- full-calendar {
- display: flex;
- flex-direction: column;
- flex: 1 0 auto;
- width: 100%;
- height: 100%;
-
- .fc-view-container {
- display: flex;
- flex-direction: column;
- flex: 1 0 auto;
- width: 100%;
- height: 100%;
-
- .fc-view {
-
- /* Day grid - Month view */
- /* Time grid - Week view */
- /* Time grid - Day view */
- &.fc-dayGridMonth-view,
- &.fc-timeGridWeek-view,
- &.fc-timeGridDay-view {
- display: flex;
- flex-direction: column;
- flex: 1 0 auto;
- width: 100%;
- height: 100%;
-
- > table {
- display: flex;
- flex-direction: column;
- flex: 1 0 auto;
- height: 100%;
-
- > thead {
- display: flex;
- }
-
- > tbody {
- display: flex;
- flex: 1 1 auto;
- overflow: hidden;
-
- > tr {
- display: flex;
-
- > td {
- display: flex;
- flex-direction: column;
-
- .fc-scroller {
- flex: 1 1 auto;
- overflow: hidden scroll !important;
- height: auto !important;
-
- }
- }
- }
- }
- }
- }
-
- /* Day grid - Month view */
- &.fc-dayGridMonth-view {
-
- > table {
-
- > tbody {
-
- > tr {
-
- > td {
-
- .fc-scroller {
- display: flex;
-
- > .fc-day-grid {
- display: flex;
- flex-direction: column;
- min-height: 580px;
-
- > .fc-row {
- flex: 1 0 0;
- height: auto !important;
- }
- }
- }
- }
- }
- }
- }
- }
-
- /* List - Year view */
- &.fc-listYear-view {
- width: 100%;
- height: 100%;
-
- .fc-scroller {
- width: 100%;
- height: 100% !important;
- overflow: hidden !important;
- }
- }
- }
- }
- }
-}
-
-/* Event panel */
-.calendar-event-panel {
- border-radius: 8px;
- @apply shadow-2xl bg-card;
-}
diff --git a/src/app/modules/admin/apps/calendar/calendar.component.ts b/src/app/modules/admin/apps/calendar/calendar.component.ts
deleted file mode 100644
index db0b9658..00000000
--- a/src/app/modules/admin/apps/calendar/calendar.component.ts
+++ /dev/null
@@ -1,1011 +0,0 @@
-import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, Inject, OnDestroy, OnInit, TemplateRef, ViewChild, ViewContainerRef, ViewEncapsulation } from '@angular/core';
-import { DOCUMENT } from '@angular/common';
-import { FormBuilder, FormGroup } from '@angular/forms';
-import { Overlay, OverlayRef } from '@angular/cdk/overlay';
-import { TemplatePortal } from '@angular/cdk/portal';
-import { MatDialog } from '@angular/material/dialog';
-import { MatDrawer } from '@angular/material/sidenav';
-import { FullCalendarComponent } from '@fullcalendar/angular';
-import { Calendar as FullCalendar } from '@fullcalendar/core';
-import dayGridPlugin from '@fullcalendar/daygrid';
-import listPlugin from '@fullcalendar/list';
-import interactionPlugin from '@fullcalendar/interaction';
-import momentPlugin from '@fullcalendar/moment';
-import rrulePlugin from '@fullcalendar/rrule';
-import timeGridPlugin from '@fullcalendar/timegrid';
-import { clone, cloneDeep, isEqual, omit } from 'lodash-es';
-import * as moment from 'moment';
-import { RRule } from 'rrule';
-import { Subject } from 'rxjs';
-import { takeUntil } from 'rxjs/operators';
-import { FuseMediaWatcherService } from '@fuse/services/media-watcher';
-import { CalendarRecurrenceComponent } from 'app/modules/admin/apps/calendar/recurrence/recurrence.component';
-import { CalendarService } from 'app/modules/admin/apps/calendar/calendar.service';
-import { Calendar, CalendarDrawerMode, CalendarEvent, CalendarEventEditMode, CalendarEventPanelMode, CalendarSettings } from 'app/modules/admin/apps/calendar/calendar.types';
-
-@Component({
- selector : 'calendar',
- templateUrl : './calendar.component.html',
- styleUrls : ['./calendar.component.scss'],
- changeDetection: ChangeDetectionStrategy.OnPush,
- encapsulation : ViewEncapsulation.None
-})
-export class CalendarComponent implements OnInit, AfterViewInit, OnDestroy
-{
- @ViewChild('eventPanel') private _eventPanel: TemplateRef;
- @ViewChild('fullCalendar') private _fullCalendar: FullCalendarComponent;
- @ViewChild('drawer') private _drawer: MatDrawer;
-
- calendars: Calendar[];
- calendarPlugins: any[] = [dayGridPlugin, interactionPlugin, listPlugin, momentPlugin, rrulePlugin, timeGridPlugin];
- drawerMode: CalendarDrawerMode = 'side';
- drawerOpened: boolean = true;
- event: CalendarEvent;
- eventEditMode: CalendarEventEditMode = 'single';
- eventForm: FormGroup;
- eventTimeFormat: any;
- events: CalendarEvent[] = [];
- panelMode: CalendarEventPanelMode = 'view';
- settings: CalendarSettings;
- view: 'dayGridMonth' | 'timeGridWeek' | 'timeGridDay' | 'listYear' = 'dayGridMonth';
- views: any;
- viewTitle: string;
- private _eventPanelOverlayRef: OverlayRef;
- private _fullCalendarApi: FullCalendar;
- private _unsubscribeAll: Subject = new Subject();
-
- /**
- * Constructor
- */
- constructor(
- private _calendarService: CalendarService,
- private _changeDetectorRef: ChangeDetectorRef,
- @Inject(DOCUMENT) private _document: Document,
- private _formBuilder: FormBuilder,
- private _matDialog: MatDialog,
- private _overlay: Overlay,
- private _fuseMediaWatcherService: FuseMediaWatcherService,
- private _viewContainerRef: ViewContainerRef
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Accessors
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Getter for event's recurrence status
- */
- get recurrenceStatus(): string
- {
- // Get the recurrence from event form
- const recurrence = this.eventForm.get('recurrence').value;
-
- // Return null, if there is no recurrence on the event
- if ( !recurrence )
- {
- return null;
- }
-
- // Convert the recurrence rule to text
- let ruleText = RRule.fromString(recurrence).toText();
- ruleText = ruleText.charAt(0).toUpperCase() + ruleText.slice(1);
-
- // Return the rule text
- return ruleText;
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Create the event form
- this.eventForm = this._formBuilder.group({
- id : [''],
- calendarId : [''],
- recurringEventId: [null],
- title : [''],
- description : [''],
- start : [null],
- end : [null],
- duration : [null],
- allDay : [true],
- recurrence : [null],
- range : [{}]
- });
-
- // Subscribe to 'range' field value changes
- this.eventForm.get('range').valueChanges.subscribe((value) => {
-
- if ( !value )
- {
- return;
- }
-
- // Set the 'start' field value from the range
- this.eventForm.get('start').setValue(value.start, {emitEvent: false});
-
- // If this is a recurring event...
- if ( this.eventForm.get('recurrence').value )
- {
- // Update the recurrence rules if needed
- this._updateRecurrenceRule();
-
- // Set the duration field
- const duration = moment(value.end).diff(moment(value.start), 'minutes');
- this.eventForm.get('duration').setValue(duration, {emitEvent: false});
-
- // Update the end value
- this._updateEndValue();
- }
- // Otherwise...
- else
- {
- // Set the end field
- this.eventForm.get('end').setValue(value.end, {emitEvent: false});
- }
- });
-
- // Subscribe to 'recurrence' field changes
- this.eventForm.get('recurrence').valueChanges.subscribe((value) => {
-
- // If this is a recurring event...
- if ( value )
- {
- // Update the end value
- this._updateEndValue();
- }
- });
-
- // Get calendars
- this._calendarService.calendars$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((calendars) => {
-
- // Store the calendars
- this.calendars = calendars;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Get events
- this._calendarService.events$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((events) => {
-
- // Clone the events to change the object reference so
- // that the FullCalendar can trigger a re-render.
- this.events = cloneDeep(events);
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Get settings
- this._calendarService.settings$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((settings) => {
-
- // Store the settings
- this.settings = settings;
-
- // Set the FullCalendar event time format based on the time format setting
- this.eventTimeFormat = {
- hour : settings.timeFormat === '12' ? 'numeric' : '2-digit',
- hour12 : settings.timeFormat === '12',
- minute : '2-digit',
- meridiem: settings.timeFormat === '12' ? 'short' : false
- };
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Subscribe to media changes
- this._fuseMediaWatcherService.onMediaChange$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe(({matchingAliases}) => {
-
- // Set the drawerMode and drawerOpened if the given breakpoint is active
- if ( matchingAliases.includes('md') )
- {
- this.drawerMode = 'side';
- this.drawerOpened = true;
- }
- else
- {
- this.drawerMode = 'over';
- this.drawerOpened = false;
- }
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Build the view specific FullCalendar options
- this.views = {
- dayGridMonth: {
- eventLimit : 3,
- eventTimeFormat: this.eventTimeFormat,
- fixedWeekCount : false
- },
- timeGrid : {
- allDayText : '',
- columnHeaderFormat: {
- weekday : 'short',
- day : 'numeric',
- omitCommas: true
- },
- columnHeaderHtml : (date) => {
- return `${moment(date).format('ddd')}
- ${moment(date).format('D')}`;
- },
- slotDuration : '01:00:00',
- slotLabelFormat : this.eventTimeFormat
- },
- timeGridWeek: {},
- timeGridDay : {},
- listYear : {
- allDayText : 'All day',
- eventTimeFormat : this.eventTimeFormat,
- listDayFormat : false,
- listDayAltFormat: false
- }
- };
- }
-
- /**
- * After view init
- */
- ngAfterViewInit(): void
- {
- // Get the full calendar API
- this._fullCalendarApi = this._fullCalendar.getApi();
-
- // Get the current view's title
- this.viewTitle = this._fullCalendarApi.view.title;
-
- // Get the view's current start and end dates, add/subtract
- // 60 days to create a ~150 days period to fetch the mock-api for
- const viewStart = moment(this._fullCalendarApi.view.currentStart).subtract(60, 'days');
- const viewEnd = moment(this._fullCalendarApi.view.currentEnd).add(60, 'days');
-
- // Get events
- this._calendarService.getEvents(viewStart, viewEnd, true).subscribe();
- }
-
- /**
- * On destroy
- */
- ngOnDestroy(): void
- {
- // Unsubscribe from all subscriptions
- this._unsubscribeAll.next();
- this._unsubscribeAll.complete();
-
- // Dispose the overlay
- if ( this._eventPanelOverlayRef )
- {
- this._eventPanelOverlayRef.dispose();
- }
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Toggle Drawer
- */
- toggleDrawer(): void
- {
- // Toggle the drawer
- this._drawer.toggle();
- }
-
- /**
- * Open recurrence panel
- */
- openRecurrenceDialog(): void
- {
- // Open the dialog
- const dialogRef = this._matDialog.open(CalendarRecurrenceComponent, {
- panelClass: 'calendar-event-recurrence-dialog',
- data : {
- event: this.eventForm.value
- }
- });
-
- // After dialog closed
- dialogRef.afterClosed().subscribe((result) => {
-
- // Return if canceled
- if ( !result || !result.recurrence )
- {
- return;
- }
-
- // Only update the recurrence if it actually changed
- if ( this.eventForm.get('recurrence').value === result.recurrence )
- {
- return;
- }
-
- // If returned value is 'cleared'...
- if ( result.recurrence === 'cleared' )
- {
- // Clear the recurrence field if recurrence cleared
- this.eventForm.get('recurrence').setValue(null);
- }
- // Otherwise...
- else
- {
- // Update the recurrence field with the result
- this.eventForm.get('recurrence').setValue(result.recurrence);
- }
- });
- }
-
- /**
- * Change the event panel mode between view and edit
- * mode while setting the event edit mode
- *
- * @param panelMode
- * @param eventEditMode
- */
- changeEventPanelMode(panelMode: CalendarEventPanelMode, eventEditMode: CalendarEventEditMode = 'single'): void
- {
- // Set the panel mode
- this.panelMode = panelMode;
-
- // Set the event edit mode
- this.eventEditMode = eventEditMode;
-
- // Update the panel position
- setTimeout(() => {
- this._eventPanelOverlayRef.updatePosition();
- });
- }
-
- /**
- * Get calendar by id
- *
- * @param id
- */
- getCalendar(id): Calendar
- {
- if ( !id )
- {
- return;
- }
-
- return this.calendars.find((calendar) => calendar.id === id);
- }
-
- /**
- * Change the calendar view
- *
- * @param view
- */
- changeView(view: 'dayGridMonth' | 'timeGridWeek' | 'timeGridDay' | 'listYear'): void
- {
- // Store the view
- this.view = view;
-
- // If the FullCalendar API is available...
- if ( this._fullCalendarApi )
- {
- // Set the view
- this._fullCalendarApi.changeView(view);
-
- // Update the view title
- this.viewTitle = this._fullCalendarApi.view.title;
- }
- }
-
- /**
- * Moves the calendar one stop back
- */
- previous(): void
- {
- // Go to previous stop
- this._fullCalendarApi.prev();
-
- // Update the view title
- this.viewTitle = this._fullCalendarApi.view.title;
-
- // Get the view's current start date
- const start = moment(this._fullCalendarApi.view.currentStart);
-
- // Prefetch past events
- this._calendarService.prefetchPastEvents(start).subscribe();
- }
-
- /**
- * Moves the calendar to the current date
- */
- today(): void
- {
- // Go to today
- this._fullCalendarApi.today();
-
- // Update the view title
- this.viewTitle = this._fullCalendarApi.view.title;
- }
-
- /**
- * Moves the calendar one stop forward
- */
- next(): void
- {
- // Go to next stop
- this._fullCalendarApi.next();
-
- // Update the view title
- this.viewTitle = this._fullCalendarApi.view.title;
-
- // Get the view's current end date
- const end = moment(this._fullCalendarApi.view.currentEnd);
-
- // Prefetch future events
- this._calendarService.prefetchFutureEvents(end).subscribe();
- }
-
- /**
- * On date click
- *
- * @param calendarEvent
- */
- onDateClick(calendarEvent): void
- {
- // Prepare the event
- const event = {
- id : null,
- calendarId : this.calendars[0].id,
- recurringEventId: null,
- isFirstInstance : false,
- title : '',
- description : '',
- start : moment(calendarEvent.date).startOf('day').toISOString(),
- end : moment(calendarEvent.date).endOf('day').toISOString(),
- duration : null,
- allDay : true,
- recurrence : null,
- range : {
- start: moment(calendarEvent.date).startOf('day').toISOString(),
- end : moment(calendarEvent.date).endOf('day').toISOString()
- }
- };
-
- // Set the event
- this.event = event;
-
- // Set the el on calendarEvent for consistency
- calendarEvent.el = calendarEvent.dayEl;
-
- // Reset the form and fill the event
- this.eventForm.reset();
- this.eventForm.patchValue(event);
-
- // Open the event panel
- this._openEventPanel(calendarEvent);
-
- // Change the event panel mode
- this.changeEventPanelMode('add');
- }
-
- /**
- * On event click
- *
- * @param calendarEvent
- */
- onEventClick(calendarEvent): void
- {
- // Find the event with the clicked event's id
- const event: any = cloneDeep(this.events.find(item => item.id === calendarEvent.event.id));
-
- // Set the event
- this.event = event;
-
- // Prepare the end value
- let end;
-
- // If this is a recurring event...
- if ( event.recuringEventId )
- {
- // Calculate the end value using the duration
- end = moment(event.start).add(event.duration, 'minutes').toISOString();
- }
- // Otherwise...
- else
- {
- // Set the end value from the end
- end = event.end;
- }
-
- // Set the range on the event
- event.range = {
- start: event.start,
- end
- };
-
- // Reset the form and fill the event
- this.eventForm.reset();
- this.eventForm.patchValue(event);
-
- // Open the event panel
- this._openEventPanel(calendarEvent);
- }
-
- /**
- * On event render
- *
- * @param calendarEvent
- */
- onEventRender(calendarEvent): void
- {
- // Get event's calendar
- const calendar = this.calendars.find((item) => item.id === calendarEvent.event.extendedProps.calendarId);
-
- // Return if the calendar doesn't exist...
- if ( !calendar )
- {
- return;
- }
-
- // If current view is year list...
- if ( this.view === 'listYear' )
- {
- // Create a new 'fc-list-item-date' node
- const fcListItemDate1 = `
-
- ${moment(calendarEvent.event.start).format('D')}
- ${moment(calendarEvent.event.start).format('MMM')}, ${moment(calendarEvent.event.start).format('ddd')}
-
- | `;
-
- // Insert the 'fc-list-item-date' into the calendar event element
- calendarEvent.el.insertAdjacentHTML('afterbegin', fcListItemDate1);
-
- // Set the color class of the event dot
- calendarEvent.el.getElementsByClassName('fc-event-dot')[0].classList.add(calendar.color);
-
- // Set the event's title to '(No title)' if event title is not available
- if ( !calendarEvent.event.title )
- {
- calendarEvent.el.querySelector('.fc-list-item-title').innerText = '(No title)';
- }
- }
- // If current view is not month list...
- else
- {
- // Set the color class of the event
- calendarEvent.el.classList.add(calendar.color);
-
- // Set the event's title to '(No title)' if event title is not available
- if ( !calendarEvent.event.title )
- {
- calendarEvent.el.querySelector('.fc-title').innerText = '(No title)';
- }
- }
-
- // Set the event's visibility
- calendarEvent.el.style.display = calendar.visible ? 'flex' : 'none';
- }
-
- /**
- * On calendar updated
- *
- * @param calendar
- */
- onCalendarUpdated(calendar): void
- {
- // Re-render the events
- this._fullCalendarApi.rerenderEvents();
- }
-
- /**
- * Add event
- */
- addEvent(): void
- {
- // Get the clone of the event form value
- let newEvent = clone(this.eventForm.value);
-
- // If the event is a recurring event...
- if ( newEvent.recurrence )
- {
- // Set the event duration
- newEvent.duration = moment(newEvent.range.end).diff(moment(newEvent.range.start), 'minutes');
- }
-
- // Modify the event before sending it to the server
- newEvent = omit(newEvent, ['range', 'recurringEventId']);
-
- // Add the event
- this._calendarService.addEvent(newEvent).subscribe(() => {
-
- // Reload events
- this._calendarService.reloadEvents().subscribe();
-
- // Close the event panel
- this._closeEventPanel();
- });
- }
-
- /**
- * Update the event
- */
- updateEvent(): void
- {
- // Get the clone of the event form value
- let event = clone(this.eventForm.value);
- const {
- range,
- ...eventWithoutRange
- } = event;
-
- // Get the original event
- const originalEvent = this.events.find(item => item.id === event.id);
-
- // Return if there are no changes made to the event
- if ( isEqual(eventWithoutRange, originalEvent) )
- {
- // Close the event panel
- this._closeEventPanel();
-
- // Return
- return;
- }
-
- // If the event is a recurring event...
- if ( event.recurrence && event.recurringEventId )
- {
- // Update the recurring event on the server
- this._calendarService.updateRecurringEvent(event, originalEvent, this.eventEditMode).subscribe(() => {
-
- // Reload events
- this._calendarService.reloadEvents().subscribe();
-
- // Close the event panel
- this._closeEventPanel();
- });
-
- // Return
- return;
- }
-
- // If the event is a non-recurring event...
- if ( !event.recurrence && !event.recurringEventId )
- {
- // Update the event on the server
- this._calendarService.updateEvent(event.id, event).subscribe(() => {
-
- // Close the event panel
- this._closeEventPanel();
- });
-
- // Return
- return;
- }
-
- // If the event was a non-recurring event but now it will be a recurring event...
- if ( event.recurrence && !event.recurringEventId )
- {
- // Set the event duration
- event.duration = moment(event.range.end).diff(moment(event.range.start), 'minutes');
-
- // Omit unnecessary fields
- event = omit(event, ['range', 'recurringEventId']);
-
- // Update the event on the server
- this._calendarService.updateEvent(event.id, event).subscribe(() => {
-
- // Reload events
- this._calendarService.reloadEvents().subscribe();
-
- // Close the event panel
- this._closeEventPanel();
- });
-
- // Return
- return;
- }
-
- // If the event was a recurring event but now it will be a non-recurring event...
- if ( !event.recurrence && event.recurringEventId )
- {
- // Set the end date
- event.end = moment(event.start).add(event.duration, 'minutes').toISOString();
-
- // Set the duration as null
- event.duration = null;
-
- // Update the recurring event on the server
- this._calendarService.updateRecurringEvent(event, originalEvent, this.eventEditMode).subscribe(() => {
-
- // Reload events
- this._calendarService.reloadEvents().subscribe();
-
- // Close the event panel
- this._closeEventPanel();
- });
- }
- }
-
- /**
- * Delete the given event
- *
- * @param event
- * @param mode
- */
- deleteEvent(event, mode: CalendarEventEditMode = 'single'): void
- {
- // If the event is a recurring event...
- if ( event.recurrence )
- {
- // Delete the recurring event on the server
- this._calendarService.deleteRecurringEvent(event, mode).subscribe(() => {
-
- // Reload events
- this._calendarService.reloadEvents().subscribe();
-
- // Close the event panel
- this._closeEventPanel();
- });
- }
- // If the event is a non-recurring, normal event...
- else
- {
- // Update the event on the server
- this._calendarService.deleteEvent(event.id).subscribe(() => {
-
- // Close the event panel
- this._closeEventPanel();
- });
- }
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Private methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Create the event panel overlay
- * @private
- */
- private _createEventPanelOverlay(positionStrategy): void
- {
- // Create the overlay
- this._eventPanelOverlayRef = this._overlay.create({
- panelClass : ['calendar-event-panel'],
- backdropClass : '',
- hasBackdrop : true,
- scrollStrategy: this._overlay.scrollStrategies.reposition(),
- positionStrategy
- });
-
- // Detach the overlay from the portal on backdrop click
- this._eventPanelOverlayRef.backdropClick().subscribe(() => {
- this._closeEventPanel();
- });
- }
-
- /**
- * Open the event panel
- *
- * @private
- */
- private _openEventPanel(calendarEvent): void
- {
- const positionStrategy = this._overlay.position().flexibleConnectedTo(calendarEvent.el).withFlexibleDimensions(false).withPositions([
- {
- originX : 'end',
- originY : 'top',
- overlayX: 'start',
- overlayY: 'top',
- offsetX : 8
- },
- {
- originX : 'start',
- originY : 'top',
- overlayX: 'end',
- overlayY: 'top',
- offsetX : -8
- },
- {
- originX : 'start',
- originY : 'bottom',
- overlayX: 'end',
- overlayY: 'bottom',
- offsetX : -8
- },
- {
- originX : 'end',
- originY : 'bottom',
- overlayX: 'start',
- overlayY: 'bottom',
- offsetX : 8
- }
- ]);
-
- // Create the overlay if it doesn't exist
- if ( !this._eventPanelOverlayRef )
- {
- this._createEventPanelOverlay(positionStrategy);
- }
- // Otherwise, just update the position
- else
- {
- this._eventPanelOverlayRef.updatePositionStrategy(positionStrategy);
- }
-
- // Attach the portal to the overlay
- this._eventPanelOverlayRef.attach(new TemplatePortal(this._eventPanel, this._viewContainerRef));
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Close the event panel
- *
- * @private
- */
- private _closeEventPanel(): void
- {
- // Detach the overlay from the portal
- this._eventPanelOverlayRef.detach();
-
- // Reset the panel and event edit modes
- this.panelMode = 'view';
- this.eventEditMode = 'single';
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Update the recurrence rule based on the event if needed
- *
- * @private
- */
- private _updateRecurrenceRule(): void
- {
- // Get the event
- const event = this.eventForm.value;
-
- // Return if this is a non-recurring event
- if ( !event.recurrence )
- {
- return;
- }
-
- // Parse the recurrence rule
- const parsedRules = {};
- event.recurrence.split(';').forEach((rule) => {
-
- // Split the rule
- const parsedRule = rule.split('=');
-
- // Add the rule to the parsed rules
- parsedRules[parsedRule[0]] = parsedRule[1];
- });
-
- // If there is a BYDAY rule, split that as well
- if ( parsedRules['BYDAY'] )
- {
- parsedRules['BYDAY'] = parsedRules['BYDAY'].split(',');
- }
-
- // Do not update the recurrence rule if ...
- // ... the frequency is DAILY,
- // ... the frequency is WEEKLY and BYDAY has multiple values,
- // ... the frequency is MONTHLY and there isn't a BYDAY rule,
- // ... the frequency is YEARLY,
- if ( parsedRules['FREQ'] === 'DAILY' ||
- (parsedRules['FREQ'] === 'WEEKLY' && parsedRules['BYDAY'].length > 1) ||
- (parsedRules['FREQ'] === 'MONTHLY' && !parsedRules['BYDAY']) ||
- parsedRules['FREQ'] === 'YEARLY' )
- {
- return;
- }
-
- // If the frequency is WEEKLY, update the BYDAY value with the new one
- if ( parsedRules['FREQ'] === 'WEEKLY' )
- {
- parsedRules['BYDAY'] = [moment(event.start).format('dd').toUpperCase()];
- }
-
- // If the frequency is MONTHLY, update the BYDAY value with the new one
- if ( parsedRules['FREQ'] === 'MONTHLY' )
- {
- // Calculate the weekday
- const weekday = moment(event.start).format('dd').toUpperCase();
-
- // Calculate the nthWeekday
- let nthWeekdayNo = 1;
- while ( moment(event.start).isSame(moment(event.start).subtract(nthWeekdayNo, 'week'), 'month') )
- {
- nthWeekdayNo++;
- }
-
- // Set the BYDAY
- parsedRules['BYDAY'] = [nthWeekdayNo + weekday];
- }
-
- // Generate the rule string from the parsed rules
- const rules = [];
- Object.keys(parsedRules).forEach((key) => {
- rules.push(key + '=' + (Array.isArray(parsedRules[key]) ? parsedRules[key].join(',') : parsedRules[key]));
- });
- const rrule = rules.join(';');
-
- // Update the recurrence rule
- this.eventForm.get('recurrence').setValue(rrule);
- }
-
- /**
- * Update the end value based on the recurrence and duration
- *
- * @private
- */
- private _updateEndValue(): void
- {
- // Get the event recurrence
- const recurrence = this.eventForm.get('recurrence').value;
-
- // Return if this is a non-recurring event
- if ( !recurrence )
- {
- return;
- }
-
- // Parse the recurrence rule
- const parsedRules = {};
- recurrence.split(';').forEach((rule) => {
-
- // Split the rule
- const parsedRule = rule.split('=');
-
- // Add the rule to the parsed rules
- parsedRules[parsedRule[0]] = parsedRule[1];
- });
-
- // If there is an UNTIL rule...
- if ( parsedRules['UNTIL'] )
- {
- // Use that to set the end date
- this.eventForm.get('end').setValue(parsedRules['UNTIL']);
-
- // Return
- return;
- }
-
- // If there is a COUNT rule...
- if ( parsedRules['COUNT'] )
- {
- // Generate the RRule string
- const rrule = 'DTSTART=' + moment(this.eventForm.get('start').value).utc().format('YYYYMMDD[T]HHmmss[Z]') + '\nRRULE:' + recurrence;
-
- // Use RRule string to generate dates
- const dates = RRule.fromString(rrule).all();
-
- // Get the last date from dates array and set that as the end date
- this.eventForm.get('end').setValue(moment(dates[dates.length - 1]).toISOString());
-
- // Return
- return;
- }
-
- // If there are no UNTIL or COUNT, set the end date to a fixed value
- this.eventForm.get('end').setValue(moment().year(9999).endOf('year').toISOString());
- }
-}
diff --git a/src/app/modules/admin/apps/calendar/calendar.module.ts b/src/app/modules/admin/apps/calendar/calendar.module.ts
deleted file mode 100644
index 12b15b2a..00000000
--- a/src/app/modules/admin/apps/calendar/calendar.module.ts
+++ /dev/null
@@ -1,75 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule } from '@angular/router';
-import { ScrollingModule } from '@angular/cdk/scrolling';
-import { MAT_DATE_FORMATS } from '@angular/material/core';
-import { MatButtonModule } from '@angular/material/button';
-import { MatButtonToggleModule } from '@angular/material/button-toggle';
-import { MatCheckboxModule } from '@angular/material/checkbox';
-import { MatDatepickerModule } from '@angular/material/datepicker';
-import { MatDialogModule } from '@angular/material/dialog';
-import { MatFormFieldModule } from '@angular/material/form-field';
-import { MatIconModule } from '@angular/material/icon';
-import { MatInputModule } from '@angular/material/input';
-import { MatMenuModule } from '@angular/material/menu';
-import { MatMomentDateModule } from '@angular/material-moment-adapter';
-import { MatRadioModule } from '@angular/material/radio';
-import { MatSelectModule } from '@angular/material/select';
-import { MatSidenavModule } from '@angular/material/sidenav';
-import { MatTooltipModule } from '@angular/material/tooltip';
-import { FullCalendarModule } from '@fullcalendar/angular';
-import { FuseDateRangeModule } from '@fuse/components/date-range';
-import { SharedModule } from 'app/shared/shared.module';
-import { CalendarComponent } from 'app/modules/admin/apps/calendar/calendar.component';
-import { CalendarRecurrenceComponent } from 'app/modules/admin/apps/calendar/recurrence/recurrence.component';
-import { CalendarSettingsComponent } from 'app/modules/admin/apps/calendar/settings/settings.component';
-import { CalendarSidebarComponent } from 'app/modules/admin/apps/calendar/sidebar/sidebar.component';
-import { calendarRoutes } from 'app/modules/admin/apps/calendar/calendar.routing';
-
-@NgModule({
- declarations: [
- CalendarComponent,
- CalendarRecurrenceComponent,
- CalendarSettingsComponent,
- CalendarSidebarComponent
- ],
- imports : [
- RouterModule.forChild(calendarRoutes),
- ScrollingModule,
- MatButtonModule,
- MatButtonToggleModule,
- MatCheckboxModule,
- MatDatepickerModule,
- MatDialogModule,
- MatFormFieldModule,
- MatIconModule,
- MatInputModule,
- MatMenuModule,
- MatMomentDateModule,
- MatRadioModule,
- MatSelectModule,
- MatSidenavModule,
- MatTooltipModule,
- FullCalendarModule,
- FuseDateRangeModule,
- SharedModule
- ],
- providers : [
- {
- provide : MAT_DATE_FORMATS,
- useValue: {
- parse : {
- dateInput: 'DD.MM.YYYY'
- },
- display: {
- dateInput : 'DD.MM.YYYY',
- monthYearLabel : 'MMM YYYY',
- dateA11yLabel : 'DD.MM.YYYY',
- monthYearA11yLabel: 'MMMM YYYY'
- }
- }
- }
- ]
-})
-export class CalendarModule
-{
-}
diff --git a/src/app/modules/admin/apps/calendar/calendar.resolvers.ts b/src/app/modules/admin/apps/calendar/calendar.resolvers.ts
deleted file mode 100644
index b53a9762..00000000
--- a/src/app/modules/admin/apps/calendar/calendar.resolvers.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-import { Injectable } from '@angular/core';
-import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
-import { Observable } from 'rxjs';
-import { CalendarService } from 'app/modules/admin/apps/calendar/calendar.service';
-import { Calendar, CalendarSettings, CalendarWeekday } from 'app/modules/admin/apps/calendar/calendar.types';
-
-@Injectable({
- providedIn: 'root'
-})
-export class CalendarCalendarsResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _calendarService: CalendarService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._calendarService.getCalendars();
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class CalendarSettingsResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _calendarService: CalendarService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._calendarService.getSettings();
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class CalendarWeekdaysResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _calendarService: CalendarService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._calendarService.getWeekdays();
- }
-}
diff --git a/src/app/modules/admin/apps/calendar/calendar.routing.ts b/src/app/modules/admin/apps/calendar/calendar.routing.ts
deleted file mode 100644
index 79d7d32b..00000000
--- a/src/app/modules/admin/apps/calendar/calendar.routing.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { Route } from '@angular/router';
-import { CalendarComponent } from 'app/modules/admin/apps/calendar/calendar.component';
-import { CalendarSettingsComponent } from 'app/modules/admin/apps/calendar/settings/settings.component';
-import { CalendarCalendarsResolver, CalendarSettingsResolver, CalendarWeekdaysResolver } from 'app/modules/admin/apps/calendar/calendar.resolvers';
-
-export const calendarRoutes: Route[] = [
- {
- path : '',
- component: CalendarComponent,
- resolve : {
- calendars: CalendarCalendarsResolver,
- settings : CalendarSettingsResolver,
- weekdays : CalendarWeekdaysResolver
- }
- },
- {
- path : 'settings',
- component: CalendarSettingsComponent,
- resolve : {
- settings: CalendarSettingsResolver
- }
- }
-];
diff --git a/src/app/modules/admin/apps/calendar/calendar.service.ts b/src/app/modules/admin/apps/calendar/calendar.service.ts
deleted file mode 100644
index d8e743cb..00000000
--- a/src/app/modules/admin/apps/calendar/calendar.service.ts
+++ /dev/null
@@ -1,475 +0,0 @@
-import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
-import { BehaviorSubject, Observable, of } from 'rxjs';
-import { map, switchMap, take, tap } from 'rxjs/operators';
-import { Moment } from 'moment';
-import { Calendar, CalendarEvent, CalendarEventEditMode, CalendarSettings, CalendarWeekday } from 'app/modules/admin/apps/calendar/calendar.types';
-
-@Injectable({
- providedIn: 'root'
-})
-export class CalendarService
-{
- // Private
- private _calendars: BehaviorSubject = new BehaviorSubject(null);
- private _events: BehaviorSubject = new BehaviorSubject(null);
- private _loadedEventsRange: { start: Moment | null, end: Moment | null } = {
- start: null,
- end : null
- };
- private readonly _numberOfDaysToPrefetch = 60;
- private _settings: BehaviorSubject = new BehaviorSubject(null);
- private _weekdays: BehaviorSubject = new BehaviorSubject(null);
-
- /**
- * Constructor
- */
- constructor(private _httpClient: HttpClient)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Accessors
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Getter for calendars
- */
- get calendars$(): Observable
- {
- return this._calendars.asObservable();
- }
-
- /**
- * Getter for events
- */
- get events$(): Observable
- {
- return this._events.asObservable();
- }
-
- /**
- * Getter for settings
- */
- get settings$(): Observable
- {
- return this._settings.asObservable();
- }
-
- /**
- * Getter for weekdays
- */
- get weekdays$(): Observable
- {
- return this._weekdays.asObservable();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Get calendars
- */
- getCalendars(): Observable
- {
- return this._httpClient.get('api/apps/calendar/calendars').pipe(
- tap((response) => {
- this._calendars.next(response);
- })
- );
- }
-
- /**
- * Add calendar
- *
- * @param calendar
- */
- addCalendar(calendar: Calendar): Observable
- {
- return this.calendars$.pipe(
- take(1),
- switchMap(calendars => this._httpClient.post('api/apps/calendar/calendars', {
- calendar
- }).pipe(
- map((addedCalendar) => {
-
- // Add the calendar
- calendars.push(addedCalendar);
-
- // Update the calendars
- this._calendars.next(calendars);
-
- // Return the added calendar
- return addedCalendar;
- })
- ))
- );
- }
-
- /**
- * Update calendar
- *
- * @param id
- * @param calendar
- */
- updateCalendar(id: string, calendar: Calendar): Observable
- {
- return this.calendars$.pipe(
- take(1),
- switchMap(calendars => this._httpClient.patch('api/apps/calendar/calendars', {
- id,
- calendar
- }).pipe(
- map((updatedCalendar) => {
-
- // Find the index of the updated calendar
- const index = calendars.findIndex(item => item.id === id);
-
- // Update the calendar
- calendars[index] = updatedCalendar;
-
- // Update the calendars
- this._calendars.next(calendars);
-
- // Return the updated calendar
- return updatedCalendar;
- })
- ))
- );
- }
-
- /**
- * Delete calendar
- *
- * @param id
- */
- deleteCalendar(id: string): Observable
- {
- return this.calendars$.pipe(
- take(1),
- switchMap(calendars => this._httpClient.delete('api/apps/calendar/calendars', {
- params: {id}
- }).pipe(
- map((isDeleted) => {
-
- // Find the index of the deleted calendar
- const index = calendars.findIndex(item => item.id === id);
-
- // Delete the calendar
- calendars.splice(index, 1);
-
- // Update the calendars
- this._calendars.next(calendars);
-
- // Remove the events belong to deleted calendar
- const events = this._events.value.filter((event) => event.calendarId !== id);
-
- // Update the events
- this._events.next(events);
-
- // Return the deleted status
- return isDeleted;
- })
- ))
- );
- }
-
- /**
- * Get events
- *
- * @param start
- * @param end
- * @param replace
- */
- getEvents(start: Moment, end: Moment, replace = false): Observable
- {
- // Set the new start date for loaded events
- if ( replace || !this._loadedEventsRange.start || start.isBefore(this._loadedEventsRange.start) )
- {
- this._loadedEventsRange.start = start;
- }
-
- // Set the new end date for loaded events
- if ( replace || !this._loadedEventsRange.end || end.isAfter(this._loadedEventsRange.end) )
- {
- this._loadedEventsRange.end = end;
- }
-
- // Get the events
- return this._httpClient.get('api/apps/calendar/events', {
- params: {
- start: start.toISOString(true),
- end : end.toISOString(true)
- }
- }).pipe(
- switchMap(response => this._events.pipe(
- take(1),
- map((events) => {
-
- // If replace...
- if ( replace )
- {
- // Execute the observable with the response replacing the events object
- this._events.next(response);
- }
- // Otherwise...
- else
- {
- // If events is null, replace it with an empty array
- events = events || [];
-
- // Execute the observable by appending the response to the current events
- this._events.next([...events, ...response]);
- }
-
- // Return the response
- return response;
- })
- ))
- );
- }
-
- /**
- * Reload events using the loaded events range
- */
- reloadEvents(): Observable
- {
- // Get the events
- return this._httpClient.get('api/apps/calendar/events', {
- params: {
- start: this._loadedEventsRange.start.toISOString(),
- end : this._loadedEventsRange.end.toISOString()
- }
- }).pipe(
- map((response) => {
-
- // Execute the observable with the response replacing the events object
- this._events.next(response);
-
- // Return the response
- return response;
- })
- );
- }
-
- /**
- * Prefetch future events
- *
- * @param end
- */
- prefetchFutureEvents(end: Moment): Observable
- {
- // Calculate the remaining prefetched days
- const remainingDays = this._loadedEventsRange.end.diff(end, 'days');
-
- // Return if remaining days is bigger than the number
- // of days to prefetch. This means we were already been
- // there and fetched the events mock-api so no need for doing
- // it again.
- if ( remainingDays >= this._numberOfDaysToPrefetch )
- {
- return of([]);
- }
-
- // Figure out the start and end dates
- const start = this._loadedEventsRange.end.clone().add(1, 'day');
- end = this._loadedEventsRange.end.clone().add(this._numberOfDaysToPrefetch - remainingDays, 'days');
-
- // Prefetch the events
- return this.getEvents(start, end);
- }
-
- /**
- * Prefetch past events
- *
- * @param start
- */
- prefetchPastEvents(start: Moment): Observable
- {
- // Calculate the remaining prefetched days
- const remainingDays = start.diff(this._loadedEventsRange.start, 'days');
-
- // Return if remaining days is bigger than the number
- // of days to prefetch. This means we were already been
- // there and fetched the events mock-api so no need for doing
- // it again.
- if ( remainingDays >= this._numberOfDaysToPrefetch )
- {
- return of([]);
- }
-
- // Figure out the start and end dates
- start = this._loadedEventsRange.start.clone().subtract(this._numberOfDaysToPrefetch - remainingDays, 'days');
- const end = this._loadedEventsRange.start.clone().subtract(1, 'day');
-
- // Prefetch the events
- return this.getEvents(start, end);
- }
-
- /**
- * Add event
- *
- * @param event
- */
- addEvent(event): Observable
- {
- return this.events$.pipe(
- take(1),
- switchMap(events => this._httpClient.post('api/apps/calendar/event', {
- event
- }).pipe(
- map((addedEvent) => {
-
- // Update the events
- this._events.next(events);
-
- // Return the added event
- return addedEvent;
- })
- ))
- );
- }
-
- /**
- * Update event
- *
- * @param id
- * @param event
- */
- updateEvent(id: string, event): Observable
- {
- return this.events$.pipe(
- take(1),
- switchMap(events => this._httpClient.patch('api/apps/calendar/event', {
- id,
- event
- }).pipe(
- map((updatedEvent) => {
-
- // Find the index of the updated event
- const index = events.findIndex(item => item.id === id);
-
- // Update the event
- events[index] = updatedEvent;
-
- // Update the events
- this._events.next(events);
-
- // Return the updated event
- return updatedEvent;
- })
- ))
- );
- }
-
- /**
- * Update recurring event
- *
- * @param event
- * @param originalEvent
- * @param mode
- */
- updateRecurringEvent(event, originalEvent, mode: CalendarEventEditMode): Observable
- {
- return this._httpClient.patch('api/apps/calendar/recurring-event', {
- event,
- originalEvent,
- mode
- });
- }
-
- /**
- * Delete event
- *
- * @param id
- */
- deleteEvent(id: string): Observable
- {
- return this.events$.pipe(
- take(1),
- switchMap(events => this._httpClient.delete('api/apps/calendar/event', {params: {id}}).pipe(
- map((isDeleted) => {
-
- // Find the index of the deleted event
- const index = events.findIndex(item => item.id === id);
-
- // Delete the event
- events.splice(index, 1);
-
- // Update the events
- this._events.next(events);
-
- // Return the deleted status
- return isDeleted;
- })
- ))
- );
- }
-
- /**
- * Delete recurring event
- *
- * @param event
- * @param mode
- */
- deleteRecurringEvent(event, mode: CalendarEventEditMode): Observable
- {
- return this._httpClient.delete('api/apps/calendar/recurring-event', {
- params: {
- event: JSON.stringify(event),
- mode
- }
- });
- }
-
- /**
- * Get settings
- */
- getSettings(): Observable
- {
- return this._httpClient.get('api/apps/calendar/settings').pipe(
- tap((response) => {
- this._settings.next(response);
- })
- );
- }
-
- /**
- * Update settings
- */
- updateSettings(settings: CalendarSettings): Observable
- {
- return this.events$.pipe(
- take(1),
- switchMap(events => this._httpClient.patch('api/apps/calendar/settings', {
- settings
- }).pipe(
- map((updatedSettings) => {
-
- // Update the settings
- this._settings.next(settings);
-
- // Get weekdays again to get them in correct order
- // in case the startWeekOn setting changes
- this.getWeekdays().subscribe();
-
- // Return the updated settings
- return updatedSettings;
- })
- ))
- );
- }
-
- /**
- * Get weekdays
- */
- getWeekdays(): Observable
- {
- return this._httpClient.get('api/apps/calendar/weekdays').pipe(
- tap((response) => {
- this._weekdays.next(response);
- })
- );
- }
-}
diff --git a/src/app/modules/admin/apps/calendar/calendar.types.ts b/src/app/modules/admin/apps/calendar/calendar.types.ts
deleted file mode 100644
index ff79255c..00000000
--- a/src/app/modules/admin/apps/calendar/calendar.types.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-export interface Calendar
-{
- id: string;
- title: string;
- color: string;
- visible: boolean;
-}
-
-export type CalendarDrawerMode = 'over' | 'side';
-
-export interface CalendarEvent
-{
- id: string;
- calendarId: string;
- recurringEventId: string | null;
- isFirstInstance: boolean;
- title: string;
- description: string;
- start: string | null;
- end: string | null;
- allDay: boolean;
- recurrence: string;
-}
-
-export interface CalendarEventException
-{
- id: string;
- eventId: string;
- exdate: string;
-}
-
-export type CalendarEventPanelMode = 'view' | 'add' | 'edit';
-export type CalendarEventEditMode = 'single' | 'future' | 'all';
-
-export interface CalendarSettings
-{
- dateFormat: 'DD/MM/YYYY' | 'MM/DD/YYYY' | 'YYYY-MM-DD' | 'll';
- timeFormat: '12' | '24';
- startWeekOn: 6 | 0 | 1;
-}
-
-export interface CalendarWeekday
-{
- abbr: string;
- label: string;
- value: string;
-}
diff --git a/src/app/modules/admin/apps/calendar/recurrence/recurrence.component.html b/src/app/modules/admin/apps/calendar/recurrence/recurrence.component.html
deleted file mode 100644
index 730d38ea..00000000
--- a/src/app/modules/admin/apps/calendar/recurrence/recurrence.component.html
+++ /dev/null
@@ -1,120 +0,0 @@
-
diff --git a/src/app/modules/admin/apps/calendar/recurrence/recurrence.component.ts b/src/app/modules/admin/apps/calendar/recurrence/recurrence.component.ts
deleted file mode 100644
index c5abd23e..00000000
--- a/src/app/modules/admin/apps/calendar/recurrence/recurrence.component.ts
+++ /dev/null
@@ -1,341 +0,0 @@
-import { Component, Inject, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
-import { FormBuilder, FormGroup, Validators } from '@angular/forms';
-import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
-import * as moment from 'moment';
-import { Subject } from 'rxjs';
-import { takeUntil } from 'rxjs/operators';
-import { CalendarService } from 'app/modules/admin/apps/calendar/calendar.service';
-import { CalendarWeekday } from 'app/modules/admin/apps/calendar/calendar.types';
-
-@Component({
- selector : 'calendar-recurrence',
- templateUrl : './recurrence.component.html',
- encapsulation: ViewEncapsulation.None
-})
-export class CalendarRecurrenceComponent implements OnInit, OnDestroy
-{
- nthWeekdayText: string;
- recurrenceForm: FormGroup;
- recurrenceFormValues: any;
- weekdays: CalendarWeekday[];
- private _unsubscribeAll: Subject = new Subject();
-
- /**
- * Constructor
- */
- constructor(
- @Inject(MAT_DIALOG_DATA) public data: any,
- public matDialogRef: MatDialogRef,
- private _calendarService: CalendarService,
- private _formBuilder: FormBuilder
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Get weekdays
- this._calendarService.weekdays$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((weekdays) => {
-
- // Store the weekdays
- this.weekdays = weekdays;
- });
-
- // Initialize
- this._init();
-
- // Create the recurrence form
- this.recurrenceForm = this._formBuilder.group({
- freq : [null],
- interval: [null, Validators.required],
- weekly : this._formBuilder.group({
- byDay: [[]]
- }),
- monthly : this._formBuilder.group({
- repeatOn : [null], // date | nthWeekday
- date : [null],
- nthWeekday: [null]
- }),
- end : this._formBuilder.group({
- type : [null], // never | until | count
- until: [null],
- count: [null]
- })
- });
-
- // Subscribe to 'freq' field value changes
- this.recurrenceForm.get('freq').valueChanges.subscribe((value) => {
-
- // Set the end values
- this._setEndValues(value);
- });
-
- // Subscribe to 'weekly.byDay' field value changes
- this.recurrenceForm.get('weekly.byDay').valueChanges.subscribe((value) => {
-
- // Get the event's start date
- const startDate = moment(this.data.event.start);
-
- // If nothing is selected, select the original value from
- // the event form to prevent an empty value on the field
- if ( !value || !value.length )
- {
- // Get the day of event start date
- const eventStartDay = startDate.format('dd').toUpperCase();
-
- // Set the original value back without emitting a
- // change event to prevent an infinite loop
- this.recurrenceForm.get('weekly.byDay').setValue([eventStartDay], {emitEvent: false});
- }
- });
-
- // Patch the form with the values
- this.recurrenceForm.patchValue(this.recurrenceFormValues);
-
- // Set end values for the first time
- this._setEndValues(this.recurrenceForm.get('freq').value);
- }
-
- /**
- * On destroy
- */
- ngOnDestroy(): void
- {
- // Unsubscribe from all subscriptions
- this._unsubscribeAll.next();
- this._unsubscribeAll.complete();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Clear
- */
- clear(): void
- {
- // Close the dialog
- this.matDialogRef.close({recurrence: 'cleared'});
- }
-
- /**
- * Done
- */
- done(): void
- {
- // Get the recurrence form values
- const recurrenceForm = this.recurrenceForm.value;
-
- // Prepare the rule array and add the base rules
- const ruleArr = ['FREQ=' + recurrenceForm.freq, 'INTERVAL=' + recurrenceForm.interval];
-
- // If monthly on certain days...
- if ( recurrenceForm.freq === 'MONTHLY' && recurrenceForm.monthly.repeatOn === 'nthWeekday' )
- {
- ruleArr.push('BYDAY=' + recurrenceForm.monthly.nthWeekday);
- }
-
- // If weekly...
- if ( recurrenceForm.freq === 'WEEKLY' )
- {
- // If byDay is an array...
- if ( Array.isArray(recurrenceForm.weekly.byDay) )
- {
- ruleArr.push('BYDAY=' + recurrenceForm.weekly.byDay.join(','));
- }
- // Otherwise
- else
- {
- ruleArr.push('BYDAY=' + recurrenceForm.weekly.byDay);
- }
- }
-
- // If one of the end options is selected...
- if ( recurrenceForm.end.type === 'until' )
- {
- ruleArr.push('UNTIL=' + moment(recurrenceForm.end.until).endOf('day').utc().format('YYYYMMDD[T]HHmmss[Z]'));
- }
-
- if ( recurrenceForm.end.type === 'count' )
- {
- ruleArr.push('COUNT=' + recurrenceForm.end.count);
- }
-
- // Generate rule text
- const ruleText = ruleArr.join(';');
-
- // Close the dialog
- this.matDialogRef.close({recurrence: ruleText});
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Private methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Initialize
- *
- * @private
- */
- private _init(): void
- {
- // Get the event's start date
- const startDate = moment(this.data.event.start);
-
- // Calculate the weekday
- const weekday = moment(this.data.event.start).format('dd').toUpperCase();
-
- // Calculate the nthWeekday
- let nthWeekdayNo = 1;
- while ( startDate.clone().isSame(startDate.clone().subtract(nthWeekdayNo, 'week'), 'month') )
- {
- nthWeekdayNo++;
- }
- const nthWeekday = nthWeekdayNo + weekday;
-
- // Calculate the nthWeekday as text
- const ordinalNumberSuffixes = {
- 1: 'st',
- 2: 'nd',
- 3: 'rd',
- 4: 'th',
- 5: 'th'
- };
- this.nthWeekdayText = nthWeekday.slice(0, 1) + ordinalNumberSuffixes[nthWeekday.slice(0, 1)] + ' ' +
- this.weekdays.find((item) => item.value === nthWeekday.slice(-2)).label;
-
- // Set the defaults on recurrence form values
- this.recurrenceFormValues = {
- freq : 'DAILY',
- interval: 1,
- weekly : {
- byDay: weekday
- },
- monthly : {
- repeatOn : 'date',
- date : moment(this.data.event.start).date(),
- nthWeekday: nthWeekday
- },
- end : {
- type : 'never',
- until: null,
- count: null
- }
- };
-
- // If recurrence rule string is available on the
- // event meaning that the is a recurring one...
- if ( this.data.event.recurrence )
- {
- // Parse the rules
- const parsedRules: any = {};
- this.data.event.recurrence.split(';').forEach((rule) => {
- parsedRules[rule.split('=')[0]] = rule.split('=')[1];
- });
-
- // Overwrite the recurrence form values
- this.recurrenceFormValues.freq = parsedRules.FREQ;
- this.recurrenceFormValues.interval = parsedRules.INTERVAL;
-
- if ( parsedRules.FREQ === 'WEEKLY' )
- {
- this.recurrenceFormValues.weekly.byDay = parsedRules.BYDAY.split(',');
- }
-
- if ( parsedRules.FREQ === 'MONTHLY' )
- {
- this.recurrenceFormValues.monthly.repeatOn = parsedRules.BYDAY ? 'nthWeekday' : 'date';
- }
-
- this.recurrenceFormValues.end.type = parsedRules.UNTIL ? 'until' : (parsedRules.COUNT ? 'count' : 'never');
- this.recurrenceFormValues.end.until = parsedRules.UNTIL || null;
- this.recurrenceFormValues.end.count = parsedRules.COUNT || null;
- }
- }
-
- /**
- * Set the end value based on frequency
- *
- * @param freq
- * @private
- */
- private _setEndValues(freq: string): void
- {
- // Return if freq is not available
- if ( !freq )
- {
- return;
- }
-
- // Get the event's start date
- const startDate = moment(this.data.event.startDate);
-
- // Get the end type
- const endType = this.recurrenceForm.get('end.type').value;
-
- // If until is not selected
- if ( endType !== 'until' )
- {
- let until;
-
- // Change the until's default value based on the frequency
- if ( freq === 'DAILY' )
- {
- until = startDate.clone().add(1, 'month').toISOString();
- }
-
- if ( freq === 'WEEKLY' )
- {
- until = startDate.clone().add(12, 'weeks').toISOString();
- }
-
- if ( freq === 'MONTHLY' )
- {
- until = startDate.clone().add(12, 'months').toISOString();
- }
-
- if ( freq === 'YEARLY' )
- {
- until = startDate.clone().add(5, 'years').toISOString();
- }
-
- // Set the until
- this.recurrenceForm.get('end.until').setValue(until);
- }
-
- // If count is not selected...
- if ( endType !== 'count' )
- {
- let count;
-
- // Change the count's default value based on the frequency
- if ( freq === 'DAILY' )
- {
- count = 30;
- }
-
- if ( freq === 'WEEKLY' || freq === 'MONTHLY' )
- {
- count = 12;
- }
-
- if ( freq === 'YEARLY' )
- {
- count = 5;
- }
-
- // Set the count
- this.recurrenceForm.get('end.count').setValue(count);
- }
- }
-}
diff --git a/src/app/modules/admin/apps/calendar/settings/settings.component.html b/src/app/modules/admin/apps/calendar/settings/settings.component.html
deleted file mode 100644
index ba07ebbf..00000000
--- a/src/app/modules/admin/apps/calendar/settings/settings.component.html
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/app/modules/admin/apps/calendar/settings/settings.component.ts b/src/app/modules/admin/apps/calendar/settings/settings.component.ts
deleted file mode 100644
index f0f62d43..00000000
--- a/src/app/modules/admin/apps/calendar/settings/settings.component.ts
+++ /dev/null
@@ -1,96 +0,0 @@
-import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
-import { FormBuilder, FormGroup } from '@angular/forms';
-import { Subject } from 'rxjs';
-import { takeUntil } from 'rxjs/operators';
-import { CalendarService } from 'app/modules/admin/apps/calendar/calendar.service';
-
-@Component({
- selector : 'calendar-settings',
- templateUrl : './settings.component.html',
- changeDetection: ChangeDetectionStrategy.OnPush,
- encapsulation : ViewEncapsulation.None
-})
-export class CalendarSettingsComponent implements OnInit, OnDestroy
-{
- settingsForm: FormGroup;
- private _unsubscribeAll: Subject = new Subject();
-
- /**
- * Constructor
- */
- constructor(
- private _calendarService: CalendarService,
- private _changeDetectorRef: ChangeDetectorRef,
- private _formBuilder: FormBuilder
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Accessors
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Getter for current year
- */
- get year(): string
- {
- return new Date().getFullYear().toString();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Create the event form
- this.settingsForm = this._formBuilder.group({
- dateFormat : [''],
- timeFormat : [''],
- startWeekOn: ['']
- });
-
- // Get settings
- this._calendarService.settings$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((settings) => {
-
- // Fill the settings form
- this.settingsForm.patchValue(settings);
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
- }
-
- /**
- * On destroy
- */
- ngOnDestroy(): void
- {
- // Unsubscribe from all subscriptions
- this._unsubscribeAll.next();
- this._unsubscribeAll.complete();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- updateSettings(): void
- {
- // Get the settings
- const settings = this.settingsForm.value;
-
- // Update the settings on the server
- this._calendarService.updateSettings(settings).subscribe((updatedSettings) => {
-
- // Reset the form with the updated settings
- this.settingsForm.reset(updatedSettings);
- });
- }
-}
diff --git a/src/app/modules/admin/apps/calendar/sidebar/calendar-colors.ts b/src/app/modules/admin/apps/calendar/sidebar/calendar-colors.ts
deleted file mode 100644
index 3d4ec0d0..00000000
--- a/src/app/modules/admin/apps/calendar/sidebar/calendar-colors.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-export const calendarColors = [
- 'bg-gray-500',
- 'bg-red-500',
- 'bg-orange-500',
- 'bg-yellow-500',
- 'bg-green-500',
- 'bg-teal-500',
- 'bg-blue-500',
- 'bg-indigo-500',
- 'bg-purple-500',
- 'bg-pink-500'
-];
diff --git a/src/app/modules/admin/apps/calendar/sidebar/sidebar.component.html b/src/app/modules/admin/apps/calendar/sidebar/sidebar.component.html
deleted file mode 100644
index c3e4eba1..00000000
--- a/src/app/modules/admin/apps/calendar/sidebar/sidebar.component.html
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-
-
-
- Calendars
-
-
-
-
-
-
- {{calendar.title}}
-
-
-
-
-
-
-
-
-
-
-
- Add calendar
- Edit calendar
-
-
-
-
-
-
-
-
- Calendar color
-
-
-
-
-
-
-
-
-
-
-
-
-
- Delete
-
-
- Update
-
-
- Cancel
-
-
- Add
-
-
-
-
-
diff --git a/src/app/modules/admin/apps/calendar/sidebar/sidebar.component.ts b/src/app/modules/admin/apps/calendar/sidebar/sidebar.component.ts
deleted file mode 100644
index 03bf404e..00000000
--- a/src/app/modules/admin/apps/calendar/sidebar/sidebar.component.ts
+++ /dev/null
@@ -1,217 +0,0 @@
-import { Component, EventEmitter, OnDestroy, OnInit, Output, TemplateRef, ViewChild, ViewContainerRef, ViewEncapsulation } from '@angular/core';
-import { Overlay, OverlayRef } from '@angular/cdk/overlay';
-import { TemplatePortal } from '@angular/cdk/portal';
-import { Subject } from 'rxjs';
-import { takeUntil } from 'rxjs/operators';
-import { cloneDeep } from 'lodash-es';
-import { Calendar } from 'app/modules/admin/apps/calendar/calendar.types';
-import { CalendarService } from 'app/modules/admin/apps/calendar/calendar.service';
-import { calendarColors } from 'app/modules/admin/apps/calendar/sidebar/calendar-colors';
-
-@Component({
- selector : 'calendar-sidebar',
- templateUrl : './sidebar.component.html',
- encapsulation: ViewEncapsulation.None
-})
-export class CalendarSidebarComponent implements OnInit, OnDestroy
-{
- @ViewChild('editPanel') private _editPanel: TemplateRef;
- @Output() readonly calendarUpdated: EventEmitter = new EventEmitter();
-
- calendar: Calendar | null;
- calendarColors: any = calendarColors;
- calendars: Calendar[];
- private _editPanelOverlayRef: OverlayRef;
- private _unsubscribeAll: Subject = new Subject();
-
- /**
- * Constructor
- */
- constructor(
- private _calendarService: CalendarService,
- private _overlay: Overlay,
- private _viewContainerRef: ViewContainerRef
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Get calendars
- this._calendarService.calendars$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((calendars) => {
-
- // Store the calendars
- this.calendars = calendars;
- });
- }
-
- /**
- * On destroy
- */
- ngOnDestroy(): void
- {
- // Unsubscribe from all subscriptions
- this._unsubscribeAll.next();
- this._unsubscribeAll.complete();
-
- // Dispose the overlay
- if ( this._editPanelOverlayRef )
- {
- this._editPanelOverlayRef.dispose();
- }
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Open edit panel
- */
- openEditPanel(calendar: Calendar): void
- {
- // Set the calendar
- this.calendar = cloneDeep(calendar);
-
- // Create the overlay if it doesn't exist
- if ( !this._editPanelOverlayRef )
- {
- this._createEditPanelOverlay();
- }
-
- // Attach the portal to the overlay
- this._editPanelOverlayRef.attach(new TemplatePortal(this._editPanel, this._viewContainerRef));
- }
-
- /**
- * Close the edit panel
- */
- closeEditPanel(): void
- {
- // Detach the overlay from the portal
- if ( this._editPanelOverlayRef )
- {
- this._editPanelOverlayRef.detach();
- }
- }
-
- /**
- * Toggle the calendar visibility
- *
- * @param calendar
- */
- toggleCalendarVisibility(calendar: Calendar): void
- {
- // Toggle the visibility
- calendar.visible = !calendar.visible;
-
- // Update the calendar
- this.saveCalendar(calendar);
- }
-
- /**
- * Add calendar
- */
- addCalendar(): void
- {
- // Create a new calendar with default values
- const calendar = {
- id : null,
- title : '',
- color : 'bg-blue-500',
- visible: true
- };
-
- // Open the edit panel
- this.openEditPanel(calendar);
- }
-
- /**
- * Save the calendar
- *
- * @param calendar
- */
- saveCalendar(calendar: Calendar): void
- {
- // If there is no id on the calendar...
- if ( !calendar.id )
- {
- // Add calendar to the server
- this._calendarService.addCalendar(calendar).subscribe(() => {
-
- // Close the edit panel
- this.closeEditPanel();
-
- // Emit the calendarUpdated event
- this.calendarUpdated.emit();
- });
- }
- // Otherwise...
- else
- {
- // Update the calendar on the server
- this._calendarService.updateCalendar(calendar.id, calendar).subscribe(() => {
-
- // Close the edit panel
- this.closeEditPanel();
-
- // Emit the calendarUpdated event
- this.calendarUpdated.emit();
- });
- }
- }
-
- /**
- * Delete the calendar
- *
- * @param calendar
- */
- deleteCalendar(calendar: Calendar): void
- {
- // Delete the calendar on the server
- this._calendarService.deleteCalendar(calendar.id).subscribe(() => {
-
- // Close the edit panel
- this.closeEditPanel();
-
- // Emit the calendarUpdated event
- this.calendarUpdated.emit();
- });
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Private methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Create the edit panel overlay
- * @private
- */
- private _createEditPanelOverlay(): void
- {
- // Create the overlay
- this._editPanelOverlayRef = this._overlay.create({
- hasBackdrop : true,
- scrollStrategy : this._overlay.scrollStrategies.reposition(),
- positionStrategy: this._overlay.position()
- .global()
- .centerHorizontally()
- .centerVertically()
- });
-
- // Detach the overlay from the portal on backdrop click
- this._editPanelOverlayRef.backdropClick().subscribe(() => {
- this.closeEditPanel();
- this.calendar = null;
- });
- }
-}
diff --git a/src/app/modules/admin/apps/contacts/contacts.component.html b/src/app/modules/admin/apps/contacts/contacts.component.html
deleted file mode 100644
index 0680b43f..00000000
--- a/src/app/modules/admin/apps/contacts/contacts.component.html
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/app/modules/admin/apps/contacts/contacts.component.ts b/src/app/modules/admin/apps/contacts/contacts.component.ts
deleted file mode 100644
index 52bd4292..00000000
--- a/src/app/modules/admin/apps/contacts/contacts.component.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';
-
-@Component({
- selector : 'contacts',
- templateUrl : './contacts.component.html',
- encapsulation : ViewEncapsulation.None,
- changeDetection: ChangeDetectionStrategy.OnPush
-})
-export class ContactsComponent
-{
- /**
- * Constructor
- */
- constructor()
- {
- }
-}
diff --git a/src/app/modules/admin/apps/contacts/contacts.guards.ts b/src/app/modules/admin/apps/contacts/contacts.guards.ts
deleted file mode 100644
index e6cf5e8f..00000000
--- a/src/app/modules/admin/apps/contacts/contacts.guards.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import { Injectable } from '@angular/core';
-import { ActivatedRouteSnapshot, CanDeactivate, RouterStateSnapshot, UrlTree } from '@angular/router';
-import { Observable } from 'rxjs';
-import { ContactsDetailsComponent } from 'app/modules/admin/apps/contacts/details/details.component';
-
-@Injectable({
- providedIn: 'root'
-})
-export class CanDeactivateContactsDetails implements CanDeactivate
-{
- canDeactivate(
- component: ContactsDetailsComponent,
- currentRoute: ActivatedRouteSnapshot,
- currentState: RouterStateSnapshot,
- nextState: RouterStateSnapshot
- ): Observable | Promise | boolean | UrlTree
- {
- // Get the next route
- let nextRoute: ActivatedRouteSnapshot = nextState.root;
- while ( nextRoute.firstChild )
- {
- nextRoute = nextRoute.firstChild;
- }
-
- // If the next state doesn't contain '/contacts'
- // it means we are navigating away from the
- // contacts app
- if ( !nextState.url.includes('/contacts') )
- {
- // Let it navigate
- return true;
- }
-
- // If we are navigating to another contact...
- if ( nextRoute.paramMap.get('id') )
- {
- // Just navigate
- return true;
- }
- // Otherwise...
- else
- {
- // Close the drawer first, and then navigate
- return component.closeDrawer().then(() => {
- return true;
- });
- }
- }
-}
diff --git a/src/app/modules/admin/apps/contacts/contacts.module.ts b/src/app/modules/admin/apps/contacts/contacts.module.ts
deleted file mode 100644
index bfbebc32..00000000
--- a/src/app/modules/admin/apps/contacts/contacts.module.ts
+++ /dev/null
@@ -1,75 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule } from '@angular/router';
-import { MatButtonModule } from '@angular/material/button';
-import { MatCheckboxModule } from '@angular/material/checkbox';
-import { MAT_DATE_FORMATS, MatRippleModule } from '@angular/material/core';
-import { MatDatepickerModule } from '@angular/material/datepicker';
-import { MatDividerModule } from '@angular/material/divider';
-import { MatFormFieldModule } from '@angular/material/form-field';
-import { MatIconModule } from '@angular/material/icon';
-import { MatInputModule } from '@angular/material/input';
-import { MatMenuModule } from '@angular/material/menu';
-import { MatMomentDateModule } from '@angular/material-moment-adapter';
-import { MatProgressBarModule } from '@angular/material/progress-bar';
-import { MatRadioModule } from '@angular/material/radio';
-import { MatSelectModule } from '@angular/material/select';
-import { MatSidenavModule } from '@angular/material/sidenav';
-import { MatTableModule } from '@angular/material/table';
-import { MatTooltipModule } from '@angular/material/tooltip';
-import * as moment from 'moment';
-import { FuseAutogrowModule } from '@fuse/directives/autogrow';
-import { FuseFindByKeyPipeModule } from '@fuse/pipes/find-by-key';
-import { SharedModule } from 'app/shared/shared.module';
-import { contactsRoutes } from 'app/modules/admin/apps/contacts/contacts.routing';
-import { ContactsComponent } from 'app/modules/admin/apps/contacts/contacts.component';
-import { ContactsDetailsComponent } from 'app/modules/admin/apps/contacts/details/details.component';
-import { ContactsListComponent } from 'app/modules/admin/apps/contacts/list/list.component';
-
-@NgModule({
- declarations: [
- ContactsComponent,
- ContactsListComponent,
- ContactsDetailsComponent
- ],
- imports : [
- RouterModule.forChild(contactsRoutes),
- MatButtonModule,
- MatCheckboxModule,
- MatDatepickerModule,
- MatDividerModule,
- MatFormFieldModule,
- MatIconModule,
- MatInputModule,
- MatMenuModule,
- MatMomentDateModule,
- MatProgressBarModule,
- MatRadioModule,
- MatRippleModule,
- MatSelectModule,
- MatSidenavModule,
- MatTableModule,
- MatTooltipModule,
- FuseAutogrowModule,
- FuseFindByKeyPipeModule,
- SharedModule
- ],
- providers : [
- {
- provide : MAT_DATE_FORMATS,
- useValue: {
- parse : {
- dateInput: moment.ISO_8601
- },
- display: {
- dateInput : 'LL',
- monthYearLabel : 'MMM YYYY',
- dateA11yLabel : 'LL',
- monthYearA11yLabel: 'MMMM YYYY'
- }
- }
- }
- ]
-})
-export class ContactsModule
-{
-}
diff --git a/src/app/modules/admin/apps/contacts/contacts.resolvers.ts b/src/app/modules/admin/apps/contacts/contacts.resolvers.ts
deleted file mode 100644
index 89ad16fd..00000000
--- a/src/app/modules/admin/apps/contacts/contacts.resolvers.ts
+++ /dev/null
@@ -1,138 +0,0 @@
-import { Injectable } from '@angular/core';
-import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@angular/router';
-import { Observable, throwError } from 'rxjs';
-import { catchError } from 'rxjs/operators';
-import { ContactsService } from 'app/modules/admin/apps/contacts/contacts.service';
-import { Contact, Country, Tag } from 'app/modules/admin/apps/contacts/contacts.types';
-
-@Injectable({
- providedIn: 'root'
-})
-export class ContactsResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _contactsService: ContactsService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._contactsService.getContacts();
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class ContactsContactResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(
- private _contactsService: ContactsService,
- private _router: Router
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._contactsService.getContactById(route.paramMap.get('id'))
- .pipe(
- // Error here means the requested contact is not available
- catchError((error) => {
-
- // Log the error
- console.error(error);
-
- // Get the parent url
- const parentUrl = state.url.split('/').slice(0, -1).join('/');
-
- // Navigate to there
- this._router.navigateByUrl(parentUrl);
-
- // Throw an error
- return throwError(error);
- })
- );
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class ContactsCountriesResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _contactsService: ContactsService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._contactsService.getCountries();
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class ContactsTagsResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _contactsService: ContactsService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._contactsService.getTags();
- }
-}
diff --git a/src/app/modules/admin/apps/contacts/contacts.routing.ts b/src/app/modules/admin/apps/contacts/contacts.routing.ts
deleted file mode 100644
index 8b00b89c..00000000
--- a/src/app/modules/admin/apps/contacts/contacts.routing.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { Route } from '@angular/router';
-import { CanDeactivateContactsDetails } from 'app/modules/admin/apps/contacts/contacts.guards';
-import { ContactsContactResolver, ContactsCountriesResolver, ContactsResolver, ContactsTagsResolver } from 'app/modules/admin/apps/contacts/contacts.resolvers';
-import { ContactsComponent } from 'app/modules/admin/apps/contacts/contacts.component';
-import { ContactsListComponent } from 'app/modules/admin/apps/contacts/list/list.component';
-import { ContactsDetailsComponent } from 'app/modules/admin/apps/contacts/details/details.component';
-
-export const contactsRoutes: Route[] = [
- {
- path : '',
- component: ContactsComponent,
- resolve : {
- tags: ContactsTagsResolver
- },
- children : [
- {
- path : '',
- component: ContactsListComponent,
- resolve : {
- tasks : ContactsResolver,
- countries: ContactsCountriesResolver
- },
- children : [
- {
- path : ':id',
- component : ContactsDetailsComponent,
- resolve : {
- task : ContactsContactResolver,
- countries: ContactsCountriesResolver
- },
- canDeactivate: [CanDeactivateContactsDetails]
- }
- ]
- }
- ]
- }
-];
diff --git a/src/app/modules/admin/apps/contacts/contacts.service.ts b/src/app/modules/admin/apps/contacts/contacts.service.ts
deleted file mode 100644
index cf38779c..00000000
--- a/src/app/modules/admin/apps/contacts/contacts.service.ts
+++ /dev/null
@@ -1,389 +0,0 @@
-import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
-import { BehaviorSubject, Observable, of, throwError } from 'rxjs';
-import { filter, map, switchMap, take, tap } from 'rxjs/operators';
-import { Contact, Country, Tag } from 'app/modules/admin/apps/contacts/contacts.types';
-
-@Injectable({
- providedIn: 'root'
-})
-export class ContactsService
-{
- // Private
- private _contact: BehaviorSubject = new BehaviorSubject(null);
- private _contacts: BehaviorSubject = new BehaviorSubject(null);
- private _countries: BehaviorSubject = new BehaviorSubject(null);
- private _tags: BehaviorSubject = new BehaviorSubject(null);
-
- /**
- * Constructor
- */
- constructor(private _httpClient: HttpClient)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Accessors
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Getter for contact
- */
- get contact$(): Observable
- {
- return this._contact.asObservable();
- }
-
- /**
- * Getter for contacts
- */
- get contacts$(): Observable
- {
- return this._contacts.asObservable();
- }
-
- /**
- * Getter for countries
- */
- get countries$(): Observable
- {
- return this._countries.asObservable();
- }
-
- /**
- * Getter for tags
- */
- get tags$(): Observable
- {
- return this._tags.asObservable();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Get contacts
- */
- getContacts(): Observable
- {
- return this._httpClient.get('api/apps/contacts/all').pipe(
- tap((contacts) => {
- this._contacts.next(contacts);
- })
- );
- }
-
- /**
- * Search contacts with given query
- *
- * @param query
- */
- searchContacts(query: string): Observable
- {
- return this._httpClient.get('api/apps/contacts/search', {
- params: {query}
- }).pipe(
- tap((contacts) => {
- this._contacts.next(contacts);
- })
- );
- }
-
- /**
- * Get contact by id
- */
- getContactById(id: string): Observable
- {
- return this._contacts.pipe(
- take(1),
- map((contacts) => {
-
- // Find the contact
- const contact = contacts.find(item => item.id === id) || null;
-
- // Update the contact
- this._contact.next(contact);
-
- // Return the contact
- return contact;
- }),
- switchMap((contact) => {
-
- if ( !contact )
- {
- return throwError('Could not found contact with id of ' + id + '!');
- }
-
- return of(contact);
- })
- );
- }
-
- /**
- * Create contact
- */
- createContact(): Observable
- {
- return this.contacts$.pipe(
- take(1),
- switchMap((contacts) => this._httpClient.post('api/apps/contacts/contact', {}).pipe(
- map((newContact) => {
-
- // Update the contacts with the new contact
- this._contacts.next([newContact, ...contacts]);
-
- // Return the new contact
- return newContact;
- })
- ))
- );
- }
-
- /**
- * Update contact
- *
- * @param id
- * @param contact
- */
- updateContact(id: string, contact: Contact): Observable
- {
- return this.contacts$.pipe(
- take(1),
- switchMap(contacts => this._httpClient.patch('api/apps/contacts/contact', {
- id,
- contact
- }).pipe(
- map((updatedContact) => {
-
- // Find the index of the updated contact
- const index = contacts.findIndex(item => item.id === id);
-
- // Update the contact
- contacts[index] = updatedContact;
-
- // Update the contacts
- this._contacts.next(contacts);
-
- // Return the updated contact
- return updatedContact;
- }),
- switchMap(updatedContact => this.contact$.pipe(
- take(1),
- filter(item => item && item.id === id),
- tap(() => {
-
- // Update the contact if it's selected
- this._contact.next(updatedContact);
-
- // Return the updated contact
- return updatedContact;
- })
- ))
- ))
- );
- }
-
- /**
- * Delete the contact
- *
- * @param id
- */
- deleteContact(id: string): Observable
- {
- return this.contacts$.pipe(
- take(1),
- switchMap(contacts => this._httpClient.delete('api/apps/contacts/contact', {params: {id}}).pipe(
- map((isDeleted: boolean) => {
-
- // Find the index of the deleted contact
- const index = contacts.findIndex(item => item.id === id);
-
- // Delete the contact
- contacts.splice(index, 1);
-
- // Update the contacts
- this._contacts.next(contacts);
-
- // Return the deleted status
- return isDeleted;
- })
- ))
- );
- }
-
- /**
- * Get countries
- */
- getCountries(): Observable
- {
- return this._httpClient.get('api/apps/contacts/countries').pipe(
- tap((countries) => {
- this._countries.next(countries);
- })
- );
- }
-
- /**
- * Get tags
- */
- getTags(): Observable
- {
- return this._httpClient.get('api/apps/contacts/tags').pipe(
- tap((tags) => {
- this._tags.next(tags);
- })
- );
- }
-
- /**
- * Create tag
- *
- * @param tag
- */
- createTag(tag: Tag): Observable
- {
- return this.tags$.pipe(
- take(1),
- switchMap(tags => this._httpClient.post('api/apps/contacts/tag', {tag}).pipe(
- map((newTag) => {
-
- // Update the tags with the new tag
- this._tags.next([...tags, newTag]);
-
- // Return new tag from observable
- return newTag;
- })
- ))
- );
- }
-
- /**
- * Update the tag
- *
- * @param id
- * @param tag
- */
- updateTag(id: string, tag: Tag): Observable
- {
- return this.tags$.pipe(
- take(1),
- switchMap(tags => this._httpClient.patch('api/apps/contacts/tag', {
- id,
- tag
- }).pipe(
- map((updatedTag) => {
-
- // Find the index of the updated tag
- const index = tags.findIndex(item => item.id === id);
-
- // Update the tag
- tags[index] = updatedTag;
-
- // Update the tags
- this._tags.next(tags);
-
- // Return the updated tag
- return updatedTag;
- })
- ))
- );
- }
-
- /**
- * Delete the tag
- *
- * @param id
- */
- deleteTag(id: string): Observable
- {
- return this.tags$.pipe(
- take(1),
- switchMap(tags => this._httpClient.delete('api/apps/contacts/tag', {params: {id}}).pipe(
- map((isDeleted: boolean) => {
-
- // Find the index of the deleted tag
- const index = tags.findIndex(item => item.id === id);
-
- // Delete the tag
- tags.splice(index, 1);
-
- // Update the tags
- this._tags.next(tags);
-
- // Return the deleted status
- return isDeleted;
- }),
- filter(isDeleted => isDeleted),
- switchMap(isDeleted => this.contacts$.pipe(
- take(1),
- map((contacts) => {
-
- // Iterate through the contacts
- contacts.forEach((contact) => {
-
- const tagIndex = contact.tags.findIndex(tag => tag === id);
-
- // If the contact has the tag, remove it
- if ( tagIndex > -1 )
- {
- contact.tags.splice(tagIndex, 1);
- }
- });
-
- // Return the deleted status
- return isDeleted;
- })
- ))
- ))
- );
- }
-
- /**
- * Update the avatar of the given contact
- *
- * @param id
- * @param avatar
- */
- uploadAvatar(id: string, avatar: File): Observable
- {
- return this.contacts$.pipe(
- take(1),
- switchMap(contacts => this._httpClient.post('api/apps/contacts/avatar', {
- id,
- avatar
- }, {
- headers: {
- 'Content-Type': avatar.type
- }
- }).pipe(
- map((updatedContact) => {
-
- // Find the index of the updated contact
- const index = contacts.findIndex(item => item.id === id);
-
- // Update the contact
- contacts[index] = updatedContact;
-
- // Update the contacts
- this._contacts.next(contacts);
-
- // Return the updated contact
- return updatedContact;
- }),
- switchMap(updatedContact => this.contact$.pipe(
- take(1),
- filter(item => item && item.id === id),
- tap(() => {
-
- // Update the contact if it's selected
- this._contact.next(updatedContact);
-
- // Return the updated contact
- return updatedContact;
- })
- ))
- ))
- );
- }
-}
diff --git a/src/app/modules/admin/apps/contacts/contacts.types.ts b/src/app/modules/admin/apps/contacts/contacts.types.ts
deleted file mode 100644
index 8befb04b..00000000
--- a/src/app/modules/admin/apps/contacts/contacts.types.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-export interface Contact
-{
- id: string;
- avatar?: string | null;
- background?: string | null;
- name: string;
- emails?: {
- email: string,
- label: string
- }[];
- phoneNumbers?: {
- country: string;
- number: string;
- label: string
- }[];
- title?: string;
- company?: string;
- birthday?: string | null;
- address?: string | null;
- notes?: string | null;
- tags: string[];
-}
-
-export interface Country
-{
- id: string;
- iso: string;
- name: string;
- code: string;
- flagImagePos: string;
-}
-
-export interface Tag
-{
- id?: string;
- title?: string;
-}
diff --git a/src/app/modules/admin/apps/contacts/details/details.component.html b/src/app/modules/admin/apps/contacts/details/details.component.html
deleted file mode 100644
index ecf5827e..00000000
--- a/src/app/modules/admin/apps/contacts/details/details.component.html
+++ /dev/null
@@ -1,641 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{contact.name.charAt(0)}}
-
-
-
-
-
-
- Edit
-
-
-
-
-
-
{{contact.name}}
-
-
-
-
-
-
-
- {{tag.title}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{contact.company}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{getCountryByIso(phoneNumber.country).code}}
-
{{phoneNumber.number}}
-
- •
- {{phoneNumber.label}}
-
-
-
-
-
-
-
-
-
-
-
-
{{contact.address}}
-
-
-
-
-
-
-
-
{{contact.birthday | date:'longDate'}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/app/modules/admin/apps/contacts/details/details.component.ts b/src/app/modules/admin/apps/contacts/details/details.component.ts
deleted file mode 100644
index 56c3c49b..00000000
--- a/src/app/modules/admin/apps/contacts/details/details.component.ts
+++ /dev/null
@@ -1,711 +0,0 @@
-import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, OnDestroy, OnInit, Renderer2, TemplateRef, ViewChild, ViewContainerRef, ViewEncapsulation } from '@angular/core';
-import { ActivatedRoute, Router } from '@angular/router';
-import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
-import { TemplatePortal } from '@angular/cdk/portal';
-import { Overlay, OverlayRef } from '@angular/cdk/overlay';
-import { MatDrawerToggleResult } from '@angular/material/sidenav';
-import { Subject } from 'rxjs';
-import { debounceTime, takeUntil } from 'rxjs/operators';
-import { Contact, Country, Tag } from 'app/modules/admin/apps/contacts/contacts.types';
-import { ContactsListComponent } from 'app/modules/admin/apps/contacts/list/list.component';
-import { ContactsService } from 'app/modules/admin/apps/contacts/contacts.service';
-
-@Component({
- selector : 'contacts-details',
- templateUrl : './details.component.html',
- encapsulation : ViewEncapsulation.None,
- changeDetection: ChangeDetectionStrategy.OnPush
-})
-export class ContactsDetailsComponent implements OnInit, OnDestroy
-{
- @ViewChild('avatarFileInput') private _avatarFileInput: ElementRef;
- @ViewChild('tagsPanel') private _tagsPanel: TemplateRef;
- @ViewChild('tagsPanelOrigin') private _tagsPanelOrigin: ElementRef;
-
- editMode: boolean = false;
- tags: Tag[];
- tagsEditMode: boolean = false;
- filteredTags: Tag[];
- contact: Contact;
- contactForm: FormGroup;
- contacts: Contact[];
- countries: Country[];
- private _tagsPanelOverlayRef: OverlayRef;
- private _unsubscribeAll: Subject = new Subject();
-
- /**
- * Constructor
- */
- constructor(
- private _activatedRoute: ActivatedRoute,
- private _changeDetectorRef: ChangeDetectorRef,
- private _contactsListComponent: ContactsListComponent,
- private _contactsService: ContactsService,
- private _formBuilder: FormBuilder,
- private _renderer2: Renderer2,
- private _router: Router,
- private _overlay: Overlay,
- private _viewContainerRef: ViewContainerRef
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Open the drawer
- this._contactsListComponent.matDrawer.open();
-
- // Create the contact form
- this.contactForm = this._formBuilder.group({
- id : [''],
- avatar : [null],
- name : ['', [Validators.required]],
- emails : this._formBuilder.array([]),
- phoneNumbers: this._formBuilder.array([]),
- title : [''],
- company : [''],
- birthday : [null],
- address : [null],
- notes : [null],
- tags : [[]]
- });
-
- // Get the contacts
- this._contactsService.contacts$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((contacts: Contact[]) => {
- this.contacts = contacts;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Get the contact
- this._contactsService.contact$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((contact: Contact) => {
-
- // Open the drawer in case it is closed
- this._contactsListComponent.matDrawer.open();
-
- // Get the contact
- this.contact = contact;
-
- // Clear the emails and phoneNumbers form arrays
- (this.contactForm.get('emails') as FormArray).clear();
- (this.contactForm.get('phoneNumbers') as FormArray).clear();
-
- // Patch values to the form
- this.contactForm.patchValue(contact);
-
- // Setup the emails form array
- const emailFormGroups = [];
-
- if ( contact.emails.length > 0 )
- {
- // Iterate through them
- contact.emails.forEach((email) => {
-
- // Create an email form group
- emailFormGroups.push(
- this._formBuilder.group({
- email: [email.email],
- label: [email.label]
- })
- );
- });
- }
- else
- {
- // Create an email form group
- emailFormGroups.push(
- this._formBuilder.group({
- email: [''],
- label: ['']
- })
- );
- }
-
- // Add the email form groups to the emails form array
- emailFormGroups.forEach((emailFormGroup) => {
- (this.contactForm.get('emails') as FormArray).push(emailFormGroup);
- });
-
- // Setup the phone numbers form array
- const phoneNumbersFormGroups = [];
-
- if ( contact.phoneNumbers.length > 0 )
- {
- // Iterate through them
- contact.phoneNumbers.forEach((phoneNumber) => {
-
- // Create an email form group
- phoneNumbersFormGroups.push(
- this._formBuilder.group({
- country: [phoneNumber.country],
- number : [phoneNumber.number],
- label : [phoneNumber.label]
- })
- );
- });
- }
- else
- {
- // Create a phone number form group
- phoneNumbersFormGroups.push(
- this._formBuilder.group({
- country: ['us'],
- number : [''],
- label : ['']
- })
- );
- }
-
- // Add the phone numbers form groups to the phone numbers form array
- phoneNumbersFormGroups.forEach((phoneNumbersFormGroup) => {
- (this.contactForm.get('phoneNumbers') as FormArray).push(phoneNumbersFormGroup);
- });
-
- // Toggle the edit mode off
- this.toggleEditMode(false);
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Get the country telephone codes
- this._contactsService.countries$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((codes: Country[]) => {
- this.countries = codes;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Get the tags
- this._contactsService.tags$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((tags: Tag[]) => {
- this.tags = tags;
- this.filteredTags = tags;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
- }
-
- /**
- * On destroy
- */
- ngOnDestroy(): void
- {
- // Unsubscribe from all subscriptions
- this._unsubscribeAll.next();
- this._unsubscribeAll.complete();
-
- // Dispose the overlays if they are still on the DOM
- if ( this._tagsPanelOverlayRef )
- {
- this._tagsPanelOverlayRef.dispose();
- }
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Close the drawer
- */
- closeDrawer(): Promise
- {
- return this._contactsListComponent.matDrawer.close();
- }
-
- /**
- * Toggle edit mode
- *
- * @param editMode
- */
- toggleEditMode(editMode: boolean | null = null): void
- {
- if ( editMode === null )
- {
- this.editMode = !this.editMode;
- }
- else
- {
- this.editMode = editMode;
- }
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Update the contact
- */
- updateContact(): void
- {
- // Get the contact object
- const contact = this.contactForm.getRawValue();
-
- // Go through the contact object and clear empty values
- contact.emails = contact.emails.filter((email) => {
- return email.email;
- });
-
- contact.phoneNumbers = contact.phoneNumbers.filter((phoneNumber) => {
- return phoneNumber.number;
- });
-
- // Update the contact on the server
- this._contactsService.updateContact(contact.id, contact).subscribe(() => {
-
- // Toggle the edit mode off
- this.toggleEditMode(false);
- });
- }
-
- /**
- * Delete the contact
- */
- deleteContact(): void
- {
- // Get the current contact's id
- const id = this.contact.id;
-
- // Get the next/previous contact's id
- const currentContactIndex = this.contacts.findIndex(item => item.id === id);
- const nextContactIndex = currentContactIndex + ((currentContactIndex === (this.contacts.length - 1)) ? -1 : 1);
- const nextContactId = (this.contacts.length === 1 && this.contacts[0].id === id) ? null : this.contacts[nextContactIndex].id;
-
- // Delete the contact
- this._contactsService.deleteContact(id)
- .subscribe((isDeleted) => {
-
- // Return if the contact wasn't deleted...
- if ( !isDeleted )
- {
- return;
- }
-
- // Get the current activated route
- let route = this._activatedRoute;
- while ( route.firstChild )
- {
- route = route.firstChild;
- }
-
- // Navigate to the next contact if available
- if ( nextContactId )
- {
- this._router.navigate(['../', nextContactId], {relativeTo: route});
- }
- // Otherwise, navigate to the parent
- else
- {
- this._router.navigate(['../'], {relativeTo: route});
- }
-
- // Toggle the edit mode off
- this.toggleEditMode(false);
- });
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Upload avatar
- *
- * @param fileList
- */
- uploadAvatar(fileList: FileList): void
- {
- // Return if canceled
- if ( !fileList.length )
- {
- return;
- }
-
- const allowedTypes = ['image/jpeg', 'image/png'];
- const file = fileList[0];
-
- // Return if the file is not allowed
- if ( !allowedTypes.includes(file.type) )
- {
- return;
- }
-
- // Upload the avatar
- this._contactsService.uploadAvatar(this.contact.id, file).subscribe();
- }
-
- /**
- * Remove the avatar
- */
- removeAvatar(): void
- {
- // Get the form control for 'avatar'
- const avatarFormControl = this.contactForm.get('avatar');
-
- // Set the avatar as null
- avatarFormControl.setValue(null);
-
- // Set the file input value as null
- this._avatarFileInput.nativeElement.value = null;
-
- // Update the contact
- this.contact.avatar = null;
- }
-
- /**
- * Open tags panel
- */
- openTagsPanel(): void
- {
- // Create the overlay
- this._tagsPanelOverlayRef = this._overlay.create({
- backdropClass : '',
- hasBackdrop : true,
- scrollStrategy : this._overlay.scrollStrategies.block(),
- positionStrategy: this._overlay.position()
- .flexibleConnectedTo(this._tagsPanelOrigin.nativeElement)
- .withFlexibleDimensions()
- .withViewportMargin(64)
- .withLockedPosition()
- .withPositions([
- {
- originX : 'start',
- originY : 'bottom',
- overlayX: 'start',
- overlayY: 'top'
- }
- ])
- });
-
- // Subscribe to the attachments observable
- this._tagsPanelOverlayRef.attachments().subscribe(() => {
-
- // Add a class to the origin
- this._renderer2.addClass(this._tagsPanelOrigin.nativeElement, 'panel-opened');
-
- // Focus to the search input once the overlay has been attached
- this._tagsPanelOverlayRef.overlayElement.querySelector('input').focus();
- });
-
- // Create a portal from the template
- const templatePortal = new TemplatePortal(this._tagsPanel, this._viewContainerRef);
-
- // Attach the portal to the overlay
- this._tagsPanelOverlayRef.attach(templatePortal);
-
- // Subscribe to the backdrop click
- this._tagsPanelOverlayRef.backdropClick().subscribe(() => {
-
- // Remove the class from the origin
- this._renderer2.removeClass(this._tagsPanelOrigin.nativeElement, 'panel-opened');
-
- // If overlay exists and attached...
- if ( this._tagsPanelOverlayRef && this._tagsPanelOverlayRef.hasAttached() )
- {
- // Detach it
- this._tagsPanelOverlayRef.detach();
-
- // Reset the tag filter
- this.filteredTags = this.tags;
-
- // Toggle the edit mode off
- this.tagsEditMode = false;
- }
-
- // If template portal exists and attached...
- if ( templatePortal && templatePortal.isAttached )
- {
- // Detach it
- templatePortal.detach();
- }
- });
- }
-
- /**
- * Toggle the tags edit mode
- */
- toggleTagsEditMode(): void
- {
- this.tagsEditMode = !this.tagsEditMode;
- }
-
- /**
- * Filter tags
- *
- * @param event
- */
- filterTags(event): void
- {
- // Get the value
- const value = event.target.value.toLowerCase();
-
- // Filter the tags
- this.filteredTags = this.tags.filter(tag => tag.title.toLowerCase().includes(value));
- }
-
- /**
- * Filter tags input key down event
- *
- * @param event
- */
- filterTagsInputKeyDown(event): void
- {
- // Return if the pressed key is not 'Enter'
- if ( event.key !== 'Enter' )
- {
- return;
- }
-
- // If there is no tag available...
- if ( this.filteredTags.length === 0 )
- {
- // Create the tag
- this.createTag(event.target.value);
-
- // Clear the input
- event.target.value = '';
-
- // Return
- return;
- }
-
- // If there is a tag...
- const tag = this.filteredTags[0];
- const isTagApplied = this.contact.tags.find((id) => id === tag.id);
-
- // If the found tag is already applied to the contact...
- if ( isTagApplied )
- {
- // Remove the tag from the contact
- this.removeTagFromContact(tag);
- }
- else
- {
- // Otherwise add the tag to the contact
- this.addTagToContact(tag);
- }
- }
-
- /**
- * Create a new tag
- *
- * @param title
- */
- createTag(title: string): void
- {
- const tag = {
- title
- };
-
- // Create tag on the server
- this._contactsService.createTag(tag)
- .subscribe((response) => {
-
- // Add the tag to the contact
- this.addTagToContact(response);
- });
- }
-
- /**
- * Update the tag title
- *
- * @param tag
- * @param event
- */
- updateTagTitle(tag: Tag, event): void
- {
- // Update the title on the tag
- tag.title = event.target.value;
-
- // Update the tag on the server
- this._contactsService.updateTag(tag.id, tag)
- .pipe(debounceTime(300))
- .subscribe();
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Delete the tag
- *
- * @param tag
- */
- deleteTag(tag: Tag): void
- {
- // Delete the tag from the server
- this._contactsService.deleteTag(tag.id).subscribe();
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Add tag to the contact
- *
- * @param tag
- */
- addTagToContact(tag: Tag): void
- {
- // Add the tag
- this.contact.tags.unshift(tag.id);
-
- // Update the contact form
- this.contactForm.get('tags').patchValue(this.contact.tags);
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Remove tag from the contact
- *
- * @param tag
- */
- removeTagFromContact(tag: Tag): void
- {
- // Remove the tag
- this.contact.tags.splice(this.contact.tags.findIndex(item => item === tag.id), 1);
-
- // Update the contact form
- this.contactForm.get('tags').patchValue(this.contact.tags);
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Toggle contact tag
- *
- * @param tag
- */
- toggleContactTag(tag: Tag): void
- {
- if ( this.contact.tags.includes(tag.id) )
- {
- this.removeTagFromContact(tag);
- }
- else
- {
- this.addTagToContact(tag);
- }
- }
-
- /**
- * Should the create tag button be visible
- *
- * @param inputValue
- */
- shouldShowCreateTagButton(inputValue: string): boolean
- {
- return !!!(inputValue === '' || this.tags.findIndex(tag => tag.title.toLowerCase() === inputValue.toLowerCase()) > -1);
- }
-
- /**
- * Add the email field
- */
- addEmailField(): void
- {
- // Create an empty email form group
- const emailFormGroup = this._formBuilder.group({
- email: [''],
- label: ['']
- });
-
- // Add the email form group to the emails form array
- (this.contactForm.get('emails') as FormArray).push(emailFormGroup);
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Remove the email field
- *
- * @param index
- */
- removeEmailField(index: number): void
- {
- // Get form array for emails
- const emailsFormArray = this.contactForm.get('emails') as FormArray;
-
- // Remove the email field
- emailsFormArray.removeAt(index);
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Add an empty phone number field
- */
- addPhoneNumberField(): void
- {
- // Create an empty phone number form group
- const phoneNumberFormGroup = this._formBuilder.group({
- country: ['us'],
- number : [''],
- label : ['']
- });
-
- // Add the phone number form group to the phoneNumbers form array
- (this.contactForm.get('phoneNumbers') as FormArray).push(phoneNumberFormGroup);
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Remove the phone number field
- *
- * @param index
- */
- removePhoneNumberField(index: number): void
- {
- // Get form array for phone numbers
- const phoneNumbersFormArray = this.contactForm.get('phoneNumbers') as FormArray;
-
- // Remove the phone number field
- phoneNumbersFormArray.removeAt(index);
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Get country info by iso code
- *
- * @param iso
- */
- getCountryByIso(iso: string): Country
- {
- return this.countries.find((country) => country.iso === iso);
- }
-
- /**
- * Track by function for ngFor loops
- *
- * @param index
- * @param item
- */
- trackByFn(index: number, item: any): any
- {
- return item.id || index;
- }
-}
diff --git a/src/app/modules/admin/apps/contacts/list/list.component.html b/src/app/modules/admin/apps/contacts/list/list.component.html
deleted file mode 100644
index 55d0a961..00000000
--- a/src/app/modules/admin/apps/contacts/list/list.component.html
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0">
- {{contactsCount}}
-
- {{contactsCount | i18nPlural: {
- '=0' : 'No contacts',
- '=1' : 'contact',
- 'other': 'contacts'
- } }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Add
-
-
-
-
-
-
-
-
-
-
-
-
- {{contact.name.charAt(0)}}
-
-
-
-
-
-
-
-
-
-
- {{contact.name.charAt(0)}}
-
-
-
-
-
{{contact.name}}
-
{{contact.title}}
-
-
-
-
-
-
-
-
- There are no contacts!
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/app/modules/admin/apps/contacts/list/list.component.ts b/src/app/modules/admin/apps/contacts/list/list.component.ts
deleted file mode 100644
index a1ac2df4..00000000
--- a/src/app/modules/admin/apps/contacts/list/list.component.ts
+++ /dev/null
@@ -1,241 +0,0 @@
-import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Inject, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
-import { DOCUMENT } from '@angular/common';
-import { ActivatedRoute, Router } from '@angular/router';
-import { FormControl } from '@angular/forms';
-import { MatDrawer } from '@angular/material/sidenav';
-import { fromEvent, Observable, Subject } from 'rxjs';
-import { filter, switchMap, takeUntil } from 'rxjs/operators';
-import { FuseMediaWatcherService } from '@fuse/services/media-watcher';
-import { Contact, Country } from 'app/modules/admin/apps/contacts/contacts.types';
-import { ContactsService } from 'app/modules/admin/apps/contacts/contacts.service';
-
-@Component({
- selector : 'contacts-list',
- templateUrl : './list.component.html',
- encapsulation : ViewEncapsulation.None,
- changeDetection: ChangeDetectionStrategy.OnPush
-})
-export class ContactsListComponent implements OnInit, OnDestroy
-{
- @ViewChild('matDrawer', {static: true}) matDrawer: MatDrawer;
-
- contacts$: Observable;
-
- contactsCount: number = 0;
- contactsTableColumns: string[] = ['name', 'email', 'phoneNumber', 'job'];
- countries: Country[];
- drawerMode: 'side' | 'over';
- searchInputControl: FormControl = new FormControl();
- selectedContact: Contact;
- private _unsubscribeAll: Subject = new Subject();
-
- /**
- * Constructor
- */
- constructor(
- private _activatedRoute: ActivatedRoute,
- private _changeDetectorRef: ChangeDetectorRef,
- private _contactsService: ContactsService,
- @Inject(DOCUMENT) private _document: any,
- private _router: Router,
- private _fuseMediaWatcherService: FuseMediaWatcherService
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Get the contacts
- this.contacts$ = this._contactsService.contacts$;
- this._contactsService.contacts$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((contacts: Contact[]) => {
-
- // Update the counts
- this.contactsCount = contacts.length;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Get the contact
- this._contactsService.contact$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((contact: Contact) => {
-
- // Update the selected contact
- this.selectedContact = contact;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Get the countries
- this._contactsService.countries$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((countries: Country[]) => {
-
- // Update the countries
- this.countries = countries;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Subscribe to search input field value changes
- this.searchInputControl.valueChanges
- .pipe(
- takeUntil(this._unsubscribeAll),
- switchMap((query) => {
-
- // Search
- return this._contactsService.searchContacts(query);
- })
- )
- .subscribe();
-
- // Subscribe to MatDrawer opened change
- this.matDrawer.openedChange.subscribe((opened) => {
- if ( !opened )
- {
- // Remove the selected contact when drawer closed
- this.selectedContact = null;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
- });
-
- // Subscribe to media changes
- this._fuseMediaWatcherService.onMediaChange$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe(({matchingAliases}) => {
-
- // Set the drawerMode if the given breakpoint is active
- if ( matchingAliases.includes('lg') )
- {
- this.drawerMode = 'side';
- }
- else
- {
- this.drawerMode = 'over';
- }
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Listen for shortcuts
- fromEvent(this._document, 'keydown')
- .pipe(
- takeUntil(this._unsubscribeAll),
- filter((event) => {
- return (event.ctrlKey === true || event.metaKey) // Ctrl or Cmd
- && (event.key === '/'); // '/'
- })
- )
- .subscribe(() => {
- this.createContact();
- });
- }
-
- /**
- * On destroy
- */
- ngOnDestroy(): void
- {
- // Unsubscribe from all subscriptions
- this._unsubscribeAll.next();
- this._unsubscribeAll.complete();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Go to contact
- *
- * @param id
- */
- goToContact(id: string): void
- {
- // Get the current activated route
- let route = this._activatedRoute;
- while ( route.firstChild )
- {
- route = route.firstChild;
- }
-
- // Go to contact
- this._router.navigate(['../', id], {relativeTo: route});
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * On backdrop clicked
- */
- onBackdropClicked(): void
- {
- // Get the current activated route
- let route = this._activatedRoute;
- while ( route.firstChild )
- {
- route = route.firstChild;
- }
-
- // Go to the parent route
- this._router.navigate(['../'], {relativeTo: route});
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Create contact
- */
- createContact(): void
- {
- // Create the contact
- this._contactsService.createContact().subscribe((newContact) => {
-
- // Go to new contact
- this.goToContact(newContact.id);
- });
- }
-
- /**
- * Get country code
- *
- * @param iso
- */
- getCountryCode(iso: string): string
- {
- if ( !iso )
- {
- return '';
- }
-
- return this.countries.find((country) => country.iso === iso).code;
- }
-
- /**
- * Track by function for ngFor loops
- *
- * @param index
- * @param item
- */
- trackByFn(index: number, item: any): any
- {
- return item.id || index;
- }
-}
diff --git a/src/app/modules/admin/apps/ecommerce/ecommerce.module.ts b/src/app/modules/admin/apps/ecommerce/ecommerce.module.ts
deleted file mode 100644
index 1a06f40b..00000000
--- a/src/app/modules/admin/apps/ecommerce/ecommerce.module.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule } from '@angular/router';
-import { MatButtonModule } from '@angular/material/button';
-import { MatCheckboxModule } from '@angular/material/checkbox';
-import { MatFormFieldModule } from '@angular/material/form-field';
-import { MatIconModule } from '@angular/material/icon';
-import { MatInputModule } from '@angular/material/input';
-import { MatMenuModule } from '@angular/material/menu';
-import { MatPaginatorModule } from '@angular/material/paginator';
-import { MatProgressBarModule } from '@angular/material/progress-bar';
-import { MatRippleModule } from '@angular/material/core';
-import { MatSortModule } from '@angular/material/sort';
-import { MatSelectModule } from '@angular/material/select';
-import { MatSlideToggleModule } from '@angular/material/slide-toggle';
-import { MatTableModule } from '@angular/material/table';
-import { MatTooltipModule } from '@angular/material/tooltip';
-import { SharedModule } from 'app/shared/shared.module';
-import { InventoryComponent } from 'app/modules/admin/apps/ecommerce/inventory/inventory.component';
-import { InventoryListComponent } from 'app/modules/admin/apps/ecommerce/inventory/list/inventory.component';
-import { ecommerceRoutes } from 'app/modules/admin/apps/ecommerce/ecommerce.routing';
-
-@NgModule({
- declarations: [
- InventoryComponent,
- InventoryListComponent
- ],
- imports : [
- RouterModule.forChild(ecommerceRoutes),
- MatButtonModule,
- MatCheckboxModule,
- MatFormFieldModule,
- MatIconModule,
- MatInputModule,
- MatMenuModule,
- MatPaginatorModule,
- MatProgressBarModule,
- MatRippleModule,
- MatSortModule,
- MatSelectModule,
- MatSlideToggleModule,
- MatTableModule,
- MatTooltipModule,
- SharedModule
- ]
-})
-export class ECommerceModule
-{
-}
diff --git a/src/app/modules/admin/apps/ecommerce/ecommerce.routing.ts b/src/app/modules/admin/apps/ecommerce/ecommerce.routing.ts
deleted file mode 100644
index a749332d..00000000
--- a/src/app/modules/admin/apps/ecommerce/ecommerce.routing.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-import { Route } from '@angular/router';
-import { InventoryComponent } from 'app/modules/admin/apps/ecommerce/inventory/inventory.component';
-import { InventoryListComponent } from 'app/modules/admin/apps/ecommerce/inventory/list/inventory.component';
-import { InventoryBrandsResolver, InventoryCategoriesResolver, InventoryProductsResolver, InventoryTagsResolver, InventoryVendorsResolver } from 'app/modules/admin/apps/ecommerce/inventory/inventory.resolvers';
-
-export const ecommerceRoutes: Route[] = [
- {
- path : '',
- pathMatch : 'full',
- redirectTo: 'inventory'
- },
- {
- path : 'inventory',
- component: InventoryComponent,
- children : [
- {
- path : '',
- component: InventoryListComponent,
- resolve : {
- brands : InventoryBrandsResolver,
- categories: InventoryCategoriesResolver,
- products : InventoryProductsResolver,
- tags : InventoryTagsResolver,
- vendors : InventoryVendorsResolver
- }
- }
- ]
- /*children : [
- {
- path : '',
- component: ContactsListComponent,
- resolve : {
- tasks : ContactsResolver,
- countries: ContactsCountriesResolver
- },
- children : [
- {
- path : ':id',
- component : ContactsDetailsComponent,
- resolve : {
- task : ContactsContactResolver,
- countries: ContactsCountriesResolver
- },
- canDeactivate: [CanDeactivateContactsDetails]
- }
- ]
- }
- ]*/
- }
-];
diff --git a/src/app/modules/admin/apps/ecommerce/inventory/inventory.component.html b/src/app/modules/admin/apps/ecommerce/inventory/inventory.component.html
deleted file mode 100644
index 0680b43f..00000000
--- a/src/app/modules/admin/apps/ecommerce/inventory/inventory.component.html
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/app/modules/admin/apps/ecommerce/inventory/inventory.component.ts b/src/app/modules/admin/apps/ecommerce/inventory/inventory.component.ts
deleted file mode 100644
index 209f1e4c..00000000
--- a/src/app/modules/admin/apps/ecommerce/inventory/inventory.component.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';
-
-@Component({
- selector : 'inventory',
- templateUrl : './inventory.component.html',
- encapsulation : ViewEncapsulation.None,
- changeDetection: ChangeDetectionStrategy.OnPush
-})
-export class InventoryComponent
-{
- /**
- * Constructor
- */
- constructor()
- {
- }
-}
diff --git a/src/app/modules/admin/apps/ecommerce/inventory/inventory.resolvers.ts b/src/app/modules/admin/apps/ecommerce/inventory/inventory.resolvers.ts
deleted file mode 100644
index 47b83a18..00000000
--- a/src/app/modules/admin/apps/ecommerce/inventory/inventory.resolvers.ts
+++ /dev/null
@@ -1,194 +0,0 @@
-import { Injectable } from '@angular/core';
-import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@angular/router';
-import { Observable, throwError } from 'rxjs';
-import { catchError } from 'rxjs/operators';
-import { InventoryService } from 'app/modules/admin/apps/ecommerce/inventory/inventory.service';
-import { InventoryBrand, InventoryCategory, InventoryPagination, InventoryProduct, InventoryTag, InventoryVendor } from 'app/modules/admin/apps/ecommerce/inventory/inventory.types';
-
-@Injectable({
- providedIn: 'root'
-})
-export class InventoryBrandsResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _inventoryService: InventoryService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._inventoryService.getBrands();
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class InventoryCategoriesResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _inventoryService: InventoryService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._inventoryService.getCategories();
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class InventoryProductResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(
- private _inventoryService: InventoryService,
- private _router: Router
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._inventoryService.getProductById(route.paramMap.get('id'))
- .pipe(
- // Error here means the requested product is not available
- catchError((error) => {
-
- // Log the error
- console.error(error);
-
- // Get the parent url
- const parentUrl = state.url.split('/').slice(0, -1).join('/');
-
- // Navigate to there
- this._router.navigateByUrl(parentUrl);
-
- // Throw an error
- return throwError(error);
- })
- );
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class InventoryProductsResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _inventoryService: InventoryService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<{ pagination: InventoryPagination, products: InventoryProduct[] }>
- {
- return this._inventoryService.getProducts();
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class InventoryTagsResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _inventoryService: InventoryService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._inventoryService.getTags();
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class InventoryVendorsResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _inventoryService: InventoryService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._inventoryService.getVendors();
- }
-}
diff --git a/src/app/modules/admin/apps/ecommerce/inventory/inventory.service.ts b/src/app/modules/admin/apps/ecommerce/inventory/inventory.service.ts
deleted file mode 100644
index 50a13b68..00000000
--- a/src/app/modules/admin/apps/ecommerce/inventory/inventory.service.ts
+++ /dev/null
@@ -1,441 +0,0 @@
-import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
-import { BehaviorSubject, Observable, of, throwError } from 'rxjs';
-import { filter, map, switchMap, take, tap } from 'rxjs/operators';
-import { InventoryBrand, InventoryCategory, InventoryPagination, InventoryProduct, InventoryTag, InventoryVendor } from 'app/modules/admin/apps/ecommerce/inventory/inventory.types';
-
-@Injectable({
- providedIn: 'root'
-})
-export class InventoryService
-{
- // Private
- private _brands: BehaviorSubject = new BehaviorSubject(null);
- private _categories: BehaviorSubject = new BehaviorSubject(null);
- private _pagination: BehaviorSubject = new BehaviorSubject(null);
- private _product: BehaviorSubject = new BehaviorSubject(null);
- private _products: BehaviorSubject = new BehaviorSubject(null);
- private _tags: BehaviorSubject = new BehaviorSubject(null);
- private _vendors: BehaviorSubject = new BehaviorSubject(null);
-
- /**
- * Constructor
- */
- constructor(private _httpClient: HttpClient)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Accessors
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Getter for brands
- */
- get brands$(): Observable
- {
- return this._brands.asObservable();
- }
-
- /**
- * Getter for categories
- */
- get categories$(): Observable
- {
- return this._categories.asObservable();
- }
-
- /**
- * Getter for pagination
- */
- get pagination$(): Observable
- {
- return this._pagination.asObservable();
- }
-
- /**
- * Getter for product
- */
- get product$(): Observable
- {
- return this._product.asObservable();
- }
-
- /**
- * Getter for products
- */
- get products$(): Observable
- {
- return this._products.asObservable();
- }
-
- /**
- * Getter for tags
- */
- get tags$(): Observable
- {
- return this._tags.asObservable();
- }
-
- /**
- * Getter for vendors
- */
- get vendors$(): Observable
- {
- return this._vendors.asObservable();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Get brands
- */
- getBrands(): Observable
- {
- return this._httpClient.get('api/apps/ecommerce/inventory/brands').pipe(
- tap((brands) => {
- this._brands.next(brands);
- })
- );
- }
-
- /**
- * Get categories
- */
- getCategories(): Observable
- {
- return this._httpClient.get('api/apps/ecommerce/inventory/categories').pipe(
- tap((categories) => {
- this._categories.next(categories);
- })
- );
- }
-
- /**
- * Get products
- *
- *
- * @param page
- * @param size
- * @param sort
- * @param order
- * @param search
- */
- getProducts(page: number = 0, size: number = 10, sort: string = 'name', order: 'asc' | 'desc' | '' = 'asc', search: string = ''):
- Observable<{ pagination: InventoryPagination, products: InventoryProduct[] }>
- {
- return this._httpClient.get<{ pagination: InventoryPagination, products: InventoryProduct[] }>('api/apps/ecommerce/inventory/products', {
- params: {
- page: '' + page,
- size: '' + size,
- sort,
- order,
- search
- }
- }).pipe(
- tap((response) => {
- this._pagination.next(response.pagination);
- this._products.next(response.products);
- })
- );
- }
-
- /**
- * Get product by id
- */
- getProductById(id: string): Observable
- {
- return this._products.pipe(
- take(1),
- map((products) => {
-
- // Find the product
- const product = products.find(item => item.id === id) || null;
-
- // Update the product
- this._product.next(product);
-
- // Return the product
- return product;
- }),
- switchMap((product) => {
-
- if ( !product )
- {
- return throwError('Could not found product with id of ' + id + '!');
- }
-
- return of(product);
- })
- );
- }
-
- /**
- * Create product
- */
- createProduct(): Observable
- {
- return this.products$.pipe(
- take(1),
- switchMap((products) => this._httpClient.post('api/apps/ecommerce/inventory/product', {}).pipe(
- map((newProduct) => {
-
- // Update the products with the new product
- this._products.next([newProduct, ...products]);
-
- // Return the new product
- return newProduct;
- })
- ))
- );
- }
-
- /**
- * Update product
- *
- * @param id
- * @param product
- */
- updateProduct(id: string, product: InventoryProduct): Observable
- {
- return this.products$.pipe(
- take(1),
- switchMap(products => this._httpClient.patch('api/apps/ecommerce/inventory/product', {
- id,
- product
- }).pipe(
- map((updatedProduct) => {
-
- // Find the index of the updated product
- const index = products.findIndex(item => item.id === id);
-
- // Update the product
- products[index] = updatedProduct;
-
- // Update the products
- this._products.next(products);
-
- // Return the updated product
- return updatedProduct;
- }),
- switchMap(updatedProduct => this.product$.pipe(
- take(1),
- filter(item => item && item.id === id),
- tap(() => {
-
- // Update the product if it's selected
- this._product.next(updatedProduct);
-
- // Return the updated product
- return updatedProduct;
- })
- ))
- ))
- );
- }
-
- /**
- * Delete the product
- *
- * @param id
- */
- deleteProduct(id: string): Observable
- {
- return this.products$.pipe(
- take(1),
- switchMap(products => this._httpClient.delete('api/apps/ecommerce/inventory/product', {params: {id}}).pipe(
- map((isDeleted: boolean) => {
-
- // Find the index of the deleted product
- const index = products.findIndex(item => item.id === id);
-
- // Delete the product
- products.splice(index, 1);
-
- // Update the products
- this._products.next(products);
-
- // Return the deleted status
- return isDeleted;
- })
- ))
- );
- }
-
- /**
- * Get tags
- */
- getTags(): Observable
- {
- return this._httpClient.get('api/apps/ecommerce/inventory/tags').pipe(
- tap((tags) => {
- this._tags.next(tags);
- })
- );
- }
-
- /**
- * Create tag
- *
- * @param tag
- */
- createTag(tag: InventoryTag): Observable
- {
- return this.tags$.pipe(
- take(1),
- switchMap(tags => this._httpClient.post('api/apps/ecommerce/inventory/tag', {tag}).pipe(
- map((newTag) => {
-
- // Update the tags with the new tag
- this._tags.next([...tags, newTag]);
-
- // Return new tag from observable
- return newTag;
- })
- ))
- );
- }
-
- /**
- * Update the tag
- *
- * @param id
- * @param tag
- */
- updateTag(id: string, tag: InventoryTag): Observable
- {
- return this.tags$.pipe(
- take(1),
- switchMap(tags => this._httpClient.patch('api/apps/ecommerce/inventory/tag', {
- id,
- tag
- }).pipe(
- map((updatedTag) => {
-
- // Find the index of the updated tag
- const index = tags.findIndex(item => item.id === id);
-
- // Update the tag
- tags[index] = updatedTag;
-
- // Update the tags
- this._tags.next(tags);
-
- // Return the updated tag
- return updatedTag;
- })
- ))
- );
- }
-
- /**
- * Delete the tag
- *
- * @param id
- */
- deleteTag(id: string): Observable
- {
- return this.tags$.pipe(
- take(1),
- switchMap(tags => this._httpClient.delete('api/apps/ecommerce/inventory/tag', {params: {id}}).pipe(
- map((isDeleted: boolean) => {
-
- // Find the index of the deleted tag
- const index = tags.findIndex(item => item.id === id);
-
- // Delete the tag
- tags.splice(index, 1);
-
- // Update the tags
- this._tags.next(tags);
-
- // Return the deleted status
- return isDeleted;
- }),
- filter(isDeleted => isDeleted),
- switchMap(isDeleted => this.products$.pipe(
- take(1),
- map((products) => {
-
- // Iterate through the contacts
- products.forEach((product) => {
-
- const tagIndex = product.tags.findIndex(tag => tag === id);
-
- // If the contact has the tag, remove it
- if ( tagIndex > -1 )
- {
- product.tags.splice(tagIndex, 1);
- }
- });
-
- // Return the deleted status
- return isDeleted;
- })
- ))
- ))
- );
- }
-
- /**
- * Get vendors
- */
- getVendors(): Observable
- {
- return this._httpClient.get('api/apps/ecommerce/inventory/vendors').pipe(
- tap((vendors) => {
- this._vendors.next(vendors);
- })
- );
- }
-
- /**
- * Update the avatar of the given contact
- *
- * @param id
- * @param avatar
- */
- /*uploadAvatar(id: string, avatar: File): Observable
- {
- return this.contacts$.pipe(
- take(1),
- switchMap(contacts => this._httpClient.post('api/apps/contacts/avatar', {
- id,
- avatar
- }, {
- headers: {
- 'Content-Type': avatar.type
- }
- }).pipe(
- map((updatedContact) => {
-
- // Find the index of the updated contact
- const index = contacts.findIndex(item => item.id === id);
-
- // Update the contact
- contacts[index] = updatedContact;
-
- // Update the contacts
- this._contacts.next(contacts);
-
- // Return the updated contact
- return updatedContact;
- }),
- switchMap(updatedContact => this.contact$.pipe(
- take(1),
- filter(item => item && item.id === id),
- tap(() => {
-
- // Update the contact if it's selected
- this._contact.next(updatedContact);
-
- // Return the updated contact
- return updatedContact;
- })
- ))
- ))
- );
- }*/
-}
diff --git a/src/app/modules/admin/apps/ecommerce/inventory/inventory.types.ts b/src/app/modules/admin/apps/ecommerce/inventory/inventory.types.ts
deleted file mode 100644
index 5daed0ee..00000000
--- a/src/app/modules/admin/apps/ecommerce/inventory/inventory.types.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-export interface InventoryProduct
-{
- id: string;
- category?: string;
- name: string;
- description?: string;
- tags?: string[];
- sku?: string | null;
- barcode?: string | null;
- brand?: string | null;
- vendor: string | null;
- stock: number;
- reserved: number;
- cost: number;
- basePrice: number;
- taxPercent: number;
- price: number;
- weight: number;
- thumbnail: string;
- images: string[];
- active: boolean;
-}
-
-export interface InventoryPagination
-{
- length: number;
- size: number;
- page: number;
- lastPage: number;
- startIndex: number;
- endIndex: number;
-}
-
-export interface InventoryCategory
-{
- id: string;
- parentId: string;
- name: string;
- slug: string;
-}
-
-export interface InventoryBrand
-{
- id: string;
- name: string;
- slug: string;
-}
-
-export interface InventoryTag
-{
- id?: string;
- title?: string;
-}
-
-export interface InventoryVendor
-{
- id: string;
- name: string;
- slug: string;
-}
diff --git a/src/app/modules/admin/apps/ecommerce/inventory/list/inventory.component.html b/src/app/modules/admin/apps/ecommerce/inventory/list/inventory.component.html
deleted file mode 100644
index 77927ab8..00000000
--- a/src/app/modules/admin/apps/ecommerce/inventory/list/inventory.component.html
+++ /dev/null
@@ -1,567 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Add
-
-
-
-
-
-
-
-
-
-
-
0; else noProducts">
-
-
-
-
-
-
-
-
-
-
- SKU
- |
-
-
-
-
-
- No Image
-
-
- {{product.sku}}
-
- |
-
-
-
-
-
- Name
- |
-
- {{product.name}}
- |
-
-
-
-
-
- Price
- |
-
- {{product.price | currency:'USD':'symbol':'1.2-2'}}
- |
-
-
-
-
-
- Stock
- |
-
-
- {{product.stock}}
-
-
-
-
-
- = 20 && product.stock < 30">
-
-
-
- = 30">
-
-
-
- |
-
-
-
-
-
- Active
- |
-
-
-
- |
-
-
-
-
-
- Details
- |
-
-
-
-
- |
-
-
-
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- There are no products!
-
-
-
-
-
-
-
diff --git a/src/app/modules/admin/apps/ecommerce/inventory/list/inventory.component.ts b/src/app/modules/admin/apps/ecommerce/inventory/list/inventory.component.ts
deleted file mode 100644
index 5b35c2c1..00000000
--- a/src/app/modules/admin/apps/ecommerce/inventory/list/inventory.component.ts
+++ /dev/null
@@ -1,552 +0,0 @@
-import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
-import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
-import { MatCheckboxChange } from '@angular/material/checkbox';
-import { MatPaginator } from '@angular/material/paginator';
-import { MatSort } from '@angular/material/sort';
-import { merge, Observable, Subject } from 'rxjs';
-import { debounceTime, map, switchMap, takeUntil } from 'rxjs/operators';
-import { FuseAnimations } from '@fuse/animations';
-import { InventoryBrand, InventoryCategory, InventoryPagination, InventoryProduct, InventoryTag, InventoryVendor } from 'app/modules/admin/apps/ecommerce/inventory/inventory.types';
-import { InventoryService } from 'app/modules/admin/apps/ecommerce/inventory/inventory.service';
-
-@Component({
- selector : 'inventory-list',
- templateUrl : './inventory.component.html',
- encapsulation : ViewEncapsulation.None,
- changeDetection: ChangeDetectionStrategy.OnPush,
- animations : FuseAnimations
-})
-export class InventoryListComponent implements OnInit, AfterViewInit, OnDestroy
-{
- @ViewChild(MatPaginator) private _paginator: MatPaginator;
- @ViewChild(MatSort) private _sort: MatSort;
-
- products$: Observable;
-
- brands: InventoryBrand[];
- categories: InventoryCategory[];
- filteredTags: InventoryTag[];
- flashMessage: 'success' | 'error' | null = null;
- isLoading: boolean = false;
- pagination: InventoryPagination;
- productsCount: number = 0;
- productsTableColumns: string[] = ['sku', 'name', 'price', 'stock', 'active', 'details'];
- searchInputControl: FormControl = new FormControl();
- selectedProduct: InventoryProduct | null = null;
- selectedProductForm: FormGroup;
- tags: InventoryTag[];
- tagsEditMode: boolean = false;
- vendors: InventoryVendor[];
- private _unsubscribeAll: Subject = new Subject();
-
- /**
- * Constructor
- */
- constructor(
- private _changeDetectorRef: ChangeDetectorRef,
- private _formBuilder: FormBuilder,
- private _inventoryService: InventoryService
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Create the selected product form
- this.selectedProductForm = this._formBuilder.group({
- id : [''],
- category : [''],
- name : ['', [Validators.required]],
- description : [''],
- tags : [[]],
- sku : [''],
- barcode : [''],
- brand : [''],
- vendor : [''],
- stock : [''],
- reserved : [''],
- cost : [''],
- basePrice : [''],
- taxPercent : [''],
- price : [''],
- weight : [''],
- thumbnail : [''],
- images : [[]],
- currentImageIndex: [0], // Image index that is currently being viewed
- active : [false]
- });
-
- // Get the brands
- this._inventoryService.brands$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((brands: InventoryBrand[]) => {
-
- // Update the brands
- this.brands = brands;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Get the categories
- this._inventoryService.categories$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((categories: InventoryCategory[]) => {
-
- // Update the categories
- this.categories = categories;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Get the pagination
- this._inventoryService.pagination$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((pagination: InventoryPagination) => {
-
- // Update the pagination
- this.pagination = pagination;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Get the products
- this.products$ = this._inventoryService.products$;
- this._inventoryService.products$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((products: InventoryProduct[]) => {
-
- // Update the counts
- this.productsCount = products.length;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Get the tags
- this._inventoryService.tags$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((tags: InventoryTag[]) => {
-
- // Update the tags
- this.tags = tags;
- this.filteredTags = tags;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Get the vendors
- this._inventoryService.vendors$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((vendors: InventoryVendor[]) => {
-
- // Update the vendors
- this.vendors = vendors;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Subscribe to search input field value changes
- this.searchInputControl.valueChanges
- .pipe(
- takeUntil(this._unsubscribeAll),
- debounceTime(300),
- switchMap((query) => {
- this.closeDetails();
- this.isLoading = true;
- return this._inventoryService.getProducts(0, 10, 'name', 'asc', query);
- }),
- map(() => {
- this.isLoading = false;
- })
- )
- .subscribe();
- }
-
- /**
- * After view init
- */
- ngAfterViewInit(): void
- {
- // If the user changes the sort order...
- this._sort.sortChange
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe(() => {
- // Reset back to the first page
- this._paginator.pageIndex = 0;
-
- // Close the details
- this.closeDetails();
- });
-
- // Get products if sort or page changes
- merge(this._sort.sortChange, this._paginator.page).pipe(
- switchMap(() => {
- this.closeDetails();
- this.isLoading = true;
- return this._inventoryService.getProducts(this._paginator.pageIndex, this._paginator.pageSize, this._sort.active, this._sort.direction);
- }),
- map(() => {
- this.isLoading = false;
- })
- ).subscribe();
- }
-
- /**
- * On destroy
- */
- ngOnDestroy(): void
- {
- // Unsubscribe from all subscriptions
- this._unsubscribeAll.next();
- this._unsubscribeAll.complete();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Toggle product details
- *
- * @param productId
- */
- toggleDetails(productId: string): void
- {
- // If the product is already selected...
- if ( this.selectedProduct && this.selectedProduct.id === productId )
- {
- // Close the details
- this.closeDetails();
- return;
- }
-
- // Get the product by id
- this._inventoryService.getProductById(productId)
- .subscribe((product) => {
-
- // Set the selected product
- this.selectedProduct = product;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
-
- // Fill the form
- this.selectedProductForm.patchValue(product);
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
- }
-
- /**
- * Close the details
- */
- closeDetails(): void
- {
- this.selectedProduct = null;
- }
-
- /**
- * Cycle through images of selected product
- */
- cycleImages(forward: boolean = true): void
- {
- // Get the image count and current image index
- const count = this.selectedProductForm.get('images').value.length;
- const currentIndex = this.selectedProductForm.get('currentImageIndex').value;
-
- // Calculate the next and previous index
- const nextIndex = currentIndex + 1 === count ? 0 : currentIndex + 1;
- const prevIndex = currentIndex - 1 < 0 ? count - 1 : currentIndex - 1;
-
- // If cycling forward...
- if ( forward )
- {
- this.selectedProductForm.get('currentImageIndex').setValue(nextIndex);
- }
- // If cycling backwards...
- else
- {
- this.selectedProductForm.get('currentImageIndex').setValue(prevIndex);
- }
- }
-
- /**
- * Toggle the tags edit mode
- */
- toggleTagsEditMode(): void
- {
- this.tagsEditMode = !this.tagsEditMode;
- }
-
- /**
- * Filter tags
- *
- * @param event
- */
- filterTags(event): void
- {
- // Get the value
- const value = event.target.value.toLowerCase();
-
- // Filter the tags
- this.filteredTags = this.tags.filter(tag => tag.title.toLowerCase().includes(value));
- }
-
- /**
- * Filter tags input key down event
- *
- * @param event
- */
- filterTagsInputKeyDown(event): void
- {
- // Return if the pressed key is not 'Enter'
- if ( event.key !== 'Enter' )
- {
- return;
- }
-
- // If there is no tag available...
- if ( this.filteredTags.length === 0 )
- {
- // Create the tag
- this.createTag(event.target.value);
-
- // Clear the input
- event.target.value = '';
-
- // Return
- return;
- }
-
- // If there is a tag...
- const tag = this.filteredTags[0];
- const isTagApplied = this.selectedProduct.tags.find((id) => id === tag.id);
-
- // If the found tag is already applied to the contact...
- if ( isTagApplied )
- {
- // Remove the tag from the contact
- this.removeTagFromProduct(tag);
- }
- else
- {
- // Otherwise add the tag to the contact
- this.addTagToProduct(tag);
- }
- }
-
- /**
- * Create a new tag
- *
- * @param title
- */
- createTag(title: string): void
- {
- const tag = {
- title
- };
-
- // Create tag on the server
- this._inventoryService.createTag(tag)
- .subscribe((response) => {
-
- // Add the tag to the product
- this.addTagToProduct(response);
- });
- }
-
- /**
- * Update the tag title
- *
- * @param tag
- * @param event
- */
- updateTagTitle(tag: InventoryTag, event): void
- {
- // Update the title on the tag
- tag.title = event.target.value;
-
- // Update the tag on the server
- this._inventoryService.updateTag(tag.id, tag)
- .pipe(debounceTime(300))
- .subscribe();
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Delete the tag
- *
- * @param tag
- */
- deleteTag(tag: InventoryTag): void
- {
- // Delete the tag from the server
- this._inventoryService.deleteTag(tag.id).subscribe();
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Add tag to the product
- *
- * @param tag
- */
- addTagToProduct(tag: InventoryTag): void
- {
- // Add the tag
- this.selectedProduct.tags.unshift(tag.id);
-
- // Update the selected product form
- this.selectedProductForm.get('tags').patchValue(this.selectedProduct.tags);
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Remove tag from the product
- *
- * @param tag
- */
- removeTagFromProduct(tag: InventoryTag): void
- {
- // Remove the tag
- this.selectedProduct.tags.splice(this.selectedProduct.tags.findIndex(item => item === tag.id), 1);
-
- // Update the selected product form
- this.selectedProductForm.get('tags').patchValue(this.selectedProduct.tags);
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Toggle product tag
- *
- * @param tag
- * @param change
- */
- toggleProductTag(tag: InventoryTag, change: MatCheckboxChange): void
- {
- if ( change.checked )
- {
- this.addTagToProduct(tag);
- }
- else
- {
- this.removeTagFromProduct(tag);
- }
- }
-
- /**
- * Should the create tag button be visible
- *
- * @param inputValue
- */
- shouldShowCreateTagButton(inputValue: string): boolean
- {
- return !!!(inputValue === '' || this.tags.findIndex(tag => tag.title.toLowerCase() === inputValue.toLowerCase()) > -1);
- }
-
- /**
- * Create product
- */
- createProduct(): void
- {
- // Create the product
- this._inventoryService.createProduct().subscribe((newProduct) => {
-
- // Go to new product
- this.selectedProduct = newProduct;
-
- // Fill the form
- this.selectedProductForm.patchValue(newProduct);
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
- }
-
- /**
- * Update the selected product using the form mock-api
- */
- updateSelectedProduct(): void
- {
- // Get the product object
- const product = this.selectedProductForm.getRawValue();
-
- // Remove the currentImageIndex field
- delete product.currentImageIndex;
-
- // Update the product on the server
- this._inventoryService.updateProduct(product.id, product).subscribe(() => {
-
- // Show a success message
- this.showFlashMessage('success');
- });
- }
-
- /**
- * Delete the selected product using the form mock-api
- */
- deleteSelectedProduct(): void
- {
- // Get the product object
- const product = this.selectedProductForm.getRawValue();
-
- // Delete the product on the server
- this._inventoryService.deleteProduct(product.id).subscribe(() => {
-
- // Close the details
- this.closeDetails();
- });
- }
-
- /**
- * Show flash message
- */
- showFlashMessage(type: 'success' | 'error'): void
- {
- // Show the message
- this.flashMessage = type;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
-
- // Hide it after 3 seconds
- setTimeout(() => {
-
- this.flashMessage = null;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }, 3000);
- }
-
- /**
- * Track by function for ngFor loops
- *
- * @param index
- * @param item
- */
- trackByFn(index: number, item: any): any
- {
- return item.id || index;
- }
-}
diff --git a/src/app/modules/admin/apps/file-manager/details/details.component.html b/src/app/modules/admin/apps/file-manager/details/details.component.html
deleted file mode 100644
index 55599ee8..00000000
--- a/src/app/modules/admin/apps/file-manager/details/details.component.html
+++ /dev/null
@@ -1,105 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{item.name}}
-
- {{item.type.toUpperCase()}}
-
-
-
-
-
Information
-
-
-
Created By
-
{{item.createdBy}}
-
-
-
Created At
-
{{item.createdAt}}
-
-
-
Modified At
-
{{item.modifiedAt}}
-
-
-
-
-
Contents
-
{{item.contents}}
-
-
-
-
-
-
-
-
-
- {{item.description}}
-
-
- Click here to add a description
-
-
-
-
-
-
-
- Download
-
-
- Delete
-
-
-
-
diff --git a/src/app/modules/admin/apps/file-manager/details/details.component.ts b/src/app/modules/admin/apps/file-manager/details/details.component.ts
deleted file mode 100644
index da4751b0..00000000
--- a/src/app/modules/admin/apps/file-manager/details/details.component.ts
+++ /dev/null
@@ -1,91 +0,0 @@
-import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
-import { MatDrawerToggleResult } from '@angular/material/sidenav';
-import { Subject } from 'rxjs';
-import { takeUntil } from 'rxjs/operators';
-import { FileManagerListComponent } from 'app/modules/admin/apps/file-manager/list/list.component';
-import { FileManagerService } from 'app/modules/admin/apps/file-manager/file-manager.service';
-import { Item } from 'app/modules/admin/apps/file-manager/file-manager.types';
-
-@Component({
- selector : 'file-manager-details',
- templateUrl : './details.component.html',
- encapsulation : ViewEncapsulation.None,
- changeDetection: ChangeDetectionStrategy.OnPush
-})
-export class FileManagerDetailsComponent implements OnInit, OnDestroy
-{
- item: Item;
- private _unsubscribeAll: Subject = new Subject();
-
- /**
- * Constructor
- */
- constructor(
- private _changeDetectorRef: ChangeDetectorRef,
- private _fileManagerListComponent: FileManagerListComponent,
- private _fileManagerService: FileManagerService
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Open the drawer
- this._fileManagerListComponent.matDrawer.open();
-
- // Get the item
- this._fileManagerService.item$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((item: Item) => {
-
- // Open the drawer in case it is closed
- this._fileManagerListComponent.matDrawer.open();
-
- // Get the item
- this.item = item;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
- }
-
- /**
- * On destroy
- */
- ngOnDestroy(): void
- {
- // Unsubscribe from all subscriptions
- this._unsubscribeAll.next();
- this._unsubscribeAll.complete();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Close the drawer
- */
- closeDrawer(): Promise
- {
- return this._fileManagerListComponent.matDrawer.close();
- }
-
- /**
- * Track by function for ngFor loops
- *
- * @param index
- * @param item
- */
- trackByFn(index: number, item: any): any
- {
- return item.id || index;
- }
-}
diff --git a/src/app/modules/admin/apps/file-manager/file-manager.component.html b/src/app/modules/admin/apps/file-manager/file-manager.component.html
deleted file mode 100644
index 0680b43f..00000000
--- a/src/app/modules/admin/apps/file-manager/file-manager.component.html
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/app/modules/admin/apps/file-manager/file-manager.component.ts b/src/app/modules/admin/apps/file-manager/file-manager.component.ts
deleted file mode 100644
index 0fa2889b..00000000
--- a/src/app/modules/admin/apps/file-manager/file-manager.component.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';
-
-@Component({
- selector : 'file-manager',
- templateUrl : './file-manager.component.html',
- encapsulation : ViewEncapsulation.None,
- changeDetection: ChangeDetectionStrategy.OnPush
-})
-export class FileManagerComponent
-{
- /**
- * Constructor
- */
- constructor()
- {
- }
-}
diff --git a/src/app/modules/admin/apps/file-manager/file-manager.guards.ts b/src/app/modules/admin/apps/file-manager/file-manager.guards.ts
deleted file mode 100644
index 68a9bbfb..00000000
--- a/src/app/modules/admin/apps/file-manager/file-manager.guards.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import { Injectable } from '@angular/core';
-import { ActivatedRouteSnapshot, CanDeactivate, RouterStateSnapshot, UrlTree } from '@angular/router';
-import { Observable } from 'rxjs';
-import { FileManagerDetailsComponent } from 'app/modules/admin/apps/file-manager/details/details.component';
-
-@Injectable({
- providedIn: 'root'
-})
-export class CanDeactivateFileManagerDetails implements CanDeactivate
-{
- canDeactivate(
- component: FileManagerDetailsComponent,
- currentRoute: ActivatedRouteSnapshot,
- currentState: RouterStateSnapshot,
- nextState: RouterStateSnapshot
- ): Observable | Promise | boolean | UrlTree
- {
- // Get the next route
- let nextRoute: ActivatedRouteSnapshot = nextState.root;
- while ( nextRoute.firstChild )
- {
- nextRoute = nextRoute.firstChild;
- }
-
- // If the next state doesn't contain '/files'
- // it means we are navigating away from the
- // tasks app
- if ( !nextState.url.includes('/file-manager') )
- {
- // Let it navigate
- return true;
- }
-
- // If we are navigating to another task...
- if ( nextRoute.paramMap.get('id') )
- {
- // Just navigate
- return true;
- }
- // Otherwise...
- else
- {
- // Close the drawer first, and then navigate
- return component.closeDrawer().then(() => {
- return true;
- });
- }
- }
-}
diff --git a/src/app/modules/admin/apps/file-manager/file-manager.module.ts b/src/app/modules/admin/apps/file-manager/file-manager.module.ts
deleted file mode 100644
index 81582b8f..00000000
--- a/src/app/modules/admin/apps/file-manager/file-manager.module.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule } from '@angular/router';
-import { MatButtonModule } from '@angular/material/button';
-import { MatIconModule } from '@angular/material/icon';
-import { MatSidenavModule } from '@angular/material/sidenav';
-import { MatTooltipModule } from '@angular/material/tooltip';
-import { SharedModule } from 'app/shared/shared.module';
-import { fileManagerRoutes } from 'app/modules/admin/apps/file-manager/file-manager.routing';
-import { FileManagerComponent } from 'app/modules/admin/apps/file-manager/file-manager.component';
-import { FileManagerDetailsComponent } from 'app/modules/admin/apps/file-manager/details/details.component';
-import { FileManagerListComponent } from 'app/modules/admin/apps/file-manager/list/list.component';
-
-@NgModule({
- declarations: [
- FileManagerComponent,
- FileManagerDetailsComponent,
- FileManagerListComponent
- ],
- imports : [
- RouterModule.forChild(fileManagerRoutes),
- MatButtonModule,
- MatIconModule,
- MatSidenavModule,
- MatTooltipModule,
- SharedModule
- ]
-})
-export class FileManagerModule
-{
-}
diff --git a/src/app/modules/admin/apps/file-manager/file-manager.resolvers.ts b/src/app/modules/admin/apps/file-manager/file-manager.resolvers.ts
deleted file mode 100644
index b1138b80..00000000
--- a/src/app/modules/admin/apps/file-manager/file-manager.resolvers.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-import { Injectable } from '@angular/core';
-import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@angular/router';
-import { Observable, throwError } from 'rxjs';
-import { catchError } from 'rxjs/operators';
-import { FileManagerService } from 'app/modules/admin/apps/file-manager/file-manager.service';
-import { Item } from 'app/modules/admin/apps/file-manager/file-manager.types';
-
-@Injectable({
- providedIn: 'root'
-})
-export class FileManagerItemsResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _fileManagerService: FileManagerService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable-
- {
- return this._fileManagerService.getItems();
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class FileManagerItemResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(
- private _router: Router,
- private _fileManagerService: FileManagerService
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
-
- {
- return this._fileManagerService.getItemById(route.paramMap.get('id'))
- .pipe(
- // Error here means the requested task is not available
- catchError((error) => {
-
- // Log the error
- console.error(error);
-
- // Get the parent url
- const parentUrl = state.url.split('/').slice(0, -1).join('/');
-
- // Navigate to there
- this._router.navigateByUrl(parentUrl);
-
- // Throw an error
- return throwError(error);
- })
- );
- }
-}
diff --git a/src/app/modules/admin/apps/file-manager/file-manager.routing.ts b/src/app/modules/admin/apps/file-manager/file-manager.routing.ts
deleted file mode 100644
index db36be9d..00000000
--- a/src/app/modules/admin/apps/file-manager/file-manager.routing.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import { Route } from '@angular/router';
-import { CanDeactivateFileManagerDetails } from 'app/modules/admin/apps/file-manager/file-manager.guards';
-import { FileManagerComponent } from 'app/modules/admin/apps/file-manager/file-manager.component';
-import { FileManagerListComponent } from 'app/modules/admin/apps/file-manager/list/list.component';
-import { FileManagerDetailsComponent } from 'app/modules/admin/apps/file-manager/details/details.component';
-import { FileManagerItemResolver, FileManagerItemsResolver } from 'app/modules/admin/apps/file-manager/file-manager.resolvers';
-
-export const fileManagerRoutes: Route[] = [
- {
- path : '',
- component: FileManagerComponent,
- children : [
- {
- path : '',
- component: FileManagerListComponent,
- resolve : {
- items: FileManagerItemsResolver
- },
- children : [
- {
- path : ':id',
- component : FileManagerDetailsComponent,
- resolve : {
- item: FileManagerItemResolver
- },
- canDeactivate: [CanDeactivateFileManagerDetails]
- }
- ]
- }
- ]
- }
-];
diff --git a/src/app/modules/admin/apps/file-manager/file-manager.service.ts b/src/app/modules/admin/apps/file-manager/file-manager.service.ts
deleted file mode 100644
index 0f89e9e5..00000000
--- a/src/app/modules/admin/apps/file-manager/file-manager.service.ts
+++ /dev/null
@@ -1,88 +0,0 @@
-import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
-import { BehaviorSubject, Observable, of, throwError } from 'rxjs';
-import { map, switchMap, take, tap } from 'rxjs/operators';
-import { Item, Items } from 'app/modules/admin/apps/file-manager/file-manager.types';
-
-@Injectable({
- providedIn: 'root'
-})
-export class FileManagerService
-{
- // Private
- private _item: BehaviorSubject
- = new BehaviorSubject(null);
- private _items: BehaviorSubject = new BehaviorSubject(null);
-
- /**
- * Constructor
- */
- constructor(private _httpClient: HttpClient)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Accessors
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Getter for items
- */
- get items$(): Observable
- {
- return this._items.asObservable();
- }
-
- /**
- * Getter for item
- */
- get item$(): Observable
-
- {
- return this._item.asObservable();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Get items
- */
- getItems(): Observable
-
- {
- return this._httpClient.get('api/apps/file-manager').pipe(
- tap((response: any) => {
- this._items.next(response);
- })
- );
- }
-
- /**
- * Get item by id
- */
- getItemById(id: string): Observable
-
- {
- return this._items.pipe(
- take(1),
- map((items) => {
-
- // Find within the folders and files
- const item = [...items.folders, ...items.files].find(value => value.id === id) || null;
-
- // Update the item
- this._item.next(item);
-
- // Return the item
- return item;
- }),
- switchMap((item) => {
-
- if ( !item )
- {
- return throwError('Could not found the item with id of ' + id + '!');
- }
-
- return of(item);
- })
- );
- }
-}
diff --git a/src/app/modules/admin/apps/file-manager/file-manager.types.ts b/src/app/modules/admin/apps/file-manager/file-manager.types.ts
deleted file mode 100644
index c779ca9b..00000000
--- a/src/app/modules/admin/apps/file-manager/file-manager.types.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-export interface Items
-{
- folders: Item[];
- files: Item[];
-}
-
-export interface Item
-{
- id?: string;
- name?: string;
- createdBy?: string;
- createdAt?: string;
- modifiedAt?: string;
- size?: string;
- type?: string;
- contents?: string | null;
- description?: string | null;
-}
diff --git a/src/app/modules/admin/apps/file-manager/list/list.component.html b/src/app/modules/admin/apps/file-manager/list/list.component.html
deleted file mode 100644
index 83cc8b75..00000000
--- a/src/app/modules/admin/apps/file-manager/list/list.component.html
+++ /dev/null
@@ -1,133 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{items.folders.length}} folders, {{items.files.length}} files
-
-
-
-
-
-
-
- Upload file
-
-
-
-
-
-
0; else noItems">
-
-
-
Folders
-
-
-
-
-
-
-
-
Files
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{item.type.toUpperCase()}}
-
-
-
-
-
-
-
-
{{item.name}}
-
- {{item.contents}}
-
-
-
-
-
-
-
-
-
-
There are no items!
-
-
-
-
-
-
-
-
-
-
diff --git a/src/app/modules/admin/apps/file-manager/list/list.component.ts b/src/app/modules/admin/apps/file-manager/list/list.component.ts
deleted file mode 100644
index 5c65d394..00000000
--- a/src/app/modules/admin/apps/file-manager/list/list.component.ts
+++ /dev/null
@@ -1,147 +0,0 @@
-import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Inject, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
-import { DOCUMENT } from '@angular/common';
-import { ActivatedRoute, Router } from '@angular/router';
-import { MatDrawer } from '@angular/material/sidenav';
-import { Subject } from 'rxjs';
-import { takeUntil } from 'rxjs/operators';
-import { FuseMediaWatcherService } from '@fuse/services/media-watcher';
-import { FuseNavigationService } from '@fuse/components/navigation';
-import { FileManagerService } from 'app/modules/admin/apps/file-manager/file-manager.service';
-import { Item, Items } from 'app/modules/admin/apps/file-manager/file-manager.types';
-
-@Component({
- selector : 'file-manager-list',
- templateUrl : './list.component.html',
- encapsulation : ViewEncapsulation.None,
- changeDetection: ChangeDetectionStrategy.OnPush
-})
-export class FileManagerListComponent implements OnInit, OnDestroy
-{
- @ViewChild('matDrawer', {static: true}) matDrawer: MatDrawer;
- drawerMode: 'side' | 'over';
- selectedItem: Item;
- items: Items;
- private _unsubscribeAll: Subject = new Subject();
-
- /**
- * Constructor
- */
- constructor(
- private _activatedRoute: ActivatedRoute,
- private _changeDetectorRef: ChangeDetectorRef,
- @Inject(DOCUMENT) private _document: any,
- private _router: Router,
- private _fileManagerService: FileManagerService,
- private _fuseMediaWatcherService: FuseMediaWatcherService,
- private _fuseNavigationService: FuseNavigationService
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Get the items
- this._fileManagerService.items$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((items: Items) => {
- this.items = items;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Get the item
- this._fileManagerService.item$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((item: Item) => {
- this.selectedItem = item;
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
-
- // Subscribe to media query change
- this._fuseMediaWatcherService.onMediaQueryChange$('(min-width: 1440px)')
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((state) => {
-
- // Calculate the drawer mode
- this.drawerMode = state.matches ? 'side' : 'over';
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- });
- }
-
- /**
- * On destroy
- */
- ngOnDestroy(): void
- {
- // Unsubscribe from all subscriptions
- this._unsubscribeAll.next();
- this._unsubscribeAll.complete();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Go to item
- *
- * @param id
- */
- goToItem(id: string): void
- {
- // Get the current activated route
- let route = this._activatedRoute;
- while ( route.firstChild )
- {
- route = route.firstChild;
- }
-
- // Go to item
- this._router.navigate(['../', id], {relativeTo: route});
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * On backdrop clicked
- */
- onBackdropClicked(): void
- {
- // Get the current activated route
- let route = this._activatedRoute;
- while ( route.firstChild )
- {
- route = route.firstChild;
- }
-
- // Go back to the parent route
- this._router.navigate(['../'], {relativeTo: route});
-
- // Mark for check
- this._changeDetectorRef.markForCheck();
- }
-
- /**
- * Track by function for ngFor loops
- *
- * @param index
- * @param item
- */
- trackByFn(index: number, item: any): any
- {
- return item.id || index;
- }
-}
diff --git a/src/app/modules/admin/apps/help-center/faqs/faqs.component.html b/src/app/modules/admin/apps/help-center/faqs/faqs.component.html
deleted file mode 100644
index e50cd9c3..00000000
--- a/src/app/modules/admin/apps/help-center/faqs/faqs.component.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
- Back to Help Center
-
-
-
-
- {{faqCategory.title}}
-
-
-
- {{faq.question}}
-
- {{faq.answer}}
-
-
-
-
-
-
-
diff --git a/src/app/modules/admin/apps/help-center/faqs/faqs.component.ts b/src/app/modules/admin/apps/help-center/faqs/faqs.component.ts
deleted file mode 100644
index c820d2d3..00000000
--- a/src/app/modules/admin/apps/help-center/faqs/faqs.component.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
-import { Subject } from 'rxjs';
-import { takeUntil } from 'rxjs/operators';
-import { HelpCenterService } from 'app/modules/admin/apps/help-center/help-center.service';
-import { FaqCategory } from 'app/modules/admin/apps/help-center/help-center.type';
-
-@Component({
- selector : 'help-center-faqs',
- templateUrl : './faqs.component.html',
- encapsulation: ViewEncapsulation.None
-})
-export class HelpCenterFaqsComponent implements OnInit, OnDestroy
-{
- faqCategories: FaqCategory[];
- private _unsubscribeAll: Subject = new Subject();
-
- /**
- * Constructor
- */
- constructor(private _helpCenterService: HelpCenterService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Get the FAQs
- this._helpCenterService.faqs$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((faqCategories) => {
- this.faqCategories = faqCategories;
- });
- }
-
- /**
- * On destroy
- */
- ngOnDestroy(): void
- {
- // Unsubscribe from all subscriptions
- this._unsubscribeAll.next();
- this._unsubscribeAll.complete();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Track by function for ngFor loops
- *
- * @param index
- * @param item
- */
- trackByFn(index: number, item: any): any
- {
- return item.id || index;
- }
-}
diff --git a/src/app/modules/admin/apps/help-center/guides/category/category.component.html b/src/app/modules/admin/apps/help-center/guides/category/category.component.html
deleted file mode 100644
index ded38c91..00000000
--- a/src/app/modules/admin/apps/help-center/guides/category/category.component.html
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
- Back to Help Center
-
-
-
-
-
-
-
-
diff --git a/src/app/modules/admin/apps/help-center/guides/category/category.component.ts b/src/app/modules/admin/apps/help-center/guides/category/category.component.ts
deleted file mode 100644
index 06a81863..00000000
--- a/src/app/modules/admin/apps/help-center/guides/category/category.component.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
-import { ActivatedRoute, Router } from '@angular/router';
-import { Subject } from 'rxjs';
-import { takeUntil } from 'rxjs/operators';
-import { HelpCenterService } from 'app/modules/admin/apps/help-center/help-center.service';
-import { GuideCategory } from 'app/modules/admin/apps/help-center/help-center.type';
-
-@Component({
- selector : 'help-center-guides-category',
- templateUrl : './category.component.html',
- encapsulation: ViewEncapsulation.None
-})
-export class HelpCenterGuidesCategoryComponent implements OnInit, OnDestroy
-{
- guideCategory: GuideCategory;
- private _unsubscribeAll: Subject = new Subject();
-
- /**
- * Constructor
- */
- constructor(
- private _activatedRoute: ActivatedRoute,
- private _helpCenterService: HelpCenterService,
- private _router: Router
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Get the Guides
- this._helpCenterService.guides$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((guideCategories) => {
- this.guideCategory = guideCategories[0];
- });
- }
-
- /**
- * On destroy
- */
- ngOnDestroy(): void
- {
- // Unsubscribe from all subscriptions
- this._unsubscribeAll.next();
- this._unsubscribeAll.complete();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Track by function for ngFor loops
- *
- * @param index
- * @param item
- */
- trackByFn(index: number, item: any): any
- {
- return item.id || index;
- }
-}
diff --git a/src/app/modules/admin/apps/help-center/guides/guide/guide.component.html b/src/app/modules/admin/apps/help-center/guides/guide/guide.component.html
deleted file mode 100644
index f5a02ab3..00000000
--- a/src/app/modules/admin/apps/help-center/guides/guide/guide.component.html
+++ /dev/null
@@ -1,52 +0,0 @@
-
diff --git a/src/app/modules/admin/apps/help-center/guides/guide/guide.component.ts b/src/app/modules/admin/apps/help-center/guides/guide/guide.component.ts
deleted file mode 100644
index c89c3cbb..00000000
--- a/src/app/modules/admin/apps/help-center/guides/guide/guide.component.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
-import { Subject } from 'rxjs';
-import { takeUntil } from 'rxjs/operators';
-import { HelpCenterService } from 'app/modules/admin/apps/help-center/help-center.service';
-import { GuideCategory } from 'app/modules/admin/apps/help-center/help-center.type';
-
-@Component({
- selector : 'help-center-guides-guide',
- templateUrl : './guide.component.html',
- encapsulation: ViewEncapsulation.None
-})
-export class HelpCenterGuidesGuideComponent implements OnInit, OnDestroy
-{
- guideCategory: GuideCategory;
- private _unsubscribeAll: Subject = new Subject();
-
- /**
- * Constructor
- */
- constructor(private _helpCenterService: HelpCenterService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Get the Guides
- this._helpCenterService.guide$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((guideCategory) => {
- this.guideCategory = guideCategory;
- });
- }
-
- /**
- * On destroy
- */
- ngOnDestroy(): void
- {
- // Unsubscribe from all subscriptions
- this._unsubscribeAll.next();
- this._unsubscribeAll.complete();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Track by function for ngFor loops
- *
- * @param index
- * @param item
- */
- trackByFn(index: number, item: any): any
- {
- return item.id || index;
- }
-}
diff --git a/src/app/modules/admin/apps/help-center/guides/guides.component.html b/src/app/modules/admin/apps/help-center/guides/guides.component.html
deleted file mode 100644
index 44ac0df5..00000000
--- a/src/app/modules/admin/apps/help-center/guides/guides.component.html
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
- Back to Help Center
-
-
-
-
-
-
-
-
diff --git a/src/app/modules/admin/apps/help-center/guides/guides.component.ts b/src/app/modules/admin/apps/help-center/guides/guides.component.ts
deleted file mode 100644
index 018e32e6..00000000
--- a/src/app/modules/admin/apps/help-center/guides/guides.component.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
-import { Subject } from 'rxjs';
-import { takeUntil } from 'rxjs/operators';
-import { HelpCenterService } from 'app/modules/admin/apps/help-center/help-center.service';
-import { GuideCategory } from 'app/modules/admin/apps/help-center/help-center.type';
-
-@Component({
- selector : 'help-center-guides',
- templateUrl : './guides.component.html',
- encapsulation: ViewEncapsulation.None
-})
-export class HelpCenterGuidesComponent implements OnInit, OnDestroy
-{
- guideCategories: GuideCategory[];
- private _unsubscribeAll: Subject = new Subject();
-
- /**
- * Constructor
- */
- constructor(private _helpCenterService: HelpCenterService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Get the Guide categories
- this._helpCenterService.guides$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((guideCategories) => {
- this.guideCategories = guideCategories;
- });
- }
-
- /**
- * On destroy
- */
- ngOnDestroy(): void
- {
- // Unsubscribe from all subscriptions
- this._unsubscribeAll.next();
- this._unsubscribeAll.complete();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Track by function for ngFor loops
- *
- * @param index
- * @param item
- */
- trackByFn(index: number, item: any): any
- {
- return item.id || index;
- }
-}
diff --git a/src/app/modules/admin/apps/help-center/help-center.component.html b/src/app/modules/admin/apps/help-center/help-center.component.html
deleted file mode 100644
index eda3d4e4..00000000
--- a/src/app/modules/admin/apps/help-center/help-center.component.html
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
-
-
-
-
-
-
-
HELP CENTER
-
-
- Search for a topic or question, check out our FAQs and guides, contact us for detailed support
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Here are the most frequently asked questions you may check before getting started
-
-
-
- {{faq.question}}
-
- {{faq.answer}}
-
-
-
-
diff --git a/src/app/modules/admin/apps/help-center/help-center.component.ts b/src/app/modules/admin/apps/help-center/help-center.component.ts
deleted file mode 100644
index a242e62b..00000000
--- a/src/app/modules/admin/apps/help-center/help-center.component.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
-import { Subject } from 'rxjs';
-import { takeUntil } from 'rxjs/operators';
-import { HelpCenterService } from 'app/modules/admin/apps/help-center/help-center.service';
-import { FaqCategory } from 'app/modules/admin/apps/help-center/help-center.type';
-
-@Component({
- selector : 'help-center',
- templateUrl : './help-center.component.html',
- encapsulation: ViewEncapsulation.None
-})
-export class HelpCenterComponent implements OnInit, OnDestroy
-{
- faqCategory: FaqCategory;
- private _unsubscribeAll: Subject = new Subject();
-
- /**
- * Constructor
- */
- constructor(private _helpCenterService: HelpCenterService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Get the FAQs
- this._helpCenterService.faqs$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((faqCategories) => {
- this.faqCategory = faqCategories[0];
- });
- }
-
- /**
- * On destroy
- */
- ngOnDestroy(): void
- {
- // Unsubscribe from all subscriptions
- this._unsubscribeAll.next();
- this._unsubscribeAll.complete();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Track by function for ngFor loops
- *
- * @param index
- * @param item
- */
- trackByFn(index: number, item: any): any
- {
- return item.id || index;
- }
-}
diff --git a/src/app/modules/admin/apps/help-center/help-center.module.ts b/src/app/modules/admin/apps/help-center/help-center.module.ts
deleted file mode 100644
index eb22b864..00000000
--- a/src/app/modules/admin/apps/help-center/help-center.module.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule } from '@angular/router';
-import { MatButtonModule } from '@angular/material/button';
-import { MatExpansionModule } from '@angular/material/expansion';
-import { MatFormFieldModule } from '@angular/material/form-field';
-import { MatIconModule } from '@angular/material/icon';
-import { MatInputModule } from '@angular/material/input';
-import { FuseAlertModule } from '@fuse/components/alert';
-import { SharedModule } from 'app/shared/shared.module';
-import { HelpCenterComponent } from 'app/modules/admin/apps/help-center/help-center.component';
-import { HelpCenterFaqsComponent } from 'app/modules/admin/apps/help-center/faqs/faqs.component';
-import { HelpCenterGuidesComponent } from 'app/modules/admin/apps/help-center/guides/guides.component';
-import { HelpCenterGuidesCategoryComponent } from 'app/modules/admin/apps/help-center/guides/category/category.component';
-import { HelpCenterGuidesGuideComponent } from 'app/modules/admin/apps/help-center/guides/guide/guide.component';
-import { HelpCenterSupportComponent } from 'app/modules/admin/apps/help-center/support/support.component';
-import { helpCenterRoutes } from 'app/modules/admin/apps/help-center/help-center.routing';
-
-@NgModule({
- declarations: [
- HelpCenterComponent,
- HelpCenterFaqsComponent,
- HelpCenterGuidesComponent,
- HelpCenterGuidesCategoryComponent,
- HelpCenterGuidesGuideComponent,
- HelpCenterSupportComponent
- ],
- imports : [
- RouterModule.forChild(helpCenterRoutes),
- MatButtonModule,
- MatExpansionModule,
- MatFormFieldModule,
- MatIconModule,
- MatInputModule,
- FuseAlertModule,
- SharedModule
- ]
-})
-export class HelpCenterModule
-{
-}
diff --git a/src/app/modules/admin/apps/help-center/help-center.resolvers.ts b/src/app/modules/admin/apps/help-center/help-center.resolvers.ts
deleted file mode 100644
index 50d85fab..00000000
--- a/src/app/modules/admin/apps/help-center/help-center.resolvers.ts
+++ /dev/null
@@ -1,145 +0,0 @@
-import { Injectable } from '@angular/core';
-import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
-import { Observable } from 'rxjs';
-import { HelpCenterService } from 'app/modules/admin/apps/help-center/help-center.service';
-import { FaqCategory, GuideCategory } from 'app/modules/admin/apps/help-center/help-center.type';
-
-@Injectable({
- providedIn: 'root'
-})
-export class HelpCenterMostAskedFaqsResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _helpCenterService: HelpCenterService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._helpCenterService.getFaqsByCategory('most-asked');
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class HelpCenterFaqsResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _helpCenterService: HelpCenterService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._helpCenterService.getAllFaqs();
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class HelpCenterGuidesResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _helpCenterService: HelpCenterService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._helpCenterService.getAllGuides();
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class HelpCenterGuidesCategoryResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _helpCenterService: HelpCenterService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._helpCenterService.getGuidesByCategory(route.paramMap.get('categorySlug'));
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class HelpCenterGuidesGuideResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _helpCenterService: HelpCenterService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._helpCenterService.getGuide(route.parent.paramMap.get('categorySlug'), route.paramMap.get('guideSlug'));
- }
-}
diff --git a/src/app/modules/admin/apps/help-center/help-center.routing.ts b/src/app/modules/admin/apps/help-center/help-center.routing.ts
deleted file mode 100644
index 98fb878c..00000000
--- a/src/app/modules/admin/apps/help-center/help-center.routing.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-import { Route } from '@angular/router';
-import { HelpCenterComponent } from 'app/modules/admin/apps/help-center/help-center.component';
-import { HelpCenterFaqsComponent } from 'app/modules/admin/apps/help-center/faqs/faqs.component';
-import { HelpCenterGuidesComponent } from 'app/modules/admin/apps/help-center/guides/guides.component';
-import { HelpCenterGuidesCategoryComponent } from 'app/modules/admin/apps/help-center/guides/category/category.component';
-import { HelpCenterGuidesGuideComponent } from 'app/modules/admin/apps/help-center/guides/guide/guide.component';
-import { HelpCenterSupportComponent } from 'app/modules/admin/apps/help-center/support/support.component';
-import { HelpCenterFaqsResolver, HelpCenterGuidesCategoryResolver, HelpCenterGuidesGuideResolver, HelpCenterGuidesResolver, HelpCenterMostAskedFaqsResolver } from 'app/modules/admin/apps/help-center/help-center.resolvers';
-
-export const helpCenterRoutes: Route[] = [
- {
- path : '',
- component: HelpCenterComponent,
- resolve : {
- faqs: HelpCenterMostAskedFaqsResolver
- }
- },
- {
- path : 'faqs',
- component: HelpCenterFaqsComponent,
- resolve : {
- faqs: HelpCenterFaqsResolver
- }
- },
- {
- path : 'guides',
- children: [
- {
- path : '',
- component: HelpCenterGuidesComponent,
- resolve : {
- guides: HelpCenterGuidesResolver
- }
- },
- {
- path : ':categorySlug',
- children: [
- {
- path : '',
- component: HelpCenterGuidesCategoryComponent,
- resolve : {
- guides: HelpCenterGuidesCategoryResolver
- }
- },
- {
- path : ':guideSlug',
- component: HelpCenterGuidesGuideComponent,
- resolve : {
- guide: HelpCenterGuidesGuideResolver
- }
- }
- ]
- }
- ]
- },
- {
- path : 'support',
- component: HelpCenterSupportComponent
- }
-];
diff --git a/src/app/modules/admin/apps/help-center/help-center.service.ts b/src/app/modules/admin/apps/help-center/help-center.service.ts
deleted file mode 100644
index df9f03d9..00000000
--- a/src/app/modules/admin/apps/help-center/help-center.service.ts
+++ /dev/null
@@ -1,134 +0,0 @@
-import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
-import { Observable, ReplaySubject } from 'rxjs';
-import { tap } from 'rxjs/operators';
-import { FaqCategory, Guide, GuideCategory } from 'app/modules/admin/apps/help-center/help-center.type';
-
-@Injectable({
- providedIn: 'root'
-})
-export class HelpCenterService
-{
- private _faqs: ReplaySubject = new ReplaySubject(1);
- private _guides: ReplaySubject = new ReplaySubject(1);
- private _guide: ReplaySubject = new ReplaySubject(1);
-
- /**
- * Constructor
- */
- constructor(private _httpClient: HttpClient)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Accessors
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Getter for FAQs
- */
- get faqs$(): Observable
- {
- return this._faqs.asObservable();
- }
-
- /**
- * Getter for guides
- */
- get guides$(): Observable
- {
- return this._guides.asObservable();
- }
-
- /**
- * Getter for guide
- */
- get guide$(): Observable
- {
- return this._guide.asObservable();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Get all FAQs
- */
- getAllFaqs(): Observable
- {
- return this._httpClient.get('api/apps/help-center/faqs').pipe(
- tap((response: any) => {
- this._faqs.next(response);
- })
- );
- }
-
- /**
- * Get FAQs by category using category slug
- *
- * @param slug
- */
- getFaqsByCategory(slug: string): Observable
- {
- return this._httpClient.get('api/apps/help-center/faqs', {
- params: {slug}
- }).pipe(
- tap((response: any) => {
- this._faqs.next(response);
- })
- );
- }
-
- /**
- * Get all guides limited per category by the given number
- *
- * @param limit
- */
- getAllGuides(limit = '4'): Observable
- {
- return this._httpClient.get('api/apps/help-center/guides', {
- params: {limit}
- }).pipe(
- tap((response: any) => {
- this._guides.next(response);
- })
- );
- }
-
- /**
- * Get guides by category using category slug
- *
- * @param slug
- */
- getGuidesByCategory(slug: string): Observable
- {
- return this._httpClient.get('api/apps/help-center/guides', {
- params: {slug}
- }).pipe(
- tap((response: any) => {
- this._guides.next(response);
- })
- );
- }
-
- /**
- * Get guide by category and guide slug
- *
- * @param categorySlug
- * @param guideSlug
- */
- getGuide(categorySlug: string, guideSlug: string): Observable
- {
- return this._httpClient.get('api/apps/help-center/guide', {
- params: {
- categorySlug,
- guideSlug
- }
- }).pipe(
- tap((response: any) => {
- this._guide.next(response);
- })
- );
- }
-}
diff --git a/src/app/modules/admin/apps/help-center/help-center.type.ts b/src/app/modules/admin/apps/help-center/help-center.type.ts
deleted file mode 100644
index dd6328df..00000000
--- a/src/app/modules/admin/apps/help-center/help-center.type.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-export interface FaqCategory
-{
- id: string;
- slug: string;
- title: string;
- faqs?: Faq[];
-}
-
-export interface Faq
-{
- id: string;
- categoryId: string;
- question: string;
- answer: string;
-}
-
-export interface GuideCategory
-{
- id: string;
- slug: string;
- title: string;
- totalGuides?: number;
- visibleGuides?: number;
- guides?: Guide[];
-}
-
-export interface Guide
-{
- id: string;
- categoryId: string;
- slug: string;
- title: string;
- subtitle?: string;
- content?: string;
-}
diff --git a/src/app/modules/admin/apps/help-center/support/support.component.html b/src/app/modules/admin/apps/help-center/support/support.component.html
deleted file mode 100644
index 216153cf..00000000
--- a/src/app/modules/admin/apps/help-center/support/support.component.html
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
-
-
-
-
-
-
- Back to Help Center
-
-
-
-
-
-
-
- {{alert.message}}
-
-
-
-
-
-
diff --git a/src/app/modules/admin/apps/help-center/support/support.component.ts b/src/app/modules/admin/apps/help-center/support/support.component.ts
deleted file mode 100644
index 77714f31..00000000
--- a/src/app/modules/admin/apps/help-center/support/support.component.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-import { Component, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
-import { FormBuilder, FormGroup, NgForm, Validators } from '@angular/forms';
-import { FuseAnimations } from '@fuse/animations';
-import { HelpCenterService } from 'app/modules/admin/apps/help-center/help-center.service';
-
-@Component({
- selector : 'help-center-support',
- templateUrl : './support.component.html',
- encapsulation: ViewEncapsulation.None,
- animations : FuseAnimations
-})
-export class HelpCenterSupportComponent implements OnInit
-{
- @ViewChild('supportNgForm') supportNgForm: NgForm;
-
- alert: any;
- supportForm: FormGroup;
-
- /**
- * Constructor
- */
- constructor(
- private _formBuilder: FormBuilder,
- private _helpCenterService: HelpCenterService
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Create the support form
- this.supportForm = this._formBuilder.group({
- name : ['', Validators.required],
- email : ['', [Validators.required, Validators.email]],
- subject: ['', Validators.required],
- message: ['', Validators.required]
- });
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Clear the form
- */
- clearForm(): void
- {
- // Reset the form
- this.supportNgForm.resetForm();
- }
-
- /**
- * Send the form
- */
- sendForm(): void
- {
- // Send your form here using an http request
- console.log('Your message has been sent!');
-
- // Show a success message (it can also be an error message)
- // and remove it after 5 seconds
- this.alert = {
- type : 'success',
- message: 'Your request has been delivered! A member of our support staff will respond as soon as possible.'
- };
-
- setTimeout(() => {
- this.alert = null;
- }, 7000);
-
- // Clear the form
- this.clearForm();
- }
-}
diff --git a/src/app/modules/admin/apps/mailbox/compose/compose.component.html b/src/app/modules/admin/apps/mailbox/compose/compose.component.html
deleted file mode 100644
index 6179e661..00000000
--- a/src/app/modules/admin/apps/mailbox/compose/compose.component.html
+++ /dev/null
@@ -1,132 +0,0 @@
-
diff --git a/src/app/modules/admin/apps/mailbox/compose/compose.component.ts b/src/app/modules/admin/apps/mailbox/compose/compose.component.ts
deleted file mode 100644
index 7b8dccf6..00000000
--- a/src/app/modules/admin/apps/mailbox/compose/compose.component.ts
+++ /dev/null
@@ -1,110 +0,0 @@
-import { Component, OnInit, ViewEncapsulation } from '@angular/core';
-import { FormBuilder, FormGroup, Validators } from '@angular/forms';
-import { MatDialogRef } from '@angular/material/dialog';
-
-@Component({
- selector : 'mailbox-compose',
- templateUrl : './compose.component.html',
- encapsulation: ViewEncapsulation.None
-})
-export class MailboxComposeComponent implements OnInit
-{
- composeForm: FormGroup;
- copyFields: { cc: boolean, bcc: boolean } = {
- cc : false,
- bcc: false
- };
- quillModules: any = {
- toolbar: [
- ['bold', 'italic', 'underline'],
- [{align: []}, {list: 'ordered'}, {list: 'bullet'}],
- ['clean']
- ]
- };
-
- /**
- * Constructor
- */
- constructor(
- public matDialogRef: MatDialogRef,
- private _formBuilder: FormBuilder
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Create the form
- this.composeForm = this._formBuilder.group({
- to : ['', [Validators.required, Validators.email]],
- cc : ['', [Validators.email]],
- bcc : ['', [Validators.email]],
- subject: [''],
- body : ['', [Validators.required]]
- });
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Show the copy field with the given field name
- *
- * @param name
- */
- showCopyField(name: string): void
- {
- // Return if the name is not one of the available names
- if ( name !== 'cc' && name !== 'bcc' )
- {
- return;
- }
-
- // Show the field
- this.copyFields[name] = true;
- }
-
- /**
- * Save and close
- */
- saveAndClose(): void
- {
- // Save the message as a draft
- this.saveAsDraft();
-
- // Close the dialog
- this.matDialogRef.close();
- }
-
- /**
- * Discard the message
- */
- discard(): void
- {
-
- }
-
- /**
- * Save the message as a draft
- */
- saveAsDraft(): void
- {
-
- }
-
- /**
- * Send the message
- */
- send(): void
- {
-
- }
-}
diff --git a/src/app/modules/admin/apps/mailbox/details/details.component.html b/src/app/modules/admin/apps/mailbox/details/details.component.html
deleted file mode 100644
index 755aad04..00000000
--- a/src/app/modules/admin/apps/mailbox/details/details.component.html
+++ /dev/null
@@ -1,409 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{label.title}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Mark as read
-
-
-
- Mark as unread
-
-
-
-
- Spam
-
-
-
- Not spam
-
-
-
-
- Delete
-
-
-
-
-
-
-
-
{{mail.subject}}
-
-
0">
-
-
-
- {{label.title}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{mail.from.contact.split('<')[0].trim()}}
-
-
-
-
to
-
me
-
0">
-
- and
- {{mail.ccCount + mail.bccCount}}
-
- other
- others
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
from:
-
{{mail.from.contact}}
-
-
-
-
-
-
-
cc:
-
{{mail.cc.join(',\n')}}
-
-
-
-
-
-
bcc:
-
{{mail.bcc.join(',\n')}}
-
-
-
-
-
date:
-
{{mail.date | date:'EEEE, MMMM d, y - hh:mm a'}}
-
-
-
-
subject:
-
{{mail.subject}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
0">
-
-
-
-
-
{{mail.attachments.length}} Attachments
-
-
-
-
-
-
-
-
-
-
- {{attachment.type.split('/')[1].trim().toUpperCase()}}
-
-
-
-
-
- {{attachment.name}}
-
-
- {{attachment.size / 1000 | number:'1.0-2'}} KB
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Reply
-
-
-
-
- Reply All
-
-
-
-
- Forward
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Discard
-
-
-
- Send
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Select a mail to read
-
-
-
-
-
diff --git a/src/app/modules/admin/apps/mailbox/details/details.component.ts b/src/app/modules/admin/apps/mailbox/details/details.component.ts
deleted file mode 100644
index e75dddfa..00000000
--- a/src/app/modules/admin/apps/mailbox/details/details.component.ts
+++ /dev/null
@@ -1,375 +0,0 @@
-import { Component, ElementRef, OnDestroy, OnInit, TemplateRef, ViewChild, ViewContainerRef, ViewEncapsulation } from '@angular/core';
-import { ActivatedRoute, Router } from '@angular/router';
-import { TemplatePortal } from '@angular/cdk/portal';
-import { Overlay, OverlayRef } from '@angular/cdk/overlay';
-import { MatButton } from '@angular/material/button';
-import { Subject } from 'rxjs';
-import { takeUntil } from 'rxjs/operators';
-import { MailboxService } from 'app/modules/admin/apps/mailbox/mailbox.service';
-import { Mail, MailFolder, MailLabel } from 'app/modules/admin/apps/mailbox/mailbox.types';
-import { labelColorDefs } from 'app/modules/admin/apps/mailbox/mailbox.constants';
-
-@Component({
- selector : 'mailbox-details',
- templateUrl : './details.component.html',
- encapsulation: ViewEncapsulation.None
-})
-export class MailboxDetailsComponent implements OnInit, OnDestroy
-{
- @ViewChild('infoDetailsPanelOrigin') private _infoDetailsPanelOrigin: MatButton;
- @ViewChild('infoDetailsPanel') private _infoDetailsPanel: TemplateRef;
-
- folders: MailFolder[];
- labelColors: any;
- labels: MailLabel[];
- mail: Mail;
- replyFormActive: boolean = false;
- private _overlayRef: OverlayRef;
- private _unsubscribeAll: Subject = new Subject();
-
- /**
- * Constructor
- */
- constructor(
- private _activatedRoute: ActivatedRoute,
- private _elementRef: ElementRef,
- private _mailboxService: MailboxService,
- private _overlay: Overlay,
- private _router: Router,
- private _viewContainerRef: ViewContainerRef
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Get the label colors
- this.labelColors = labelColorDefs;
-
- // Folders
- this._mailboxService.folders$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((folders: MailFolder[]) => {
- this.folders = folders;
- });
-
- // Labels
- this._mailboxService.labels$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((labels: MailLabel[]) => {
- this.labels = labels;
- });
-
- // Mail
- this._mailboxService.mail$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((mail: Mail) => {
- this.mail = mail;
- });
-
- // Selected mail changed
- this._mailboxService.selectedMailChanged
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe(() => {
-
- // De-activate the reply form
- this.replyFormActive = false;
- });
- }
-
- /**
- * On destroy
- */
- ngOnDestroy(): void
- {
- // Unsubscribe from all subscriptions
- this._unsubscribeAll.next();
- this._unsubscribeAll.complete();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Get the current folder
- */
- getCurrentFolder(): any
- {
- return this._activatedRoute.snapshot.paramMap.get('folder');
- }
-
- /**
- * Move to folder
- *
- * @param folderSlug
- */
- moveToFolder(folderSlug: string): void
- {
- // Find the folder details
- const folder = this.folders.find((item) => {
- return item.slug === folderSlug;
- });
-
- // Return if the current folder of the mail
- // is already equals to the given folder
- if ( this.mail.folder === folder.id )
- {
- return;
- }
-
- // Update the mail object
- this.mail.folder = folder.id;
-
- // Update the mail on the server
- this._mailboxService.updateMail(this.mail.id, {folder: this.mail.folder}).subscribe();
-
- // Navigate to the parent
- this._router.navigate(['./'], {relativeTo: this._activatedRoute.parent});
- }
-
- /**
- * Toggle label
- *
- * @param label
- */
- toggleLabel(label: MailLabel): void
- {
- let deleted = false;
-
- // Update the mail object
- if ( this.mail.labels.includes(label.id) )
- {
- // Set the deleted
- deleted = true;
-
- // Delete the label
- this.mail.labels.splice(this.mail.labels.indexOf(label.id), 1);
- }
- else
- {
- // Add the label
- this.mail.labels.push(label.id);
- }
-
- // Update the mail on the server
- this._mailboxService.updateMail(this.mail.id, {labels: this.mail.labels}).subscribe();
-
- // If the label was deleted...
- if ( deleted )
- {
- // If the current activated route has a label parameter and it equals to the one we are removing...
- if ( this._activatedRoute.snapshot.paramMap.get('label') && this._activatedRoute.snapshot.paramMap.get('label') === label.slug )
- {
- // Navigate to the parent
- this._router.navigate(['./'], {relativeTo: this._activatedRoute.parent});
- }
- }
- }
-
- /**
- * Toggle important
- */
- toggleImportant(): void
- {
- // Update the mail object
- this.mail.important = !this.mail.important;
-
- // Update the mail on the server
- this._mailboxService.updateMail(this.mail.id, {important: this.mail.important}).subscribe();
-
- // If the important was removed...
- if ( !this.mail.important )
- {
- // If the current activated route has a filter parameter and it equals to the 'important'...
- if ( this._activatedRoute.snapshot.paramMap.get('filter') && this._activatedRoute.snapshot.paramMap.get('filter') === 'important' )
- {
- // Navigate to the parent
- this._router.navigate(['./'], {relativeTo: this._activatedRoute.parent});
- }
- }
- }
-
- /**
- * Toggle star
- */
- toggleStar(): void
- {
- // Update the mail object
- this.mail.starred = !this.mail.starred;
-
- // Update the mail on the server
- this._mailboxService.updateMail(this.mail.id, {starred: this.mail.starred}).subscribe();
-
- // If the star was removed...
- if ( !this.mail.starred )
- {
- // If the current activated route has a filter parameter and it equals to the 'starred'...
- if ( this._activatedRoute.snapshot.paramMap.get('filter') && this._activatedRoute.snapshot.paramMap.get('filter') === 'starred' )
- {
- // Navigate to the parent
- this._router.navigate(['./'], {relativeTo: this._activatedRoute.parent});
- }
- }
- }
-
- /**
- * Toggle unread
- *
- * @param unread
- */
- toggleUnread(unread: boolean): void
- {
- // Update the mail object
- this.mail.unread = unread;
-
- // Update the mail on the server
- this._mailboxService.updateMail(this.mail.id, {unread: this.mail.unread}).subscribe();
- }
-
- /**
- * Reply
- */
- reply(): void
- {
- // Activate the reply form
- this.replyFormActive = true;
-
- // Scroll to the bottom of the details pane
- setTimeout(() => {
- this._elementRef.nativeElement.scrollTop = this._elementRef.nativeElement.scrollHeight;
- });
- }
-
- /**
- * Reply all
- */
- replyAll(): void
- {
- // Activate the reply form
- this.replyFormActive = true;
-
- // Scroll to the bottom of the details pane
- setTimeout(() => {
- this._elementRef.nativeElement.scrollTop = this._elementRef.nativeElement.scrollHeight;
- });
- }
-
- /**
- * Forward
- */
- forward(): void
- {
- // Activate the reply form
- this.replyFormActive = true;
-
- // Scroll to the bottom of the details pane
- setTimeout(() => {
- this._elementRef.nativeElement.scrollTop = this._elementRef.nativeElement.scrollHeight;
- });
- }
-
- /**
- * Discard
- */
- discard(): void
- {
- // Deactivate the reply form
- this.replyFormActive = false;
- }
-
- /**
- * Send
- */
- send(): void
- {
- // Deactivate the reply form
- this.replyFormActive = false;
- }
-
- /**
- * Open info details panel
- */
- openInfoDetailsPanel(): void
- {
- // Create the overlay
- this._overlayRef = this._overlay.create({
- backdropClass : '',
- hasBackdrop : true,
- scrollStrategy : this._overlay.scrollStrategies.block(),
- positionStrategy: this._overlay.position()
- .flexibleConnectedTo(this._infoDetailsPanelOrigin._elementRef.nativeElement)
- .withFlexibleDimensions()
- .withViewportMargin(16)
- .withLockedPosition()
- .withPositions([
- {
- originX : 'start',
- originY : 'bottom',
- overlayX: 'start',
- overlayY: 'top'
- },
- {
- originX : 'start',
- originY : 'top',
- overlayX: 'start',
- overlayY: 'bottom'
- },
- {
- originX : 'end',
- originY : 'bottom',
- overlayX: 'end',
- overlayY: 'top'
- },
- {
- originX : 'end',
- originY : 'top',
- overlayX: 'end',
- overlayY: 'bottom'
- }
- ])
- });
-
- // Create a portal from the template
- const templatePortal = new TemplatePortal(this._infoDetailsPanel, this._viewContainerRef);
-
- // Attach the portal to the overlay
- this._overlayRef.attach(templatePortal);
-
- // Subscribe to the backdrop click
- this._overlayRef.backdropClick().subscribe(() => {
-
- // If overlay exists and attached...
- if ( this._overlayRef && this._overlayRef.hasAttached() )
- {
- // Detach it
- this._overlayRef.detach();
- }
-
- // If template portal exists and attached...
- if ( templatePortal && templatePortal.isAttached )
- {
- // Detach it
- templatePortal.detach();
- }
- });
- }
-
- /**
- * Track by function for ngFor loops
- *
- * @param index
- * @param item
- */
- trackByFn(index: number, item: any): any
- {
- return item.id || index;
- }
-}
diff --git a/src/app/modules/admin/apps/mailbox/list/list.component.html b/src/app/modules/admin/apps/mailbox/list/list.component.html
deleted file mode 100644
index de579c6b..00000000
--- a/src/app/modules/admin/apps/mailbox/list/list.component.html
+++ /dev/null
@@ -1,154 +0,0 @@
-
-
-
-
0; else noMails">
-
-
-
-
-
-
-
-
-
-
-
-
{{category.name}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
There are no e-mails
-
-
-
-
-
0">
-
-
-
-
-
-
diff --git a/src/app/modules/admin/apps/mailbox/list/list.component.ts b/src/app/modules/admin/apps/mailbox/list/list.component.ts
deleted file mode 100644
index 00b89ed2..00000000
--- a/src/app/modules/admin/apps/mailbox/list/list.component.ts
+++ /dev/null
@@ -1,203 +0,0 @@
-import { Component, ElementRef, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
-import { Subject } from 'rxjs';
-import { takeUntil } from 'rxjs/operators';
-import * as moment from 'moment';
-import { MailboxService } from 'app/modules/admin/apps/mailbox/mailbox.service';
-import { MailboxComponent } from 'app/modules/admin/apps/mailbox/mailbox.component';
-import { Mail, MailCategory } from 'app/modules/admin/apps/mailbox/mailbox.types';
-
-@Component({
- selector : 'mailbox-list',
- templateUrl : './list.component.html',
- encapsulation: ViewEncapsulation.None
-})
-export class MailboxListComponent implements OnInit, OnDestroy
-{
- @ViewChild('mailList') mailList: ElementRef;
-
- category: MailCategory;
- mails: Mail[];
- mailsLoading: boolean = false;
- pagination: any;
- selectedMail: Mail;
- private _unsubscribeAll: Subject = new Subject();
-
- /**
- * Constructor
- */
- constructor(
- public mailboxComponent: MailboxComponent,
- private _mailboxService: MailboxService
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Category
- this._mailboxService.category$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((category: MailCategory) => {
- this.category = category;
- });
-
- // Mails
- this._mailboxService.mails$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((mails: Mail[]) => {
- this.mails = mails;
- });
-
- // Mails loading
- this._mailboxService.mailsLoading$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((mailsLoading: boolean) => {
- this.mailsLoading = mailsLoading;
-
- // If the mail list element is available & the mails are loaded...
- if ( this.mailList && !mailsLoading )
- {
- // Reset the mail list element scroll position to top
- this.mailList.nativeElement.scrollTo(0, 0);
- }
- });
-
- // Pagination
- this._mailboxService.pagination$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((pagination) => {
- this.pagination = pagination;
- });
-
- // Selected mail
- this._mailboxService.mail$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe((mail: Mail) => {
- this.selectedMail = mail;
- });
- }
-
- /**
- * On destroy
- */
- ngOnDestroy(): void
- {
- // Unsubscribe from all subscriptions
- this._unsubscribeAll.next();
- this._unsubscribeAll.complete();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On mail selected
- *
- * @param mail
- */
- onMailSelected(mail: Mail): void
- {
- // If the mail is unread...
- if ( mail.unread )
- {
- // Update the mail object
- mail.unread = false;
-
- // Update the mail on the server
- this._mailboxService.updateMail(mail.id, {unread: false}).subscribe();
- }
-
- // Execute the mailSelected observable
- this._mailboxService.selectedMailChanged.next(mail);
- }
-
- /**
- * Generate and return mail list group label if necessary or return false
- *
- * @param index
- */
- mailListGroupLabel(index: number): string | false
- {
- const previousMail = this.mails[index - 1];
- const currentMail = this.mails[index];
-
- // Generate and return label, if there is no previous mail
- if ( !previousMail )
- {
- return this._generateMailListGroupLabel(this.mails[index].date);
- }
-
- // Return false, if the two dates are equal by day
- if ( moment(previousMail.date, moment.ISO_8601).isSame(moment(currentMail.date, moment.ISO_8601), 'day') )
- {
- return false;
- }
-
- // Generate and return label
- return this._generateMailListGroupLabel(this.mails[index].date);
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Private methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Generate a mail list group label based on the date
- *
- * @param mailDate
- * @private
- */
- private _generateMailListGroupLabel(mailDate: string): string
- {
- const date = moment(mailDate, moment.ISO_8601);
- const today = moment();
- const yesterday = moment().subtract(1, 'day');
-
- // Check if the mail date is today
- if ( date.isSame(today, 'day') )
- {
- // Return 'Today'
- return 'Today';
- }
-
- // Check if the mail date is yesterday
- if ( date.isSame(yesterday, 'day') )
- {
- // Return 'Yesterday'
- return 'Yesterday';
- }
-
- // Check if we are in the same year with the mail date...
- if ( date.isSame(today, 'year') )
- {
- // Return a date without a year
- return date.format('MMMM DD');
- }
-
- // Return a date
- return date.format('LL');
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Track by function for ngFor loops
- *
- * @param index
- * @param item
- */
- trackByFn(index: number, item: any): any
- {
- return item.id || index;
- }
-}
diff --git a/src/app/modules/admin/apps/mailbox/mailbox.component.html b/src/app/modules/admin/apps/mailbox/mailbox.component.html
deleted file mode 100644
index 40c2fd1e..00000000
--- a/src/app/modules/admin/apps/mailbox/mailbox.component.html
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/app/modules/admin/apps/mailbox/mailbox.component.ts b/src/app/modules/admin/apps/mailbox/mailbox.component.ts
deleted file mode 100644
index b5136710..00000000
--- a/src/app/modules/admin/apps/mailbox/mailbox.component.ts
+++ /dev/null
@@ -1,64 +0,0 @@
-import { Component, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
-import { MatDrawer } from '@angular/material/sidenav';
-import { Subject } from 'rxjs';
-import { takeUntil } from 'rxjs/operators';
-import { FuseMediaWatcherService } from '@fuse/services/media-watcher';
-
-@Component({
- selector : 'mailbox',
- templateUrl : './mailbox.component.html',
- encapsulation: ViewEncapsulation.None
-})
-export class MailboxComponent implements OnInit, OnDestroy
-{
- @ViewChild('drawer') drawer: MatDrawer;
-
- drawerMode: 'over' | 'side' = 'side';
- drawerOpened: boolean = true;
- private _unsubscribeAll: Subject = new Subject();
-
- /**
- * Constructor
- */
- constructor(private _fuseMediaWatcherService: FuseMediaWatcherService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Lifecycle hooks
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * On init
- */
- ngOnInit(): void
- {
- // Subscribe to media changes
- this._fuseMediaWatcherService.onMediaChange$
- .pipe(takeUntil(this._unsubscribeAll))
- .subscribe(({matchingAliases}) => {
-
- // Set the drawerMode and drawerOpened if the given breakpoint is active
- if ( matchingAliases.includes('md') )
- {
- this.drawerMode = 'side';
- this.drawerOpened = true;
- }
- else
- {
- this.drawerMode = 'over';
- this.drawerOpened = false;
- }
- });
- }
-
- /**
- * On destroy
- */
- ngOnDestroy(): void
- {
- // Unsubscribe from all subscriptions
- this._unsubscribeAll.next();
- this._unsubscribeAll.complete();
- }
-}
diff --git a/src/app/modules/admin/apps/mailbox/mailbox.constants.ts b/src/app/modules/admin/apps/mailbox/mailbox.constants.ts
deleted file mode 100644
index edb3c749..00000000
--- a/src/app/modules/admin/apps/mailbox/mailbox.constants.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-export const labelColors = [
- 'gray',
- 'red',
- 'orange',
- 'yellow',
- 'green',
- 'teal',
- 'blue',
- 'indigo',
- 'purple',
- 'pink'
-];
-
-export const labelColorDefs = {
- gray : {
- text : 'text-gray-500',
- bg : 'bg-gray-500',
- combined: 'text-gray-800 bg-gray-100'
- },
- red : {
- text : 'text-red-500',
- bg : 'bg-red-500',
- combined: 'text-red-800 bg-red-100'
- },
- orange: {
- text : 'text-orange-500',
- bg : 'bg-orange-500',
- combined: 'text-orange-800 bg-orange-100'
- },
- yellow: {
- text : 'text-yellow-500',
- bg : 'bg-yellow-500',
- combined: 'text-yellow-800 bg-yellow-100'
- },
- green : {
- text : 'text-green-500',
- bg : 'bg-green-500',
- combined: 'text-green-800 bg-green-100'
- },
- teal : {
- text : 'text-teal-500',
- bg : 'bg-teal-500',
- combined: 'text-teal-800 bg-teal-100'
- },
- blue : {
- text : 'text-blue-500',
- bg : 'bg-blue-500',
- combined: 'text-blue-800 bg-blue-100'
- },
- indigo: {
- text : 'text-indigo-500',
- bg : 'bg-indigo-500',
- combined: 'text-indigo-800 bg-indigo-100'
- },
- purple: {
- text : 'text-purple-500',
- bg : 'bg-purple-500',
- combined: 'text-purple-800 bg-purple-100'
- },
- pink : {
- text : 'text-pink-500',
- bg : 'bg-pink-500',
- combined: 'text-pink-800 bg-pink-100'
- }
-};
diff --git a/src/app/modules/admin/apps/mailbox/mailbox.module.ts b/src/app/modules/admin/apps/mailbox/mailbox.module.ts
deleted file mode 100644
index ae5e20a1..00000000
--- a/src/app/modules/admin/apps/mailbox/mailbox.module.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule } from '@angular/router';
-import { MatButtonModule } from '@angular/material/button';
-import { MatCheckboxModule } from '@angular/material/checkbox';
-import { MatDialogModule } from '@angular/material/dialog';
-import { MatDividerModule } from '@angular/material/divider';
-import { MatFormFieldModule } from '@angular/material/form-field';
-import { MatIconModule } from '@angular/material/icon';
-import { MatInputModule } from '@angular/material/input';
-import { MatMenuModule } from '@angular/material/menu';
-import { MatProgressBarModule } from '@angular/material/progress-bar';
-import { MatSelectModule } from '@angular/material/select';
-import { MatSidenavModule } from '@angular/material/sidenav';
-import { QuillModule } from 'ngx-quill';
-import { FuseFindByKeyPipeModule } from '@fuse/pipes/find-by-key';
-import { FuseNavigationModule } from '@fuse/components/navigation';
-import { FuseScrollbarModule } from '@fuse/directives/scrollbar';
-import { FuseScrollResetModule } from '@fuse/directives/scroll-reset';
-import { SharedModule } from 'app/shared/shared.module';
-import { MailboxComponent } from 'app/modules/admin/apps/mailbox/mailbox.component';
-import { MailboxComposeComponent } from 'app/modules/admin/apps/mailbox/compose/compose.component';
-import { MailboxDetailsComponent } from 'app/modules/admin/apps/mailbox/details/details.component';
-import { MailboxListComponent } from 'app/modules/admin/apps/mailbox/list/list.component';
-import { MailboxSettingsComponent } from 'app/modules/admin/apps/mailbox/settings/settings.component';
-import { MailboxSidebarComponent } from 'app/modules/admin/apps/mailbox/sidebar/sidebar.component';
-import { mailboxRoutes } from 'app/modules/admin/apps/mailbox/mailbox.routing';
-
-@NgModule({
- declarations: [
- MailboxComponent,
- MailboxComposeComponent,
- MailboxDetailsComponent,
- MailboxListComponent,
- MailboxSettingsComponent,
- MailboxSidebarComponent
- ],
- imports : [
- RouterModule.forChild(mailboxRoutes),
- MatButtonModule,
- MatCheckboxModule,
- MatDialogModule,
- MatDividerModule,
- MatFormFieldModule,
- MatIconModule,
- MatInputModule,
- MatMenuModule,
- MatProgressBarModule,
- MatSelectModule,
- MatSidenavModule,
- QuillModule.forRoot(),
- FuseFindByKeyPipeModule,
- FuseNavigationModule,
- FuseScrollbarModule,
- FuseScrollResetModule,
- SharedModule
- ]
-})
-export class MailboxModule
-{
-}
diff --git a/src/app/modules/admin/apps/mailbox/mailbox.resolvers.ts b/src/app/modules/admin/apps/mailbox/mailbox.resolvers.ts
deleted file mode 100644
index b91dd0e3..00000000
--- a/src/app/modules/admin/apps/mailbox/mailbox.resolvers.ts
+++ /dev/null
@@ -1,246 +0,0 @@
-import { Injectable } from '@angular/core';
-import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@angular/router';
-import { forkJoin, Observable, throwError } from 'rxjs';
-import { catchError, finalize } from 'rxjs/operators';
-import { MailboxService } from 'app/modules/admin/apps/mailbox/mailbox.service';
-import { Mail, MailFilter, MailFolder, MailLabel } from 'app/modules/admin/apps/mailbox/mailbox.types';
-
-@Injectable({
- providedIn: 'root'
-})
-export class MailboxFoldersResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _mailboxService: MailboxService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._mailboxService.getFolders();
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class MailboxFiltersResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _mailboxService: MailboxService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._mailboxService.getFilters();
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class MailboxLabelsResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(private _mailboxService: MailboxService)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._mailboxService.getLabels();
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class MailboxMailsResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(
- private _mailboxService: MailboxService,
- private _router: Router
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | any
- {
- // Don't allow page param to go below 1
- if ( route.paramMap.get('page') && parseInt(route.paramMap.get('page'), 10) <= 0 )
- {
- // Get the parent url
- const url = state.url.split('/').slice(0, -1).join('/') + '/1';
-
- // Navigate to there
- this._router.navigateByUrl(url);
-
- // Don't allow request to go through
- return false;
- }
-
- // Create and build the sources array
- const sources = [];
-
- // If folder is set on the parameters...
- if ( route.paramMap.get('folder') )
- {
- sources.push(this._mailboxService.getMailsByFolder(route.paramMap.get('folder'), route.paramMap.get('page')));
- }
-
- // If filter is set on the parameters...
- if ( route.paramMap.get('filter') )
- {
- sources.push(this._mailboxService.getMailsByFilter(route.paramMap.get('filter'), route.paramMap.get('page')));
- }
-
- // If label is set on the parameters...
- if ( route.paramMap.get('label') )
- {
- sources.push(this._mailboxService.getMailsByLabel(route.paramMap.get('label'), route.paramMap.get('page')));
- }
-
- // Fork join all the sources
- return forkJoin(sources)
- .pipe(
- finalize(() => {
-
- // Reset the mail every time mails list changes,
- // if there is no selected mail. This will ensure
- // that the mail will be reset while navigating
- // between the folders/filters/labels but it won't
- // reset on page reload if we are reading a mail.
-
- // Try to get the current activated route
- let currentRoute = route;
- while ( currentRoute.firstChild )
- {
- currentRoute = currentRoute.firstChild;
- }
-
- // Make sure there is no 'id' parameter on the current route
- if ( !currentRoute.paramMap.get('id') )
- {
- // Reset the mail
- this._mailboxService.resetMail().subscribe();
- }
- }),
-
- // Error here means the requested page is not available
- catchError((error) => {
-
- // Log the error
- console.error(error.message);
-
- // Get the parent url and append the last possible page number to the parent url
- const url = state.url.split('/').slice(0, -1).join('/') + '/' + error.pagination.lastPage;
-
- // Navigate to there
- this._router.navigateByUrl(url);
-
- // Throw an error
- return throwError(error);
- })
- );
- }
-}
-
-@Injectable({
- providedIn: 'root'
-})
-export class MailboxMailResolver implements Resolve
-{
- /**
- * Constructor
- */
- constructor(
- private _mailboxService: MailboxService,
- private _router: Router
- )
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Resolver
- *
- * @param route
- * @param state
- */
- resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable
- {
- return this._mailboxService.getMailById(route.paramMap.get('id'))
- .pipe(
- // Error here means the requested mail is either
- // not available on the requested page or not
- // available at all
- catchError((error) => {
-
- // Log the error
- console.error(error);
-
- // Get the parent url
- const parentUrl = state.url.split('/').slice(0, -1).join('/');
-
- // Navigate to there
- this._router.navigateByUrl(parentUrl);
-
- // Throw an error
- return throwError(error);
- })
- );
- }
-}
diff --git a/src/app/modules/admin/apps/mailbox/mailbox.routing.ts b/src/app/modules/admin/apps/mailbox/mailbox.routing.ts
deleted file mode 100644
index d836c7a0..00000000
--- a/src/app/modules/admin/apps/mailbox/mailbox.routing.ts
+++ /dev/null
@@ -1,162 +0,0 @@
-import { ActivatedRouteSnapshot, Route, UrlMatchResult, UrlSegment } from '@angular/router';
-import { isEqual } from 'lodash-es';
-import { MailboxComponent } from 'app/modules/admin/apps/mailbox/mailbox.component';
-import { MailboxFiltersResolver, MailboxFoldersResolver, MailboxLabelsResolver, MailboxMailResolver, MailboxMailsResolver } from 'app/modules/admin/apps/mailbox/mailbox.resolvers';
-import { MailboxListComponent } from 'app/modules/admin/apps/mailbox/list/list.component';
-import { MailboxDetailsComponent } from 'app/modules/admin/apps/mailbox/details/details.component';
-import { MailboxSettingsComponent } from 'app/modules/admin/apps/mailbox/settings/settings.component';
-
-/**
- * Mailbox custom route matcher
- *
- * @param url
- */
-export function mailboxRouteMatcher(url: UrlSegment[]): UrlMatchResult
-{
- // Prepare consumed url and positional parameters
- let consumed = url;
- const posParams = {};
-
- // Settings
- if ( url[0].path === 'settings' )
- {
- // Do not match
- return null;
- }
- // Filter or label
- else if ( url[0].path === 'filter' || url[0].path === 'label' )
- {
- posParams[url[0].path] = url[1];
- posParams['page'] = url[2];
-
- // Remove the id if exists
- if ( url[3] )
- {
- consumed = url.slice(0, -1);
- }
- }
- // Folder
- else
- {
- posParams['folder'] = url[0];
- posParams['page'] = url[1];
-
- // Remove the id if exists
- if ( url[2] )
- {
- consumed = url.slice(0, -1);
- }
- }
-
- return {
- consumed,
- posParams
- };
-}
-
-export function mailboxRunGuardsAndResolvers(from: ActivatedRouteSnapshot, to: ActivatedRouteSnapshot): boolean
-{
- // If we are navigating from mail to mails, meaning there is an id in
- // from's deepest first child and there isn't one in the to's, we will
- // trigger the resolver
-
- // Get the current activated route of the 'from'
- let fromCurrentRoute = from;
- while ( fromCurrentRoute.firstChild )
- {
- fromCurrentRoute = fromCurrentRoute.firstChild;
- }
-
- // Get the current activated route of the 'to'
- let toCurrentRoute = to;
- while ( toCurrentRoute.firstChild )
- {
- toCurrentRoute = toCurrentRoute.firstChild;
- }
-
- // Trigger the resolver if the condition met
- if ( fromCurrentRoute.paramMap.get('id') && !toCurrentRoute.paramMap.get('id') )
- {
- return true;
- }
-
- // If the from and to params are equal, don't trigger the resolver
- const fromParams = {};
- const toParams = {};
-
- from.paramMap.keys.forEach((key) => {
- fromParams[key] = from.paramMap.get(key);
- });
-
- to.paramMap.keys.forEach((key) => {
- toParams[key] = to.paramMap.get(key);
- });
-
- if ( isEqual(fromParams, toParams) )
- {
- return false;
- }
-
- // Trigger the resolver on other cases
- return true;
-}
-
-export const mailboxRoutes: Route[] = [
- {
- path : '',
- redirectTo: 'inbox/1',
- pathMatch : 'full'
- },
- {
- path : 'filter/:filter',
- redirectTo: 'filter/:filter/1',
- pathMatch : 'full'
- },
- {
- path : 'label/:label',
- redirectTo: 'label/:label/1',
- pathMatch : 'full'
- },
- {
- path : ':folder',
- redirectTo: ':folder/1',
- pathMatch : 'full'
- },
- {
- path : '',
- component: MailboxComponent,
- resolve : {
- filters: MailboxFiltersResolver,
- folders: MailboxFoldersResolver,
- labels : MailboxLabelsResolver
- },
- children : [
- {
- component : MailboxListComponent,
- matcher : mailboxRouteMatcher,
- runGuardsAndResolvers: mailboxRunGuardsAndResolvers,
- resolve : {
- mails: MailboxMailsResolver
- },
- children : [
- {
- path : '',
- component: MailboxDetailsComponent,
- children : [
- {
- path : ':id',
- resolve: {
- mail: MailboxMailResolver
- }
- }
- ]
- }
- ]
- },
- {
- path : 'settings',
- component: MailboxSettingsComponent
- }
- ]
- }
-];
diff --git a/src/app/modules/admin/apps/mailbox/mailbox.service.ts b/src/app/modules/admin/apps/mailbox/mailbox.service.ts
deleted file mode 100644
index 7fddeae9..00000000
--- a/src/app/modules/admin/apps/mailbox/mailbox.service.ts
+++ /dev/null
@@ -1,396 +0,0 @@
-import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
-import { BehaviorSubject, Observable, of, throwError } from 'rxjs';
-import { map, switchMap, take, tap } from 'rxjs/operators';
-import { Mail, MailCategory, MailFilter, MailFolder, MailLabel } from 'app/modules/admin/apps/mailbox/mailbox.types';
-
-@Injectable({
- providedIn: 'root'
-})
-export class MailboxService
-{
- selectedMailChanged: BehaviorSubject = new BehaviorSubject(null);
- private _category: BehaviorSubject = new BehaviorSubject(null);
- private _filters: BehaviorSubject = new BehaviorSubject(null);
- private _folders: BehaviorSubject = new BehaviorSubject(null);
- private _labels: BehaviorSubject = new BehaviorSubject(null);
- private _mails: BehaviorSubject = new BehaviorSubject(null);
- private _mailsLoading: BehaviorSubject = new BehaviorSubject(false);
- private _mail: BehaviorSubject = new BehaviorSubject(null);
- private _pagination: BehaviorSubject = new BehaviorSubject(null);
-
- /**
- * Constructor
- */
- constructor(private _httpClient: HttpClient)
- {
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Accessors
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Getter for category
- */
- get category$(): Observable
- {
- return this._category.asObservable();
- }
-
- /**
- * Getter for filters
- */
- get filters$(): Observable
- {
- return this._filters.asObservable();
- }
-
- /**
- * Getter for folders
- */
- get folders$(): Observable
- {
- return this._folders.asObservable();
- }
-
- /**
- * Getter for labels
- */
- get labels$(): Observable
- {
- return this._labels.asObservable();
- }
-
- /**
- * Getter for mails
- */
- get mails$(): Observable
- {
- return this._mails.asObservable();
- }
-
- /**
- * Getter for mails loading
- */
- get mailsLoading$(): Observable
- {
- return this._mailsLoading.asObservable();
- }
-
- /**
- * Getter for mail
- */
- get mail$(): Observable
- {
- return this._mail.asObservable();
- }
-
- /**
- * Getter for pagination
- */
- get pagination$(): Observable
- {
- return this._pagination.asObservable();
- }
-
- // -----------------------------------------------------------------------------------------------------
- // @ Public methods
- // -----------------------------------------------------------------------------------------------------
-
- /**
- * Get filters
- */
- getFilters(): Observable
- {
- return this._httpClient.get('api/apps/mailbox/filters').pipe(
- tap((response: any) => {
- this._filters.next(response);
- })
- );
- }
-
- /**
- * Get folders
- */
- getFolders(): Observable
- {
- return this._httpClient.get('api/apps/mailbox/folders').pipe(
- tap((response: any) => {
- this._folders.next(response);
- })
- );
- }
-
- /**
- * Get labels
- */
- getLabels(): Observable
- {
- return this._httpClient.get('api/apps/mailbox/labels').pipe(
- tap((response: any) => {
- this._labels.next(response);
- })
- );
- }
-
- /**
- * Get mails by filter
- */
- getMailsByFilter(filter: string, page: string = '1'): Observable
- {
- // Execute the mails loading with true
- this._mailsLoading.next(true);
-
- return this._httpClient.get('api/apps/mailbox/mails', {
- params: {
- filter,
- page
- }
- }).pipe(
- tap((response: any) => {
- this._category.next({
- type: 'filter',
- name: filter
- });
- this._mails.next(response.mails);
- this._pagination.next(response.pagination);
- this._mailsLoading.next(false);
- }),
- switchMap((response) => {
-
- if ( response.mails === null )
- {
- return throwError({
- message : 'Requested page is not available!',
- pagination: response.pagination
- });
- }
-
- return of(response);
- })
- );
- }
-
- /**
- * Get mails by folder
- */
- getMailsByFolder(folder: string, page: string = '1'): Observable
- {
- // Execute the mails loading with true
- this._mailsLoading.next(true);
-
- return this._httpClient.get('api/apps/mailbox/mails', {
- params: {
- folder,
- page
- }
- }).pipe(
- tap((response: any) => {
- this._category.next({
- type: 'folder',
- name: folder
- });
- this._mails.next(response.mails);
- this._pagination.next(response.pagination);
- this._mailsLoading.next(false);
- }),
- switchMap((response) => {
-
- if ( response.mails === null )
- {
- return throwError({
- message : 'Requested page is not available!',
- pagination: response.pagination
- });
- }
-
- return of(response);
- })
- );
- }
-
- /**
- * Get mails by label
- */
- getMailsByLabel(label: string, page: string = '1'): Observable
- {
- // Execute the mails loading with true
- this._mailsLoading.next(true);
-
- return this._httpClient.get