Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielKag committed Mar 5, 2018
1 parent 5b5b6ce commit e70ba75
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component } from '@angular/core';
import { NgRedux } from '@angular-redux/store';
import { IStaticDataState } from './reducers/static-data.reducer';
import { IPizzariumState } from './app.module';

@Component({
selector: 'app-root',
Expand All @@ -11,7 +11,7 @@ import { IStaticDataState } from './reducers/static-data.reducer';
`
})
export class AppComponent {
constructor(private ngRedux: NgRedux<IStaticDataState>) {
constructor(private ngRedux: NgRedux<IPizzariumState>) {
this.ngRedux.dispatch({
type: 'GET_TOPPINGS',
payload: {
Expand Down
4 changes: 2 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { FormsModule } from '@angular/forms';
Expand Down Expand Up @@ -38,7 +38,7 @@ export interface IPizzariumState {
],
imports: [
NgReduxModule,
BrowserModule,
BrowserAnimationsModule,
FormsModule,
RouterModule.forRoot(routes),
OrderDetailsModule,
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/top/top.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import {MenuItem} from 'primeng/api';
import { MenuItem } from 'primeng/api';
import { Router } from '@angular/router';
import { select, NgRedux } from '@angular-redux/store';
import { Observable } from 'rxjs/Observable';
Expand Down
6 changes: 3 additions & 3 deletions src/app/containers/cart/cart.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { Component } from '@angular/core';
import { select, NgRedux } from '@angular-redux/store';
import { Router } from '@angular/router';
import { MessageService } from 'primeng/components/common/messageservice'
import { IUIState } from '../../reducers/ui.reducer';
import { Order } from '../../models';
import { IPizzariumState } from '../../app.module';

@Component({
selector: 'app-cart',
styleUrls: ['./cart.component.css'],
template: `
<p-growl [(value)]="msgs"></p-growl>
<div *ngIf="(orders$ | async).length === 0">No items in cart</div>
<div *ngIf="(orders$ | async)?.length === 0">No items in cart</div>
<div class="cart-container">
<div *ngFor="let order of orders$ | async; let orderIndex = index" class="order">
<div>Size: {{ order.selectedPizza.value }} - {{ order.selectedPizza.extraData.price }}₪</div>
Expand Down Expand Up @@ -41,7 +41,7 @@ export class CartComponent {
@select(['ui', 'orders']) orders$;
@select(['ui', 'totalPrice']) totalPrice$;

constructor(private ngRedux: NgRedux<IUIState>, private messageService: MessageService, private router: Router) { }
constructor(private ngRedux: NgRedux<IPizzariumState>, private messageService: MessageService, private router: Router) { }

public deletePizzaFromCart(order: Order, pizzaIndex: number): void {
this.ngRedux.dispatch({type: 'DELETE_ORDER', payload: {order, pizzaIndex}});
Expand Down
5 changes: 1 addition & 4 deletions src/app/containers/cart/cart.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { NgReduxModule } from '@angular-redux/store'
import { CartComponent } from './cart.component';
import { GrowlModule } from 'primeng/growl';
import { ButtonModule } from 'primeng/button';
Expand All @@ -13,14 +12,12 @@ import { MessageService } from 'primeng/components/common/messageservice';
CartComponent
],
imports: [
NgReduxModule,
CommonModule,
FormsModule,
ButtonModule,
GrowlModule,
],
providers: [MessageService],
bootstrap: [CartComponent]
providers: [MessageService]
})
export class CartModule {
}
9 changes: 4 additions & 5 deletions src/app/containers/order-details/order-details.component.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import {Message} from 'primeng/api';
import { MessageService } from 'primeng/components/common/messageservice'
import { select, NgRedux } from '@angular-redux/store';
import { Component, ViewChild} from '@angular/core';
import { ImageSelectorItem } from '../../models'
import { IUIState } from '../../reducers/ui.reducer';
import { Order } from '../../models';
import { ImageSelectorComponent } from '../../components/image-selector/image-selector.component';
import { IPizzariumState } from '../../app.module';

@Component({
selector: 'app-order-details',
styleUrls: ['./order-details.component.css'],
template: `
<p-growl [(value)]="msgs"></p-growl>
<image-selector #sizesSelector [data]="sizes$ | async" (selectionChanged)=onSizeSelectedChanged($event)></image-selector>
<image-selector #toppingsSelector [data]="toppings$ | async" [multiSelect]="true" [itemsInRow]="7" (selectionChanged)=onToppingsSelectedChanged($event)></image-selector>
<image-selector #sizesSelector *ngIf="sizes$ | async" [data]="sizes$ | async" (selectionChanged)=onSizeSelectedChanged($event)></image-selector>
<image-selector #toppingsSelector *ngIf="toppings$ | async" [data]="toppings$ | async" [multiSelect]="true" [itemsInRow]="7" (selectionChanged)=onToppingsSelectedChanged($event)></image-selector>
<div class="order-details-footer">
<p-button label="Clear Order" icon="fa fa-trash" (click)=clear()></p-button>
<p-button label="Add" icon="fa fa-cart-plus" (click)="addOrder()"></p-button>
Expand All @@ -29,7 +28,7 @@ export class OrderDetailsComponent {

private currentOrder: Order;

constructor(private ngRedux: NgRedux<IUIState>, private messageService: MessageService) {
constructor(private ngRedux: NgRedux<IPizzariumState>, private messageService: MessageService) {
this.resetCurrentOrder();
}

Expand Down
11 changes: 4 additions & 7 deletions src/app/containers/order-details/order-details.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { NgReduxModule } from '@angular-redux/store'
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { OrderDetailsComponent } from './order-details.component';
import { ImageSelectorComponent } from '../../components/image-selector/image-selector.component';
import { GrowlModule } from 'primeng/growl';
Expand All @@ -14,14 +13,12 @@ import { MessageService } from 'primeng/components/common/messageservice';
ImageSelectorComponent
],
imports: [
NgReduxModule,
BrowserAnimationsModule,
CommonModule,
FormsModule,
ButtonModule,
GrowlModule,
GrowlModule
],
providers: [MessageService],
bootstrap: [OrderDetailsComponent]
providers: [MessageService]
})
export class OrderDetailsModule {

Expand Down

0 comments on commit e70ba75

Please sign in to comment.