YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/basic/modules/Vtiger/resources/GenerateModal.min.js

Summary

Maintainability
A
0 mins
Test Coverage
'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";jQuery.Class("Vtiger_GenerateModal_Js",{},{registerGenetateButton:function registerGenetateButton(container){var thisInstance=this;container.find("button.js-genetate-button").on("click",function(){document.progressLoader=$.progressIndicator({message:app.vtranslate("JS_LOADING_PLEASE_WAIT"),position:"html",blockInfo:{enabled:!0}});var currentTarget=container.find(".js-generate-mapping option:selected"),actionUrl=currentTarget.data("url"),method=container.find("[name=\"method\"]:checked");0>=method.length?window.location.href=actionUrl:AppConnector.request({data:{module:app.getModuleName(),action:"GenerateRecords",records:container.find("[name=\"all_records\"]").val(),template:currentTarget.data("id"),target:currentTarget.data("name"),method:method.val()},dataType:"json"}).done(function(data){var response=data.result;if(data.success){var records=response.ok;if(thisInstance.summary(container,response),document.progressLoader.progressIndicator({mode:"hide"}),"1"===method.val())for(var i in records)window.open(actionUrl+records[i],"_blank");}}).fail(function(data,err){app.errorLog(data,err);});});},summary:function summary(container,data){container.find(".modal-title").text(app.vtranslate("JS_SUMMARY")),container.find(".modal-body").html("<div>"+app.vtranslate("JS_SELECTED_RECORDS")+": <strong>"+data.all+"</strong></div><div>"+app.vtranslate("JS_SUCCESSFULLY_PERFORMED_ACTION_FOR")+": <strong>"+data.ok.length+"</strong></div><div>"+app.vtranslate("JS_ACTION_FAILED_FOR")+": <strong>"+data.fail.length+"</strong></div>");},registerEvents:function registerEvents(){var container=jQuery(".generateMappingModal");this.registerGenetateButton(container);}}),jQuery(document).ready(function(){var instance=new Vtiger_GenerateModal_Js;instance.registerEvents();});
//# sourceMappingURL=GenerateModal.min.js.map