Commit d6f97436 authored by prumde's avatar prumde

Updated for empty cart


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174154 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 9d3d39fb
...@@ -22,9 +22,18 @@ ...@@ -22,9 +22,18 @@
.itemdescription .itemdescription
{ {
font-size: 12px; font-size: 12px;
width: 42%; width: 45%;
cursor: pointer; cursor: pointer;
position: relative;
}
.item-descr-span{
display: block;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
position: relative;
width: 125px;
} }
.ecm-itemdescription{ .ecm-itemdescription{
font-size: 18px; font-size: 18px;
...@@ -395,14 +404,48 @@ ...@@ -395,14 +404,48 @@
display: none; display: none;
cursor: pointer; cursor: pointer;
font-size: 20px; font-size: 20px;
width: 20px; width: 32px;
height: 20px; height: 32px;
text-align: center;
position: relative;
} }
.cartItemsDetail:HOVER .delete-icon{ .cartItemsDetail:HOVER .delete-icon{
display: table-row; display: block;
} }
.cartItemsDetail{
cursor: pointer;
}
/* Empty Cart*/
.empty-cart-img {
width: 140px;
height: 140px;
}
.empty-cart-title {
display: block;
font-size: 14px;
font-weight: bold;
text-align: center;
padding: 0;
line-height: 0.8;
}
.empty-cart-msg {
font-size: 14px;
display: block;
text-align: center;
padding-top: 10px;
line-height: 1.2;
}
.border-line {
height: 3px;
width: 40px;
background-color: mediumvioletred;
display: inline-block;
}
...@@ -2,8 +2,11 @@ ...@@ -2,8 +2,11 @@
<div *ngIf="isMiniCart then miniCart; else fullCart;"></div> <div *ngIf="isMiniCart then miniCart; else fullCart;"></div>
<ng-template #miniCart> <ng-template #miniCart>
<div *ngIf="cartCount == 0" > <div *ngIf="cartCount == 0" style="text-align: center;">
<span> Your cart is empty <i class="material-icons" style="color: mediumvioletred; font-size: 20px;">add_shopping_cart</i> </span> <img class="empty-cart-img" src="/ecm/assets/images/svg/Empty Cart.svg">
<span class="empty-cart-title">Empty Cart</span>
<span class="border-line"></span>
<span class="empty-cart-msg">Looks like you haven't made your choice yet...</span>
</div> </div>
<div *ngIf="cartCount > 0"> <div *ngIf="cartCount > 0">
...@@ -11,9 +14,11 @@ ...@@ -11,9 +14,11 @@
<table style="border: 2px solid ghostwhite; width: 100%;"> <table style="border: 2px solid ghostwhite; width: 100%;">
<tr> <tr>
<td class="itemImage"><ecm-image [refId]='item.itemCode' [refSer]="'M-ITEM'" [object]="'ITEM'" [isSingleImage]="true" [isThumbnail]="true"></ecm-image></td> <td class="itemImage"><ecm-image [refId]='item.itemCode' [refSer]="'M-ITEM'" [object]="'ITEM'" [isSingleImage]="true" [isThumbnail]="true"></ecm-image></td>
<td class="itemdescription" (click)="viewItem(item.itemCode)">{{item.descr}}</td> <td class="itemdescription" (click)="viewItem(item.itemCode)">
<td style="padding: 10px;">₹ {{item.costRate}}</td> <span class="item-descr-span">{{item.descr}}</span>
<td (click)="deleteCartItem(item.itemCode)" style="cursor: pointer;"><span class="delete-icon">x</span></td> </td>
<td style="padding: 10px;">Rs. {{item.costRate}}</td>
<td (click)="deleteCartItem(item.itemCode)" style="cursor: pointer;"><span class="delete-icon" md-ripple >x</span></td>
</tr> </tr>
</table> </table>
</div> </div>
......
...@@ -9,7 +9,7 @@ import { EcmCategoryComponent } from '../ecm-category/ecm-category.component'; ...@@ -9,7 +9,7 @@ import { EcmCategoryComponent } from '../ecm-category/ecm-category.component';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { EcmStoreModel } from '../../ecm-store/ecm-store.model'; import { EcmStoreModel } from '../../ecm-store/ecm-store.model';
import { INCREMENT, DECREMENT, RESET } from '../../ecm-store/ecm-store'; import { INCREMENT, DECREMENT, REMOVE, RESET } from '../../ecm-store/ecm-store';
import { Item } from '../../ecm-model/product-model'; import { Item } from '../../ecm-model/product-model';
import { EcmCartService } from './ecm-cart.service'; import { EcmCartService } from './ecm-cart.service';
...@@ -61,6 +61,7 @@ export class EcmCartComponent implements OnInit { ...@@ -61,6 +61,7 @@ export class EcmCartComponent implements OnInit {
} }
}, },
error => { error => {
this.cartCount = 0;
let errorMessage = <any>error; let errorMessage = <any>error;
console.log( 'comp errorMessage[' + errorMessage + ']' ); console.log( 'comp errorMessage[' + errorMessage + ']' );
}); });
...@@ -75,12 +76,12 @@ export class EcmCartComponent implements OnInit { ...@@ -75,12 +76,12 @@ export class EcmCartComponent implements OnInit {
console.log( "deleted item in Cart" ); console.log( "deleted item in Cart" );
}, error => { }, error => {
console.log( error.json() ); console.log( error.json() );
}); });
this.getCartItem(); this.getCartItem();
this.decreasePrice(); this.decreasePrice();
let cartData = new ECMCart; let cartData = new ECMCart;
cartData.itemCode = itemCode; cartData.itemCode = itemCode;
this.store.dispatch({ type: DECREMENT, payload: cartData }); this.store.dispatch({ type: REMOVE, payload: cartData });
this.openSnackBar('Item Removed from your Cart' ); this.openSnackBar('Item Removed from your Cart' );
} }
...@@ -116,8 +117,12 @@ export class EcmCartComponent implements OnInit { ...@@ -116,8 +117,12 @@ export class EcmCartComponent implements OnInit {
this.openSnackBar( data.shDescr + ' Added to your Cart ' ); this.openSnackBar( data.shDescr + ' Added to your Cart ' );
} }
decrement(item) { decrement(data : Item) {
item.itemQuantity--; data.itemQuantity--;
let cartData = new ECMCart;
cartData.itemCode = data.itemCode;
this.store.dispatch({ type: DECREMENT, payload: cartData });
this.openSnackBar( data.shDescr + ' Removed from your Cart' );
} }
checkQantity(item) checkQantity(item)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment