public_html/layouts/resources/app.min.js
'use strict';
/*+***********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
* Contributor(s): YetiForce S.A.
*************************************************************************************/"use strict";var _class;function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(iter){if("undefined"!=typeof Symbol&&null!=iter[Symbol.iterator]||null!=iter["@@iterator"])return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o);}return t}function _objectSpread(e){for(var t,r=1;r<arguments.length;r++)t=null==arguments[r]?{}:arguments[r],r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});return e}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _createForOfIteratorHelper(o,allowArrayLike){var it="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&"number"==typeof o.length){it&&(o=it);var i=0,F=function(){};return {s:F,n:function n(){return i>=o.length?{done:!0}:{done:!1,value:o[i++]}},e:function e(_e2){throw _e2},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var err,normalCompletion=!0,didErr=!1;return {s:function s(){it=it.call(o);},n:function n(){var step=it.next();return normalCompletion=step.done,step},e:function e(_e3){didErr=!0,err=_e3;},f:function f(){try{normalCompletion||null==it.return||it.return();}finally{if(didErr)throw err}}}}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return "Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return "symbol"===_typeof(key)?key:String(key)}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return ("string"===hint?String:Number)(input)}var App=window.App={Components:{Tree:{Basic:/*#__PURE__*/function(){function Basic(){var container=0<arguments.length&&void 0!==arguments[0]?arguments[0]:$(".js-tree-container");_classCallCheck(this,Basic),this.treeInstance=!1,this.treeData=!1,this.generateTree(container);}return _createClass(Basic,[{key:"generateTree",value:function generateTree(container){var self=this;!1===self.treeInstance&&(self.treeInstance=container,self.treeInstance.on("select_node.jstree",function(_e,data){void 0!==data.event&&$(data.event.target).hasClass("jstree-checkbox")||data.instance.select_node(data.node.children_d);}).on("deselect_node.jstree",function(_e,data){void 0!==data.event&&$(data.event.target).hasClass("jstree-checkbox")||data.instance.deselect_node(data.node.children_d);}).jstree({core:{data:self.getRecords(container),themes:{name:"proton",responsive:!0}},plugins:["search","checkbox"]}),this.registerSearchEvent());}},{key:"registerSearchEvent",value:function registerSearchEvent(){var self=this,searchTimeout=!1,treeSearch=$(".js-tree-search");treeSearch.on("keyup",function(){searchTimeout&&clearTimeout(searchTimeout),searchTimeout=setTimeout(function(){var searchValue=treeSearch.val();self.treeInstance.jstree(!0).search(searchValue);},250);});}},{key:"getRecords",value:function getRecords(container){return !1===this.treeData&&"undefined"!==container&&(this.treeData=JSON.parse(container.find(".js-tree-data").val())),this.treeData}}]),Basic}()},/**
* Quick create object used by Header.js and yf plugins
*
*/QuickCreate:{/**
* module quick create data cache
*/moduleCache:{},/**
* Register function
* @param {jQuery} container
*/register:function register(container){container="undefined"==typeof container?$("body"):$(container),container.on("click",".js-quick-create-modal",function(e){e.preventDefault();var element=$(this);if(element.data("module")&&App.Components.QuickCreate.createRecord(element.data("module")),element.data("url")){var url=element.data("url"),urlObject=app.convertUrlToObject(url),params={callbackFunction:function callbackFunction(){}},progress=$.progressIndicator({blockInfo:{enabled:!0}});App.Components.QuickCreate.getForm(url,urlObject.module,params).done(function(data){progress.progressIndicator({mode:"hide"}),App.Components.QuickCreate.showModal(data,params,element),app.registerEventForClockPicker();});}});},/**
* createRecord
*
* @param {string} moduleName
* @param {object} params
*/createRecord:function createRecord(moduleName){var _this=this,params=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};if("parentIframe"===CONFIG.modalTarget)return void window.parent.App.Components.QuickCreate.createRecord(moduleName,params);var url="index.php?module="+moduleName+"&view=QuickCreateAjax";void 0===params.callbackFunction&&(params.callbackFunction=function(){}),"Detail"!==app.getViewName()&&("Edit"!==app.getViewName()||app.getRecordId()===void 0)||"Settings"==app.getParentModuleName()||params.data&&"sourceModule"in params.data||(url+="&sourceModule="+app.getModuleName(),url+="&sourceRecord="+app.getRecordId());var progress=$.progressIndicator({blockInfo:{enabled:!0}});this.getForm(url,moduleName,params).done(function(data){progress.progressIndicator({mode:"hide"}),_this.showModal(data,params),app.registerEventForClockPicker();});},/**
* Get quick create form
*
* @param {string} url
* @param {string} moduleName
* @param {object} params
*
* @return {Promise} aDeferred
*/getForm:function getForm(url,moduleName){var requestParams,params=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},aDeferred=$.Deferred(),isCacheActive=!params.noCache||void 0===params.noCache;return isCacheActive&&App.Components.QuickCreate.moduleCache[moduleName]?(aDeferred.resolve(App.Components.QuickCreate.moduleCache[moduleName]),aDeferred.promise()):(requestParams=url,"undefined"!=typeof params.data&&(requestParams={},requestParams.data=params.data,requestParams.url=url),AppConnector.request(requestParams).done(function(data){isCacheActive&&(App.Components.QuickCreate.moduleCache[moduleName]=data),aDeferred.resolve(data);}),aDeferred.promise())},/**
* Show modal
*
* @param {string} html
* @param {object} params
* @param {jQuery} element
*/showModal:function showModal(html){var _this2=this,params=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},element=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;app.showModalWindow(html,function(container){var quickCreateForm=container.find("form.js-form"),moduleName=quickCreateForm.find("[name=\"module\"]").val();"undefined"!=typeof params.callbackBeforeRegister&¶ms.callbackBeforeRegister(container);var editViewInstance=Vtiger_Edit_Js.getInstanceByModuleName(moduleName);editViewInstance.setForm(quickCreateForm),editViewInstance.registerBasicEvents(quickCreateForm);var moduleClassName=moduleName+"_QuickCreate_Js";"undefined"!=typeof window[moduleClassName]&&new window[moduleClassName]().registerEvents(container),quickCreateForm.validationEngine(app.validationEngineOptionsForRecord),"undefined"!=typeof params.callbackPostShown&¶ms.callbackPostShown(quickCreateForm),_this2.registerPostLoadEvents(quickCreateForm,params,element);});},/**
* Register post load events
*
* @param {jQuery} form
* @param {object} params
* @param {jQuery} element
*
* @return {boolean}
*/registerPostLoadEvents:function registerPostLoadEvents(form,params,element){var _this3=this,submitSuccessCallback=params.callbackFunction||function(){},goToFullFormCallBack=params.goToFullFormcallback||function(){};form.on("submit",function(e){if(form.hasClass("not_validation"))return !0;var moduleName=form.find("[name=\"module\"]").val();//Form should submit only once for multiple clicks also
if("undefined"!=typeof form.data("submit"))return !1;if(0<form.data("jqv").InvalidFields.length)return form.removeData("submit"),$.progressIndicator({mode:"hide"}),void e.preventDefault();//Once the form is submiting add data attribute to that form element
form.data("submit","true"),$.progressIndicator({mode:"hide"});var recordPreSaveEvent=$.Event(Vtiger_Edit_Js.recordPreSave);if(form.trigger(recordPreSaveEvent,{value:"edit",module:moduleName}),!recordPreSaveEvent.isDefaultPrevented()){var moduleInstance=Vtiger_Edit_Js.getInstanceByModuleName(moduleName),saveHandler=moduleInstance.quickCreateSave?moduleInstance.quickCreateSave:_this3.save,progress=$.progressIndicator({message:app.vtranslate("JS_SAVE_LOADER_INFO"),position:"html",blockInfo:{enabled:!0}});saveHandler(form).done(function(data){var modalContainer=form.closest(".modalContainer");modalContainer.length&&app.hideModalWindow(!1,modalContainer[0].id),submitSuccessCallback(data),app.event.trigger("QuickCreate.AfterSaveFinal",data,form),progress.progressIndicator({mode:"hide"}),data.success&&app.showNotify({text:app.vtranslate("JS_SAVE_NOTIFY_SUCCESS"),type:"success"}),app.reloadAfterSave(data,params,form,element);}).fail(function(_,errorThrown){app.showNotify({textTrusted:!1,text:errorThrown,title:app.vtranslate("JS_ERROR"),type:"error"});});}else//If validation fails in recordPreSaveEvent, form should submit again
form.removeData("submit"),$.progressIndicator({mode:"hide"});e.preventDefault();}),form.find(".js-full-editlink").on("click",function(e){var form=$(e.currentTarget).closest("form"),editViewUrl=$(e.currentTarget).data("url");goToFullFormCallBack(form),_this3.goToFullForm(form,editViewUrl);}),this.registerTabEvents(form);},/**
* Function to navigate from quick create to edit iew full form
*
* @param {object} form jQuery
*/goToFullForm:function goToFullForm(form){//As formData contains information about both view and action removed action and directed to view
form.find("input[name=\"action\"]").remove(),form.append("<input type=\"hidden\" name=\"view\" value=\"Edit\" />"),$.each(form.find("[data-validation-engine]"),function(key,data){$(data).removeAttr("data-validation-engine");}),form.addClass("not_validation"),form.trigger("submit");},/**
* Register tab events
*
* @param {object} form jQuery
*/registerTabEvents:function registerTabEvents(form){var tabElements=form.find(".nav.nav-pills , .nav.nav-tabs").find("a"),quickCreateTabOnHide=function(target){$(target).find("[name]").each(function(index,element){element=$(element),element.attr("data-element-name",element.attr("name")).removeAttr("name");});},quickCreateTabOnShow=function(target){$(target).find("[data-element-name]").each(function(index,element){element=$(element),element.attr("name",element.attr("data-element-name")).removeAttr("data-element-name");});};//This will remove the name attributes and assign it to data-element-name . We are doing this to avoid
//Multiple element to send as in calendar
//This will add the name attributes and get value from data-element-name . We are doing this to avoid
//Multiple element to send as in calendar
//To show aleady non active element , this we are doing so that on load we can remove name attributes for other fields
tabElements.on("click",function(){//while switching tabs we have to clear the invalid fields list
quickCreateTabOnHide(tabElements.not("[aria-expanded=\"false\"]").attr("data-target")),quickCreateTabOnShow($(this).attr("data-target")),form.data("jqv").InvalidFields=[];}),tabElements.filter("a:not(.active)").each(function(){quickCreateTabOnHide($(this).attr("data-target"));});},/**
* Save quick create form
*
* @param {object} form jQuery
*
* @return {Promise} aDeferred
*/save:function save(form){var aDeferred=$.Deferred();return AppConnector.request(form.serializeFormData()).done(function(data){aDeferred.resolve(data);}).fail(function(textStatus,errorThrown){aDeferred.reject(textStatus,errorThrown);}),aDeferred.promise()}},QuickEdit:{/**
* Show modal
*
* @param {string} html
* @param {object} params
*/showModal:function showModal(){var params=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},element=1<arguments.length?arguments[1]:void 0,self=this;params.view="QuickEditModal",AppConnector.request(params).done(function(html){app.showModalWindow(html,function(container){var form=container.find("form[name=\"QuickEdit\"]"),moduleName=form.find("[name=\"module\"]").val(),editViewInstance=Vtiger_Edit_Js.getInstanceByModuleName(moduleName),moduleClassName=moduleName+"_QuickEdit_Js";editViewInstance.setForm(form),editViewInstance.registerBasicEvents(form),"undefined"!=typeof window[moduleClassName]&&new window[moduleClassName]().registerEvents(container),form.validationEngine(app.validationEngineOptionsForRecord),"undefined"!=typeof params.callbackPostShown&¶ms.callbackPostShown(form,params),self.registerPostLoadEvents(form,params,element);});});},/**
* Register post load events
*
* @param {jQuery} form jQuery
* @param {object} params
* @param {jQuery} element
*/registerPostLoadEvents:function registerPostLoadEvents(form,params,element){var _this4=this,submitSuccessCallback=params.callbackFunction||function(){},goToFullFormCallBack=params.goToFullFormcallback||function(){};form.on("submit",function(e){if(form.hasClass("not_validation"))return !0;var moduleName=form.find("[name=\"module\"]").val();//Form should submit only once for multiple clicks also
if("undefined"!=typeof form.data("submit"))return !1;if(0<form.data("jqv").InvalidFields.length)return form.removeData("submit"),$.progressIndicator({mode:"hide"}),void e.preventDefault();//Once the form is submiting add data attribute to that form element
form.data("submit","true"),$.progressIndicator({mode:"hide"});var recordPreSaveEvent=$.Event(Vtiger_Edit_Js.recordPreSave);if(form.trigger(recordPreSaveEvent,{value:"edit",module:moduleName}),!recordPreSaveEvent.isDefaultPrevented()){var moduleInstance=Vtiger_Edit_Js.getInstanceByModuleName(moduleName),saveHandler=moduleInstance.quickEditSave?moduleInstance.quickEditSave:_this4.save,progress=$.progressIndicator({message:app.vtranslate("JS_SAVE_LOADER_INFO"),position:"html",blockInfo:{enabled:!0}});saveHandler(form).done(function(data){var modalContainer=form.closest(".modalContainer");modalContainer.length&&app.hideModalWindow(!1,modalContainer[0].id),submitSuccessCallback(data),app.event.trigger("QuickEdit.AfterSaveFinal",data,form,element),delete window.popoverCache[data.result._recordId],progress.progressIndicator({mode:"hide"}),data.success&&app.showNotify({text:app.vtranslate("JS_SAVE_NOTIFY_SUCCESS"),type:"success"}),app.reloadAfterSave(data,params,form,element);});}else//If validation fails in recordPreSaveEvent, form should submit again
form.removeData("submit"),$.progressIndicator({mode:"hide"});e.preventDefault();}),form.find(".js-full-editlink").on("click",function(e){var form=$(e.currentTarget).closest("form"),editViewUrl=$(e.currentTarget).data("url");goToFullFormCallBack(form),_this4.goToFullForm(form,editViewUrl);});},/**
* Function to navigate from quick create to edit iew full form
*
* @param {object} form jQuery
*/goToFullForm:function goToFullForm(form){form.find("input[name=\"action\"]").remove(),form.append("<input type=\"hidden\" name=\"view\" value=\"Edit\" />"),$.each(form.find("[data-validation-engine]"),function(key,data){$(data).removeAttr("data-validation-engine");}),form.addClass("not_validation"),form.trigger("submit");},/**
* Save quick create form
*
* @param {object} form jQuery
*
* @return {Promise} aDeferred
*/save:function save(form){var aDeferred=$.Deferred();form.serializeFormData();var formData=new FormData(form[0]);return AppConnector.request({url:"index.php",type:"POST",data:formData,processData:!1,contentType:!1}).done(function(data){aDeferred.resolve(data);}).fail(function(textStatus,errorThrown){aDeferred.reject(textStatus,errorThrown);}),aDeferred.promise()}},Scrollbar:{active:!0,defaults:{scrollbars:{autoHide:"leave"}},page:{instance:{},element:null},initPage:function initPage(){var scrollbarContainer=$(".mainBody");scrollbarContainer.length||(scrollbarContainer=$("#page")),scrollbarContainer.length||(scrollbarContainer=$("body")),this.active&&(this.page.instance=this.y(scrollbarContainer),this.page.element=$(this.page.instance.getElements().viewport));},xy:function xy(element){var options=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};return element.overlayScrollbars(options).overlayScrollbars()},y:function y(element,options){var mergedOptions=Object.assign(this.defaults,options,{overflowBehavior:{x:"h"}});return element.overlayScrollbars(mergedOptions).overlayScrollbars()}},DropFile:/*#__PURE__*/function(){function DropFile(container,params){_classCallCheck(this,DropFile),this.container=container,this.init(params);}/**
* Register function
* @param {jQuery} container
* @param {Object} params
*/return _createClass(DropFile,[{key:"init",value:/**
* Initiation
* @param {Object} params
*/function init(params){var _this5=this,css={border:this.container.css("border"),opacity:"unset"};this.container.bind("dragenter dragover",function(e){$(e.currentTarget).css({border:"2px dashed #4aa1f3",opacity:.4}),e.preventDefault();}),this.container.bind("dragleave",function(e){$(e.currentTarget).css(css),e.preventDefault();}),this.container.bind("drop",function(e){var element=$(e.currentTarget).css(css);e.preventDefault();var files=e.originalEvent.dataTransfer.files;return !(1>files.length)&&void(params.callback=params.callback||function(){var _step,progressIndicatorElement=$.progressIndicator({blockInfo:{enabled:!0}}),formData=new FormData,_iterator=_createForOfIteratorHelper(files);try{for(_iterator.s();!(_step=_iterator.n()).done;){var file=_step.value;formData.append(element.data("field-name"),file,file.name);}}catch(err){_iterator.e(err);}finally{_iterator.f();}formData.append("action","SaveAjax"),formData.append("record",element.data("id")),formData.append("module",element.data("module")),AppConnector.request({method:"POST",data:formData,processData:!1,contentType:!1}).done(function(data){data.success?(progressIndicatorElement.progressIndicator({mode:"hide"}),app.showNotify({text:app.vtranslate("JS_SAVE_NOTIFY_SUCCESS"),type:"success"}),element.closest(".js-detail-widget").length&&Vtiger_Detail_Js.getInstance().getFiltersDataAndLoad(e)):(app.showNotify({text:app.vtranslate("JS_UNEXPECTED_ERROR"),type:"error"}),progressIndicatorElement.progressIndicator({mode:"hide"}));}).fail(function(error,err){app.showNotify({text:app.vtranslate("JS_ERROR"),type:"error"}),progressIndicatorElement.progressIndicator({mode:"hide"}),app.errorLog(error,err);});},app.showConfirmModal({text:app.vtranslate("JS_CHANGE_CONFIRMATION"),confirmedCallback:function confirmedCallback(){params.callback(e,_this5);}}))});}}],[{key:"register",value:function register(container){var params=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if("undefined"==typeof container&&(container=$("body")),container.hasClass("js-drop-container")&&!container.prop("disabled"))return new App.Components.DropFile(container,params);var instances=[];return container.find(".js-drop-container").each(function(_,e){instances.push(new App.Components.DropFile($(e),params));}),instances}}]),DropFile}(),ActivityNotifier:(_class=/*#__PURE__*/function(){function ActivityNotifier(element,params,interval){var notice=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};_classCallCheck(this,ActivityNotifier),_defineProperty(this,"notice",{type:"error",icon:!1,hide:!0,delay:8e3,stack:new PNotify.Stack({dir1:"up",dir2:"left",firstpos1:25,firstpos2:25,modal:!1,maxOpen:2,maxStrategy:"close",maxClosureCausesWait:!0})}),_defineProperty(this,"intervalId",null),_defineProperty(this,"state",null),this.nodeElement=element.get(0),this.url=params,this.interval=interval||10,notice.length&&(this.notice=_objectSpread(_objectSpread({},this.notice),notice));}/**
* Register
* @param {jQuery} container
*/return _createClass(ActivityNotifier,[{key:"init",value:/**
* Initiation
*/function init(){var _this6=this;this.setFormat(),this.setTime(),document.addEventListener("visibilitychange",function(){document.hidden?_this6.destroyInterval():(_this6.setInterval(),_this6.requestNotifier());}),document.hidden||this.setInterval();}/**
* Set date format
* @param string
*/},{key:"setFormat",value:function setFormat(){var format=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";if(!format){var timeFormat="";timeFormat=24==CONFIG.hourFormat.toUpperCase()?"HH:mm:ss":"hh:mm:ss A",format=CONFIG.dateFormat.toUpperCase()+" "+timeFormat;}this.format=format;}/**
* Set date time
* @param string
*/},{key:"setTime",value:function setTime(){var time=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";time||(time=moment().format(this.format)),this.startTime=time;}/**
* Set Interval
*/},{key:"setInterval",value:function(_setInterval){function setInterval(){return _setInterval.apply(this,arguments)}return setInterval.toString=function(){return _setInterval.toString()},setInterval}(function(){var _this7=this;this.nodeElement.isConnected&&(this.intervalId=setInterval(function(){_this7.state||_this7.requestNotifier();},1e3*this.interval));}/**
* Destroy Interval
*/)},{key:"destroyInterval",value:function destroyInterval(){clearInterval(this.intervalId);}/**
* Function request for notifier popups
*/},{key:"requestNotifier",value:function requestNotifier(){var _this8=this;return this.nodeElement.isConnected?void(this.url.dateTime=this.startTime,this.state=1,AppConnector.request(this.url).done(function(data){_this8.state=0,app.isJsonString(data)&&(data=JSON.parse(data));var response=data.result;response.text&&(_this8.notice.text=response.text.trim(),_this8.notice.title=response.title.trim(),app.showNotify(_this8.notice)),_this8.setTime(response.dateTime);}).fail(function(data,err){app.errorLog(data,err),_this8.destroyInterval();})):(this.destroyInterval(),!1)}}],[{key:"register",value:function register(container){var element=container.find(ActivityNotifier.identifier);if(element.length){var notifierData=element.data();new ActivityNotifier(element,{module:notifierData.module,view:"RecordActivity",record:notifierData.record},notifierData.interval).init();}}}]),ActivityNotifier}(),_defineProperty(_class,"identifier","#recordActivityNotifier"),_class),/**
* Icons class
*/Icons:/*#__PURE__*/function(){function Icons(){_classCallCheck(this,Icons);}return _createClass(Icons,null,[{key:"modalView",value:/**
* Show modal window with icons to select
* @param {Object} params
*/function modalView(){var params=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},aDeferred=$.Deferred(),url="index.php?module=AppComponents&view=MediaModal";params&&Object.keys(params).length&&(url=app.convertObjectToUrl(params,url));var progressElement=$.progressIndicator({position:"html",blockInfo:{enabled:!0}});return app.showModalWindow({id:"MediaModal",url:url,cb:function cb(container){progressElement.progressIndicator({mode:"hide"}),container.on("click",".js-icon-item",function(e){var data={type:e.currentTarget.dataset.type,name:e.currentTarget.dataset.name};"image"===data.type&&(data.src=$(e.currentTarget).find("img").attr("src"),data.key=e.currentTarget.dataset.key),aDeferred.resolve(data),app.hideModalWindow(null,"MediaModal");});}}),aDeferred.promise()}}]),Icons}()},Notify:{/**
* Check if notifications are allowed
*/isDesktopPermitted:function isDesktopPermitted(){return "undefined"!=typeof Notification&&"granted"===Notification.permission},/**
* Show desktop notification
* @param {Object} params
*/desktop:function desktop(params){var type="error";return params.modules=new Map([].concat(_toConsumableArray(PNotify.defaultModules),[[PNotifyDesktop,{fallback:!1,icon:params.icon}]])),"undefined"!=typeof params.type&&(type=params.type,"error"!=params.type&&(params.hide=!0)),PNotify[type](params)}},Clipboard:/*#__PURE__*/function(){function Clipboard(container){_classCallCheck(this,Clipboard),this.text=null,this.oClipboard=null,this.container=container;}/**
* Register
* @param {jQuery} params
*/return _createClass(Clipboard,[{key:"load",value:/**
* Initiation
*/function load(){var _this9=this,aDeferred=$.Deferred(),url=this.container.data("url");return url?this.getTextFromUrl(url).then(function(response){_this9.text=response.result.text,aDeferred.resolve(_this9);}):aDeferred.resolve(this),aDeferred.promise()}/**
* Create ClipboardJS
*/},{key:"createClipboard",value:function createClipboard(){var _this10=this,id=this.container.attr("id");this.oClipboard=new ClipboardJS("#".concat(id),{text:function text(){return _this10.text}});}/**
* Get text to Clipboard from URL
*/},{key:"getTextFromUrl",value:function getTextFromUrl(url){var aDeferred=$.Deferred(),progressIndicatorElement=$.progressIndicator({blockInfo:{enabled:!0}});return AppConnector.request(url).done(function(response){progressIndicatorElement.progressIndicator({mode:"hide"}),response.success?aDeferred.resolve(response):aDeferred.reject(response);}).fail(function(_){app.showNotify({text:app.vtranslate("JS_ERROR"),type:"error"}),progressIndicatorElement.progressIndicator({mode:"hide"}),aDeferred.reject(_);}),aDeferred.promise()}/**
* Set text to Clipboard
*/},{key:"copy",value:function copy(){this.container.trigger("click"),app.showNotify({text:app.vtranslate("JS_NOTIFY_COPY_TEXT"),type:"success"});}/**
* Destroy ClipboardJS object
*/},{key:"destroy",value:function destroy(){this.oClipboard.destroy();}}],[{key:"register",value:function register(container){"undefined"==typeof container&&(container=$("body")),container.on("dblclick",".js-copy-clipboard",function(e){e.preventDefault(),new Clipboard($(e.currentTarget)).load().then(function(instance){instance.createClipboard(),instance.copy(),instance.destroy();});});}}]),Clipboard}(),/**
* File
*/File:/*#__PURE__*/function(){/**
* Constructor
* @param {jQuery} element
* @param {Object} options
*/function File(element){var options=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,File),_defineProperty(this,"fileupload",{dataType:"json",replaceFileInput:!1,autoUpload:!1,fail:this.uploadError.bind(this),add:this.add.bind(this),change:this.change.bind(this)}),_defineProperty(this,"options",{formats:[],limit:1,maxFileSize:CONFIG.maxUploadLimit||0,maxFileSizeDisplay:""}),_defineProperty(this,"files",[]),this.fileInput=element,"undefined"!=typeof options.fileupload&&(this.fileupload=_objectSpread(_objectSpread({},this.fileupload),options.fileupload),delete options.fileupload),this.options=_objectSpread(_objectSpread({},this.options),options);}/**
* Register file element
* @param {jQuery} element
* @param {Object} options
* @returns
*/return _createClass(File,[{key:"init",value:/**
* Initiation
*/function init(){this.fileInput.detach(),this.fileupload.fileInput=this.fileInput,this.fileInput.fileupload(this.fileupload),this.filesActive=0;}/**
* Add event handler from jQuery-file-upload
*
* @param {Event} e
* @param {Object} data
*/},{key:"add",value:function add(_e,data){0<data.files.length&&data.submit();}/**
* File change event handler from jQuery-file-upload
*
* @param {Event} e
* @param {object} data
*/},{key:"change",value:function change(_e,data){var _this$filterFiles=this.filterFiles(data.files),valid=_this$filterFiles.valid,error=_this$filterFiles.error;data.files=valid,valid.length||this.fileInput.val(""),error.length&&this.showErrors(error);}/**
* Get only valid files from list
* @param {Array} files
*
* @returns {Object}
*/},{key:"filterFiles",value:function filterFiles(files){var valid=[],error=[];if(files.length+this.files.length>this.options.limit)error.push({error:{text:"".concat(app.vtranslate("JS_FILE_LIMIT")," [").concat(this.options.limit,"]")}});else {var _step2,_iterator2=_createForOfIteratorHelper(files);try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var file=_step2.value;this.validateFileType(file)&&this.validateFileSize(file)?valid.push(file):error.push(file);}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}}return {valid:valid,error:error}}/**
* Validate maximum file size
* @param {Object} file
* @returns {Boolean}
*/},{key:"validateFileSize",value:function validateFileSize(file){var result="number"==typeof file.size&&file.size<this.options.maxFileSize;return result||(file.error={title:"".concat(app.vtranslate("JS_UPLOADED_FILE_SIZE_EXCEEDS")," <br> [").concat(this.options.maxFileSizeDisplay,"]"),text:file.name}),result}/**
* Validate file type
*
* @param {Object} file
* @returns {boolean}
*/},{key:"validateFileType",value:function validateFileType(file){var result=!this.options.formats.length||0<this.options.formats.filter(function(format){return file.type===format||"/*"===format.slice(-2)&&0===file.type.indexOf(format.slice(0,-1))}).length;return result||(file.error={title:app.vtranslate("JS_INVALID_FILE_TYPE"),text:file.name}),result}/**
* Show errors
*/},{key:"showErrors",value:function showErrors(){var _step3,errors=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],_iterator3=_createForOfIteratorHelper(errors);try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var info=_step3.value;this.showError(info.error);}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}}/**
* Show error
*/},{key:"showError",value:function showError(error){"undefined"==typeof error.type&&(error.type="error"),error.textTrusted=!1,app.showNotify(error);}/**
* Error event handler from file upload request
*
* @param {Event} e
* @param {Object} data
*/},{key:"uploadError",value:function uploadError(_e,data){var _this11=this;this.filesActive--,app.errorLog("File upload error.");var jqXHR=data.jqXHR,files=data.files;return "undefined"==typeof jqXHR.responseJSON||null===jqXHR.responseJSON?this.showError({title:app.vtranslate("JS_FILE_UPLOAD_ERROR"),type:"error"}):void files.forEach(function(file){_this11.showError({title:app.vtranslate("JS_FILE_UPLOAD_ERROR"),text:file.name,type:"error"});})}}],[{key:"register",value:function register(element){var options=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},file=new File(element,options);return file.init(),file}}]),File}()},app=window.app={/**
* variable stores client side language strings
*/languageString:[],breakpoints:{xs:0,sm:576,md:768,lg:992,xl:1200,xxl:1300,xxxl:1700},cacheParams:[],modalEvents:[],mousePosition:{x:0,y:0},childFrame:!1,touchDevice:!1,event:new function(){this.el=$({}),this.trigger=function(){this.el.trigger(arguments[0],Array.prototype.slice.call(arguments,1));},this.on=function(){this.el.on.apply(this.el,arguments);},this.one=function(){this.el.one.apply(this.el,arguments);},this.off=function(){this.el.off.apply(this.el,arguments);};},/**
* Function to get the module name. This function will get the value from element which has id module
* @return : string - module name
*/getModuleName:function getModuleName(){return this.getMainParams("module")},/**
* Function to get the module name. This function will get the value from element which has id module
* @return : string - module name
*/getParentModuleName:function getParentModuleName(){return this.getMainParams("parent")},/**
* Function returns the current view name
*/getViewName:function getViewName(){return this.getMainParams("view")},/**
* Function returns the record id
*/getRecordId:function getRecordId(){var recordId;return -1!==$.inArray(this.getViewName(),["Edit","PreferenceEdit","Detail","PreferenceDetail","DetailPreview"])&&(recordId=this.getMainParams("recordId")),recordId},/**
* Function which will give you all details of the selected record
* @params {object} params - an object of values like {'record' : recordId, 'module' : searchModule, 'fieldType' : 'email'}
*/getRecordDetails:function getRecordDetails(params){var aDeferred=$.Deferred();return "Settings"===app.getParentModuleName()&&(params.parent="Settings"),AppConnector.request(Object.assign(params,{action:"GetData"})).done(function(data){data.success?aDeferred.resolve(data):aDeferred.reject(data.message);}).fail(function(){aDeferred.reject();}),aDeferred.promise()},/**
* Function to get language
*/getLanguage:function getLanguage(){return $("body").data("language")},/**
* Function to get page title
*/getPageTitle:function getPageTitle(){return document.title},/**
* Function gets current window parent
* @returns {object}
*/getWindowParent:function getWindowParent(){return "undefined"!=typeof window.frames[0]&&"undefined"!=typeof window.frames[0].app&&window.frames[0].app.childFrame?window.frames[0]:window},/**
* Check if current window is window top
*/isWindowTop:function isWindowTop(){return window.top===window.self},/**
* Function gets current window parent
* @returns {boolean}
*/isTouchDevice:function isTouchDevice(){var supportsTouch=!1;return "ontouchstart"in window?supportsTouch=!0:window.navigator.msPointerEnabled?supportsTouch=!0:"ontouchstart"in document.documentElement&&(supportsTouch=!0),supportsTouch&&$("<style type='text/css'> ::-webkit-scrollbar { display: none;} </style>").appendTo("head"),supportsTouch},/**
* Check if string is json
* @param {string} str
* @returns {boolean}
*/isJsonString:function isJsonString(str){try{JSON.parse(str);}catch(e){return !1}return !0},/**
* Function to set page title
*/setPageTitle:function setPageTitle(title){document.title=title;},/**
* Function to get the contents container
* @returns jQuery object
*/getContentsContainer:function getContentsContainer(){return $(".bodyContents")},hidePopover:function hidePopover(element){"undefined"==typeof element&&(element=$("body .js-popover-tooltip")),element.popover("hide");},hidePopoversAfterClick:function hidePopoversAfterClick(popoverParent){popoverParent.on("mousedown",function(){setTimeout(function(){popoverParent.popover("hide");},100);});},registerPopoverManualTrigger:function registerPopoverManualTrigger(element,manualTriggerDelay){var _this12=this,hideDelay=500;element.on("mouseleave",function(){setTimeout(function(){var currentPopover=_this12.getBindedPopover(element);$(":hover").filter(currentPopover).length||currentPopover.find(".js-popover-tooltip--record[aria-describedby]").length||currentPopover.popover("hide");},hideDelay);}),element.on("mouseenter",function(){setTimeout(function(){if(element.is(":hover")){element.popover("show");var currentPopover=_this12.getBindedPopover(element);currentPopover.on("mouseleave",function(){setTimeout(function(){$(":hover").filter(currentPopover).length||currentPopover.find(".js-popover-tooltip--record[aria-describedby]").length||currentPopover.popover("hide"),$(":hover").filter($(".popover")).length||$(".popover").popover("hide");},hideDelay);});}},manualTriggerDelay);}),app.hidePopoversAfterClick(element);},isEllipsisActive:function isEllipsisActive(element){var clone=element.clone().addClass("u-text-ellipsis--not-active").css(element.css(["font-size","font-weight","font-family"])).appendTo("body");return (clone.find(".u-text-ellipsis").removeClass("u-text-ellipsis").addClass("u-text-ellipsis--not-active"),clone.width()-1>element.width())?(clone.remove(),!0):(clone.remove(),!1)},showPopoverElementView:function showPopoverElementView(){var selectElement=0<arguments.length&&void 0!==arguments[0]?arguments[0]:$(".js-popover-tooltip"),params=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},defaultParams={trigger:"manual",manualTriggerDelay:500,placement:"auto",html:!0,template:"<div class=\"popover\" role=\"tooltip\"><div class=\"arrow\"></div><h3 class=\"popover-header\"></h3></div>",container:"body",boundary:"viewport",delay:{show:300,hide:100}};return selectElement.each(function(_index,domElement){var element=$(domElement),elementParams=$.extend(!0,defaultParams,params,element.data()),tmp=elementParams.template;elementParams.class&&(tmp=tmp.replace("class=\"popover\"","class=\"popover ".concat(elementParams.class,"\""))),elementParams.content&&(tmp=tmp.replace("</h3></div>","</h3><div class=\"popover-body\">".concat(elementParams.content,"</div></div>"))),elementParams.template=tmp,element.hasClass("delay0")&&(elementParams.delay={show:0,hide:0}),element.popover(elementParams),("manual"===elementParams.trigger||"undefined"==typeof elementParams.trigger)&&app.registerPopoverManualTrigger(element,elementParams.manualTriggerDelay),elementParams.callbackShown&&element.on("shown.bs.popover",function(e){elementParams.callbackShown(e);}),element.addClass("popover-triggered");}),selectElement},registerPopoverEllipsis:function registerPopoverEllipsis(){var _ref=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},_ref$element=_ref.element,element=void 0===_ref$element?$(".js-popover-tooltip--ellipsis"):_ref$element,_ref$params=_ref.params,params=void 0===_ref$params?{trigger:"hover focus"}:_ref$params,_ref$container=_ref.container,container=void 0===_ref$container?$(window):_ref$container,self=this;params={callbackShown:function callbackShown(){self.setPopoverPosition(element,container);},trigger:"manual",placement:"right",class:"js-popover--before-positioned"};var popoverText=element.find(".js-popover-text").length?element.find(".js-popover-text"):element;return app.isEllipsisActive(popoverText)?void app.showPopoverElementView(element,params):void element.addClass("popover-triggered")},registerPopoverEllipsisIcon:function registerPopoverEllipsisIcon(){var selectElement=0<arguments.length&&arguments[0]!==void 0?arguments[0]:$(".js-popover-tooltip--ellipsis-icon"),params=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{trigger:"hover focus"};selectElement.each(function(index,domElement){var element=$(domElement),popoverText=element.find(".js-popover-text").length?element.find(".js-popover-text"):element;if(app.isEllipsisActive(popoverText)){var iconElement=element.find(".js-popover-icon");iconElement.length&&(element.find(".js-popover-icon").removeClass("d-none"),params.selector=".js-popover-icon"),app.showPopoverElementView(element,params);}});},/**
* Register popover record
* @param {jQuery} selectElement
* @param {object} customParams
*/registerPopoverRecord:function registerPopoverRecord(){var selectElement=0<arguments.length&&arguments[0]!==void 0?arguments[0]:$(".js-popover-tooltip--record"),customParams=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},container=2<arguments.length&&arguments[2]!==void 0?arguments[2]:$(document),self=this;app.showPopoverElementView(selectElement,{template:"<div class=\"popover c-popover--link js-popover--before-positioned\" role=\"tooltip\"><div class=\"popover-body\"></div></div>",content:"<div class=\"d-none\"></div>",manualTriggerDelay:app.getMainParams("recordPopoverDelay"),placement:"right",callbackShown:function callbackShown(){var href;if(selectElement.attr("href")||(href=selectElement.find("a").attr("href")),!href&&(!selectElement.attr("href")||selectElement.closest(".ui-sortable-handle").hasClass("ui-sortable-helper")))return !1;href||(href=selectElement.eq(0).attr("href"));var link=new URL(href,window.location.origin);if(!link.searchParams.get("record")||!link.searchParams.get("view"))return !1;var url=link.href;url=url.replace("view=","xview=")+"&view=RecordPopover";var currentPopover=self.getBindedPopover(selectElement),popoverBody=currentPopover.find(".popover-body");popoverBody.progressIndicator({});var appendPopoverData=function(data){popoverBody.progressIndicator({mode:"hide"}).html(data),"function"==typeof customParams.callback&&customParams.callback(popoverBody),self.setPopoverPosition(selectElement,container);},urlObject=app.convertUrlToObject(url),cacheData=window.popoverCache[urlObject.record];"undefined"==typeof cacheData?AppConnector.request(url).done(function(data){window.popoverCache[urlObject.record]=data,appendPopoverData(data);}):appendPopoverData(cacheData);}});},/**
* Update popover record position (overwrite bootstrap positioning, failing on huge elements)
* @param {jQuery} popover
* @param {number} offsetLeft
*/setPopoverPosition:function setPopoverPosition(popoverElement){var container=1<arguments.length&&arguments[1]!==void 0?arguments[1]:$(window),popover=this.getBindedPopover(popoverElement);if(popover.length){var iframeOffset=this.computePopoverIframeOffset(popoverElement),windowHeight=$(window).height(),windowWidth=$(window).width(),popoverPadding=10,popoverBody=popover.find(".popover-body"),popoverHeight=popoverBody.height(),popoverWidth=popoverBody.width(),offsetTop=app.mousePosition.y+iframeOffset.top,offsetLeft=app.mousePosition.x+iframeOffset.left;popoverHeight+offsetTop+popoverPadding>windowHeight&&(offsetTop=offsetTop-popoverHeight-popoverPadding),popoverWidth+offsetLeft+popoverPadding>windowWidth&&(offsetLeft=windowWidth-popoverWidth),popover.css({transform:"translate3d(".concat(offsetLeft,"px, ").concat(offsetTop,"px, 0)")}),popover.removeClass("js-popover--before-positioned"),popoverElement.one("hide.bs.popover",function(){popover.addClass("js-popover--before-positioned");});}},/**
* Compute popover iframe offset
*
* @param {Object} popoverElement jquery
*
* @return {Object} offset top and left
*/computePopoverIframeOffset:function computePopoverIframeOffset(popoverElement){var iframeOffsetTop=0,iframeOffsetLeft=0;if(!$(document).find(popoverElement).length){var iframe=$(document).find("iframe"),iframeOffset=iframe.offset();if(iframeOffsetTop+=iframeOffset.top,iframeOffsetLeft+=iframeOffset.left,!iframe.contents().find(popoverElement).length){var iframe2=iframe.contents().find("iframe"),iframeOffset2=iframe2.offset();iframeOffsetTop+=iframeOffset2.top,iframeOffsetLeft+=iframeOffset2.left;}}return {top:iframeOffsetTop,left:iframeOffsetLeft}},/**
* Get binded popover
* @param {jQuery} element
* @returns {Mixed|jQuery|HTMLElement}
*/getBindedPopover:function getBindedPopover(element){return $("#".concat(element.attr("aria-describedby")))},/**
* Function to check the maximum selection size of multiselect and update the results
* @params <object> multiSelectElement
* @params <object> select2 params
*/registerChangeEventForMultiSelect:function registerChangeEventForMultiSelect(selectElement,params){if("undefined"!=typeof selectElement){var instance=selectElement.data("select2"),limit=params.maximumSelectionLength;selectElement.on("change",function(){var data=instance.data();$.isArray(data)&&data.length>=limit&&instance.updateResults();});}},/**
* Function to get data of the child elements in serialized format
* @params <object> parentElement - element in which the data should be serialized. Can be selector , domelement or jquery object
* @params <String> returnFormat - optional which will indicate which format return value should be valid values "object" and "string"
* @return <object> - encoded string or value map
*/getSerializedData:function getSerializedData(parentElement,returnFormat){"undefined"==typeof returnFormat&&(returnFormat="string"),parentElement=$(parentElement);var encodedString=parentElement.children().serialize();if("string"==returnFormat)return encodedString;var keyValueMap={},valueList=encodedString.split("&");for(var index in valueList){var keyValueString=valueList[index],keyValueArr=keyValueString.split("="),nameOfElement=keyValueArr[0],valueOfElement=keyValueArr[1];keyValueMap[nameOfElement]=decodeURIComponent(valueOfElement);}return keyValueMap},showModalData:function showModalData(data,container,paramsObject,cb,url,sendByAjaxCb){var thisInstance=this,params={show:!0};app.getMainParams("backgroundClosingModal")||(params.backdrop="static",params.keyboard=!1),"object"===_typeof(paramsObject)&&(container.css(paramsObject),params=$.extend(params,paramsObject)),container.html(data),container.find(".modal").hasClass("static")&&(params.backdrop="static"),$.fn.modal.Constructor.prototype._enforceFocus=function(){$(document).off("focusin.bs.modal")// guard against infinite focus loop
.on("focusin.bs.modal",$.proxy(function(e){if($(e.target).hasClass("select2-search__field"))return !0},this));};var modalContainer=container.find(".modal:first");modalContainer.one("shown.bs.modal",function(){thisInstance.registerDataTables(modalContainer.find(".js-modal-data-table")),cb(modalContainer),App.Fields.Picklist.changeSelectElementView(modalContainer),App.Fields.Date.register(modalContainer),App.Fields.DateTime.register(modalContainer),App.Fields.Text.Editor.register(modalContainer.find(".js-editor"),{height:"5em",toolbar:"Min"}),App.Fields.MultiAttachment.register(modalContainer),App.Fields.Icon.register(modalContainer),app.registesterScrollbar(modalContainer),app.registerIframeEvents(modalContainer),modalContainer.find(".modal-dialog:not(.js-no-drag)").draggable({handle:".modal-title"}),modalContainer.find(".modal-title").css("cursor","move");}),$("body").append(container),modalContainer.modal(params),app.registerFormsEvents(modalContainer),thisInstance.registerModalEvents(modalContainer,sendByAjaxCb);},showModalWindow:function showModalWindow(data,url,cb){var paramsObject=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};if(!app.isCurrentWindowTarget("app.showModalWindow",arguments))return !1;var sendByAjaxCb,modalId,thisInstance=this;//null is also an object
if(modalId="modal_"+Math.random().toString(36).substr(2,9),"object"===_typeof(data)&&null!=data&&!(data instanceof $))null!=data.id&&(modalId=data.id),paramsObject=data.css,cb=data.cb,url=data.url,"undefined"!==data.sendByAjaxCb&&(sendByAjaxCb=data.sendByAjaxCb),data=data.data;else if("string"==typeof data){var modalData=$(data).last();modalData.data("modalid")&&(modalId=modalData.data("modalid"));}"function"==typeof url?("object"===_typeof(cb)&&(paramsObject=cb),cb=url,url=!1):"object"===_typeof(url)&&(cb=function(){},paramsObject=url,url=!1),"function"!=typeof cb&&(cb=function(){}),"function"!=typeof sendByAjaxCb&&(sendByAjaxCb=function(){}),void 0!==paramsObject&&void 0!==paramsObject.modalId&&(modalId=paramsObject.modalId);// prevent duplicate hash generation
var container=$("#"+modalId);return container.length&&container.remove(),container=$("<div></div>"),container.attr("id",modalId).addClass("modalContainer js-modal-container"),container.one("hidden.bs.modal",function(){container.remove();var backdrop=$(".modal-backdrop");$(".modal.show").length||backdrop.remove(),0<backdrop.length&&$("body").addClass("modal-open");}),Window.lastModalId=modalId,data?thisInstance.showModalData(data,container,paramsObject,cb,url,sendByAjaxCb):$.get(url).done(function(response){thisInstance.showModalData(response,container,paramsObject,cb,url,sendByAjaxCb);}),container},showModalHtml:function showModalHtml(params){var _params$footer,data="",icon="",footer=null!==(_params$footer=params.footer)&&void 0!==_params$footer?_params$footer:"";params.header&&(params.header="<span class=\"".concat(params.headerIcon," mr-2\"></span>").concat(params.header)),params.footerButtons&&$.each(params.footerButtons,function(i,button){icon=data="",$.each(button.data,function(key,val){data+=" data-".concat(key,"=\"").concat(val,"\"");}),button.icon&&(icon+="<span class=\"".concat(button.icon," mr-2\"></span>")),footer+="<button type=\"button\" class=\"btn ".concat(button["class"],"\" ").concat(data,">").concat(icon).concat(button.text,"</button>");}),footer&&(footer="<div class=\"modal-footer\">".concat(footer,"</div>"));var html="<div class=\"modal\" role=\"dialog\"><div class=\"modal-dialog ".concat(params["class"],"\" role=\"document\"><div class=\"modal-content\">\n\t\t<div class=\"modal-header\"><h5 class=\"modal-title js-modal-title\" data-js=\"container\">").concat(params.header,"</h5><button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">×</span></button></div>\n\t\t<div class=\"modal-body js-modal-content text-break ").concat(params.bodyClass,"\" data-js=\"container\">").concat(params.body,"</div>").concat(footer,"</div></div></div>");return params.data=html,app.showModalWindow(params)},/**
* Check if current window is target for a modal and trigger in correct window if not
*
* @param {String} sourceFunction source function name in dot prop notation object
* @param {Array} args source function arguments
*
* @return {Boolean} isCurrentWindowTarget
*/isCurrentWindowTarget:function(sourceFunction,args){var isCurrentWindowTarget=!0;return "parentIframe"===CONFIG.modalTarget&&(this.childFrame=!0,sourceFunction=sourceFunction.split("."),sourceFunction.unshift("parent"),sourceFunction=sourceFunction.reduce(function(o,i){return o[i]},window),sourceFunction.apply(window.parent.app,args),isCurrentWindowTarget=!1),isCurrentWindowTarget},/**
* Function which you can use to hide the modal
* This api assumes that we are using block ui plugin and uses unblock api to unblock it
*/hideModalWindow:function hideModalWindow(callback,id){if(!app.isCurrentWindowTarget("app.hideModalWindow",arguments))return !1;var container;if(container=callback&&"object"===_typeof(callback)?callback:null==id?$(".modalContainer"):$("#"+id),!(0>=container.length)){"function"!=typeof callback&&(callback=function(){});var modalContainer=container.find(".modal");modalContainer.modal("hide");var backdrop=$(".modal-backdrop:last");0==$(".modalContainer").length&&backdrop.length&&backdrop.remove(),modalContainer.one("hidden.bs.modal",callback);}},registerModalController:function registerModalController(modalId,modalContainer,cb){var windowParent=this.childFrame?window.parent:window;modalId||(modalId=Window.lastModalId),modalContainer||(modalContainer=$("#"+modalId+" .js-modal-data"));var moduleName=modalContainer.data("module")||"Base",modalClass=moduleName.replace(":","_")+"_"+modalContainer.data("view")+"_JS";if("undefined"==typeof windowParent[modalClass]&&(modalClass=[].concat(_toConsumableArray(modalClass.split("_").slice(0,-1)),["Js"]).join("_")),"undefined"==typeof windowParent[modalClass]&&(modalClass="Base_"+modalContainer.data("view")+"_JS"),"undefined"!=typeof windowParent[modalClass]){var instance=new windowParent[modalClass];"function"==typeof cb&&cb(modalContainer,instance),instance.registerEvents(modalContainer),modalId&&app.modalEvents[modalId]&&app.modalEvents[modalId](modalContainer,instance);}},registerModalEvents:function registerModalEvents(container,sendByAjaxCb){var form=container.find("form"),validationForm=!1;(form.hasClass("validateForm")||form.hasClass("js-validate-form"))&&(form.validationEngine(app.validationEngineOptions),validationForm=!0),"QuickDetailModal"===container.data("view")&&this.registerBlockAnimationEvent(container),(form.hasClass("sendByAjax")||form.hasClass("js-send-by-ajax"))&&form.on("submit",function(e){var save=!0;if(e.preventDefault(),validationForm&&0<form.data("jqv").InvalidFields.length&&(app.formAlignmentAfterValidation(form),save=!1),save){var progressIndicatorElement=$.progressIndicator({blockInfo:{enabled:!0}}),formData=form.serializeFormData();AppConnector.request(formData).done(function(responseData){return sendByAjaxCb(formData,responseData),responseData.success&&responseData.result&&(responseData.result.notify&&Vtiger_Helper_Js.showMessage(responseData.result.notify),responseData.result.processStop)?(progressIndicatorElement.progressIndicator({mode:"hide"}),!1):void(app.hideModalWindow(),progressIndicatorElement.progressIndicator({mode:"hide"}))}).fail(function(error){app.showNotify({type:"error",title:app.vtranslate("JS_UNEXPECTED_ERROR"),text:error}),progressIndicatorElement.progressIndicator({mode:"hide"});});}});},registerFormsEvents:function registerFormsEvents(container){var forms=container.find("form.js-form-ajax-submit,form.js-form-single-save");forms.each(function(i,form){form=$(form);var validationForm=!1;form.hasClass("js-validate-form")&&(form.validationEngine(app.validationEngineOptions),validationForm=!0),form.hasClass("js-form-single-save")&&form.find("select,input").on("change",function(){var element=$(this);if(!(validationForm&&element.validationEngine("validate"))){var progressIndicatorElement=$.progressIndicator({blockInfo:{enabled:!0}}),formData=form.serializeFormData(),name=element.attr("name").replace("[]","");formData.updateField=name,formData.updateValue=formData[name],AppConnector.request(formData).done(function(responseData){responseData.success&&responseData.result&&responseData.result.notify&&app.showNotify(responseData.result.notify),progressIndicatorElement.progressIndicator({mode:"hide"});}).fail(function(error){app.showNotify({title:app.vtranslate("JS_UNEXPECTED_ERROR"),text:error,type:"error"}),progressIndicatorElement.progressIndicator({mode:"hide"});});}}),form.hasClass("js-form-ajax-submit")&&form.on("submit",function(e){var save=!0;if(e.preventDefault(),validationForm&&0<form.data("jqv").InvalidFields.length&&(app.formAlignmentAfterValidation(form),save=!1),save){var progressIndicatorElement=$.progressIndicator({blockInfo:{enabled:!0}});AppConnector.request(form.serializeFormData()).done(function(responseData){responseData.success&&responseData.result&&(responseData.result.notify&&Vtiger_Helper_Js.showMessage(responseData.result.notify),responseData.result.closeModal&&app.hideModalWindow(null,container.closest(".js-modal-container").attr("id"))),progressIndicatorElement.progressIndicator({mode:"hide"});}).fail(function(){app.showNotify({text:app.vtranslate("JS_UNEXPECTED_ERROR"),type:"error"}),progressIndicatorElement.progressIndicator({mode:"hide"});});}});});},isHidden:function isHidden(element){return "none"==element.css("display")},isInvisible:function isInvisible(element){return "hidden"==element.css("visibility")},/**
* Default validation eninge options
*/validationEngineOptions:{// Avoid scroll decision and let it scroll up page when form is too big
// Reference: http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/
scroll:!1,promptPosition:"topLeft",//to support validation for select2 select box
prettySelect:!0,usePrefix:"s2id_"},validationEngineOptionsForRecord:{scroll:!1,promptPosition:"topLeft",//to support validation for select2 select box
prettySelect:!0,usePrefix:"s2id_",onBeforePromptType:function onBeforePromptType(field){var block=field.closest(".js-toggle-panel");block.find(".blockContent").is(":hidden")&&block.find(".blockHeader").click();}},/**
* Default scroll options
*/scrollOptions:{wheelSpeed:.5},/**
* Function to push down the error message size when validation is invoked
* @params : form Element
*/formAlignmentAfterValidation:function formAlignmentAfterValidation(form){// to avoid hiding of error message under the fixed nav bar
var formError=form.find(".formError:not('.greenPopup'):first");if(0<formError.length){var destination=formError.offset().top;$("html").animate({scrollTop:destination-105},"slow");}},/**
* Register block toggle event
* @param {jQuery} container
*/registerBlockToggleEvent:function registerBlockToggleEvent(container){container.on("click",".js-block-header",function(e){var target=$(e.target);if(target.is("input")||target.is("button")||target.parents().is("button")||target.hasClass("js-stop-propagation")||target.parents().hasClass("js-stop-propagation"))return !1;var blockHeader=$(e.currentTarget),blockContents=blockHeader.next(),iconToggle=blockHeader.find(".iconToggle");blockContents.hasClass("d-none")?(blockContents.removeClass("d-none"),iconToggle.removeClass(iconToggle.data("hide")).addClass(iconToggle.data("show"))):(blockContents.addClass("d-none"),iconToggle.removeClass(iconToggle.data("show")).addClass(iconToggle.data("hide")));});},registerBlockAnimationEvent:function registerBlockAnimationEvent(){var container=!!(0<arguments.length&&arguments[0]!==void 0)&&arguments[0],detailViewContentHolder=$("div.details div.contents"),blockHeader=detailViewContentHolder.find(".blockHeader");!1!==container&&(blockHeader=container.find(".blockHeader")),blockHeader.on("click",function(e){var target=$(e.target);if(target.is("input")||target.is("button")||target.parents().is("button")||target.hasClass("js-stop-propagation")||target.parents().hasClass("js-stop-propagation"))return !1;var currentTarget=$(this).find(".js-block-toggle").not(".d-none"),blockId=currentTarget.data("id"),closestBlock=currentTarget.closest(".js-toggle-panel"),bodyContents=closestBlock.find(".blockContent"),data=currentTarget.data(),module=app.getModuleName();"show"===data.mode?(bodyContents.addClass("d-none"),app.cacheSet(module+"."+blockId,0),currentTarget.addClass("d-none"),closestBlock.find("[data-mode=\"hide\"]").removeClass("d-none")):(bodyContents.removeClass("d-none"),app.cacheSet(module+"."+blockId,1),currentTarget.addClass("d-none"),closestBlock.find("[data-mode=\"show\"]").removeClass("d-none"));});},registerEventForDateFields:function registerEventForDateFields(parentElement){"undefined"==typeof parentElement&&(parentElement=$("body")),parentElement=$(parentElement);var element;element=parentElement.hasClass("dateField")?parentElement:$(".dateField",parentElement),element.datepicker({autoclose:!0}).on("changeDate",function(ev){var currentElement=$(ev.currentTarget),dateFormat=currentElement.data("dateFormat").toUpperCase(),date=$.datepicker.formatDate(moment(ev.date).format(dateFormat),ev.date);currentElement.val(date);}),App.Fields.Utils.hideMobileKeyboard(element);},registerEventForClockPicker:function registerEventForClockPicker(){var timeInputs=0<arguments.length&&void 0!==arguments[0]?arguments[0]:$(".clockPicker");if(timeInputs.hasClass("clockPicker")||(timeInputs=timeInputs.find(".clockPicker")),!!timeInputs.length){var params={placement:"bottom",autoclose:!0,minutestep:5};$(".js-clock__btn").on("click",function(e){e.stopPropagation();var tempElement=$(e.currentTarget).closest(".time").find("input.clockPicker");"disabled"!==tempElement.attr("disabled")&&"readonly"!==tempElement.attr("readonly")&&tempElement.clockpicker("show");});var formatTimeString=function(timeInput){if(params.twelvehour){var meridiemTime="";params.afterDone=function(){//format time string after picking a value
var timeString=timeInput.val(),timeStringFormatted=timeString.slice(0,timeString.length-2)+" "+meridiemTime;timeInput.val(timeStringFormatted),app.event.trigger("Clockpicker.changed",timeInput);},params.beforeHide=function(){meridiemTime=$(".clockpicker-buttons-am-pm:visible").find("a:not(.text-white-50)").text();};}else params.afterDone=function(){app.event.trigger("Clockpicker.changed",timeInput);};};timeInputs.each(function(i,e){var timeInput=$(e),formatTime=timeInputs.data("format")||CONFIG.hourFormat;params.twelvehour=12===parseInt(formatTime),formatTimeString(timeInput),timeInput.clockpicker(params);}),App.Fields.Utils.hideMobileKeyboard(timeInputs);}},registerDataTables:function registerDataTables(table){var options=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return null!=$.fn.dataTable&&0!=table.length&&($.extend($.fn.dataTable.defaults,{language:{sLengthMenu:app.vtranslate("JS_S_LENGTH_MENU"),sZeroRecords:app.vtranslate("JS_NO_RESULTS_FOUND"),sInfo:app.vtranslate("JS_S_INFO"),sInfoEmpty:app.vtranslate("JS_S_INFO_EMPTY"),sSearch:app.vtranslate("JS_SEARCH"),sEmptyTable:app.vtranslate("JS_NO_RESULTS_FOUND"),sInfoFiltered:app.vtranslate("JS_S_INFO_FILTERED"),sLoadingRecords:app.vtranslate("JS_LOADING_OF_RECORDS"),sProcessing:app.vtranslate("JS_LOADING_OF_RECORDS"),oPaginate:{sFirst:app.vtranslate("JS_S_FIRST"),sPrevious:app.vtranslate("JS_S_PREVIOUS"),sNext:app.vtranslate("JS_S_NEXT"),sLast:app.vtranslate("JS_S_LAST")},oAria:{sSortAscending:app.vtranslate("JS_S_SORT_ASCENDING"),sSortDescending:app.vtranslate("JS_S_SORT_DESCENDING")}}}),Object.keys(options).length||(options=Object.assign({searching:!0,ordering:!0,paging:!0,info:!0},table.data())),table.DataTable(options))},/**
* Function to get the select2 element from the raw select element
* @params: select element
* @return : select2Element - corresponding select2 element
*/getSelect2ElementFromSelect:function getSelect2ElementFromSelect(selectElement){var selectId=selectElement.attr("id");//since select2 will add s2id_ to the id of select element
return $("#"+("select2-"+selectId+"-container")).closest(".select2-container")},/**
* Function to set with of the element to parent width
* @params : jQuery element for which the action to take place
*/setInheritWidth:function setInheritWidth(elements){$(elements).each(function(index,element){var parentWidth=$(element).parent().width();$(element).width(parentWidth);});},showNewScrollbar:function showNewScrollbar(element){var options=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{wheelPropagation:!0};return "undefined"!=typeof element&&element.length?new PerfectScrollbar(element[0],Object.assign(this.scrollOptions,options)):void 0},showNewScrollbarTopBottomRight:function showNewScrollbarTopBottomRight(element){var options=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{};if("undefined"!=typeof element&&element.length){options=Object.assign(options,this.scrollOptions);var scrollbarTopLeftInit=new PerfectScrollbar(element[0],options),scrollbarTopElement=element.find(".ps__rail-x").first();scrollbarTopElement.css({top:0,bottom:"auto"}),scrollbarTopElement.find(".ps__thumb-x").css({top:2,bottom:"auto"});var scrollbarBottomRightInit=new PerfectScrollbar(element[0],options);return [scrollbarTopLeftInit,scrollbarBottomRightInit]}},showNewScrollbarTopBottom:function showNewScrollbarTopBottom(element){var options=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{wheelPropagation:!0,suppressScrollY:!0};if("undefined"!=typeof element&&element.length){options=Object.assign(options,this.scrollOptions),new PerfectScrollbar(element[0],options),new PerfectScrollbar(element[0],options);var scrollbarTopElement=element.find(".ps__rail-x").first();scrollbarTopElement.css({top:0,bottom:"auto"}),scrollbarTopElement.find(".ps__thumb-x").css({top:2,bottom:"auto"});}},showNewScrollbarTop:function showNewScrollbarTop(element){var options=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{wheelPropagation:!0,suppressScrollY:!0};if("undefined"!=typeof element&&element.length){options=Object.assign(this.scrollOptions,options),new PerfectScrollbar(element[0],options);var scrollbarTopElement=element.find(".ps__rail-x").first();scrollbarTopElement.css({top:0,bottom:"auto"}),scrollbarTopElement.find(".ps__thumb-x").css({top:2,bottom:"auto"});}},showNewScrollbarLeft:function showNewScrollbarLeft(element){var options=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{wheelPropagation:!0};if("undefined"!=typeof element&&element.length){options=Object.assign(this.scrollOptions,options),new PerfectScrollbar(element[0],options);var scrollbarLeftElement=element.children(".ps__rail-y").first();scrollbarLeftElement.css({left:0,right:"auto"}),scrollbarLeftElement.find(".ps__thumb-y").css({left:2,right:"auto"});}},showScrollBar:function showScrollBar(element){var options=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return "undefined"==typeof options.height&&(options.height=element.css("height")),element.slimScroll(options)},/**
* Register middle scroll hack for scrollbar libraries
* @param {jQuery} container
*/registerMiddleClickScroll:function registerMiddleClickScroll(container){var middleScroll=!1;container.on("mousedown",function(e){var clickedMouseButton=e.which;// get clicked button id
if(2==clickedMouseButton&&!1==middleScroll){middleScroll=!0;var mouseY=e.pageY,mouseX=e.pageX;$(document).on("mousemove",function(e){if(!0==middleScroll){$("body").addClass("u-cursor-scroll-all");var mouseMoveY=mouseY-e.pageY,// higher number = slower scroll
contentScrollY=container.scrollTop(),mouseMoveX=mouseX-e.pageX,contentScrollX=container.scrollLeft();container.scrollTop(contentScrollY-mouseMoveY-100),container.scrollLeft(contentScrollX-mouseMoveX-100);}});}}),container.on("mouseup",function(){$("body").removeClass("u-cursor-scroll-all"),middleScroll=!1;});},/**
* Function returns translated string
*/vtranslate:function vtranslate(key){return key in LANG?LANG[key]:key},/*
* Cache API on client-side
*/cacheNSKey:function cacheNSKey(key){// Namespace in client-storage
return "yf."+key},cacheGet:function cacheGet(key){return key=this.cacheNSKey(key),store.get(key)},cacheSet:function cacheSet(key,value){key=this.cacheNSKey(key),store.set(key,value);},cacheClear:function cacheClear(key){return key=this.cacheNSKey(key),store.remove(key)},moduleCacheSet:function moduleCacheSet(key,value){var orgKey=key;key=this.getModuleName()+"_"+key,this.cacheSet(key,value);var cacheKey="mCache"+this.getModuleName(),moduleCache=this.cacheGet(cacheKey);moduleCache=null==moduleCache?[]:moduleCache.split(","),moduleCache.push(orgKey),this.cacheSet(cacheKey,Vtiger_Helper_Js.unique(moduleCache).join(","));},moduleCacheGet:function moduleCacheGet(key){return this.cacheGet(this.getModuleName()+"_"+key)},moduleCacheKeys:function moduleCacheKeys(){var modules=this.cacheGet("mCache"+this.getModuleName());return modules?modules.split(","):[]},moduleCacheClear:function moduleCacheClear(){var thisInstance=this,moduleName=this.getModuleName(),cacheKey="mCache"+moduleName,moduleCache=this.cacheGet(cacheKey);moduleCache=null==moduleCache?[]:moduleCache.split(","),$.each(moduleCache,function(index,value){thisInstance.cacheClear(moduleName+"_"+value);}),thisInstance.cacheClear(cacheKey);},htmlEncode:function htmlEncode(value){return value?$("<div />").text(value).html():""},htmlDecode:function htmlDecode(value){return value?$("<div />").html(value).text():""},/**
* Function places an element at the center of the page
* @param <jQuery Element> element
*/placeAtCenter:function placeAtCenter(element){element.css("position","absolute"),element.css("top",($(window).height()-element.outerHeight())/2+$(window).scrollTop()+"px"),element.css("left",($(window).width()-element.outerWidth())/2+$(window).scrollLeft()+"px");},getvalidationEngineOptions:function getvalidationEngineOptions(){return Object.assign({},app.validationEngineOptions)},/**
* Function to notify UI page ready after AJAX changes.
* This can help in re-registering the event handlers (which was done during ready event).
*/notifyPostAjaxReady:function notifyPostAjaxReady(){$(document).trigger("postajaxready");},/**
* Listen to xready notiications.
*/listenPostAjaxReady:function listenPostAjaxReady(callback){$(document).on("postajaxready",callback);},/**
* Form function handlers
*/setFormValues:function setFormValues(kv){for(var k in kv)$(k).val(kv[k]);},/**
* Function returns the javascript controller based on the current view
*/getPageController:function getPageController(){if(window.pageController)return window.pageController;var moduleName=app.getModuleName(),view=app.getViewName(),parentModule=app.getParentModuleName(),moduleClassName=parentModule+"_"+moduleName+"_"+view+"_Js";"undefined"==typeof window[moduleClassName]&&(moduleClassName=parentModule+"_Vtiger_"+view+"_Js"),"undefined"==typeof window[moduleClassName]&&(moduleClassName=moduleName+"_"+view+"_Js");var extendModules=$("#extendModules").val();if("undefined"==typeof window[moduleClassName]&&null!=extendModules&&(moduleClassName=extendModules+"_"+view+"_Js"),"undefined"==typeof window[moduleClassName]&&(moduleClassName="Vtiger_"+view+"_Js"),"undefined"!=typeof window[moduleClassName]){if("function"==typeof window[moduleClassName])return window.pageController=new window[moduleClassName];if("object"===_typeof(window[moduleClassName]))return window.pageController=window[moduleClassName]}var moduleBaseClassName=parentModule+"_"+moduleName+"_Index_Js";if("undefined"!=typeof window[moduleBaseClassName]){if("function"==typeof window[moduleBaseClassName])return window.pageController=new window[moduleBaseClassName];if("object"===_typeof(window[moduleBaseClassName]))return window.pageController=window[moduleBaseClassName]}},/**
* Function to decode the encoded htmlentities values
*/getDecodedValue:function getDecodedValue(value){return $("<div></div>").html(value).text()},getCookie:function getCookie(c_name){var c_value=document.cookie,c_start=c_value.indexOf(" "+c_name+"=");if(-1===c_start&&(c_start=c_value.indexOf(c_name+"=")),-1===c_start)c_value=null;else {c_start=c_value.indexOf("=",c_start)+1;var c_end=c_value.indexOf(";",c_start);-1===c_end&&(c_end=c_value.length),c_value=unescape(c_value.substring(c_start,c_end));}return c_value},setCookie:function setCookie(c_name,value,exdays){var exdate=new Date;exdate.setDate(exdate.getDate()+exdays);var c_value=escape(value)+(null==exdays?"":"; expires="+exdate.toUTCString());document.cookie=c_name+"="+c_value;},getUrlVar:function getUrlVar(varName){return function getVar(){var vars={};return window.location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(m,key,value){vars[key]=value;}),vars}()[varName]},saveAjax:function saveAjax(mode,param,addToParams){var aDeferred=$.Deferred(),params={};if(params.module=app.getModuleName(),params.parent=app.getParentModuleName(),params.action="SaveAjax",mode&&(params.mode=mode),params.param=param,null!=addToParams)for(var i in addToParams)params[i]=addToParams[i];return AppConnector.request(params).done(function(data){aDeferred.resolve(data);}).fail(function(textStatus,errorThrown){aDeferred.reject(textStatus,errorThrown);}),aDeferred.promise()},/**
* Hack for Safari breaking down, when sending empty file input
* @param html
*/removeEmptyFilesInput:function removeEmptyFilesInput(form){for(var i=0;i<form.elements.length;i++)"file"===form.elements[i].type&&""===form.elements[i].value&&form.elements[i].parentNode.removeChild(form.elements[i]);},getMainParams:function getMainParams(param,json){if(param in CONFIG)return CONFIG[param];void 0===app.cacheParams[param]&&(app.cacheParams[param]=$("#"+param).val());var value=app.cacheParams[param];return json&&(value?value=JSON.parse(value):value=[]),value},setMainParams:function setMainParams(param,value){app.cacheParams[param]=value,$("#"+param).val(value);},errorLog:function errorLog(error,err,errorThrown){CONFIG.debug&&(console.warn("%cYetiForce debug mode!!!","color: red; font-family: sans-serif; font-size: 1.5em; font-weight: bolder; text-shadow: #000 1px 1px;"),"object"===_typeof(error)&&error.responseText&&(error=error.responseText),"object"===_typeof(error)&&error.statusText&&(error=error.statusText),error&&console.error(error),err&&"error"!==err&&console.error(err),errorThrown&&console.error(errorThrown));},registerQuickEditModal:function registerQuickEditModal(container){"undefined"==typeof container&&(container=$("body")),container.on("click",".js-quick-edit-modal",function(e){e.preventDefault();var element=$(this),data={module:element.data("module"),record:element.data("record"),removeFromUrl:"step"};element.data("values")&&$.extend(data,element.data("values")),$.each(["mandatoryFields","modalTitle","showLayout","editFields","picklistValues"],function(index,value){element.data(value)&&(data[value]=element.data(value));}),App.Components.QuickEdit.showModal(data,element);});},registerModal:function registerModal(container){"undefined"==typeof container&&(container=$("body")),container.off("click","button.showModal, a.showModal, .js-show-modal").on("click","button.showModal, a.showModal, .js-show-modal",function(e){e.preventDefault();var currentElement=$(e.currentTarget),url=currentElement.data("url");if("undefined"!=typeof url){currentElement.hasClass("js-popover-tooltip")&¤tElement.popover("hide"),currentElement.hasClass("disabledOnClick")&¤tElement.attr("disabled",!0);var modalWindowParams={url:url,cb:function cb(container){var call=currentElement.data("cb");if("undefined"!=typeof call)if(-1!==call.indexOf(".")){var callerArray=call.split(".");("object"===_typeof(window[callerArray[0]])||"function"==typeof window[callerArray[0]])&&window[callerArray[0]][callerArray[1]](container,e);}else "function"==typeof window[call]&&window[call](container,e);currentElement.removeAttr("disabled");}};currentElement.data("modalid")&&(modalWindowParams.id=currentElement.data("modalid")),app.showModalWindow(modalWindowParams);}e.stopPropagation();}),container.off("click",".js-show-modal-content").on("click",".js-show-modal-content",function(e){e.preventDefault();var currentElement=$(e.currentTarget),content=currentElement.data("content"),title="",modalClass="";currentElement.data("title")&&(title=currentElement.data("title")),currentElement.data("class")&&(modalClass=currentElement.data("class")),app.showModalHtml({class:modalClass,header:title,body:content}),e.stopPropagation();});},playSound:function playSound(action){var soundsConfig=app.getMainParams("sounds");if(soundsConfig.IS_ENABLED){var audio=new Audio(app.getMainParams("soundFilesPath")+soundsConfig[action]);audio.volume=.3,audio.play();}},registerIframeAndMoreContent:function registerIframeAndMoreContent(){var container=0<arguments.length&&arguments[0]!==void 0?arguments[0]:$(document);container.on("click",".js-more",function(e){e.preventDefault(),e.stopPropagation();var btn=$(e.currentTarget);app.showModalHtml({class:btn.data("modalSize")?btn.data("modalSize"):"modal-fullscreen",header:app.vtranslate("JS_FULL_TEXT"),headerIcon:"mdi mdi-overscan",bodyClass:"u-word-break pb-0 pt-1",footerButtons:[{text:app.vtranslate("JS_CANCEL"),icon:"fas fa-times",class:"btn-danger",data:{dismiss:"modal"}}],cb:function cb(modal){if(btn.data("iframe")){var iframe=btn.siblings("iframe"),message=iframe.clone();message[0].hasAttribute("srcdoctemp")&&message.attr("srcdoc",message.attr("srcdoctemp"));var isHidden=iframe.is(":hidden"),height=0;if(iframe.data("height"))height="full"===iframe.data("height")?$(window).height()-185:iframe.data("height");else {var _iframe$contents$heig;isHidden&&(message.css("display",""),iframe.css("display","")),height=null!==(_iframe$contents$heig=iframe.contents().height())&&void 0!==_iframe$contents$heig?_iframe$contents$heig:iframe.contents().find("body").height();}height&&message.height(height),isHidden&&iframe.css("display","none"),modal.find(".js-modal-content").html(message);}else modal.find(".js-modal-content").html(btn.closest(".js-more-content").find(".fullContent").html());}});});},registerIframeEvents:function registerIframeEvents(content){content.find(".js-iframe-full-height").each(function(){var iframe=$(this);iframe.on("load",function(){iframe.height(iframe.contents().find("body").height()+50);});}),content.find(".js-modal-iframe").each(function(){var iframe=$(this);iframe.on("load",function(){var height=iframe.contents().find("body").height();height&&height<iframe.height()&&iframe.height(height+50);});});},registerMenu:function registerMenu(){var self=this;self.keyboard={DOWN:40,ESCAPE:27,LEFT:37,RIGHT:39,SPACE:32,UP:38},self.sidebarBtn=$(".js-sidebar-btn").first(),self.sidebar=$(".js-sidebar").first(),self.sidebarBtn.on("click",self.toggleSidebar.bind(self)),$("a.nav-link,[tabindex],input,select,textarea,button").on("focus",function(e){self.sidebarBtn[0]==e.target||self.sidebar.find(e.target).length||(self.sidebar.find(":focus").length?self.openSidebar():self.sidebar.hasClass("js-expand")&&self.closeSidebar());}),self.sidebar.on("mouseenter",self.openSidebar.bind(self)).on("mouseleave",self.closeSidebar.bind(self)),self.sidebar.find(".js-menu__content").on("keydown",self.sidebarKeyboard.bind(self)),self.sidebar.on("keydown",function(e){e.which==self.keyboard.ESCAPE&&(self.closeSidebar(),self.sidebarBtn.is(":tabbable")?self.sidebarBtn.focus():$(":tabbable").eq(parseInt($(":tabbable").index(self.sidebar.find(":tabbable").last()))+1).focus());}),$(".js-submenu-toggler").on("click",function(e){$(e.currentTarget).hasClass("collapsed")||$(e.target).closest(".toggler").length||(window.location=$(e.currentTarget).attr("href"));}),self.registerPinEvent();},openSidebar:function openSidebar(){this.sidebar.addClass("js-expand"),this.sidebarBtn.attr("aria-expanded",!0);},closeSidebar:function closeSidebar(){this.sidebar.removeClass("js-expand"),this.sidebarBtn.attr("aria-expanded",!1);},toggleSidebar:function toggleSidebar(){this.sidebar.hasClass("js-expand")?this.closeSidebar():(this.openSidebar(),this.sidebar.find(".js-menu__content :tabbable").first().focus());},registerPinEvent:function registerPinEvent(){var self=this,pinButton=self.sidebar.find(".js-menu--pin"),baseContainer=self.sidebar.closest(".js-base-container");pinButton.on("click",function(){var hideMenu=0;baseContainer.removeClass("c-menu--animation"),"0"===pinButton.attr("data-show")?(hideMenu="on",pinButton.removeClass("u-opacity-muted"),baseContainer.addClass("c-menu--open"),self.sidebar.off("mouseleave mouseenter")):(pinButton.addClass("u-opacity-muted"),baseContainer.removeClass("c-menu--open"),self.sidebar.on("mouseenter",self.openSidebar.bind(self)).on("mouseleave",self.closeSidebar.bind(self)),self.closeSidebar.bind(self)),AppConnector.request({module:"Users",action:"SaveAjax",field:"leftpanelhide",record:CONFIG.userId,value:hideMenu}).done(function(responseData){responseData.success&&responseData.result&&pinButton.attr("data-show",hideMenu);}),setTimeout(function(){baseContainer.addClass("c-menu--animation");},300);});},sidebarKeyboard:function sidebarKeyboard(e){var target=$(e.target);if(e.which==this.keyboard.LEFT){if(target.hasClass("js-submenu-toggler")&&!target.hasClass("collapsed"))return target.click(),!1;var toggler=$(e.target).closest(".js-submenu").prev(".js-submenu-toggler");if(toggler.length&&!toggler.hasClass("collapsed"))return toggler.click().focus(),!1}else {if(target.hasClass("js-submenu-toggler")&&e.which==this.keyboard.RIGHT&&target.hasClass("collapsed")||target.hasClass("js-submenu-toggler")&&e.which==this.keyboard.SPACE)return target.click(),!1;if(e.which==this.keyboard.UP)return this.sidebar.find(".js-menu__content :tabbable").eq(parseInt(this.sidebar.find(".js-menu__content :tabbable").index(target))-1).focus(),!1;if(e.which==this.keyboard.DOWN)return this.sidebar.find(".js-menu__content :tabbable").eq(parseInt(this.sidebar.find(".js-menu__content :tabbable").index(target))+1).focus(),!1}},registerTabdrop:function registerTabdrop(){var tabs=$(".js-tabdrop");if(tabs.length){var tab=tabs.find("> li");tab.each(function(){$(this).removeClass("d-none");}),tabs.tabdrop({text:app.vtranslate("JS_MORE")});//change position to the last element (wcag keyboard navigation)
var dropdown=tabs.find("> li.dropdown");dropdown.appendTo(tabs),tab.on("click",function(){setTimeout(function(){$(window).trigger("resize");},500);}),$(window).trigger("resize");}},getScreenHeight:function getScreenHeight(percantage){return "undefined"==typeof percantage&&(percantage=100),$(window).height()*percantage/100},clearBrowsingHistory:function clearBrowsingHistory(){AppConnector.request({module:"Home",action:"BrowsingHistory"}).done(function(){$(".historyList").html("<a class=\"item dropdown-item\" href=\"#\" role=\"listitem\">".concat(app.vtranslate("JS_NO_RECORDS"),"</a>"));});},/**
* Open url in top window
* @param string url
*/openUrl:function openUrl(url){"parentIframe"===CONFIG.openUrlTarget?window.parent.location.href=url:window.location.href=url;},/**
* Convert url string to object
*
* @param {string} url example: index.php?module=LayoutEditor&parent=Settings
*/changeUrl:function changeUrl(params){var fullUrl="";if(params.data&&"undefined"!=typeof params.data.historyUrl&&(fullUrl=params.data.historyUrl),""===fullUrl?params.data?"string"==typeof params.data?fullUrl="index.php?"+params.data:fullUrl="index.php?"+$.param(params.data):"object"===_typeof(params)&&(fullUrl="index.php?"+$.param(params)):-1===fullUrl.indexOf("index.php?")&&(fullUrl="index.php?"+fullUrl),app.isWindowTop()&&history&&history.pushState&&""!==fullUrl){if(!history.state){var currentHref=window.location.href;history.replaceState(currentHref,"title 1",currentHref);}history.pushState(fullUrl,"title 2",fullUrl);}},/**
* Convert url string to object
*
* @param {string} url example: index.php?module=LayoutEditor&parent=Settings
*
* @return {object} urlObject
*/convertUrlToObject:function convertUrlToObject(url){var urlObject={};return -1!==url.indexOf("index.php?")&&(url=url.split("index.php?")[1]),url.split("&").forEach(function(el){if(el.includes("=")){var values=el.split("=");urlObject[values[0]]=values[1];}}),urlObject},/**
* Convert object to url string
*
* @param {object} urlData
* @param {string} entryFile
*
* @return {string} url
*/convertObjectToUrl:function convertObjectToUrl(){var urlData=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},entryFile=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"index.php?",url=entryFile;return Object.keys(urlData).forEach(function(key){var value=urlData[key];"object"===_typeof(value)||"string"==typeof value&&value.startsWith("<")||(!url.endsWith("&")&&!url.endsWith("?")&&(url+="&"),url+=key+"="+encodeURIComponent(value));}),url},formatToHourText:function formatToHourText(decTime){var type=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"short",withSeconds=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2],withMinutes=!(3<arguments.length&&void 0!==arguments[3])||arguments[3],short="short"===type,hour=Math.floor(decTime),min=Math.floor(60*(decTime-hour)),sec=Math.round(60*(60*(decTime-hour)-min)),result="";return hour&&(result+=short?hour+app.vtranslate("JS_H"):"".concat(hour," ")+app.vtranslate("JS_H_LONG")),(hour||min)&&withMinutes&&(result+=short?" ".concat(min)+app.vtranslate("JS_M"):" ".concat(min," ")+app.vtranslate("JS_M_LONG")),!1!==withSeconds&&(result+=short?" ".concat(sec)+app.vtranslate("JS_S"):" ".concat(sec," ")+app.vtranslate("JS_S_LONG")),hour||min||!1!==withSeconds||!withMinutes||(result+=short?"0"+app.vtranslate("JS_M"):"0 "+app.vtranslate("JS_M_LONG")),hour||min||!1!==withSeconds||withMinutes||(result+=short?"0"+app.vtranslate("JS_H"):"0 "+app.vtranslate("JS_H_LONG")),result.trim()},showRecordsList:function showRecordsList(params,cb,afterShowModal){"object"!==_typeof(params)||params.view||(params.view="RecordsList"),this.showRecordsListModal(params).done(function(modal){"function"==typeof afterShowModal&&afterShowModal(modal),app.registerModalController(!1,modal,cb);});},/**
* Show records list modal
* @param {object} params
* @returns {Promise}
*/showRecordsListModal:function showRecordsListModal(params){var aDeferred=$.Deferred();return AppConnector.request(params).done(function(requestData){app.showModalWindow(requestData,function(modal){aDeferred.resolve(modal);});}).fail(function(textStatus,errorThrown){aDeferred.reject(textStatus,errorThrown);}),aDeferred.promise()},/**
* Convert html content to base64 image
* This function can be used in promise chain or with callback if specified
*
* @param {HTMLElement} element
* @param {function} callback with imageString argument which contains an image in base64 string format
* @param {object} options see: https://html2canvas.hertzen.com/configuration , imageType is our custom option
* @return {Promise} with base64 string image as argument
*/htmlToImage:function htmlToImage(element,callback){var options=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{imageType:"image/png",logging:!1};element=$(element).get(0);// make sure we have HTMLElement not jQuery because it will not work
var imageType=options.imageType;return delete options.imageType,html2canvas(element,options).then(function(canvas){var base64Image=canvas.toDataURL(imageType);return "function"==typeof callback&&callback(base64Image),base64Image})},registerHtmlToImageDownloader:function registerHtmlToImageDownloader(container){var self=this;container.on("click",".js-download-html",function(){var element=$(this),fileName=element.data("fileName");self.htmlToImage($(element.data("html"))).then(function(img){$("<a href=\"".concat(img,"\" download=\"").concat(fileName,".png\"></a>")).get(0).click();});});},decodeHTML:function decodeHTML(html){var txt=document.createElement("textarea");return txt.innerHTML=html,txt.value},showAlert:function showAlert(text){return this.showNotify({title:text,type:"error",closer:!1,sticker:!1,destroy:!1,modules:new Map([].concat(_toConsumableArray(PNotify.defaultModules),[[PNotifyConfirm,{confirm:!0,buttons:[{text:app.vtranslate("JS_OK"),primary:!0,click:function click(notice){return notice.close()}}]}]])),stack:new PNotify.Stack({dir1:"down",modal:!0,firstpos1:25,overlayClose:!1})})},/**
* Show notify
* @param {object} customParams
* @returns {PNotify}
*/showNotify:function showNotify(customParams){var params={hide:!1},userParams=customParams,type="info";return "string"==typeof customParams&&(userParams={title:customParams}),"undefined"!=typeof customParams.type&&(type=customParams.type),"error"!==type&&(params.hide=!0),PNotify[type]($.extend(params,userParams))},/**
* Set Pnotify defaults options
*/setPnotifyDefaultOptions:function setPnotifyDefaultOptions(){// *Trusted option enables html as parameter's value
PNotify.defaults.textTrusted=!0,PNotify.defaults.titleTrusted=!0,PNotify.defaults.sticker=!1,PNotify.defaults.styling="bootstrap4",PNotify.defaults.icons="fontawesome5",PNotify.defaults.delay=3e3,PNotify.defaults.stack.maxOpen=10,PNotify.defaults.stack.spacing1=5,PNotify.defaults.stack.spacing2=5,PNotify.defaults.labels.close=app.vtranslate("JS_CLOSE"),PNotify.defaultModules.set(PNotifyBootstrap4,{}),PNotify.defaultModules.set(PNotifyFontAwesome5,{}),PNotify.defaultModules.set(PNotifyMobile,{});},/**
* Show confirm modal
* @param {object} params
* @returns {PNotify}
* @returns
*/showConfirmModal:function showConfirmModal(params){var confirmButtonLabel="JS_OK",rejectedButtonLabel="JS_CANCEL";return "undefined"!=typeof params.confirmButtonLabel&&(confirmButtonLabel=params.confirmButtonLabel),"undefined"!=typeof params.rejectedButtonLabel&&(rejectedButtonLabel=params.rejectedButtonLabel),this.showNotify($.extend({icon:"fas fa-question-circle",closer:!1,sticker:!1,destroy:!1,hide:!1,width:"auto",animateSpeed:"fast",addModalClass:"c-confirm-modal",modules:new Map([].concat(_toConsumableArray(PNotify.defaultModules),[[PNotifyConfirm,{confirm:!0,prompt:!!("showDialog"in params)&¶ms.showDialog,promptMultiLine:!!("multiLineDialog"in params)&¶ms.multiLineDialog,buttons:[{text:"<span class=\"fas fa-check mr-2\"></span>"+app.vtranslate(confirmButtonLabel),textTrusted:!0,primary:!0,promptTrigger:!0,click:function click(notice,value,e){params.showDialog&&!value||("undefined"!=typeof params.confirmedCallback&¶ms.confirmedCallback(notice,value,e),notice.close());}},{text:"<span class=\"fas fa-times mr-2\"></span>"+app.vtranslate(rejectedButtonLabel),textTrusted:!0,click:function click(notice){"undefined"!=typeof params.rejectedCallback&¶ms.rejectedCallback(notice),notice.close();}}]}]])),stack:new PNotify.Stack({dir1:"down",firstpos1:50,spacing1:0,push:"top",modal:!0,overlayClose:!1})},params))},registesterScrollbar:function registesterScrollbar(container){container.find(".js-scrollbar").each(function(){var element=$(this),scrollbarFnName=element.data("scrollbarFnName");"function"==typeof app[scrollbarFnName]?app[scrollbarFnName](element):app.showNewScrollbar(element);});},registerPopover:function registerPopover(){var container=0<arguments.length&&arguments[0]!==void 0?arguments[0]:$(document);window.popoverCache={},container.on("mousemove",function(e){app.mousePosition={x:e.pageX,y:e.pageY};}),container.on("mouseenter",".js-popover-tooltip, .js-popover-tooltip--record, .js-popover-tooltip--ellipsis, [data-field-type=\"reference\"], [data-field-type=\"multireference\"]",function(e){var currentTarget=$(e.currentTarget);currentTarget.hasClass("popover-triggered")||(currentTarget.hasClass("js-popover-tooltip--record")?(app.registerPopoverRecord(currentTarget,{},container),currentTarget.trigger("mouseenter")):!currentTarget.hasClass("js-popover-tooltip--record")&¤tTarget.data("field-type")?app.registerPopoverRecord(currentTarget.children("a"),{},container):!currentTarget.hasClass("js-popover-tooltip--record")&&!currentTarget.find(".js-popover-tooltip--record").length&&!currentTarget.data("field-type")&&(currentTarget.hasClass("js-popover-tooltip--ellipsis")?app.registerPopoverEllipsis({element:currentTarget,container:container}):app.showPopoverElementView(currentTarget),currentTarget.trigger("mouseenter")));});},/**
* Register auto format number value
*/registerFormatNumber:function registerFormatNumber(){$(document).on("focusout",".js-format-numer",function(e){$(e.currentTarget).formatNumber();});},/**
* Register toggle icon click event
* @param container
*/registerToggleIconClick:function registerToggleIconClick(container){container.on("click",".js-toggle-icon, .js-toggle-icon__container",function(e){var icon=$(e.target);icon.hasClass("js-toggle-icon__container")&&(icon=icon.find(".js-toggle-icon"));var iconData=icon.data();icon.toggleClass("".concat(iconData.active," ").concat(iconData.inactive)),e.stopPropagation();});},stripHtml:function stripHtml(html){var temporalDiv=document.createElement("div");return temporalDiv.innerHTML=html,temporalDiv.textContent||temporalDiv.innerText||""},registerShowHideBlock:function registerShowHideBlock(container){container.on("click",".js-hb__btn",function(e){$(e.currentTarget).closest(".js-hb__container").toggleClass("u-hidden-block__opened");}),container.find(".js-fab__container").on("clickoutside",function(e){$(e.currentTarget).removeClass("u-hidden-block__opened");});},processEvents:!1,registerAfterLoginEvents:function registerAfterLoginEvents(){if(!1===this.processEvents){var processEvents=$("#processEvents");if(0===processEvents.length)return;this.processEvents=JSON.parse(processEvents.val());}if(0!==this.processEvents.length){var event=this.processEvents.shift();switch(event.type){case"modal":AppConnector.request(event.url).done(function(requestData){app.showModalWindow(requestData).one("hidden.bs.modal",function(){app.registerAfterLoginEvents();});}).fail(function(_textStatus,errorThrown){app.showNotify({title:app.vtranslate("JS_ERROR"),textTrusted:!1,text:errorThrown,type:"error"});});break;case"notify":app.showNotify(event.notify),app.registerAfterLoginEvents();break;default:}}},/**
* Function to reload view after save event
*
* @param {object} responseData - Save responses data.
* @param {object} params - Save params.
* @param {jQuery} form - Jquery form container.
* @param {jQuery} element - Jquery trigger element.
*/reloadAfterSave:function reloadAfterSave(responseData,params,form,element){if(!responseData.skipReload){var moduleName=params.module,parentModuleName=app.getModuleName(),viewName=app.getViewName();if("List"===viewName||"Tiles"===viewName)moduleName===parentModuleName&&app.pageController.getListViewRecords();else if("Kanban"===viewName)app.pageController.loadKanban(!1);else if("Detail"===viewName)if(!(form&&app.getRecordId()===form.find("[name=\"record\"]").val())){var widget,block;responseData.result&&responseData.result._reload?window.location.reload():"showRelatedList"===app.getUrlVar("mode")?app.pageController.loadRelatedList():element&&(widget=element.closest(".widgetContentBlock"))&&0!==widget.length?app.pageController.loadWidget(widget):element&&(block=element.closest(".detailViewBlockLink"))&&0!==block.length?app.pageController.reloadDetailViewBlock(block):params&¶ms.data?window.location.reload():app.pageController.reloadTabContent();}else if(!1==responseData.result._isViewable)window===window.parent?window.location.href="index.php?module="+moduleName+"&view=List":window.parent.location.href="index.php?module="+moduleName+"&view=ListPreview";else if(params&¶ms.removeFromUrl){var searchParams=new URLSearchParams(window.location.search);searchParams.delete("step"),window.location.href="index.php?"+searchParams.toString();}else window.location.reload();}},/**
* Function to register the records events
* @param {jQuery} container - Jquery container.
*/registerRecordActionsEvents:function registerRecordActionsEvents(container){container.on("click",".js-action-confirm",function(event){event.stopPropagation();var target=$(this),sourceView=target.data("sourceView"),addBtnIcon=target.data("addBtnIcon"),params={icon:!1,title:target.data("content"),confirmedCallback:function confirmedCallback(){var progressIndicatorElement=$.progressIndicator({position:"html",blockInfo:{enabled:!0}}),url=target.data("url")+"&sourceView="+sourceView;AppConnector.request(url).done(function(data){progressIndicatorElement.progressIndicator({mode:"hide"}),data&&data.success?(data.result.notify&&app.showNotify(data.result.notify),"Href"===sourceView?app.openUrl(data.result):app.reloadAfterSave(data,app.convertUrlToObject(url),null,target)):app.showNotify({text:app.vtranslate(data.error.message),title:app.vtranslate("JS_LBL_PERMISSION"),type:"error"});});}};target.data("confirm")&&(params.text=target.data("confirm"),addBtnIcon=1),1==addBtnIcon&&(params.title=target.html()+(params.title?" "+params.title:"")),app.showConfirmModal(params);});},/**
* Register keyboard shortcuts events
* @param {jQuery} container
*/registerKeyboardShortcutsEvent:function registerKeyboardShortcutsEvent(){"Settings"!==app.getUrlVar("parent")&&document.addEventListener("keydown",function(event){CONFIG.isEntityModule&&event.shiftKey&&event.ctrlKey&&"KeyL"===event.code&&(window.location.href="index.php?module="+app.getModuleName()+"&view=List"),CONFIG.isQuickCreateSupported&&event.shiftKey&&event.ctrlKey&&"KeyQ"===event.code&&App.Components.QuickCreate.createRecord(app.getModuleName());});},/**
* Register POST action
* @param {jQuery} container
*/registerPostActionEvent:function registerPostActionEvent(container){container.on("click",".js-post-action",function(e){e.preventDefault();var element=$(this);element.attr("href")&&AppConnector.requestForm(element.attr("href"));});},/**
* Print data modal
* @param {jQuery} container
*/printModal:function printModal(container){var html=container.html().replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi," "),head=$("head").html().replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi," "),modal=window.open();modal.document.write("<head>".concat(head,"</head>")),modal.document.write("<body>".concat(html,"</body>")),modal.onafterprint=function(){modal.close();},setTimeout(function(){modal.print();},500);},/**
* Register print event
* @param {jQuery} container
*/registerPrintEvent:function registerPrintEvent(container){container.on("click",".js-print-container",function(){app.printModal($($(this).data("container")).children());});}};$(function(){Quasar.iconSet.set(Quasar.iconSet.mdiV3);var document=$(this);// Instantiate Page Controller
app.registerToggleIconClick(document),app.touchDevice=app.isTouchDevice(),app.setPnotifyDefaultOptions(),App.Fields.Picklist.changeSelectElementView(),app.registerPopoverEllipsisIcon(),app.registerPopover(),app.registerFormatNumber(),app.registerIframeAndMoreContent(),app.registerModal(),app.registerQuickEditModal(document),app.registerMenu(),app.registerTabdrop(),app.registerIframeEvents(document),app.registesterScrollbar(document),app.registerHtmlToImageDownloader(document),app.registerShowHideBlock(document),app.registerAfterLoginEvents(document),app.registerFormsEvents(document),app.registerRecordActionsEvents(document),app.registerPrintEvent(document),app.registerKeyboardShortcutsEvent(document),app.registerPostActionEvent(document),App.Components.QuickCreate.register(document),App.Components.Scrollbar.initPage(),App.Clipboard.register(document),String.prototype.toCamelCase=function(){var value=this.valueOf();return value.charAt(0).toUpperCase()+value.slice(1).toLowerCase()},(/MSIE/.test(navigator.userAgent)||/Trident/.test(navigator.userAgent))&&$("textarea").resizable(),app.pageController=app.getPageController(),app.pageController&&app.pageController.registerEvents();}),function($){// Case-insensitive :icontains expression
$.fn.getNumberFromValue=function(){return App.Fields.Double.formatToDb($(this).val())},$.fn.getNumberFromText=function(){return App.Fields.Double.formatToDb($(this).text())},$.fn.setValue=function(value,params){return App.Fields.Utils.setValue($(this),value,params)},$.fn.formatNumber=function(){var element=$(this);element.val(App.Fields.Double.formatToDisplay(App.Fields.Double.formatToDb(element.val()),!1));},$.fn.disable=function(){this.attr("disabled","disabled");},$.fn.enable=function(){this.removeAttr("disabled");},$.fn.serializeFormData=function(){for(var instance in CKEDITOR.instances)CKEDITOR.instances[instance].updateElement();var form=this,values=form.serializeArray(),data={};values&&$(values).each(function(k,v){var element=form.find("[name=\""+v.name+"\"]");element.is("select")&&null!=element.attr("multiple")?(null==data[v.name]&&(data[v.name]=[]),data[v.name].push(v.value)):data[v.name]=v.value;});// If data-type="autocomplete", pickup data-value="..." set
var autocompletes=$("[data-type=\"autocomplete\"]",$(this));return $(autocompletes).each(function(i){var ac=$(autocompletes[i]);data[ac.attr("name")]=ac.data("value");}),delete data._csrf,data},$.expr[":"].icontains=function(obj,index,meta){return -1!==(obj.textContent||obj.innerText||$(obj).text()||"").toLowerCase().indexOf(meta[3].toLowerCase())},$.fn.removeTextNode=function(){$(this).contents().filter(function(){return 3==this.nodeType;//Node.TEXT_NODE
}).remove();};}($);
//# sourceMappingURL=app.min.js.map