-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
501f9c9
commit 5e7f758
Showing
5 changed files
with
85 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<div class="container-fluid"> | ||
<div class="row"> | ||
<div class="col bg-dark text-white"> | ||
<a class="navbar-brand">SPORTS STORE</a> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col mt-2"> | ||
<h2 class="text-center">Your Cart</h2> | ||
<table class="table table-bordered table-striped p-2"> | ||
<thead> | ||
<tr> | ||
<th>Quantity</th> | ||
<th>Product</th> | ||
<th class="text-right">Price</th> | ||
<th class="text-right">Subtotal</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr *ngIf="cart.lines.length == 0"> | ||
<td colspan="4" class="text-center"> | ||
Your cart is empty | ||
</td> | ||
</tr> | ||
<tr *ngFor="let line of cart.lines"> | ||
<td> | ||
<input type="number" | ||
class="form-control-sm" | ||
style="width: 5em;" | ||
[value]="line.quantity" | ||
(change)="cart.updateQuantity(line.product, $event.target.value)"/> | ||
</td> | ||
<td>{{ line.product.name }}</td> | ||
<td class="text-right"> | ||
{{ line.product.price | currency:"USD":true:"2.2-2" }} | ||
</td> | ||
<td class="text-right"> | ||
{{ line.lineTotal | currency:"USD":true:"2.2-2" }} | ||
</td> | ||
<td class="text-center"> | ||
<button class="btn btn-sm btn-danger" (click)="cart.removeLine(line.product.id)"> | ||
Remove | ||
</button> | ||
</td> | ||
</tr> | ||
</tbody> | ||
<tfoot> | ||
<tr> | ||
<td colspan="3" class="text-right">Total:</td> | ||
<td class="text-right"> | ||
{{ cart.cartPrice | currency:"USD":true:"2.2-2" }} | ||
</td> | ||
</tr> | ||
</tfoot> | ||
</table> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col"> | ||
<div class="text-center"> | ||
<button class="btn btn-primary m-1" routerLink="/store"> | ||
Continue Shopping | ||
</button> | ||
<button class="btn btn-secondary m-1" routerLink="/checkout" [disabled]="cart.lines.length == 0"> | ||
Checkout | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
import { Component } from "@angular/core"; | ||
import { Cart } from "../model/cart.model"; | ||
|
||
@Component({ | ||
template:`<div><h3 class="bg-info p-1 text-white">Cart Detail Component</h3></div>` | ||
templateUrl: "cartDetail.component.html" | ||
}) | ||
|
||
export class CartDetailComponent {} | ||
export class CartDetailComponent { | ||
|
||
constructor(public cart: Cart) {} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters