Skip to content

Commit

Permalink
Create the shopping module.
Browse files Browse the repository at this point in the history
  • Loading branch information
mosh-hamedani committed Aug 27, 2017
1 parent f7692a8 commit a26a343
Show file tree
Hide file tree
Showing 34 changed files with 66 additions and 58 deletions.
55 changes: 11 additions & 44 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ShoppingModule } from './shopping/shopping.module';
import { AdminModule } from './admin/admin.module';
import { SharedModule } from './shared/shared.module';
import { NgModule } from '@angular/core';
Expand All @@ -18,37 +19,30 @@ import { AdminProductsComponent } from './admin/components/admin-products/admin-
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 { CheckOutComponent } from './shopping/components/check-out/check-out.component';
import { HomeComponent } from './home/home.component';
import { LoginComponent } from './login/login.component';
import { MyOrdersComponent } from './my-orders/my-orders.component';
import { OrderSuccessComponent } from './order-success/order-success.component';
import { ProductFilterComponent } from './products/product-filter/product-filter.component';
import { ProductsComponent } from './products/products.component';
import { MyOrdersComponent } from './shopping/components/my-orders/my-orders.component';
import { OrderSuccessComponent } from './shopping/components/order-success/order-success.component';
import { ProductFilterComponent } from './shopping/components/products/product-filter/product-filter.component';
import { ProductsComponent } from './shopping/components/products/products.component';
import { AuthGuard } from './shared/services/auth-guard.service';
import { ShippingFormComponent } from './shipping-form/shipping-form.component';
import { ShoppingCartSummaryComponent } from './shopping-cart-summary/shopping-cart-summary.component';
import { ShoppingCartComponent } from './shopping-cart/shopping-cart.component';
import { ShippingFormComponent } from './shopping/components/shipping-form/shipping-form.component';
import { ShoppingCartSummaryComponent } from './shopping/components/shopping-cart-summary/shopping-cart-summary.component';
import { ShoppingCartComponent } from './shopping/components/shopping-cart/shopping-cart.component';

