text: /*! Copyright Pyplan 2020. All rights reserved. */
  (window.webpackJsonp=window.webpackJsonp||[]).push([[36],{1498:function(e,t,a){(function(e,n){var r=/%[sdj%]/g;t.format=function(e){if(!v(e)){for(var t=[],a=0;a<arguments.length;a++)t.push(o(arguments[a]));return t.join(" ")}a=1;for(var n=arguments,l=n.length,i=String(e).replace(r,function(e){if("%%"===e)return"%";if(a>=l)return e;switch(e){case"%s":return String(n[a++]);case"%d":return Number(n[a++]);case"%j":try{return JSON.stringify(n[a++])}catch(e){return"[Circular]"}default:return e}}),s=n[a];a<l;s=n[++a])m(s)||!y(s)?i+=" "+s:i+=" "+o(s);return i},t.deprecate=function(a,r){if(b(e.process))return function(){return t.deprecate(a,r).apply(this,arguments)};if(!0===n.noDeprecation)return a;var l=!1;return function(){if(!l){if(n.throwDeprecation)throw new Error(r);n.traceDeprecation?console.trace(r):console.error(r),l=!0}return a.apply(this,arguments)}};var l,i={};function o(e,a){var n={seen:[],stylize:c};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),p(a)?n.showHidden=a:a&&t._extend(n,a),b(n.showHidden)&&(n.showHidden=!1),b(n.depth)&&(n.depth=2),b(n.colors)&&(n.colors=!1),b(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=s),d(n,e,n.depth)}function s(e,t){var a=o.styles[t];return a?"["+o.colors[a][0]+"m"+e+"["+o.colors[a][1]+"m":e}function c(e,t){return e}function d(e,a,n){if(e.customInspect&&a&&k(a.inspect)&&a.inspect!==t.inspect&&(!a.constructor||a.constructor.prototype!==a)){var r=a.inspect(n,e);return v(r)||(r=d(e,r,n)),r}var l=function(e,t){if(b(t))return e.stylize("undefined","undefined");if(v(t)){var a="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(a,"string")}if(g(t))return e.stylize(""+t,"number");if(p(t))return e.stylize(""+t,"boolean");if(m(t))return e.stylize("null","null")}(e,a);if(l)return l;var i=Object.keys(a),o=function(e){var t={};return e.forEach(function(e,a){t[e]=!0}),t}(i);if(e.showHidden&&(i=Object.getOwnPropertyNames(a)),D(a)&&(i.indexOf("message")>=0||i.indexOf("description")>=0))return u(a);if(0===i.length){if(k(a)){var s=a.name?": "+a.name:"";return e.stylize("[Function"+s+"]","special")}if(_(a))return e.stylize(RegExp.prototype.toString.call(a),"regexp");if(w(a))return e.stylize(Date.prototype.toString.call(a),"date");if(D(a))return u(a)}var c,y="",C=!1,M=["{","}"];(f(a)&&(C=!0,M=["[","]"]),k(a))&&(y=" [Function"+(a.name?": "+a.name:"")+"]");return _(a)&&(y=" "+RegExp.prototype.toString.call(a)),w(a)&&(y=" "+Date.prototype.toUTCString.call(a)),D(a)&&(y=" "+u(a)),0!==i.length||C&&0!=a.length?n<0?_(a)?e.stylize(RegExp.prototype.toString.call(a),"regexp"):e.stylize("[Object]","special"):(e.seen.push(a),c=C?function(e,t,a,n,r){for(var l=[],i=0,o=t.length;i<o;++i)R(t,String(i))?l.push(h(e,t,a,n,String(i),!0)):l.push("");return r.forEach(function(r){r.match(/^\d+$/)||l.push(h(e,t,a,n,r,!0))}),l}(e,a,n,o,i):i.map(function(t){return h(e,a,n,o,t,C)}),e.seen.pop(),function(e,t,a){if(e.reduce(function(e,t){return 0,t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return a[0]+(""===t?"":t+"\n ")+" "+e.join(",\n  ")+" "+a[1];return a[0]+t+" "+e.join(", ")+" "+a[1]}(c,y,M)):M[0]+y+M[1]}function u(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,a,n,r,l){var i,o,s;if((s=Object.getOwnPropertyDescriptor(t,r)||{value:t[r]}).get?o=s.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):s.set&&(o=e.stylize("[Setter]","special")),R(n,r)||(i="["+r+"]"),o||(e.seen.indexOf(s.value)<0?(o=m(a)?d(e,s.value,null):d(e,s.value,a-1)).indexOf("\n")>-1&&(o=l?o.split("\n").map(function(e){return"  "+e}).join("\n").substr(2):"\n"+o.split("\n").map(function(e){return"   "+e}).join("\n")):o=e.stylize("[Circular]","special")),b(i)){if(l&&r.match(/^\d+$/))return o;(i=JSON.stringify(""+r)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),i=e.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),i=e.stylize(i,"string"))}return i+": "+o}function f(e){return Array.isArray(e)}function p(e){return"boolean"==typeof e}function m(e){return null===e}function g(e){return"number"==typeof e}function v(e){return"string"==typeof e}function b(e){return void 0===e}function _(e){return y(e)&&"[object RegExp]"===C(e)}function y(e){return"object"==typeof e&&null!==e}function w(e){return y(e)&&"[object Date]"===C(e)}function D(e){return y(e)&&("[object Error]"===C(e)||e instanceof Error)}function k(e){return"function"==typeof e}function C(e){return Object.prototype.toString.call(e)}function M(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(b(l)&&(l=n.env.NODE_DEBUG||""),e=e.toUpperCase(),!i[e])if(new RegExp("\\b"+e+"\\b","i").test(l)){var a=n.pid;i[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,a,n)}}else i[e]=function(){};return i[e]},t.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=f,t.isBoolean=p,t.isNull=m,t.isNullOrUndefined=function(e){return null==e},t.isNumber=g,t.isString=v,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=b,t.isRegExp=_,t.isObject=y,t.isDate=w,t.isError=D,t.isFunction=k,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=a(1499);var T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function R(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",function(){var e=new Date,t=[M(e.getHours()),M(e.getMinutes()),M(e.getSeconds())].join(":");return[e.getDate(),T[e.getMonth()],t].join(" ")}(),t.format.apply(t,arguments))},t.inherits=a(1500),t._extend=function(e,t){if(!t||!y(t))return e;for(var a=Object.keys(t),n=a.length;n--;)e[a[n]]=t[a[n]];return e}}).call(this,a(14),a(136))},1499:function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},1500:function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var a=function(){};a.prototype=t.prototype,e.prototype=new a,e.prototype.constructor=e}},1501:function(e,t,a){var n=a(690);e.exports=(n.default||n).template({compiler:[8,">= 4.3.0"],main:function(e,t,a,n,r){return'\n<div class="row formFilters" style="display: block;">\n    \n</div>\n\n<div class="row">\n\n    <ul class="inputFormCollabWrapper">\n    </ul>\n    <div class="col-sm-12 tableWrapper" style="width:100%;">\n    </div>\n\n    <div class="col-sm-12 rowCount">\n        \n    </div>\n\n</div>\n'},useData:!0})},1502:function(e,t,a){var n=a(690);e.exports=(n.default||n).template({1:function(e,t,n,r,l){var i;return"\n"+(null!=(i=function(e){return e&&(e.__esModule?e.default:e)}(a(689)).call(null!=t?t:e.nullContext||{},null!=t?t.filterType:t,"==","text",{name:"ifCond",hash:{},fn:e.program(2,l,0),inverse:e.program(4,l,0),data:l,loc:{start:{line:3,column:0},end:{line:43,column:11}}}))?i:"")},2:function(e,t,a,n,r){var l=e.lambda,i=e.escapeExpression;return'<div class="col-sm-3">\n\n    <div class="form-group">\n        <label for="textfield" class="control-label col-sm-12">'+i(l(null!=t?t.header:t,t))+'</label>\n        <div class="col-sm-10">\n            <div class="input-group">\n                <input class="form-control filterText col-sm-12" type="text" name="textfield" id="textfield"\n                    class="form-control" filter="true" field="'+i(l(null!=t?t.field:t,t))+'" value-field="'+i(l(null!=t?t.valueField:t,t))+'" filter-type="'+i(l(null!=t?t.filterType:t,t))+'"\n                    node-filter-id="'+i(l(null!=t?t.nodeFilterId:t,t))+'" template-code="'+i(l(null!=t?t.entity:t,t))+'" template-id="'+i(l(null!=t?t.inputTemplateId:t,t))+'"\n                    use-like="'+i(l(null!=t?t.useLike:t,t))+'" read-only="'+i(l(null!=t?t.readOnly:t,t))+'" status-ready="false" value="'+i(l(null!=t?t.defaultVal:t,t))+'">\n                <div class="input-group-btn">\n                    <button class="btn" type="button"> <i class="fa fa-search"></i> </button>\n                </div>\n            </div>\n        </div>\n    </div>\n</div>\n'},4:function(e,t,a,n,r){var l,i=e.lambda,o=e.escapeExpression,s=null!=t?t:e.nullContext||{};return'<div class="col-sm-3">\n    <div class="form-group">\n        <label for="textfield" class="control-label">'+o(i(null!=t?t.header:t,t))+"</label>\n\n"+(null!=(l=a.if.call(s,null!=t?t.multiple:t,{name:"if",hash:{},fn:e.program(5,r,0),inverse:e.noop,data:r,loc:{start:{line:26,column:8},end:{line:28,column:19}}}))?l:"")+'\n            <div class="selectRemote" style="width: 100%; '+(null!=(l=a.if.call(s,null!=t?t.multiple:t,{name:"if",hash:{},fn:e.program(7,r,0),inverse:e.noop,data:r,loc:{start:{line:30,column:58},end:{line:30,column:82}}}))?l:"")+'" filter="true" field="'+o(i(null!=t?t.field:t,t))+'"\n                value-field="'+o(i(null!=t?t.valueField:t,t))+'" filter-type="'+o(i(null!=t?t.filterType:t,t))+'" node-filter-id="'+o(i(null!=t?t.nodeFilterId:t,t))+'"\n                template-code="'+o(i(null!=t?t.entity:t,t))+'" template-id="'+o(i(null!=t?t.inputTemplateId:t,t))+'" use-like="'+o(i(null!=t?t.useLike:t,t))+'"\n                entity-label="'+o(i(null!=t?t.entityLabel:t,t))+'" related-field="'+o(i(null!=t?t.relatedField:t,t))+'"\n                related-manytomanyentity="'+o(i(null!=t?t.relatedManyToManyEntity:t,t))+'" related-manytomanykey="'+o(i(null!=t?t.relatedManyToManyKey:t,t))+'"\n                include-all="'+o(i(null!=t?t.includeAll:t,t))+'" read-only="'+o(i(null!=t?t.readOnly:t,t))+'" sort-by="'+o(i(null!=t?t.sortBy:t,t))+'" status-ready="false"></div>\n\n'+(null!=(l=a.if.call(s,null!=t?t.multiple:t,{name:"if",hash:{},fn:e.program(9,r,0),inverse:e.noop,data:r,loc:{start:{line:37,column:12},end:{line:39,column:15}}}))?l:"")+"\n    </div>\n</div>\n"},5:function(e,t,a,n,r){return'        <div class="multiple-wrapper">\n'},7:function(e,t,a,n,r){return" "},9:function(e,t,a,n,r){return"        </div>\n"},compiler:[8,">= 4.3.0"],main:function(e,t,a,n,r){var l;return null!=(l=a.each.call(null!=t?t:e.nullContext||{},null!=t?t.filters:t,{name:"each",hash:{},fn:e.program(1,r,0),inverse:e.noop,data:r,loc:{start:{line:1,column:0},end:{line:44,column:9}}}))?l:""},useData:!0})},849:function(module,exports,__webpack_require__){"use strict";(function(Backbone,$,moment){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__,_globalFxs=__webpack_require__(18),_handsontable=_interopRequireDefault(__webpack_require__(884)),_util=__webpack_require__(1498);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}__WEBPACK_AMD_DEFINE_ARRAY__=[__webpack_require__(746),__webpack_require__(986),__webpack_require__(1501),__webpack_require__(1502)],__WEBPACK_AMD_DEFINE_RESULT__=function(InputModuleModel,NodeJsManager,HTMLTemplate,HTMLFilters){var view=Backbone.View.extend({el:$("#main"),table:void 0,templateMetadata:void 0,templateData:void 0,tableData:void 0,hasRowTotal:!1,departmentDic:void 0,userDic:void 0,tableOptions:null,changesDic:{rows:[],toDelete:[]},rowsToDelete:{toDelete:[]},externalView:null,nodeJSManager:null,totalFilters:0,historyTimeOut:-1,titleTimeOut:-1,historyDic:null,includeHistory:!1,tagId:null,errorList:"",firstLoad:!0,_div:document.createElement("div"),_button:document.createElement("button"),render:function(e){var t=this;t._div.className="remoteDropdown",t._button.className="btn formBtn",this.tagId=e,this.nodeJSManager=new NodeJsManager,this.inputModuleModel=new InputModuleModel;var a=HTMLTemplate();this.getBase().append(a),this.drawTemplate(!1),this.addHandlers(),this.getBase().closest(".mainTask").on("removeView",function(){t.onRemoveView()}),this.getBase().closest(".mainTask").on("collabMessage",function(e,a,n){t.onCollabMessage(a,n)}),this.getBase().closest(".mainTask").on("refreshOnFocus",function(){t.templateMetadata.refreshOnFocus&&t.getTemplateData()}),$(window).resize(function(){t.options.inputForm?t.onBaseResize():t.onResize()}),this.addMouseOverTitleHandler()},onResize:function(){this.getBase().find(".tableWrapper");var e=this.getBase().find(".formFilters").height(),t=$(window).width()-10;t-=68;var a=$(window).height();a-=145+e,this.table&&this.table.updateSettings({height:a,width:t})},onBaseResize:function(){var e=this.getBase().find(".formFilters").height(),t=this.$el.parent().width(),a=this.$el.parent().height();a-=55+e,this.table&&this.table.updateSettings({height:a,width:t})},onRemoveView:function(){if(this.inputModuleModel=null,this.departmentDic=null,this.userDic=null,this.changesDic={rows:[],toDelete:[]},this.table&&(this.table.destroy(),this.table=null),this.templateMetadata=null,this.templateData=null,this.tableData=null,this.externalView&&this.externalView.destroy)try{this.externalView.destroy()}catch(e){}this.externalView=null,this.nodeJSManager=null,this.historyDic=null},resize:function(){this.getBase().find(".inputTable").parent().height($(window).height()-200),this.getBase().find(".inputTable").height($(window).height()-200),this.getBase().find(".inputTable").trigger("updateSize")},getBase:function(){return this.$el},getBaseTask:function(){var e=this.options.templateId;return $('div[data-rel="form-'+e+'"]')},addHandlers:function(){var e=this,t=this.options.templateId;this.getBaseTask().find("button.addRow").on("click",function(t){e.addNewRow()}),this.getBaseTask().find("button.showFilters").on("click",function(t){e.toggleFilters()}),this.getBaseTask().find("button.showWorkflow").on("click",function(t){t.preventDefault(),e.showWorkflow(t)}),this.getBaseTask().find("button.showHistory").on("click",function(t){t.preventDefault(),e.includeHistory=!e.includeHistory,$(this).toggleClass("selected"),e.getTemplateData()}),this.getBase().find(".tableWrapper").on("mouseover","td.with-history",function(){var t=$(this).attr("data-history-key"),a=event;e.historyTimeOut=setTimeout(function(){e.showHistoryData(a,t)},500)}),this.getBase().find(".tableWrapper").on("mouseover","a.with-description",function(){var t=$(this).attr("data-desc"),a=event;e.titleTimeOut=setTimeout(function(){e.showColDescription(a,t)},500)}),this.getBase().find(".tableWrapper").on("mouseout","td.with-history",function(){clearTimeout(e.historyTimeOut)}),this.getBase().find(".tableWrapper").on("mouseout","a.with-description",function(){clearTimeout(e.titleTimeOut)}),$("a[data-rel="+t+"] div").on("click",function(t){$(this).hasClass("orange")&&__webpack_require__.e(14).then(function(){var a=[__webpack_require__(734)];(function(a){var n={title:"Errors",content:e.errorList,left:t.clientX,top:t.clientY};(new a).show(n)}).apply(null,a)}).catch(__webpack_require__.oe)}),$(e.tagId).find(".item-title div div").on("click",function(t){$(this).hasClass("orange")&&__webpack_require__.e(14).then(function(){var a=[__webpack_require__(734)];(function(a){var n={title:"Errors",content:e.errorList,left:t.clientX,top:t.clientY};(new a).show(n)}).apply(null,a)}).catch(__webpack_require__.oe)})},addMouseOverTitleHandler:function(){var e,t=this;$(this.tagId).find(".item-title .knowledge-arrow").hover(function(a){if(t.templateMetadata.workflowGroups&&t.templateMetadata.workflowGroups.length>0)return e=setTimeout(function(){$(".popover-title").parent().remove(),t.showWorkflow(a)},1e3),!1},function(){clearTimeout(e)})},toggleFilters:function(e){this.getBase().find(".formFilters").toggle()},addNewRow:function(){var e=this,t={id:this.options.templateId,debugConsole:"-- AddNewRow --",rows:[{changes:[],id:-1}]};e.addDataForHiddenCols(e.table.getInstance(),t.rows[0]),this.inputModuleModel.setData(t,function(t){var a=e.table.countRows(),n=a;e.hasRowTotal&&(n=a-1),e.table.alter("insert_row",n,1,"ContextMenu.rowAbove"),e.table.setDataAtRowProp(n,"id",t[0].newId)})},deleteRows:function(){var e=this;this.inputModuleModel.setData(e.rowsToDelete,function(t){t.length>0&&(e.drawTable(),e.rowsToDelete.toDelete=[],e.toRemoveOnTable=[])})},drawTemplate:function(e){var t=this,a=this.options.templateId;a||(a=this.options.inputForm.templateId),this.inputModuleModel.getMetadata(a,function(n){t.loadMetadata(n,a,e),t.$el.trigger("onUpdateMetadata",n)})},loadMetadata:function(e,t,a){var n=this;this.templateMetadata=e,this.includeExternalJs();var r=e.filters||[];this.loadToolbar();var l=!0;this.totalFilters=r.length;for(var i=0;i<r.length;i++)!0===r[i].includeAll||void 0===r[i].includeAll?(r[i].includeAll=!0,l=!1):!1===r[i].includeAll&&(l=!1);r.length>0&&this.drawFilters(r,a);var o=new Promise(function(t,a){n.checkForDepartmentSelector(e)?n.createDepartmentDict(function(){t(!0)}):t(!1)}),s=new Promise(function(t,a){n.checkForUserSelector(e)?n.createUserDict(function(){t(!0)}):t(!1)});Promise.all([o,s]).then(function(e){(e[0]||e[1]||l)&&n.getTemplateData()}),this.templateMetadata.allowAdd&&$(this.tagId).trigger("setAddButton")},getTemplateData:function getTemplateData(){var _this=this,formId=this.options.templateId;formId||(formId=this.options.inputForm.templateId);var params={id:formId,filters:[],includeHistory:_this.includeHistory},filters=[];if(_this.firstLoad&&_this.options.savedFilters&&_this.options.savedFilters.length>0)for(var i=0;i<_this.options.savedFilters.length;i++)this.getBase().find('.formFilters .selectRemote[field="'+_this.options.savedFilters[i].field+'"]').select2("data",_this.options.savedFilters[i].val);_this.firstLoad=!1,this.getBase().find(".formFilters .selectRemote.select2-offscreen, .formFilters .filterText").each(function(e,t){var a,n,r=$(t).attr("field"),l=$(t).attr("value-field"),i=$(t).attr("use-like"),o=$(t).attr("filter-type"),s=$(t).attr("node-filter-id");if(i="true"===i,"text"===o)n=[],""==(a=$(t).val()).trim()&&(a="-1"),i=!0;else if(l){var c=$(t).select2("data");n=[$(t).select2("data")],"1"===o?(a=[],$.each(c,function(e,t){a.push(t[l])})):a="-1"===c.id?"-1":c[l]}else a=$(t).select2("val"),n=[$(t).select2("data")];var d=[];"string"==typeof a&&(a=[a]),a.length>0&&"-1"!==a[0]&&($.each(a,function(e,t){d.push(t)}),l?filters.push({field:l,nodeFilterId:s,idxValues:n,values:d,useLike:i}):filters.push({field:r,nodeFilterId:s,idxValues:n,values:d,useLike:i}))}),filters.length>0&&(params.filters=filters),_this.lastFiltersStatus=params.filters,this.inputModuleModel.getData(params,function(templateData){try{var fnOnLoad;if(_this.templateMetadata&&_this.templateMetadata.onLoad)eval(" fnOnLoad = "+_this.templateMetadata.onLoad),fnOnLoad(params)}catch(e){console.log("Error onLoad: "+e.message)}_this.templateData=templateData,_this.drawTable()})},loadToolbar:function(){this.templateMetadata.allowAdd&&this.getBaseTask().find("button.addRow").show(),this.templateMetadata.workflowGroups&&this.templateMetadata.workflowGroups.length>0&&this.getBaseTask().find("button.showWorkflow").show(),this.templateMetadata.enableHistoryChanges},instanceTextFilters:function(e){var t=this;this.getBase().find(".filterText").each(function(e,a){var n=$(a),r=n.attr("template-id"),l=n.attr("template-code"),i=n.attr("filter-type"),o=n.attr("entity-label"),s=n.attr("field"),c=n.attr("value-field"),d="true"===n.attr("read-only"),u={code:l,pageSize:10};l||(u.templateId=r);var h=t.getFilterFromField(s),f=h&&h.initialValue?t.evaluateIfIsFunction(h.initialValue):void 0,p={params:u,$el:$(a),labelField:o,valueField:c,readOnly:d,filterType:i,initialValue:f,tagId:t.tagId,inputLength:3,callback:function(){t.table&&null!==t.table.table&&t.table.destroy(),t.getBase().find('.formFilters .filterText[field="'+s+'"]').attr("status-ready","true"),t.allFiltersLoaded()}};__webpack_require__.e(285).then(function(){var e=[__webpack_require__(2106)];(function(e){new e(p).render()}).apply(null,e)}).catch(__webpack_require__.oe)})},drawFilters:function(e,t){var a=this,n={filters:e};if(t)return!0,void a.allFiltersLoaded();var r=HTMLFilters(n);this.getBase().find(".formFilters").append(r),a.instanceTextFilters(),this.getBase().find(".formFilters .selectRemote").each(function(e,t){var n=$(t).attr("template-id"),r=$(t).attr("template-code"),l=($(t).attr("filter"),$(t).attr("filter-type")),i=$(t).attr("node-filter-id"),o=$(t).attr("entity-label"),s=$(t).attr("field"),c=$(t).attr("related-field"),d=$(t).attr("value-field"),u=$(t).attr("related-manytomanyentity"),h=$(t).attr("related-manytomanykey"),f="true"===$(t).attr("include-all"),p="true"===$(t).attr("read-only"),m=$(t).attr("sort-by"),g=null,v={code:r,pageSize:10};""!==r&&null!==r?v.code=r:v.templateId=n;var b=c.split(","),_=[];b.length>0&&""!==b[0]&&$.each(b,function(e,t){g=null,t=t.trim();var n=a.getBase().find('.formFilters .selectRemote[field="'+t+'"]');g={relatedEl:n,relatedField:t,relatedManyToManyEntity:u=u,relatedManyToManyKey:h=h},_.push(g)});var y={params:v,$el:$(this),labelField:o,valueField:d,relatedObject:_,includeAll:f,readOnly:p,sortBy:m,filterType:l,nodeFilterId:i,tagId:a.tagId,inputLength:0,callback:function(e){a.table&&null!==a.table.table&&a.table.destroy(),a.getBase().find('.formFilters .selectRemote[field="'+s+'"]').attr("status-ready","true"),a.countRelatedFilters(s),a.allFiltersLoaded()}};__webpack_require__.e(286).then(function(){var e=[__webpack_require__(2107)];(function(e){new e(y).render()}).apply(null,e)}).catch(__webpack_require__.oe)})},allFiltersLoaded:function(){!(this.getBase().find('.formFilters .selectRemote[status-ready="false"]').length>0)&&(this.getTemplateData(),this.refreshFiltersToIndex())},refreshFiltersToIndex:function(){$(this.tagId).trigger("onFiltersChange",[this.lastFiltersStatus])},countRelatedFilters:function(e,t){var a=this;this.getBase().find(".formFilters .selectRemote").each(function(t,n){var r=$(this).attr("related-field"),l=0,i=-1;r?(l=(r=r.replace(/\s/g,"").split(",")).length,i=r.indexOf(e)):l=0,l>1&&i>=0?($(this).attr("status-ready",!1),a.checkMultipleRelated($(this),l,r)):e===$(this).attr("related-field")&&($(this).attr("status-ready",!1),$(this).trigger("relatedChanged",$(this).attr("field")))})},checkMultipleRelated:function(e,t,a){for(var n=0,r=0;r<t;r++)"true"===$('.selectRemote[field="'+a[r].trim()+'"]').attr("status-ready")&&n++;n!==t||"false"!==$(e).attr("status-ready")&&!1!==$(e).attr("status-ready")?"false"===$(e).attr("status-ready")&&this.checkMultipleRelated(e,t,a):$(e).trigger("relatedChanged",$(e).attr("field"))},checkIfRelatedHasValues:function(e){e=e;this.getBase().find(".formFilters .selectRemote").each(function(t,a){e===$(this).attr("related-field")&&(e=$(this).attr("field"))})},drawTable:function(){this.tableData=this.templateData,this.historyDic=this.generateHistoryDic(),this.redrawTable(),this.sendCurrentPosition()},departmentsRenderer:function(e,t,a,n,r,l,i){var o,s=this;if(_handsontable.default.renderers.TextRenderer.apply(this,arguments),l){var c="";l.split(",").map(function(e){""!=c&&(c+=", "),c+=s.departmentDic[e]}),o=c}else o="";_handsontable.default.dom.empty(t);var d=$(document.createElement("div"));d.css("width","100%"),d.text(o),d.appendTo($(t)),_handsontable.default.dom.addEvent(t,"dblclick",function(t){t.preventDefault(),s.openDepartmentSelector(e,a,n,e.getSourceDataAtCell(a,n))})},usersRenderer:function(e,t,a,n,r,l,i){var o,s=this;if(_handsontable.default.renderers.TextRenderer.apply(this,arguments),l){var c="";l.split(",").map(function(e){""!=c&&(c+=", "),c+=s.userDic[e]}),o=c}else o="";_handsontable.default.dom.empty(t);var d=$(document.createElement("div"));d.css("width","100%"),d.text(o),d.appendTo($(t)),_handsontable.default.dom.addEvent(t,"dblclick",function(t){t.preventDefault(),s.openUserSelector(e,a,n,e.getSourceDataAtCell(a,n))})},buttonRenderer:function buttonRenderer(instance,td,row,col,prop,value,cellProperties){_handsontable.default.renderers.TextRenderer.apply(this,arguments);var _this=this,buttonLabel=instance.getSettings().columns[col].buttonLabel;_handsontable.default.dom.empty(td);var button=_this._button.cloneNode(!0);return button.textContent=buttonLabel,td.appendChild(button),_handsontable.default.dom.addEvent(button,"click",function(e){e.preventDefault();try{var fnOnClick;if(eval(" fnOnClick = "+instance.getSettings().columns[col].onclick),!1===fnOnClick(_this,instance,row,col))return!1}catch(e){console.log("Error onClick: "+e.message)}}),td},openDepartmentSelector:function(e,t,a,n){var r=this,l=[],i=null!==n&&void 0!==n?n.split(","):"",o=function(){var e={value:s,text:r.departmentDic[s],selected:!1};i.length>0&&i.forEach(function(t){e.value===t&&(e.selected=!0)}),l.push(e)};for(var s in this.departmentDic)o();var c={sourceDepartments:l,callback:function(n){e.setDataAtCell(t,a,n)}};__webpack_require__.e(27).then(function(){var e=[__webpack_require__(805)];(function(e){(new e).openDepartmentSelectorModal(c,null)}).apply(null,e)}).catch(__webpack_require__.oe)},openUserSelector:function(e,t,a,n){var r=this,l=[],i=null!==n&&void 0!==n?n.split(","):"",o=function(){var e={value:s,text:r.userDic[s],selected:!1};i.length>0&&i.forEach(function(t){e.value===t&&(e.selected=!0)}),l.push(e)};for(var s in this.userDic)o();var c={sourceUsers:l,callback:function(n){e.setDataAtCell(t,a,n)}};__webpack_require__.e(27).then(function(){var e=[__webpack_require__(805)];(function(e){(new e).openUserSelectorModal(c,null)}).apply(null,e)}).catch(__webpack_require__.oe)},remoteDropdownRenderer:function(e,t,a,n,r,l,i){var o=this,s="",c=e.getSettings().columns[n].readOnly;if(o.hasRowTotal&&a===e.countRows()-1)return t;if(o.checkValidations(e,a),null!==l&&"null|-| "!==l&&"|-|"!==l||(s=""),null!==l&&(l.indexOf("|-|")>=0&&(s=l.split("|-|")[1]),-1===l.indexOf("|-|")&&(s=null)),null!==s){_handsontable.default.renderers.BaseRenderer.apply(this,arguments),_handsontable.default.dom.empty(t);var d=o._div.cloneNode(!0),u=e.getSettings().columns[n].relatedField;return null!==u&&""!==u&&void 0!==u&&d.setAttribute("related-field",u),d.textContent=s,t.appendChild(d),$(d).on("changeRemote",function(t,a){e.setDataAtCell(a.instance.row,a.relatedCol,"null|-| ")}),_handsontable.default.dom.addEvent(d,"click",function(s){s.preventDefault(),i.readOnly||c||o.initializeRemoteDropdown(e,t,a,n,r,l,i)}),t}},initializeRemoteDropdown:function(e,t,a,n,r,l,i){var o=this,s={pageSize:10},c=e.getSettings().columns[n].code;""!==c&&null!==c?s.code=c:s.templateId=e.getSettings().columns[n].inputTemplateId;var d=e.getSourceDataAtCell(a,n);if(e.getSettings().columns[n].relatedField)var u=e.getSettings().columns[n].relatedField.split(",");if(void 0!==u){var h,f,p=null,m=null,g=[];$.each(u,function(t,r){var l=null;r=r.trim();for(var i=0;i<o.templateMetadata.columns.length;i++)if(h=o.templateMetadata.columns[i].field,f=o.templateMetadata.columns[i].hidden,r===h&&!0===f){var s=o.getBase().find('.formFilters .selectRemote[field="'+o.templateMetadata.columns[i].field+'"]'),c=s.val();p=s.attr("related-manytomanyentity"),m=s.attr("related-manytomanykey"),l={relatedVal:c,relatedField:r,relatedManyToManyEntity:p,relatedManyToManyKey:m},g.push(l)}null===l&&null!==e.getDataAtRowProp(a,r)&&(c=e.getDataAtRowProp(a,r),p=e.getSettings().columns[n].relatedManyToManyEntity,m=e.getSettings().columns[n].relatedManyToManyKey,l={relatedVal:c,relatedField:r,relatedManyToManyEntity:p,relatedManyToManyKey:m},g.push(l))})}var v={params:s,$el:$(t).find("div"),labelField:e.getSettings().columns[n].entityLabel,valueField:e.getSettings().columns[n].data,enabledItemField:e.getSettings().columns[n].enabledItemField,relatedObject:g,tableInstance:{instance:e,row:a,col:n},inputLength:0,callback:function(t){var a=this.tableInstance.row,n=this.tableInstance.col,r=this.tableInstance.instance.getCellMeta(a,n),l=this.tableInstance.instance.getSettings().columns;if(e.getSourceDataAtCell(a,n)!==t[r.prop]){e.setDataAtCell(this.tableInstance.row,this.tableInstance.col,t[r.prop]);for(var i=null,o=0;o<l.length;o++)l[o].relatedField===r.prop&&(i=o);i&&this.tableInstance.col!==i&&this.$el.trigger("changeRemote",{instance:this.tableInstance,field:r,relatedCol:i})}}};d&&(v.selectedId=d.split("|-|")[0],v.selectedLabel=d.split("|-|")[1]),__webpack_require__.e(287).then(function(){var e=[__webpack_require__(2108)];(function(e){new e(v).render()}).apply(null,e)}).catch(__webpack_require__.oe)},redrawTable:function redrawTable(){var _this=this,separator="|-|";this.table&&(this.getBase().find(".inputTable").remove(),this.table=null),this.getBase().find(".tableWrapper").append('<div class="inputTable" style="height:100%, overflow:scroll"></div>');var $table=this.getBase().find(".inputTable");null===this.tableOptions&&(this.tableOptions=this.parseMetadata()),this.hasRowTotal&&this.tableData.push([]),_handsontable.default.renderers.registerRenderer("remoteDropdown",function(e,t,a,n,r,l,i){return _this.remoteDropdownRenderer(e,t,a,n,r,l,i)}),_handsontable.default.renderers.registerRenderer("departmentsRenderer",function(e,t,a,n,r,l,i){return _this.departmentsRenderer(e,t,a,n,r,l,i)}),_handsontable.default.renderers.registerRenderer("usersRenderer",function(e,t,a,n,r,l,i){return _this.usersRenderer(e,t,a,n,r,l,i)}),_handsontable.default.renderers.registerRenderer("buttonRenderer",function(e,t,a,n,r,l,i){return _this.buttonRenderer(e,t,a,n,r,l,i)});var hot1=$table.handsontable({data:this.tableData,fixedColumnsLeft:this.tableOptions.fixedColumnsLeft,manualColumnResize:this.tableOptions.columnResize,nestedHeaders:this.tableOptions.nestedHeaders,colWidths:this.tableOptions.colWidths,colHeaders:!1!==this.tableOptions.colHeaders&&function(e){var t=_this.tableOptions.colHeaders[e],a=_this.tableOptions.columns[e].description;return a&&""!==a&&(t='<a data-desc="'+a+'" class="with-description">'+t+"</a>"),t},contextMenu:!!this.tableOptions.allowRemove&&["remove_row"],rowHeaders:this.tableOptions.rowHeaders,columns:this.tableOptions.columns,minRows:0,stretchH:"all",afterSelection:function(e,t,a,n){var r=[],l=[e,a];l.sort(function(e,t){return t-e});for(var i=l[0]-l[1]+1,o=l[1];o<=l[0];o++)r.push(this.getDataAtRowProp(o,"id"));_this.rowsToDelete.id=_this.options.templateId;var s=l[0]===l[1]?l[0]:l[1];_this.toRemoveOnTable=[s,i],_this.rowsToDelete.toDelete=r},afterDeselect:function(){_this.rowsToDelete.toDelete=[],_this.toRemoveOnTable=[]},afterRemoveRow:function(e,t){_this.deleteRows()},beforeKeyDown:function(e){8!=e.keyCode&&37!=e.keyCode&&39!=e.keyCode&&46!=e.keyCode||$(e.path[1]).hasClass("select2-search")&&(e.isImmediatePropagationEnabled=!1)},beforeRender:function(e){_this.beforeRender(e,_this.tableOptions)},afterRenderer:function(e,t,a,n,r,l){_this.applyStyles(this,e,t,a,n,r,l)},beforeChange:function beforeChange(changes,source){for(var row,col,prop,cellProperties,cols=this.getSettings().columns,cc=changes.length-1;cc>=0;cc--){for(var isNumeric=!1,value=changes[cc][3],currentCol,i=0;i<cols.length;i++)if(cols[i].data===changes[cc][1]){isNumeric="numeric"===cols[i].type,currentCol=cols[i];break}if(isNumeric&&isNaN(value)&&!0!==value&&""!==value)return!1;if(row=changes[cc][0],col=this.propToCol(changes[cc][1]),prop=changes[cc][1],cellProperties=this.getCellMeta(row,col),null!==changes[cc][2]&&void 0!==changes[cc][2]&&-1!==changes[cc][2]&&!isNumeric&&changes[cc][2].toString().indexOf(separator)>=0&&-1===changes[cc][3].toString().indexOf(separator))return!1;if(currentCol&&void 0!==currentCol.onBeforeChange&&currentCol.onBeforeChange)try{var fnOnChange;if(eval(" fnOnChange = "+currentCol.onBeforeChange),!1===fnOnChange(_this,this,changes[cc],source))return!1}catch(e){console.log("Error onBeforeChange: "+e.message)}}},afterChange:function(e,t){null!==e&&e.length>0&&("CopyPaste.paste"!==t&&"edit"!==t&&"Autofill.fill"!==t&&"UndoRedo.undo"!==t&&"UndoRedo.redo"!==t||"id"===e[0][1]||_this.updateDic(e,t,this))},cells:function cells(row,col,prop){var cellProperties={};try{var fnCustomFn,fn=_this.getOnCellFunctionByProp(prop,this.instance);fn&&(eval("fnCustomFn= "+_this.getOnCellFunctionByProp(prop,this.instance)),fnCustomFn(this.instance,null,row,col,prop,null,cellProperties))}catch(e){console.log("getOnCellFunctionByProp error: "+e.message)}return _this.hasRowTotal?(row===this.instance.countRows()-1&&(cellProperties.readOnly=!0),cellProperties):cellProperties}});this.table=$table.handsontable("getInstance");var countRows=_this.hasRowTotal?this.table.countRows()-1:this.table.countRows();this.getBase().find(".rowCount").text("Total rows: "+countRows);try{this.externalView&&this.externalView.onCreateTable&&this.externalView.onCreateTable(this.table)}catch(e){console.log("Error on external view:onCreateTable"+e.message)}this.options.inputForm?_this.onBaseResize():_this.onResize(),_this.templateMetadata.workflowGroups&&_this.templateMetadata.workflowGroups.length>0&&$(this.tagId).find(".item-title .knowledge-arrow").addClass("on")},getOnCellFunctionByProp:function(e,t){for(var a=0;a<this.templateMetadata.columns.length;a++)if(this.templateMetadata.columns[a].field===e)return this.templateMetadata.columns[a].onCell},addDataForHiddenCols:function(e,t){for(var a=this.templateMetadata.columns,n=0;n<a.length;n++)if(a[n].hidden){var r=this.getBase().find('.formFilters .selectRemote[field="'+a[n].field+'"]');if(r.length>0){for(var l=r.val(),i=!1,o=0;o<t.changes.length;o++)if(t.changes[o].field===a[n].field){i=!0;break}i||t.changes.push({field:a[n].field,value:l})}}},updateDic:function updateDic(changes,source,instance){var _this=this,separator="|-|",instance=instance,inputTemplateId=this.options.templateId,dataRow,rowIndex,changeField;this.changesDic.debugConsole="-- updateDic ("+source+") --",this.changesDic.toDelete=[],this.changesDic.rows=[],this.changesDic.id=inputTemplateId;for(var isReadOnly=!1,x=0;x<changes.length;x++)if(isReadOnly=instance.getCellMeta(changes[x][0],instance.propToCol(changes[x][1])).readOnly,isReadOnly&&console.log("readonly: "+changes[x][0]+", "+instance.propToCol(changes[x][1])),!isReadOnly){dataRow=instance.getSourceDataAtRow(changes[x][0]),dataRow.id||(dataRow.id=-1);var value=changes[x][3];rowIndex=changes[x][0],changeField=changes[x][1],"object"===_typeof(changes[x][3])&&(value=null===changes[x][3]?"":changes[x][3].id),"number"!=typeof value&&value.indexOf(separator)>=0&&(value=value.split(separator)[0],"null"===value&&(value=null));for(var change={id:dataRow.id,rowIndex:rowIndex,changes:[{field:changeField,value:value}]},isRowOnEdition=!1,i=0;i<this.changesDic.rows.length;i++)if(this.changesDic.rows[i].rowIndex===rowIndex){isRowOnEdition=!0;for(var j=0;j<this.changesDic.rows[i].changes.length;j++)this.changesDic.rows[i].changes[j].field===changeField&&this.changesDic.rows[i].changes.splice(j,1);this.changesDic.rows[i].changes.push({field:changeField,value:value});break}isRowOnEdition||(this.changesDic.rows.push(change),-1===change.id&&_this.addDataForHiddenCols(instance,this.changesDic.rows[this.changesDic.rows.length-1]))}var formId=this.options.templateId,row,prop,dataStatusDash=$(_this.tagId).find(".item-title div div");$(dataStatusDash).removeClass().addClass("dataStatus yellow"),$("a[data-rel="+formId+"] div").removeClass().addClass("dataStatus yellow"),this.inputModuleModel.setData(this.changesDic,function(res){var error=!1,row;if(res.length>0)for(var i=0;i<res.length;i++)res[i].err&&(error=!0,_this.errorList+="- "+res[i].err+"<br>");if(error){$(dataStatusDash).removeClass().addClass("dataStatus orange"),$("a[data-rel="+formId+"] div").removeClass().addClass("dataStatus orange");for(var i=0;i<_this.changesDic.rows.length;i++)row=_this.changesDic.rows[i].rowIndex,_this.checkValidations(instance,row)}else{try{var fnOnChange;if(_this.templateMetadata&&_this.templateMetadata.onChange)eval(" fnOnChange = "+_this.templateMetadata.onChange),fnOnChange(_this.changesDic),$(dataStatusDash).removeClass().addClass("dataStatus green"),$("a[data-rel="+formId+"] div").removeClass().addClass("dataStatus green"),_this.errorList=""}catch(e){$(dataStatusDash).removeClass().addClass("dataStatus orange"),$("a[data-rel="+formId+"] div").removeClass().addClass("dataStatus orange"),console.log("Error onChange: "+e.message)}for(var i=0;i<res.length;i++)res[i].newId!==res[i].id&&res[i].id<0&&instance.setDataAtRowProp(res[i].rowIndex,"id",res[i].newId);$(dataStatusDash).removeClass().addClass("dataStatus green"),$("a[data-rel="+formId+"] div").removeClass().addClass("dataStatus green"),_this.changesDic.rows=[],_this.errorList=""}},function(e){var t=_this.options.templateId;$(dataStatusDash).removeClass().addClass("dataStatus orange"),$("a[data-rel="+t+"] div").removeClass().addClass("dataStatus orange")})},checkValidations:function(e,t){for(var a=e.getSettings().columns,n=0;n<a.length;n++){var r=null;if(a[n].validators&&a[n].validators.required&&(null===(r=e.getDataAtCell(t,n))||"null|-| "===r||"|-|"===r)){var l=e.getCell(t,n);$(l).addClass("required-td")}}},firstRowRenderer:function(e,t,a,n,r,l,i){_handsontable.default.renderers.TextRenderer.apply(this,arguments),t.style.fontWeight="bold",t.style.color="green",t.style.background="#CEC"},beforeRender:function(e,t){if(e){this.table||(this.table=this.getBase().find(".inputTable").handsontable("getInstance"));for(var a=this.tableData,n=this.table.getSettings().columns,r=0;r<n.length;r++)if(n[r].formula)for(var l=0;l<a.length;l++)a[l]["_cc"+r]=this.parseFormula(a[l],n[r].formula)}},parseFormula:function parseFormula(row,columnFormula){for(var res,formula=columnFormula,performCalc=!1,re=/#(.*?)#/gim,resReg;null!==(resReg=re.exec(columnFormula));){resReg.index===re.lastIndex&&re.lastIndex++;var key=resReg[1];if(void 0!==row[key]){performCalc=!0;var rr=new RegExp("#"+key+"#","gi");formula=formula.replace(rr,row[key])}}if(performCalc)try{res=eval(formula)}catch(e){res=0}return res},applyStyles:function applyStyles(hotInstance,TD,row,col,prop,value,cellProperties){var _this=this,fnConditional;if(cellProperties||(cellProperties={}),cellProperties.style)for(var key in cellProperties.style)TD.style[key]=this.evaluateIfIsFunction(cellProperties.style[key]);cellProperties.conditionalFormat&&($.isArray(cellProperties.conditionalFormat)?fnConditional=function(e,t,a,n,r,l,i){for(var o=cellProperties.conditionalFormat,s=0;s<o.length;s++)if(l>=o[s].from&&l<o[s].to){for(var c in o[s].style)t.style[c]=o[s].style[c];break}}:eval("fnConditional = "+cellProperties.conditionalFormat),fnConditional(hotInstance,TD,row,col,prop,value,cellProperties));if(row<=this.tableData.length-1&&cellProperties.customCellFunction)try{var fnCustomFn;eval("fnCustomFn= "+cellProperties.customCellFunction),fnCustomFn(hotInstance,TD,row,col,prop,value,cellProperties)}catch(e){console.log("customCellFunction error: "+e.message)}if(this.historyDic){var key=row+"||"+prop;this.historyDic[key]&&($(TD).addClass("with-history").attr("data-history-key",key),$("<div class='history'></div>").appendTo(TD))}this.hasRowTotal&&row==this.tableData.length-1&&(TD.style.backgroundColor="#666666",TD.style.color="#ffffff",1!==this.tableOptions.columns[col].totalType&&(cellProperties.type="text"))},parseMetadata:function(){var e={fixedColumnsLeft:void 0,columnResize:!1,colHeaders:[],columns:[],columnSummary:[],nestedHeaders:[]};if(this.templateMetadata){e.fixedColumnsLeft=this.templateMetadata.fixedColumns,e.columnResize=this.templateMetadata.columnResize,e.colHeaders=this.templateMetadata.colHeaders,e.rowHeaders=this.templateMetadata.rowHeaders,e.allowRemove=this.templateMetadata.allowRemove,e.allowAdd=this.templateMetadata.allowAdd,e.colWidths=this.templateMetadata.colWidths,e.nestedHeaders=[],void 0!==this.templateMetadata.nestedHeaders&&null!==this.templateMetadata.nestedHeaders?e.nestedHeaders=this.templateMetadata.nestedHeaders:e.nestedHeaders=null;for(var t,a=[],n=0,r=0;r<this.templateMetadata.columns.length;r++){var l=this.templateMetadata.columns[r];l.hidden||(t=this.generateTableColumn(l,n),a.push(l.header),e.columns.push(t),n++)}null!==e.nestedHeaders&&e.nestedHeaders.length>0?(e.nestedHeaders.push(a),e.colHeaders=!1):e.colHeaders=a}return e},numericValidator:function(e,t){isNaN(e)&&!0===e&&""===e?t(!1):t(!0)},checkUnique:function(e,t){var a=!0,n=[];this.table&&(n=this.table.getDataAtCol(e));for(var r=0;r<n.length;r++)if(!(a=t!==n[r]))return a;return a},applyValidator:function(e,t,a,n){var r=!0;e.required&&0===t.length&&(r=!1),e.range&&(t<e.range[0]||t>e.range[1])&&(r=!1),e.unique&&!1!==e.unique&&(r=this.checkUnique(a,t)),n(r)},generateTableColumn:function(e,t){var a=this,n={},r=e.type;switch(n.data=e.field,r){case"numeric":n.readOnly=!1,1===e.totalType&&(a.hasRowTotal=!0,n.renderer=function(e,t,n,r,l,i){n==e.countRows()-1&&(i=a.getTotal(e,r)),arguments[5]=i,_handsontable.default.renderers.NumericRenderer.apply(this,arguments)});break;case"text":n.readOnly=!1;break;case"dropdown":n.source=this.getListFromDataset(e.entity,e.entityLabel);break;case"calc":r="numeric",n.readOnly=!0,n.formula=e.formula,n.data="_cc"+t;break;case"departmentSelector":r="text",n.readOnly=!1,n.renderer="departmentsRenderer",n.editor=!1;break;case"userSelector":r="text",n.readOnly=!1,n.renderer="usersRenderer",n.editor=!1;break;case"remoteDropdown":r="text",n.readOnly=!1,n.renderer="remoteDropdown",n.editor=!1,e.relatedField&&(n.relatedField=e.relatedField),e.relatedManyToManyEntity&&(n.relatedManyToManyEntity=e.relatedManyToManyEntity,n.relatedManyToManyKey=e.relatedManyToManyKey);break;case"relatedColumn":r="0"==e.relatedColumnType||"numeric"==e.relatedColumnType?"numeric":"text",n.readOnly=!0;break;case"button":r="text",n.onclick=e.onClick,n.buttonLabel=e.buttonLabel,n.renderer="buttonRenderer",n.editor=!1,n.data="id";break;case"date":case"dateTime":r="date",n.readOnly=!1,n.type="date",n.dateFormat="YYYY-MM-DD",n.correctFormat=!0,n.allowEmpty=!1,n.datePickerConfig={firstDay:0,showWeekNumber:!0,numberOfMonths:2}}return!0===a.templateMetadata.readOnly&&(n.readOnly=!0),n.type=r,n.format=e.format,n.required=e.required,n.style=e.style,n.conditionalFormat=e.conditionalFormat,n.inputTemplateId=e.inputTemplateId,n.code=e.entity,n.entityLabel=e.entityLabel,n.totalType=e.totalType,n.validators=e.validators,n.customCellFunction=e.customCellFunction,n.onCell=e.onCell,n.onBeforeChange=e.onBeforeChange,n.hidden=!0===e.hidden,n.enabledItemField=e.enabledItemField,n.description=e.description,e.validators&&(n.validator=function(e,n){a.applyValidator(this.validators,e,t,n)},n.allowInvalid=!1),e.readOnly&&(e.readOnly?n.readOnly=!0:this.isFunction(e.readOnly)&&(n.readOnly=this.evaluateIfIsFunction(e.readOnly))),n},getTotal:function(e,t){var a;return e.getData().reduce(function(e,n){return null!=(a=0===n.length||""===n[t]?0:n[t])?e+a:e},0)},getLabelFromDataset:function(e,t,a){var n=null;if(this.templateMetadata&&this.templateMetadata.dataset[t])for(var r=this.templateMetadata.dataset[t],l=0;l<r.data.length;l++)if(r.data[l][0]==e){var i=r.columns.indexOf(a.toLowerCase());n=r.data[l][i];break}return n},getListFromDataset:function(e,t){var a=[];if(this.templateMetadata&&this.templateMetadata.dataset[e])for(var n=this.templateMetadata.dataset[e],r=0;r<n.data.length;r++){var l=n.columns.indexOf(t.toLowerCase());a.push(n.data[r][l])}return a},isFunction:function(e){return!!(e&&e.length>30&&e.toLowerCase().startsWith("function"))},evaluateIfIsFunction:function evaluateIfIsFunction(value){var res=value;if(this.isFunction(value))try{var _this=this;eval("res = "+value),res=res()}catch(e){return console.log(e.message),null}return res},ensureEmptyRow:function(){var e=!1;if(this.tableData){if(this.tableData.length<=1)e=!0;else{for(var t=this.tableData[this.tableData.length-2],a=!0,n=0;n<t.length;n++)if(t[n]){a=!1;break}e=!a}e&&this.tableData.push({})}return e},checkForDepartmentSelector:function(e){return e&&e.columns&&e.columns.some(function(e){return"departmentSelector"==e.type})},checkForUserSelector:function(e){return e&&e.columns&&e.columns.some(function(e){return"userSelector"==e.type})},createDepartmentDict:function(e){var t=this;Promise.resolve().then(function(){var a=[__webpack_require__(219)];(function(a){(new a).getDepartments(function(a){t.departmentDic={},a&&a.forEach(function(e){t.departmentDic[e.id]=e.name}),e()})}).apply(null,a)}).catch(__webpack_require__.oe)},createUserDict:function(e){var t=this;__webpack_require__.e(23).then(function(){var a=[__webpack_require__(713)];(function(a){(new a).listByCompany(function(a){t.userDic={},a&&a.forEach(function(e){t.userDic[e.user_company_id]="".concat(e.first_name," ").concat(e.last_name)}),e()})}).apply(null,a)}).catch(__webpack_require__.oe)},sendCurrentPosition:function(){var e=this;if(this&&this.table&&this.templateMetadata){try{if(this.getBase().is(":visible")&&this.table.getSelectedRange()){var t=this.table.getSourceDataAtRow(this.table.getSelectedRange().from.row).id,a=this.table.getCellMeta(this.table.getSelectedRange().from.row,this.table.getSelectedRange().from.col).prop;if(this.nodeJSManager){var n={};n.code=this.templateMetadata.code,n.id=t,n.col=a,n.userName=__currentSession.userName,n.userId=__currentSession.loginId,this.nodeJSManager.triggerEvent("setInputTemplatePos",n)}}setTimeout(function(){e.sendCurrentPosition()},7e3)}catch(e){}this.getBase().find(".inputFormCollabWrapper li[data_live=0]").each(function(t,a){e.collabRemoveRemoteCellIndicator(a)}),this.getBase().find(".inputFormCollabWrapper li[data_live=0]").remove(),this.getBase().find(".inputFormCollabWrapper li[data_live=1]").attr("data_live",0)}},collabRemoveRemoteCellIndicator:function(e){if($(e).attr("class").match(/\bcollabItemCell_(\d+)\b/)){var t=$(e).attr("class").match(/\bcollabItemCell_(\d+)\b/)[0];this.getBase().find("td").removeClass(t)}},collabGetNextColorClass:function(e){return"collabItemCell_"+e.find("li").length},collabCreateItem:function(e,t){0==e.find("li[data_id='"+t.userId+"']").length?$("<li/>").text(t.userName.substr(0,1)).attr("data_id",t.userId).attr("title",t.userName).attr("data_live",1).appendTo(e).addClass(this.collabGetNextColorClass(e)):e.find("li[data_id='"+t.userId+"']").attr("data_live",1)},collabSetActiveCell:function(e,t){var a=e.find("li[data_id='"+t.userId+"']").attr("class");this.getBase().find("td").removeClass(a);var n=this.table.getSourceData();if(n)try{for(var r=0;r<n.length;r++)if(n[r].id==t.id){for(var l=0;l<this.templateMetadata.columns.length;l++)if(this.templateMetadata.columns[l].field==t.col){var i=this.table.getCell(r,l,!0);i&&!$(i).hasClass(a)&&$(i).addClass(a);break}break}}catch(e){console.log("error in sync set pos: "+e.message)}n=null},collabSetChanges:function(e,t){if(t.rowsChanged&&t.rowsChanged.length>0){var a=this.table.getSourceData();if(a)for(var n=0;n<t.rowsChanged.length;n++)for(var r=t.rowsChanged[n],l=0;l<a.length;l++)if(a[l].id==r.id){for(var i=0;i<r.changes.length;i++){var o=r.changes[i].field,s=r.changes[i].values?r.changes[i].values:r.changes[i].value;try{this.table.setDataAtRowProp(l,o,s,"collab"),!0}catch(e){console.log("error in sync changes: "+e.message)}}break}}},onCollabMessage:function(e,t){if(t){var a=t.userId;if(a!=__currentSession.loginId&&this.table&&this.templateMetadata&&this.templateMetadata.code==t.code){var n=this.getBase().find(".inputFormCollabWrapper");switch(e){case"loadInputTemplate":this.collabCreateItem(n,t);break;case"unloadInputTemplate":n.find("li[data_id='"+a+"']").length>0&&(this.collabRemoveRemoteCellIndicator(n.find("li[data_id='"+a+"']")[0]),n.find("li[data_id='"+a+"']").remove());break;case"setInputTemplatePos":this.collabCreateItem(n,t),this.collabSetActiveCell(n,t);break;case"setInputTemplateValues":this.collabCreateItem(n,t),this.collabSetChanges(n,t)}}}},includeExternalJs:function(){if(this.templateMetadata&&this.templateMetadata.externalJs)try{var e=this;__webpack_require__.e(39).then(function(){var t=[__webpack_require__(712)("./"+this.templateMetadata.externalJs)];(function(t){e.externalView=new t($.extend(!0,{},e.options)),e.externalView.render(),e=null}).apply(null,t)}).catch(__webpack_require__.oe)}catch(e){console.log("Error on create external view: "+e.message)}},getPossibleTransitions:function(e,t,a){var n=[],r=(0,_globalFxs.haveAccess)("BYPASSWORKFLOWTASKTRANSITIONS");if(e)for(var l=e.stateId,i=0;i<t.length;i++){for(var o=!1,s=0;s<a.length;s++)if(l==a[s].fromStateId&&t[i].taskStateId==a[s].toStateId){o=!0;break}(r||o||l==t[i].taskStateId)&&n.push(t[i])}return n},showWorkflow:function(e){var t=this;if(this.templateMetadata.workflowGroups&&this.templateMetadata.workflowGroups.length>0){var a=this.templateMetadata.workflowGroups;__webpack_require__.e(33).then(function(){var n=[__webpack_require__(706)];(function(n){var r=new n;r.getWorkflowByGroups(a,function(a){var n=void 0!==__currentSession.fromEmbedded&&__currentSession.fromEmbedded,l={tasks:[]};a&&a.length>0&&r.listStates(function(i){r.listTransitions(function(r){for(var o=0;o<a.length;o++)for(var s=0;s<a[o].tasks.length;s++)a[o].tasks[s].startDate=moment(a[o].tasks[s].startDate).format("MM/DD"),a[o].tasks[s].endDate=moment(a[o].tasks[s].endDate).format("MM/DD"),a[o].tasks[s].transitions=t.getPossibleTransitions(a[o].tasks[s],i,r),l.tasks.push(a[o].tasks[s]);var c={title:(0,_globalFxs.translate)("workflow"),workflow:l,workflowData:!0,content:"",left:e.clientX,top:e.clientY,className:"popover_workflow",workflowEnabled:!0,fromEmbedded:n,fromImputTemplate:!0,inputFormView:t,onSaveCallback:function(){this.inputFormView.drawTemplate(!0)}};__webpack_require__.e(14).then(function(){var e=[__webpack_require__(734)];(function(e){(new e).show(c,function(e){})}).apply(null,e)}).catch(__webpack_require__.oe)})})})}).apply(null,n)}).catch(__webpack_require__.oe)}},generateHistoryDic:function(){var e={},t=!1;if(this.tableData&&this.tableData.length>0&&void 0!=_typeof(this.tableData.historyColumns))for(var a=0;a<this.tableData.length;a++)if(this.tableData[a].historyColumns){t=!0;for(var n=this.tableData[a].historyColumns.split(","),r=0;r<n.length;r++)e[a+"||"+n[r]]=!0}return t?e:null},showHistoryData:function(e,t){if(this.historyDic&&this.historyDic[t]){$(".popover_inputetemplate_history").remove();var a={inputTemplateId:this.options.templateId,entityId:this.table.getSourceDataAtRow(t.split("||")[0]).id,columnName:t.split("||")[1]};this.inputModuleModel.getHistoryChanges(a,function(t){for(var a="",n=0;n<t.length;n++)a+="<b>"+moment(t[n].dateChange).format("MM/DD/YYYY HH:mm")+"</b> "+t[n].newUser+" changed de value '"+t[n].oldValue+"' for '"+t[n].newValue+"' <br/>";var r={content:a,left:e.clientX,top:e.clientY,className:"popover_inputetemplate_history"};__webpack_require__.e(14).then(function(){var e=[__webpack_require__(734)];(function(e){(new e).show(r,function(e){})}).apply(null,e)}).catch(__webpack_require__.oe)})}},showColDescription:function(e,t){$(".popover_inputetemplate_colDesc").remove();var a={content:t,left:e.clientX,top:e.clientY,title:(0,_globalFxs.translate)("_description"),className:"popover_inputetemplate_colDesc"};__webpack_require__.e(14).then(function(){var e=[__webpack_require__(734)];(function(e){(new e).show(a,function(e){})}).apply(null,e)}).catch(__webpack_require__.oe)},getDataByEntity:function(e,t){this.inputModuleModel.getData(e,function(e){t(e)})},getFilterFromField:function(e){return this.templateMetadata&&this.templateMetadata.filters&&this.templateMetadata.filters.find(function(t){return t.field==e})}});return view}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)}).call(this,__webpack_require__(218),__webpack_require__(1),__webpack_require__(134))},986:function(e,t,a){"use strict";(function(n,r){var l,i=a(18);void 0===(l=function(){return n.Controller.extend({name:"NodeJs",socket:void 0,start:function(){},triggerEvent:function(e,t){var a={event:e,body:t};this.socket&&this.socket.connected&&this.socket.emit("sendMessage",__currentToken,a)},changeToken:function(e){this.socket&&this.socket.connected&&this.socket.emit("changeToken",e)},processMessage:function(e){if(e)switch(e.event){case"FPCaseAfterSave":r("#projectMapSidebar").trigger("refreshProject",[e.body]);break;case"DashboardShareAfterSave":r("#model-summary").trigger("reloadShared",[e.body]);break;case"UpdateCreateScenarioProgress":r("#scenarioManager,#dataSnapshot").trigger("updateProgress",[e.body]);break;case"RefreshImageDashboard":r("#summary").trigger("refreshImageDashboard",[e.body]),r("#report-manager").trigger("refreshImageDashboard",[e.body]),r("#main .mainTask[data-rel='dashboard-"+e.body+"']").trigger("refreshImageDashboard",[e.body]);break;case"AfterCreateDashboardComment":r(".dashboard-comments").trigger("refreshExternalComments",[e.body]);break;case"NeedLogout":r("body").trigger("needLogout");break;case"SessionKilled":r("body").trigger("sessionKilled");break;case"MemoryQuotaExceeded":r("body").trigger("memoryQuotaExceeded",[e.body]);break;case"ProcessCancelByMemoryQuotaExceeded":var t=(0,i.translate)("process_cancel_by_quota").replace("##quota##",e.body.memoryQuota).replace("##current##",e.body.modelMemory);(0,i.showMessage)(t,void 0,"error");break;case"modelprogressbar":Promise.all([a.e(2),a.e(4),a.e(63)]).then(function(){var t=[a(695)];(function(t){(new t).showProgressBar(e.body)}).apply(null,t)}).catch(a.oe);break;case"modelmsgbox":Promise.all([a.e(2),a.e(4),a.e(63)]).then(function(){var t=[a(695)];(function(t){(new t).showMsgBox(e.body)}).apply(null,t)}).catch(a.oe);break;case"GenericMessage":var n=e.body.title;t=e.body.text;(0,i.showMessage)(t,n);break;case"notify":Promise.all([a.e(2),a.e(167)]).then(function(){var t=[a(876)];(function(t){(new t).notify(e.body)}).apply(null,t)}).catch(a.oe);break;case"ReloadAllOpenDashboards":Promise.all([a.e(2),a.e(4),a.e(7),a.e(30)]).then(function(){var e=[a(702)];(function(e){(new e).refreshAllOpenDashboards()}).apply(null,e)}).catch(a.oe);break;case"UpdatePrintReportProgress":Promise.all([a.e(2),a.e(4),a.e(7),a.e(30)]).then(function(){var t=[a(702)];(function(t){(new t).updatePrintReportProgress(e.body)}).apply(null,t)}).catch(a.oe);break;case"UpdatePrintReportMessage":Promise.all([a.e(2),a.e(4),a.e(7),a.e(30)]).then(function(){var t=[a(702)];(function(t){(new t).updatePrintReportMessage(e.body)}).apply(null,t)}).catch(a.oe);break;case"UpdatePrintReportComplete":Promise.all([a.e(2),a.e(4),a.e(7),a.e(30)]).then(function(){var t=[a(702)];(function(t){(new t).updatePrintReportComplete(e.body)}).apply(null,t)}).catch(a.oe);break;case"ExecuteButtonComplete":r("#genericLoading").hide(),e&&e.body&&e.body.error&&(0,i.showMessage)(e.body.result,void 0,"error");break;case"loadInputTemplate":case"unloadInputTemplate":case"setInputTemplatePos":case"setInputTemplateValues":r(".inputFormTask").trigger("collabMessage",[e.event,e.body]);break;case"ModelEditionAvailable":e&&e.body&&e.body.message&&((0,i.showMessage)(e.body.message,void 0,"info"),__currentSession.modelInfo&&__currentSession.modelInfo.uri==e.body.modelfile&&a.e(168).then(function(){var e=[a(219)];(function(e){var t=new e,a=r("#navigation li.modelopened[data-key='btnSaveModelAs'] a"),n=r("#navigation li.modelopened[data-key='btnSaveModelAs'] a i");t.canEdit()?(r("#navigation li.modelopened[data-key='btnSaveModel']").show(),n.removeClass("fa-paste").addClass("fa-save-all"),a.prop("title",(0,i.translate)("save_model_as")),r("#navigation li.modelopened[data-key='btnSaveModelAs']").show()):t.isInPublic()}).apply(null,e)}).catch(a.oe))}}})}.apply(t,[]))||(e.exports=l)}).call(this,a(694),a(1))}}]);