]> _ Git - fluidbook-html5.git/commitdiff
wait #4344 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 12 Mar 2021 10:20:10 +0000 (11:20 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 12 Mar 2021 10:20:10 +0000 (11:20 +0100)
js/libs/fluidbook/cart/fluidbook.cart.puma.js
style/cart/puma.less

index 03bc86e3e6c7ccf801afa8fb4758e40d492a87cc..5b62c35e41e230ce739772ae1a7b0d7511aa22ab 100644 (file)
@@ -23,6 +23,34 @@ FluidbookCartPuma.prototype = {
             }
             return false;
         });
+
+        $(document).on('click', '.emptyCart', function () {
+            $.confirm({
+                backgroundDismiss: true,
+                title: 'Empty my cart',
+                content: 'Are you sure you want to empty your cart ?',
+                buttons: {
+                    confirm: {
+                        text: 'Confirm',
+                        btnClass: 'btn-ok',
+                        action: function () {
+                            $this.emptyCart();
+                        },
+                    },
+                    cancel: function () {
+
+                    },
+                }
+            });
+            return false;
+        });
+    },
+
+    emptyCart: function () {
+        this.items = [];
+        this.updateCart();
+        this.save();
+        resize();
     },
 
     addToCart: function (ref, quantity) {
@@ -44,7 +72,6 @@ FluidbookCartPuma.prototype = {
     },
 
     removeFromCart: function (key) {
-        console.log(key);
         if (key >= 0) {
             this.items.splice(key, 1);
             this.save();
@@ -126,9 +153,9 @@ FluidbookCartPuma.prototype = {
         content += head;
         content += '<tbody>';
         $.each(this.getItems(), function (i, ref) {
-            if(i%12===0 && i>0){
-                content+='<tr class="break">';
-            }else {
+            if (i % 12 === 0 && i > 0) {
+                content += '<tr class="break">';
+            } else {
                 content += '<tr>';
             }
             $.each(columns, function (k, v) {
@@ -153,7 +180,7 @@ FluidbookCartPuma.prototype = {
         content += '</tbody>';
         content += '</table>';
         content += '<div class="cart-footer">';
-        content += '<div class="fonctions"><a href="#" class="exportCartPDF">Export my cart (PDF)</a><a href="#" class="exportCartXLS">Export my cart (XLS)</a></div>';
+        content += '<div class="fonctions"><a href="#" class="emptyCart">Empty my cart</a><a href="#" class="exportCartPDF">Export my cart (PDF)</a><a href="#" class="exportCartXLS">Export my cart (XLS)</a></div>';
         content += '</div>';
 
         return content;
index 44470cc87c2af3fd3af01350124d3c101f08a330..d69d1bb616fb5d3ee09565c267e59b7bcfe9df91 100644 (file)
@@ -9,6 +9,14 @@
       display: none;
     }
   }
+
+  .emptyCart {
+    float: left;
+    margin-left: 30px;
+    border: 1px solid @menu-button-background;
+    color: @menu-button-background;
+    background-color: transparent;
+  }
 }
 
 [data-type="7"] {