@NgModule({
declarations: [
AppComponent,
BsNavbarComponent,
HomeComponent,
ProductsComponent,
ShoppingCartComponent,
CheckOutComponent,
OrderSuccessComponent,
MyOrdersComponent,
LoginComponent,
ProductFilterComponent,
ShoppingCartSummaryComponent,
ShippingFormComponent
LoginComponent,
],
imports: [
BrowserModule,
SharedModule,
AdminModule,
ShoppingModule,
FormsModule,
CustomFormsModule,
DataTableModule,
Expand All @@ -58,34 +52,7 @@ import { ShoppingCartComponent } from './shopping-cart/shopping-cart.component';
NgbModule.forRoot(),
RouterModule.forRoot([
{ path: '', component: ProductsComponent },
{ path: 'products', component: ProductsComponent },
{ path: 'shopping-cart', component: ShoppingCartComponent },
{ path: 'login', component: LoginComponent },

{ path: 'check-out', component: CheckOutComponent, canActivate: [AuthGuard] },
{ path: 'order-success/:id', component: OrderSuccessComponent, canActivate: [AuthGuard] },
{ path: 'my/orders', component: MyOrdersComponent, canActivate: [AuthGuard] },

{
path: 'admin/products/new',
component: ProductFormComponent,
canActivate: [AuthGuard, AdminAuthGuard]
},
{
path: 'admin/products/:id',
component: ProductFormComponent,
canActivate: [AuthGuard, AdminAuthGuard]
},
{
path: 'admin/products',
component: AdminProductsComponent,
canActivate: [AuthGuard, AdminAuthGuard]
},
{
path: 'admin/orders',
component: AdminOrdersComponent,
canActivate: [AuthGuard, AdminAuthGuard]
}
])
],
providers: [
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Observable } from 'rxjs/Observable';
import { ShoppingCart } from '../shared/models/shopping-cart';
import { ShoppingCartService } from '../shared/services/shopping-cart.service';
import { ShoppingCart } from '../../../shared/models/shopping-cart';
import { ShoppingCartService } from '../../../shared/services/shopping-cart.service';
import { Component, OnInit } from '@angular/core';

@Component({
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AuthService } from 'shared/services/auth.service';
import { OrderService } from '../shared/services/order.service';
import { OrderService } from '../../../shared/services/order.service';
import { Component, OnInit } from '@angular/core';
import 'rxjs/add/operator/switchMap';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CategoryService } from '../../shared/services/category.service';
import { CategoryService } from '../../../../shared/services/category.service';
import { Component, OnInit, Input } from '@angular/core';

@Component({
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ShoppingCart } from '../shared/models/shopping-cart';
import { ShoppingCart } from '../../../shared/models/shopping-cart';
import { Observable } from 'rxjs/Observable';
import { ShoppingCartService } from '../shared/services/shopping-cart.service';
import { Product } from '../shared/models/product';
import { ShoppingCartService } from '../../../shared/services/shopping-cart.service';
import { Product } from '../../../shared/models/product';
import { ActivatedRoute } from '@angular/router';
import { ProductService } from '../shared/services/product.service';
import { ProductService } from '../../../shared/services/product.service';
import { Component, OnInit } from '@angular/core';
import 'rxjs/add/operator/switchMap';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ShoppingCart } from '../shared/models/shopping-cart';
import { OrderService } from '../shared/services/order.service';
import { AuthService } from '../shared/services/auth.service';
import { ShoppingCart } from '../../../shared/models/shopping-cart';
import { OrderService } from '../../../shared/services/order.service';
import { AuthService } from '../../../shared/services/auth.service';
import { Router } from '@angular/router';
import { Subscription } from 'rxjs/Subscription';
import { Component, OnInit, OnDestroy, Input } from '@angular/core';
import { Order } from "../shared/models/order";
import { Order } from "../../../shared/models/order";

@Component({
selector: 'shipping-form',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ShoppingCart } from '../shared/models/shopping-cart';
import { ShoppingCart } from '../../../shared/models/shopping-cart';
import { Component, OnInit, Input } from '@angular/core';

@Component({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ShoppingCartService } from '../shared/services/shopping-cart.service';
import { ShoppingCartService } from '../../../shared/services/shopping-cart.service';
import { Component, OnInit } from '@angular/core';

@Component({
Expand Down
41 changes: 41 additions & 0 deletions src/app/shopping/shopping.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { SharedModule } from './../shared/shared.module';
import { AuthGuard } from 'shared/services/auth-guard.service';
import { RouterModule } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';

import { CheckOutComponent } from './components/check-out/check-out.component';
import { MyOrdersComponent } from './components/my-orders/my-orders.component';
import { OrderSuccessComponent } from './components/order-success/order-success.component';
import { ProductFilterComponent } from './components/products/product-filter/product-filter.component';
import { ProductsComponent } from './components/products/products.component';
import { ShippingFormComponent } from './components/shipping-form/shipping-form.component';
import { ShoppingCartSummaryComponent } from './components/shopping-cart-summary/shopping-cart-summary.component';
import { ShoppingCartComponent } from './components/shopping-cart/shopping-cart.component';

@NgModule({
imports: [
SharedModule,
CommonModule,
FormsModule,
RouterModule.forChild([
{ path: 'products', component: ProductsComponent },
{ path: 'shopping-cart', component: ShoppingCartComponent },
{ path: 'check-out', component: CheckOutComponent, canActivate: [AuthGuard] },
{ path: 'order-success/:id', component: OrderSuccessComponent, canActivate: [AuthGuard] },
{ path: 'my/orders', component: MyOrdersComponent, canActivate: [AuthGuard] },
])
],
declarations: [
ProductsComponent,
ShoppingCartComponent,
CheckOutComponent,
OrderSuccessComponent,
MyOrdersComponent,
ProductFilterComponent,
ShoppingCartSummaryComponent,
ShippingFormComponent
]
})
export class ShoppingModule { }

0 comments on commit a26a343

Please sign in to comment.