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

index b475c9e2a9cddfd1286eec94615ceb47850486c1..03bc86e3e6c7ccf801afa8fb4758e40d492a87cc 100644 (file)
@@ -87,7 +87,7 @@ FluidbookCartPuma.prototype = {
     },
 
     getColumns: function () {
-        return ['Catalogue', 'Catégorie', 'Ligne', 'Sexe', 'Modèle', 'Couleur', 'Désignation', 'Tarif', 'PVC', 'Image', 'PACK'];
+        return ['Image|onlyprint', 'Catalogue', 'Catégorie', 'Ligne', 'Sexe', 'Modèle', 'Couleur', 'Désignation', 'Tarif', 'PVC', 'Image|noprint', 'PACK'];
     },
 
     getExcelColumns: function () {
@@ -111,19 +111,30 @@ FluidbookCartPuma.prototype = {
             return '<div class="cart-empty">' + this.fluidbook.l10n.__('your cart is empty') + '</div>';
         }
 
-        var columns = this.getColumns();
         var $this = this;
-        var content = '<table id="pumacarttable" class="cart-items" cellpadding="0" cellspacing="0">';
-        content += '<thead><tr>';
+        var columns = this.getColumns();
+        var head = '<thead><tr>';
         $.each(columns, function (k, v) {
-            content += '<th data-label="' + v + '">' + v + '</th>';
+            var e = v.split('|');
+            var cls = e.length === 1 ? '' : ' class="' + e[1] + '"'
+            head += '<th data-label="' + e[0] + '"' + cls + '>' + e[0] + '</th>';
         });
-        content += '<th></th>';
-        content += '</tr></thead>';
+        head += '<th></th>';
+        head += '</tr></thead>';
+
+        var content = '<table id="pumacarttable" class="cart-items" cellpadding="0" cellspacing="0">';
+        content += head;
         content += '<tbody>';
         $.each(this.getItems(), function (i, ref) {
-            content += '<tr>';
+            if(i%12===0 && i>0){
+                content+='<tr class="break">';
+            }else {
+                content += '<tr>';
+            }
             $.each(columns, function (k, v) {
+                var e = v.split('|');
+                var cls = e.length === 1 ? '' : ' class="' + e[1] + '"'
+                v = e[0];
                 var value = $this.data[ref][v];
                 if (v === 'PVC' || v === 'Tarif') {
                     value = $this.formatPrice(value, '€');
@@ -134,7 +145,7 @@ FluidbookCartPuma.prototype = {
                         value = '-';
                     }
                 }
-                content += '<td data-label="' + v + '"><span>' + value + '</span></td>';
+                content += '<td data-label="' + v + '"' + cls + '><span>' + value + '</span></td>';
             });
             content += '<td><a href="#" data-cart-delete="' + i + '">' + getSpriteIcon('interface-close') + '</a></td>';
             content += '</tr>';
@@ -170,7 +181,7 @@ FluidbookCartPuma.prototype = {
 
     getExportFileName: function () {
         var date = new Date();
-        return this.fluidbook.settings.title + ' - Cart - ' + date.getFullYear() + '-' + date.getMonth() + '-' + date.getDay();
+        return this.fluidbook.settings.title + ' - Cart - ' + date.getFullYear() + '-' + date.getMonth() + '-' + date.getDate();
     },
 
     exportXLS: function () {
@@ -231,8 +242,8 @@ FluidbookCartPuma.prototype = {
                 }
                 row[v] = val;
             });
-            var r=sheet.addRow(row);
-            r.height=Math.round(150/$this.data[ref]['zoom_image_ratio']);
+            var r = sheet.addRow(row);
+            r.height = Math.round(150 / $this.data[ref]['zoom_image_ratio']);
         });
         $.each(columnsLabels, function (k, v) {
             sheet.getColumn(k + 1).numFmt = fmt[v];
@@ -243,7 +254,7 @@ FluidbookCartPuma.prototype = {
                 base64: 'data:image/jpeg;base64,' + $this.data[ref]['zoom_url'],
                 extension: 'jpeg',
             });
-            sheet.addImage(img, {tl: {col:0, row: i + 1}, br: {col: 1, row: i + 2}, editAs: 'twoCell'});
+            sheet.addImage(img, {tl: {col: 0, row: i + 1}, br: {col: 1, row: i + 2}, editAs: 'twoCell'});
         });
 
         workbook.xlsx.writeBuffer().then(function (data) {
index 063b3444cad88da6a7eb5b1b54fe02d9ef1b958d..44470cc87c2af3fd3af01350124d3c101f08a330 100644 (file)
     font-size: 8px;
     width: 100%;
 
+    tr.break {
+      page-break-after: always;
+    }
+
     td, th {
       vertical-align: top;
       padding: 5px;
 
+      &.onlyprint {
+        display: table-cell;
+      }
+
+      &.noprint {
+        display: none;
+      }
+
       &:last-child {
         display: none;
       }
     font-size: 11px;
     text-align: center;
 
+    &.onlyprint {
+      display: none;
+    }
+
+    &.noprint {
+      display: table-cell;
+    }
+
     span {
       display: block;
       max-width: 120px;
     tr {
       background-color: #fff;
       color: #000
+
     }
 
   }