Skip to content

Commit

Permalink
admin module and ListOrderView moved to shared
Browse files Browse the repository at this point in the history
  • Loading branch information
ritwickdey committed Jan 25, 2018
1 parent 1abc2b3 commit 6484203
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 19 deletions.
36 changes: 36 additions & 0 deletions src/app/admin/admin.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { DataTableModule } from 'angular-4-data-table';
import { SharedModule } from 'shared/shared.module';

import { AuthGuardService } from './../shared/services/auth-guard.service';
import { AdminOrdersComponent } from './components/admin-orders/admin-orders.component';
import { AdminProductsComponent } from './components/admin-products/admin-products.component';
import { ProductFormComponent } from './components/product-form/product-form.component';
import { AdminAuthGuardService } from './services/admin-auth-guard.service';

@NgModule({
imports: [
CommonModule,
DataTableModule,
FormsModule,
SharedModule,
RouterModule.forChild([
{ path: 'admin/orders', component: AdminOrdersComponent, canActivate: [AuthGuardService, AdminAuthGuardService] },
{ path: 'admin/products/new', component: ProductFormComponent, canActivate: [AuthGuardService, AdminAuthGuardService] },
{ path: 'admin/products/:id', component: ProductFormComponent, canActivate: [AuthGuardService, AdminAuthGuardService] },
{ path: 'admin/products', component: AdminProductsComponent, canActivate: [AuthGuardService, AdminAuthGuardService] }
])
],
declarations: [
AdminProductsComponent,
AdminOrdersComponent,
ProductFormComponent,
],
providers: [
AdminAuthGuardService,
]
})
export class AdminModule { }
19 changes: 3 additions & 16 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,21 @@ import { DataTableModule } from 'angular-4-data-table';
import { AngularFireModule } from 'angularfire2';
import { AngularFireAuthModule } from 'angularfire2/auth';
import { AngularFireDatabaseModule } from 'angularfire2/database';
import { AdminModule } from 'app/admin/admin.module';
import { CustomFormsModule } from 'ng2-validation';
import { SharedModule } from 'shared/shared.module';

import { environment } from './../environments/environment';
import { AdminOrdersComponent } from './admin/components/admin-orders/admin-orders.component';
import { AdminProductsComponent } from './admin/components/admin-products/admin-products.component';
import { ProductFormComponent } from './admin/components/product-form/product-form.component';
import { AppComponent } from './app.component';
import { BsNavbarComponent } from './bs-navbar/bs-navbar.component';
import { CheckOutComponent } from './check-out/check-out.component';
import { HomeComponent } from './home/home.component';
import { ListOrderViewComponent } from './list-order-view/list-order-view.component';
import { LoginComponent } from './login/login.component';
import { MyOrdersComponent } from './my-orders/my-orders.component';
import { OrderSuccssComponent } from './order-succss/order-succss.component';
import { OrderViewComponent } from './order-view/order-view.component';
import { ProductFilterComponent } from './products/product-filter/product-filter.component';
import { ProductsComponent } from './products/products.component';
import { AdminAuthGuardService } from './admin/services/admin-auth-guard.service';
import { AuthGuardService } from './shared/services/auth-guard.service';
import { AuthService } from './shared/services/auth.service';
import { CategoryService } from './shared/services/category.service';
Expand All @@ -49,14 +45,10 @@ import { ShoppingCartSummaryComponent } from './shopping-cart-summary/shopping-c
OrderSuccssComponent,
ShopingCartComponent,
MyOrdersComponent,
AdminProductsComponent,
AdminOrdersComponent,
LoginComponent,
ProductFormComponent,
ProductFilterComponent,
ShoppingCartSummaryComponent,
ShippingFormComponent,
ListOrderViewComponent,
OrderViewComponent
],
imports: [
Expand All @@ -69,6 +61,7 @@ import { ShoppingCartSummaryComponent } from './shopping-cart-summary/shopping-c
NgbModule.forRoot(),
DataTableModule,
SharedModule,
AdminModule,
RouterModule.forRoot([
{ path: '', component: ProductsComponent },
{ path: 'Products', component: ProductsComponent },
Expand All @@ -78,19 +71,13 @@ import { ShoppingCartSummaryComponent } from './shopping-cart-summary/shopping-c
{ path: 'myorders', component: MyOrdersComponent, canActivate: [AuthGuardService] },
{ path: 'checkout', component: CheckOutComponent, canActivate: [AuthGuardService] },
{ path: 'order-success/:id', component: OrderSuccssComponent, canActivate: [AuthGuardService] },
{ path: 'order-details/:id', component: OrderViewComponent, canActivate: [AuthGuardService] },

{ path: 'admin/orders', component: AdminOrdersComponent, canActivate: [AuthGuardService, AdminAuthGuardService] },
{ path: 'admin/products/new', component: ProductFormComponent, canActivate: [AuthGuardService, AdminAuthGuardService] },
{ path: 'admin/products/:id', component: ProductFormComponent, canActivate: [AuthGuardService, AdminAuthGuardService] },
{ path: 'admin/products', component: AdminProductsComponent, canActivate: [AuthGuardService, AdminAuthGuardService] },
{ path: 'order-details/:id', component: OrderViewComponent, canActivate: [AuthGuardService] }
])
],
providers: [
AuthService,
AuthGuardService,
UserService,
AdminAuthGuardService,
CategoryService,
ProductService,
ShoppingCartService,
Expand Down
11 changes: 8 additions & 3 deletions src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';

import { ListOrderViewComponent } from './components/list-order-view/list-order-view.component';
import { ProductCardComponent } from './components/product-card/product-card.component';
import { ProductQuantityComponent } from './components/product-quantity/product-quantity.component';

@NgModule({
imports: [
CommonModule
CommonModule,
RouterModule,
],
declarations: [
ProductCardComponent,
ProductQuantityComponent
ProductQuantityComponent,
ListOrderViewComponent
],
exports : [
ProductCardComponent,
ProductQuantityComponent
ProductQuantityComponent,
ListOrderViewComponent
]
})
export class SharedModule { }

0 comments on commit 6484203

Please sign in to comment.