Commit f918d366 authored by prumde's avatar prumde

Updated for on Remove confirmation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174420 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 51423e12
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<span class="item-descr-span">{{item.descr}}</span> <span class="item-descr-span">{{item.descr}}</span>
</td> </td>
<td style="padding: 10px;">Rs. {{item.costRate}}</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> <td (click)="confirmDialog(item)" style="cursor: pointer;"><span class="delete-icon" md-ripple >x</span></td>
</tr> </tr>
</table> </table>
</div> </div>
...@@ -88,8 +88,8 @@ ...@@ -88,8 +88,8 @@
</div> </div>
<div class="wish-remove-dipslay"> <div class="wish-remove-dipslay">
<span class="wishList-items" (click)="wishList()">Add to Wishlist</span> <span class="wishList-items" (click)="wishList()">Add to Wishlist</span>
<!-- <span class="remove-items" (click)=" openDialog(item.itemCode)" style="cursor: pointer;">Remove</span> --> <!-- <span class="remove-items" (click)=" confirmDialog(item)" style="cursor: pointer;">Remove</span> -->
<span class="remove-items"(click)="deleteCartItem(item.itemCode) ">Remove</span> <span class="remove-items" (click)="confirmDialog(item)">Remove</span>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -34,7 +34,6 @@ export class EcmCartComponent implements OnInit { ...@@ -34,7 +34,6 @@ export class EcmCartComponent implements OnInit {
@Input() isMiniCart: boolean = false; @Input() isMiniCart: boolean = false;
@Output() closePanel = new EventEmitter(); @Output() closePanel = new EventEmitter();
@Output() doActivity = new EventEmitter(); @Output() doActivity = new EventEmitter();
selectedOption: string;
constructor( private route: ActivatedRoute, public dialog: MdDialog, private router: Router,public subcategoryService: EcmProductDetailService, public cartService: EcmCartService, public snackBar: MdSnackBar, private http: Http, private store: Store<EcmStoreModel> ) { } constructor( private route: ActivatedRoute, public dialog: MdDialog, private router: Router,public subcategoryService: EcmProductDetailService, public cartService: EcmCartService, public snackBar: MdSnackBar, private http: Http, private store: Store<EcmStoreModel> ) { }
...@@ -144,11 +143,22 @@ export class EcmCartComponent implements OnInit { ...@@ -144,11 +143,22 @@ export class EcmCartComponent implements OnInit {
}); });
} }
openDialog( itemCode ) { confirmDialog( item: any ) {
this.cartService.setItemCode( itemCode ); this.cartService.setItemCode( item.itemCode );
let dialogRef = this.dialog.open( DialogOverviewExampleDialog ); let dialogRef = this.dialog.open( ECMConfirmDialog,{
width:'250px',
height:'150px',
disableClose: true
});
dialogRef.componentInstance.dialogTitle = "Remove Item from cart?";
//dialogRef.componentInstance.confirmMsg = "Would you like to remove item from cart?";
dialogRef.componentInstance.cancelText = "No";
dialogRef.componentInstance.confirmText = "Yes";
dialogRef.afterClosed().subscribe( result => { dialogRef.afterClosed().subscribe( result => {
this.selectedOption = result; if( result == 'true')
{
this.deleteCartItem(item.itemCode);
}
}); });
} }
viewItem( itemCode ) { viewItem( itemCode ) {
...@@ -158,26 +168,19 @@ export class EcmCartComponent implements OnInit { ...@@ -158,26 +168,19 @@ export class EcmCartComponent implements OnInit {
@Component( { @Component( {
selector: 'dialog-overview-example-dialog', selector: 'ecm-confirm-dialog',
templateUrl: 'dialog-overview-example-dialog.html', templateUrl: 'ecm-confirm-dialog.html',
styleUrls: ['./ecm-cart.component.css'], styleUrls: ['./ecm-cart.component.css'],
providers: [EcmCartComponent] providers: [EcmCartComponent]
}) })
export class DialogOverviewExampleDialog { export class ECMConfirmDialog {
@Input() dialogTitle : any;
@Input() confirmMsg : any;
@Input() cancelText : any;
@Input() confirmText : any;
itemCode; constructor( public dialogRef: MdDialogRef<ECMConfirmDialog>) { }
constructor( public dialogRef: MdDialogRef<DialogOverviewExampleDialog>, private route: ActivatedRoute, private router: Router, public cartService: EcmCartService, private http: Http, private store: Store<EcmStoreModel>, private cartComp:EcmCartComponent) { }
userActionUrl = '/ecm/service/feeds/cart';
deleteCartItem() {
console.log( "deleteCartItem Called" );
this.itemCode = this.cartService.getItemCode();
console.log( "the cart deleted " + this.itemCode);
this.cartComp.deleteCartItem(this.itemCode);
}
} }
......
<!--
<div class="deleteCart"> <div class="deleteCart">
<i class="material-icons" style="color: mediumvioletred;">remove_shopping_cart</i> <i class="material-icons" style="color: mediumvioletred;">remove_shopping_cart</i>
<span style="font-size: 16px;padding-left: 12px;position: relative;bottom: 6px;">Remove the item from the cart ?</span> <span style="font-size: 16px;padding-left: 12px;position: relative;bottom: 6px;">Remove the item from the cart ?</span>
<div md-dialog-actions class="delete-cartitems-button"> <div md-dialog-actions class="delete-cartitems-button">
<button style="background-color: mediumvioletred;color: white;" md-button md-dialog-close="Option 1" (click)="deleteCartItem();">Yes</button> <button style="background-color: mediumvioletred;color: white;" md-button md-dialog-close="Option 1" ">Yes</button>
<button class="no-button" md-button md-dialog-close="Option 2">No</button> <button class="no-button" md-button md-dialog-close="Option 2">No</button>
</div> </div>
</div> </div>
-->
<h1 md-dialog-title>{{dialogTitle}}</h1>
<div md-dialog-content>{{confirmMsg}}</div>
<div md-dialog-actions>
<button md-button md-dialog-close="false">{{cancelText}}</button>
<button md-button md-dialog-close="true">{{confirmText}}</button>
</div>
\ No newline at end of file
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