]> _ Git - fluidbook-html5.git/commitdiff
wait #7834 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 14 Nov 2025 13:12:47 +0000 (14:12 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 14 Nov 2025 13:12:47 +0000 (14:12 +0100)
js/libs/fluidbook/cart/fluidbook.cart.puma.js

index db8d03843640e6baa7e16fcc45a3475fcffb7ff9..61193a6ac3fce88066e65e8d955bb4690b400fc5 100644 (file)
@@ -266,6 +266,7 @@ FluidbookCartPuma.prototype = {
 
 
     exportPlanogramme: function () {
+        let $this = this;
         let GET = {};
         $.each(this.exportData, function (k, v) {
             GET[v.name] = v.value;
@@ -277,12 +278,21 @@ FluidbookCartPuma.prototype = {
             GET.pvp = 0;
         }
         this.fluidbook.displayLoader();
-        this.fluidbook.hideLoader(3);
-        let url = this.fluidbook.service.getBaseURL(true) + 'puma/planogramme/' + this.fluidbook.settings.id + '_' + this.fluidbook.settings.cid + '/' + encodeURIComponent(this.getItemsReferences().join(',')) + '/pdf/' + encodeURIComponent(this.getExportFileName()) + '/' + (GET.pa == '1' ? '1' : '0') + '/' + (GET.pvp == '1' ? '1' : '0');
-        console.log(url);
-        $("#puma_planogramme").remove();
-        $("body").append('<a href="' + url + '" download="' + this.getExportFileName() + '.pdf' + '" id="puma_planogramme"></a>');
-        $("#puma_planogramme").get(0).click();
+        let refs = this.getItemsReferences().join(',');
+        let url = this.fluidbook.service.getBaseURL(true) + 'puma/planogramme/' + this.fluidbook.settings.id + '_' + this.fluidbook.settings.cid + '/pdf/' + encodeURIComponent(this.getExportFileName()) + '/' + (GET.pa == '1' ? '1' : '0') + '/' + (GET.pvp == '1' ? '1' : '0');
+
+        $.ajax({
+            url: url, method: 'POST', data: {references: refs}, xhrFields: {
+                'responseType': 'blob'
+            }, dataType: 'binary', success: function (data) {
+                var blob = new Blob([data]);
+                var link = document.createElement('a');
+                link.href = window.URL.createObjectURL(blob);
+                link.download = $this.getExportFileName() + ".pdf";
+                link.click();
+                $this.fluidbook.hideLoader(2);
+            },
+        });
     },
 
     exportPDF: function () {