exportPlanogramme: function () {
+ let $this = this;
let GET = {};
$.each(this.exportData, function (k, v) {
GET[v.name] = v.value;
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 () {