this.fluidbook = this.cart.fluidbook;
this.data = this.fluidbook.settings.basketReferences;
this.exportFileName = '';
+ this.exportData;
this.base64URL = {};
this.base64Loading = 0;
this.init();
$(document).on(this.fluidbook.input.clickEvent, '.exportCartPDF', function () {
$this.chooseFileName(function () {
$this.exportPlanogramme();
- });
+ }, '<h3 style="margin-top: 15px; font-weight: normal">Options</h3><label><input type="checkbox" name="pa" value="1" checked> Show PA</label><label><input type="checkbox" name="pvp" value="1" checked> Show PVP</label>');
return false;
});
exportPlanogramme: function () {
+ let GET = {};
+ $.each(this.exportData, function (k, v) {
+ GET[v.name] = v.value;
+ });
+ if(GET.pa===undefined){
+ GET.pa = 0;
+ }
+ if(GET.pvp===undefined){
+ 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());
+ 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>');
});
},
- chooseFileName: function (callback) {
+ chooseFileName: function (callback, contents) {
+ if (contents === undefined) {
+ contents = '';
+ }
var $this = this;
$.confirm({
title: 'Name your file',
- content: '' + '<form action="" class="formName">' + '<div class="form-group">' + '<input type="text" value="' + this.getExportFileName() + '" placeholder="File name" class="name form-control" required />' + '</div>' + '</form>',
+ content: '' + '<form action="" class="formName">' + '<div class="form-group">' + '<input type="text" value="' + this.getExportFileName() + '" placeholder="File name" class="name form-control" required />' + contents + '</div>' + '</form>',
buttons: {
formSubmit: {
text: 'Submit', btnClass: 'btn-ok', action: function () {
$this.exportFileName = this.$content.find('.name').val();
+ $this.exportData = this.$content.find('form').serializeArray();
callback();
}
}, cancel: function () {