public_html/layouts/basic/modules/Vtiger/resources/PDF.min.js
'use strict';
/* {[The file is published on the basis of YetiForce Public License 6.5 that can be found in the following directory: licenses/LicenseEN.txt or yetiforce.com]} */"use strict";$.Class("Vtiger_PDF_Js",{/**
* Proceed form submission
*/proceedSubmit:function proceedSubmit(mode){var loader=$.progressIndicator({message:app.vtranslate("JS_PDF_GENERATING"),position:"html",blockInfo:{enabled:!0}});"generate_pdf"===mode?this.container.find("#pdfExportModal").submit():"single_pdf"===mode?(this.container.find("[name=\"single_pdf\"]").val(1),this.container.find("#pdfExportModal").submit()):"email_pdf"===mode?(this.container.find("[name=\"email_pdf\"]").val(1),this.container.find("#pdfExportModal").submit()):void 0;loader.progressIndicator({mode:"hide"}),app.hideModalWindow();},/*
* Function to register the click event for generate button
*/registerPreSubmitEvent:function registerPreSubmitEvent(container){var self=this;container.find("#generate_pdf, #single_pdf, #email_pdf").on("click",function(e){e.preventDefault(),self.proceedSubmit.apply(self,[$(e.currentTarget).attr("id")]);});},/**
* Register list view check records
*
* @param {jQuery} container
*/registerListViewCheckRecords:function registerListViewCheckRecords(container){var templateElements=container.find("[name=\"pdf_template[]\"]");templateElements.on("change",function(){document.progressLoader=$.progressIndicator({message:app.vtranslate("JS_PDF_RECALCULATING"),position:"html",blockInfo:{enabled:!0}});var templateContainer=$(this).closest(".js-pdf-template-content");templateContainer.find(".js-pdf-user-variable").toggleClass("d-none");var templates=[];templateElements.filter(":checked").each(function(){templates.push($(this).val());});var params=container.find("form").serializeFormData();params.mode="validateRecords",params.templates=templates,AppConnector.request(params).done(function(data){var response=data.result;if(data.success){var valid=response.valid,info=container.find(".js-records-info").text(response.message).removeClass("d-none");valid&&info.addClass("d-none"),setTimeout(function(){document.progressLoader.progressIndicator({mode:"hide"});},500),container.find(".js-submit-button").each(function(){$(this).attr("disabled",!valid);});}}).fail(function(data,err){app.errorLog(data,err);});});},/**
* Register select custom columns change
*/registerSelectCustomColumnsChange:function registerSelectCustomColumnsChange(){var _this=this;this.container.find("[name=\"isCustomMode\"]").on("change",function(ev){$(ev.target).is(":checked")?(_this.container.find("[name=\"inventoryColumns[]\"]").prop("disabled",null),_this.container.find(".js-save-scheme").prop("disabled",null)):(_this.container.find("[name=\"inventoryColumns[]\"]").prop("disabled","disabled"),_this.container.find(".js-save-scheme").prop("disabled","disabled"));});},/**
* Register save scheme button click
*/registerSaveInventoryColumnSchemeClick:function registerSaveInventoryColumnSchemeClick(){var _this2=this;this.container.find(".js-save-scheme").on("click",function(e){e.preventDefault(),e.stopPropagation();var loader=$.progressIndicator({position:"html",blockInfo:{enabled:!0}}),params=_this2.container.find("form").serializeFormData();params.mode="saveInventoryColumnScheme",params.isCustomMode=_this2.container.find("[name=\"isCustomMode\"]").is(":checked"),AppConnector.request(params).done(function(data){var response=data.result;data.success&&loader.progressIndicator({mode:"hide"}),response.message&&data.success&&app.showNotify({text:response.message,type:"success"});}).fail(function(data,err){app.errorLog(data,err);});});},/**
* Register events
*/registerEvents:function registerEvents(){var container=this.container=$("#pdfExportModal").closest(".js-modal-container");this.dynamicTemplatesCount=0,this.recordId=parseInt(container.find("[name=\"record\"]").val()),this.registerPreSubmitEvent(container),this.registerSaveInventoryColumnSchemeClick(),this.registerSelectCustomColumnsChange(),this.registerListViewCheckRecords(container);}}),$(function(){new Vtiger_PDF_Js().registerEvents();});
//# sourceMappingURL=PDF.min.js.map