Skip to content

Commit

Permalink
#115 added check out component
Browse files Browse the repository at this point in the history
  • Loading branch information
tareq89 committed Aug 21, 2016
1 parent a174c79 commit 2819250
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/cart/cart-icon/cart-icon.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ i {

.quantity-background {
border-radius: 50%;
background-color: red;
float: right;
margin-left: 5px;
width: 20px;
text-align: center;
}

.has-item {
background-color: red;
}

textarea {
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion app/cart/cart-icon/cart-icon.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div (click)="openShoppingCartModal()">
<i class="fa fa-shopping-cart fa-lg" aria-hidden="true"></i>
<div class="quantity-background">
<div class="quantity-background {{cartNumberCss}}">
<strong>{{numberOfItems}}</strong>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions app/cart/cart-icon/cart-icon.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { Observable } from 'rxjs';
export class CartIconComponent implements OnInit{
numberOfItems: number = 0;
orderCart: OrderModel;
cartNumberCss: string = "no-item";
ngOnInit(){
this.orderCart = OrderCart.getOrderCart();
this.update();
Expand All @@ -24,6 +25,9 @@ export class CartIconComponent implements OnInit{
public update(){
OrderCart.update();
this.numberOfItems = OrderCart.totalQuantity();
if(this.numberOfItems > 0)
this.cartNumberCss = "has-item";
else this.cartNumberCss = "";
}

itemChanged(value){
Expand Down
Empty file.
1 change: 1 addition & 0 deletions app/cart/check-out/check-out.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Check out</h1>
12 changes: 12 additions & 0 deletions app/cart/check-out/check-out.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Component } from '@angular/core';

@Component({
selector: 'check-out',
templateUrl: 'app/cart/check-out/check-out.component.html',
styleUrls: ['app/cart/check-out/check-out.component.css']
})


export class CheckOutComponent {

}
7 changes: 7 additions & 0 deletions app/shared/router.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { OrderComponent } from '../dashboard/order/order.component';
import {JobHistoryComponent} from '../job/job-history/job-history.component';
import {DashboardComponent} from '../dashboard/dashboard.component';
import {VendorMenuComponent} from '../vendor-menu/vendor-menu.component';
import {CheckOutComponent} from '../cart/check-out/check-out.component';


export const Routes = [
Expand Down Expand Up @@ -39,7 +40,13 @@ export const Routes = [
path: '/vendors/:vendorId',
name: 'VendorMenu',
component: VendorMenuComponent
},
{
path: '/checkout',
name: 'Checkout',
component: CheckOutComponent
}

]

export const PublicRoutes = [
Expand Down
1 change: 1 addition & 0 deletions app/vendor-menu/vendor-menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { OrderModel, PackageListModel } from ".././shared/model/order-model";
import { OrderCart } from '.././shared/model/order-cart';



@Component({
selector: 'vendor-menu',
templateUrl: 'app/vendor-menu/vendor-menu.component.html',
Expand Down

0 comments on commit 2819250

Please sign in to comment.