Skip to content

Commit

Permalink
Update style of order table
Browse files Browse the repository at this point in the history
  • Loading branch information
Popovkov57 committed Oct 6, 2022
1 parent 7aaa5e1 commit f795819
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 24 deletions.
66 changes: 44 additions & 22 deletions src/app/admin/orderTable.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,52 @@
Display Shipped Orders
</label>
</div>
<div class="table table-sm">
<table class="table table-sm table-striped">
<thead>
<tr><th>Name</th><th>Zip</th><th colspan="2">Cart</th><th></th></tr>
<tr class="d-flex">
<th class="col-1">Id</th>
<th class="col-2">Name</th>
<th class="col-2">Address</th>
<th class="col-5">Cart</th>
<th class="col-2"></th>
</tr>
</thead>
<tbody>
<tr *ngIf="getOrders().length == 0">
<td colspan="5">There are no orders</td>
<tr *ngFor="let o of getOrders()" class="d-flex">
<td class="col-1">{{ o.id }}</td>
<td class="col-2">{{ o.name }}</td>
<td class="col-2">
{{ o.address}}
<br>{{ o.zip}} - {{ o.city }}
<br>{{ o.state }}
<br>{{ o.country }}
</td>
<td class="col-5">
<div *ngFor="let line of o.cart.lines" class="d-flex">
<td class="col-4">
{{ line.product.name }}
<br><span style="color: #00000087;">{{ line.product.price | currency:"USD":"symbol":"2.2-2" }}</span>
</td>
<td class="col-4 my-auto">
{{ line.quantity }}
</td>
<td class="col-4 my-auto">
{{ line.quantity*line.product.price | currency:"USD":"symbol":"2.2-2" }}
</td>
</div>
<div class="d-flex" style="margin-top: 10px;">
<th class="col-8">Total</th>
<th class="col-4">
{{ o.cart.cartPrice | currency:"USD":"symbol":"2.2-2" }}
</th>
</div>
</td>
<td class="col-2">
<div class="btn-group float-end" role="group" aria-label="Basic example">
<button class="btn btn-warning" (click)="markShipped(o)"><i class="fa fa-paper-plane-o" aria-hidden="true"></i></button>
<button class="btn btn-danger" (click)="delete(o.id)"><i class="fa fa-trash-o" aria-hidden="true"></i></button>
</div>
</td>
</tr>
<ng-template ngFor let-o [ngForOf]="getOrders()">
<tr>
<td>{{o.name}}</td>
<td>{{o.zip}}</td>
<th>Product</th>
<th>Quantity</th>
<td>
<button class="btn btn-warning" (click)="markShipped(o)">Ship</button>
<button class="btn btn-danger" (click)="delete(o.id)">Delete</button>
</td>
</tr>
<tr *ngFor="let line of o.cart.lines">
<td colspan="2"></td>
<td>{{line.product.name}}</td>
<td>{{line.quantity}}</td>
</tr>
</ng-template>
</tbody>
</div>
</table>
2 changes: 1 addition & 1 deletion src/app/model/cart.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class Cart {
export class CartLine {
constructor(public product: Product, public quantity: number) {}

get lineTotal() {
getLineTotal() {
return this.quantity * this.product.price;
}
}
2 changes: 1 addition & 1 deletion src/app/store/cartDetail.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h2 class="text-center">Your Cart</h2>
{{ line.product.price | currency:"USD":true:"2.2-2" }}
</td>
<td class="text-right">
{{ line.lineTotal | currency:"USD":true:"2.2-2" }}
{{ line.quantity*line.product.price | currency:"USD":true:"2.2-2" }}
</td>
<td class="text-center">
<button class="btn btn-sm btn-danger" (click)="cart.removeLine(line.product.id)">
Expand Down

0 comments on commit f795819

Please sign in to comment.