-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#115 added a cart icon on upper right corner, need to update the cart…
… icon number on adding new items on cart
- Loading branch information
Showing
7 changed files
with
68 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
i { | ||
color: white; | ||
margin: 0; | ||
} | ||
|
||
.quantity-background { | ||
border-radius: 50%; | ||
background-color: red; | ||
float: right; | ||
margin-left: 5px; | ||
width: 20px; | ||
text-align: center; | ||
} |
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,6 @@ | ||
<div (click)="update()"> | ||
<i class="fa fa-shopping-cart fa-lg" aria-hidden="true"></i> | ||
<div class="quantity-background"> | ||
<strong>{{numberOfItems}}</strong> | ||
</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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { OrderCart } from '../../shared/model/order-cart' | ||
|
||
import { Observable } from 'rxjs'; | ||
|
||
|
||
@Component({ | ||
selector: 'cart-icon', | ||
templateUrl: 'app/cart/cart-icon/cart-icon.component.html', | ||
styleUrls: ['app/cart/cart-icon/cart-icon.component.css'] | ||
}) | ||
|
||
|
||
export class CartIconComponent implements OnInit{ | ||
numberOfItems: number = 0; | ||
|
||
ngOnInit(){ | ||
this.update(); | ||
} | ||
|
||
public update(){ | ||
if(OrderCart.getOrderCart().OrderCart.PackageList){ | ||
this.numberOfItems = 0; | ||
OrderCart.getOrderCart().OrderCart.PackageList.forEach(item => { | ||
this.numberOfItems += item.Quantity; | ||
}); | ||
|
||
if(OrderCart.getOrderCart().Description){ | ||
this.numberOfItems += 1; | ||
} | ||
} | ||
} | ||
|
||
|
||
} |
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
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