3 lines
61 KiB
JavaScript
3 lines
61 KiB
JavaScript
!function e(t,a,l){function i(o,r){if(!a[o]){if(!t[o]){var s="function"==typeof require&&require;if(!r&&s)return s(o,!0);if(n)return n(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=a[o]={exports:{}};t[o][0].call(u.exports,(function(e){return i(t[o][1][e]||e)}),u,u.exports,e,t,a,l)}return a[o].exports}for(var n="function"==typeof require&&require,o=0;o<l.length;o++)i(l[o]);return i}({1:[function(e,t,a){"use strict";var l=e("./lib");window.ClientAdapter=l.ClientAdapter},{"./lib":2}],2:[function(e,t,a){"use strict";var l;function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var a=0;a<t.length;a++){var l=t[a];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(e,l.key,l)}}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var a,l=u(e);if(t){var i=u(this).constructor;a=Reflect.construct(l,arguments,i)}else a=l.apply(this,arguments);return c(this,a)}}function c(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var d=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}(c,e);var t,a,l,i=s(c);function c(){return n(this,c),i.apply(this,arguments)}return t=c,(a=[{key:"getDataMapping",value:function(){return["id","name","details","address","contact_number"]}},{key:"getHeaders",value:function(){return[{sTitle:"ID",bVisible:!1},{sTitle:"Name"},{sTitle:"Details"},{sTitle:"Address"},{sTitle:"Contact Number"}]}},{key:"getFormFields",value:function(){return this.showSave?[["id",{label:"ID",type:"hidden"}],["name",{label:"Name",type:"text"}],["details",{label:"Details",type:"textarea",validation:"none"}],["address",{label:"Address",type:"textarea",validation:"none"}],["contact_number",{label:"Contact Number",type:"text",validation:"none"}],["contact_email",{label:"Contact Email",type:"text",validation:"none"}],["company_url",{label:"Company Url",type:"text",validation:"none"}],["status",{label:"Status",type:"select",source:[["Active","Active"],["Inactive","Inactive"]]}],["first_contact_date",{label:"First Contact Date",type:"date",validation:"none"}]]:[["id",{label:"ID",type:"hidden"}],["name",{label:"Name",type:"placeholder"}],["details",{label:"Details",type:"placeholder",validation:"none"}],["address",{label:"Address",type:"placeholder",validation:"none"}],["contact_number",{label:"Contact Number",type:"placeholder",validation:"none"}],["contact_email",{label:"Contact Email",type:"placeholder",validation:"none"}],["company_url",{label:"Company Url",type:"placeholder",validation:"none"}],["status",{label:"Status",type:"placeholder",source:[["Active","Active"],["Inactive","Inactive"]]}],["first_contact_date",{label:"First Contact Date",type:"placeholder",validation:"none"}]]}},{key:"getHelpLink",value:function(){return"http://blog.icehrm.com/docs/projects/"}}])&&o(t.prototype,a),l&&o(t,l),c}(((l=e("../../../api/AdapterBase"))&&l.__esModule?l:{default:l}).default);t.exports={ClientAdapter:d}},{"../../../api/AdapterBase":4}],3:[function(e,t,a){"use strict";function l(e,t){for(var a=0;a<t.length;a++){var l=t[a];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(e,l.key,l)}}Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var i=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,a,i;return t=e,(a=[{key:"getKey",value:function(e,t){var a="".concat(e,"|");for(var l in t)a+="".concat(l,"=").concat(t[l],"|");return a}},{key:"invalidateTable",value:function(e){for(var t,a=0;a<localStorage.length;a++)(t=localStorage.key(a)).indexOf("t=".concat(e))>0&&localStorage.removeItem(t)}},{key:"getData",value:function(e){var t;if("undefined"==typeof Storage)return null;var a=localStorage.getItem(e);return void 0!==a&&null!=a&&""!==a?void 0===(t=JSON.parse(a))||null==t||void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status?null:t:null}},{key:"setData",value:function(e,t){if("undefined"==typeof Storage)return null;if(void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status)return null;var a=JSON.stringify(t);return localStorage.setItem(e,a),a}}])&&l(t.prototype,a),i&&l(t,i),e}();a.default=i},{}],4:[function(e,t,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var l=n(e("./ModuleBase")),i=n(e("../api-common/RequestCache"));function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){for(var a=0;a<t.length;a++){var l=t[a];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(e,l.key,l)}}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var a,l=d(e);if(t){var i=d(this).constructor;a=Reflect.construct(l,arguments,i)}else a=l.apply(this,arguments);return u(this,a)}}function u(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var h=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(o,e);var t,a,l,n=c(o);function o(e,t,a,l){var i;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),(i=n.call(this)).moduleRelativeURL=null,i.tableData=[],i.sourceData=[],i.filter=null,i.origFilter=null,i.orderBy=null,i.currentElement=null,i.initAdapter(e,t,a,l),i}return t=o,(a=[{key:"initAdapter",value:function(e,t,a,l){this.moduleRelativeURL=baseUrl,this.table=e,this.tab=null==t?e:t,this.filter=null==a?null:a,this.origFilter=this.filter,this.orderBy=null==l?null:l,this.trackEvent("initAdapter",t),this.requestCache=new i.default}},{key:"setFilter",value:function(e){this.filter=e}},{key:"preSetFilterExternal",value:function(e){this.initialFilter=e}},{key:"setFilterExternal",value:function(e){var t=e;null==t&&(t=this.initialFilter),null!=t&&(this.setFilter(t),this.filtersAlreadySet=!0,$("#".concat(this.getTableName(),"_resetFilters")).show(),this.currentFilterString=this.getFilterString(t))}},{key:"getFilter",value:function(){return this.filter}},{key:"setOrderBy",value:function(e){this.orderBy=e}},{key:"getOrderBy",value:function(){return this.orderBy}},{key:"add",value:function(e,t,a,l){var i=this;null==a&&(a=!0),$(e).attr("a","add"),$(e).attr("t",this.table),i.showLoader(),this.requestCache.invalidateTable(this.table),$.post(this.moduleRelativeURL,e,(function(e){"SUCCESS"===e.status?i.addSuccessCallBack(t,e.object,a,l,i):i.addFailCallBack(t,e.object)}),"json").always((function(){i.hideLoader()})),this.trackEvent("add",this.tab,this.table)}},{key:"addSuccessCallBack",value:function(e,t,a,l,i){a&&this.get(e),this.initFieldMasterData(),null!=l&&l.apply(i,[t]),this.trackEvent("addSuccess",this.tab,this.table)}},{key:"addFailCallBack",value:function(e,t){try{this.closePlainMessage()}catch(e){}this.showMessage("Error saving",t),this.trackEvent("addFailed",this.tab,this.table)}},{key:"deleteObj",value:function(e,t){var a=this;a.showLoader(),this.requestCache.invalidateTable(this.table),$.post(this.moduleRelativeURL,{t:this.table,a:"delete",id:e},(function(e){"SUCCESS"===e.status?a.deleteSuccessCallBack(t,e.object):a.deleteFailCallBack(t,e.object)}),"json").always((function(){a.hideLoader()})),this.trackEvent("delete",this.tab,this.table)}},{key:"deleteSuccessCallBack",value:function(e,t){this.get(e),this.clearDeleteParams()}},{key:"deleteFailCallBack",value:function(e,t){this.clearDeleteParams(),this.showMessage("Error Occurred while Deleting Item",t)}},{key:"get",value:function(e){var t=this;if(this.getRemoteTable())return this.createTableServer(this.getTableName()),$("#".concat(this.getTableName(),"Form")).hide(),void $("#".concat(this.getTableName())).show();var a=JSON.stringify(this.getSourceMapping()),l="";null!==this.getFilter()&&(l=JSON.stringify(this.getFilter()));var i="";null!==this.getOrderBy()&&(i=this.getOrderBy()),a=this.fixJSON(a),l=this.fixJSON(l),t.showLoader(),$.post(this.moduleRelativeURL,{t:this.table,a:"get",sm:a,ft:l,ob:i},(function(a){"SUCCESS"===a.status?t.getSuccessCallBack(e,a.object):t.getFailCallBack(e,a.object)}),"json").always((function(){t.hideLoader()})),t.initFieldMasterData(),this.trackEvent("get",this.tab,this.table)}},{key:"getDataUrl",value:function(e){var t=JSON.stringify(this.getSourceMapping()),a=JSON.stringify(e),l="";null!==this.getFilter()&&(l=JSON.stringify(this.getFilter()));var i="";null!==this.getOrderBy()&&(i=this.getOrderBy());var n=this.moduleRelativeURL.replace("service.php","data.php");return n="".concat(n,"?t=").concat(this.table),n="".concat(n,"&sm=").concat(this.fixJSON(t)),n="".concat(n,"&cl=").concat(this.fixJSON(a)),n="".concat(n,"&ft=").concat(this.fixJSON(l)),n="".concat(n,"&ob=").concat(i),this.isSubProfileTable()&&(n="".concat(n,"&type=sub")),this.remoteTableSkipProfileRestriction()&&(n="".concat(n,"&skip=1")),n}},{key:"isSubProfileTable",value:function(){return!1}},{key:"remoteTableSkipProfileRestriction",value:function(){return!1}},{key:"preProcessTableData",value:function(e){return e}},{key:"getSuccessCallBack",value:function(e,t){for(var a=[],l=this.getDataMapping(),i=0;i<t.length;i++){for(var n=[],o=0;o<l.length;o++)n[o]=t[i][l[o]];a.push(this.preProcessTableData(n))}this.sourceData=t,void 0!==e.callBack&&null!==e.callBack&&(void 0!==e.callBackData&&null!==e.callBackData||(e.callBackData=[]),e.callBackData.push(t),e.callBackData.push(a),this.callFunction(e.callBack,e.callBackData)),this.tableData=a,void 0!==e.noRender&&null!==e.noRender&&!0===e.noRender||(this.createTable(this.getTableName()),$("#".concat(this.getTableName(),"Form")).hide(),$("#".concat(this.getTableName())).show())}},{key:"getFailCallBack",value:function(e,t){}},{key:"getElement",value:function(e,t,a){var l=this,i=JSON.stringify(this.getSourceMapping());i=this.fixJSON(i),l.showLoader(),$.post(this.moduleRelativeURL,{t:this.table,a:"getElement",id:e,sm:i},(function(e){"SUCCESS"===e.status?(a&&delete e.object.id,this.currentElement=e.object,l.getElementSuccessCallBack.apply(l,[t,e.object])):l.getElementFailCallBack.apply(l,[t,e.object])}),"json").always((function(){l.hideLoader()})),this.trackEvent("getElement",this.tab,this.table)}},{key:"getElementSuccessCallBack",value:function(e,t){void 0!==e.callBack&&null!==e.callBack&&(void 0!==e.callBackData&&null!==e.callBackData||(e.callBackData=[]),e.callBackData.push(t),this.callFunction(e.callBack,e.callBackData,this)),this.currentElement=t,void 0!==e.noRender&&null!==e.noRender&&!0===e.noRender||this.renderForm(t)}},{key:"getElementFailCallBack",value:function(e,t){}},{key:"getTableData",value:function(){return this.tableData}},{key:"getTableName",value:function(){return this.tab}},{key:"getFieldValues",value:function(e,t){var a=this,l="",i="";void 0!==e[3]&&null!==e[3]&&(l=e[3]),void 0!==e[4]&&null!==e[4]&&(i=JSON.stringify(e[4]));var n=this.requestCache.getKey(this.moduleRelativeURL,{t:e[0],key:e[1],value:e[2],method:l,methodParams:i,a:"getFieldValues"}),o=this.requestCache.getData(n);null!=o&&"SUCCESS"===o.status&&(t.callBackData.push(o.data),null!==t.callBackSuccess&&void 0!==t.callBackSuccess&&t.callBackData.push(t.callBackSuccess),a.callFunction(t.callBack,t.callBackData));var r=function e(l){if("SUCCESS"===l.status){a.requestCache.setData(this.success.key,l);var i=t;i.callBackData=[t.callBackData[0]],i.callBackData.push(l.data),null!==i.callBackSuccess&&void 0!==i.callBackSuccess&&i.callBackData.push(t.callBackSuccess),a.callFunction(i.callBack,i.callBackData)}else"Access violation"===l.message&&alert("Error : ".concat(e.table," ").concat(l.message))};r.key=n,r.table=e[0],$.post(this.moduleRelativeURL,{t:e[0],key:e[1],value:e[2],method:l,methodParams:i,a:"getFieldValues"},r,"json")}},{key:"setAdminProfile",value:function(e){try{localStorage.clear()}catch(e){}$.post(this.moduleRelativeURL,{a:"setAdminEmp",empid:e},(function(){top.location.href=clientUrl}),"json")}},{key:"customAction",value:function(e,t,a,l,i){var n=this;a=this.fixJSON(a),i?$.post(this.moduleRelativeURL,{t:this.table,a:"ca",sa:e,mod:t,req:a},(function(e){"SUCCESS"===e.status?(l.callBackData.push(e.data),n.callFunction(l.callBackSuccess,l.callBackData)):(l.callBackData.push(e.data),n.callFunction(l.callBackFail,l.callBackData))}),"json"):$.getJSON(this.moduleRelativeURL,{t:this.table,a:"ca",sa:e,mod:t,req:a},(function(e){"SUCCESS"===e.status?(l.callBackData.push(e.data),n.callFunction(l.callBackSuccess,l.callBackData)):(l.callBackData.push(e.data),n.callFunction(l.callBackFail,l.callBackData))}))}},{key:"sendCustomRequest",value:function(e,t,a,l){t.a=e,$.post(this.moduleRelativeURL,t,(function(e){"SUCCESS"===e.status?a(e.data):l(e.data)}),"json")}},{key:"getCustomActionUrl",value:function(e,t){t.a=e;var a="";for(var l in t)t.hasOwnProperty(l)&&(""!==a&&(a+="&"),a+="".concat(l,"=").concat(t[l]));return"".concat(this.moduleRelativeURL,"?").concat(a)}},{key:"getClientDataUrl",value:function(){return"".concat(this.moduleRelativeURL.replace("service.php",""),"data/")}},{key:"getCustomUrl",value:function(e){return this.moduleRelativeURL.replace("service.php",e)}}])&&r(t.prototype,a),l&&r(t,l),o}(l.default);a.default=h},{"../api-common/RequestCache":3,"./ModuleBase":6}],5:[function(e,t,a){"use strict";function l(e,t){for(var a=0;a<t.length;a++){var l=t[a];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(e,l.key,l)}}Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var i={float:function(e){return!(null==e||!e.match(/^[-+]?[0-9]+(\.[0-9]+)?$/))},number:function(e){return!(null==e||!e.match(/^[0-9]+$/))},numberOrEmpty:function(e){if(""===e)return!0;return!(null==e||!e.match(/^[0-9]+$/))},email:function(e){return null!=e&&/^\s*[\w\-+_]+(\.[\w\-+_]+)*@[\w\-+_]+\.[\w\-+_]+(\.[\w\-+_]+)*\s*$/.test(e)},emailOrEmpty:function(e){if(""===e)return!0;return null!=e&&/^\s*[\w\-+_]+(\.[\w\-+_]+)*@[\w\-+_]+\.[\w\-+_]+(\.[\w\-+_]+)*\s*$/.test(e)},username:function(e){return null!=e&&/^[a-zA-Z0-9.-]+$/.test(e)},input:function(e){return null!=e&&e.length>0}},n=function(){function e(t,a,l){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.tempOptions={},this.formId=t,this.formError=!1,this.formObject=null,this.errorMessages="",this.popupDialog=null,this.validateAll=a,this.errorMap=[],this.settings={thirdPartyPopup:null,LabelErrorClass:!1,ShowPopup:!0},this.settings=jQuery.extend(this.settings,l),this.inputTypes=["text","radio","checkbox","file","password","select-one","select-multi","textarea","fileupload","signature"],this.validator=i}var t,a,n;return t=e,a=[{key:"clearError",value:function(e,t){var a=e.attr("id");$("#".concat(this.formId," #field_").concat(a)).removeClass("error"),$("#".concat(this.formId," #help_").concat(a)).html("")}},{key:"addError",value:function(e,t){this.formError=!0,null!=e.attr("message")?(this.errorMessages+="".concat(e.attr("message"),"\n"),this.errorMap[e.attr("name")]=e.attr("message")):this.errorMap[e.attr("name")]="";var a=e.attr("id"),l=e.attr("validation"),i=e.attr("validation");$("#".concat(this.formId," #field_").concat(a)).addClass("error"),void 0===i||null==i||""===i?$("#".concat(this.formId," #help_err_").concat(a)).html(i):void 0===l||null==l||""===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Required"):"float"===l||"number"===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Number required"):"email"===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Email required"):$("#".concat(this.formId," #help_err_").concat(a)).html("Required")}},{key:"showErrors",value:function(){this.formError&&(void 0!==this.settings.thirdPartyPopup&&null!=this.settings.thirdPartyPopup?this.settings.thirdPartyPopup.alert():!0===this.settings.ShowPopup&&(void 0!==this.tempOptions.popupTop&&null!=this.tempOptions.popupTop?this.alert("Errors Found",this.errorMessages,this.tempOptions.popupTop):this.alert("Errors Found",this.errorMessages,-1)))}},{key:"checkValues",value:function(e){this.tempOptions=e;var t=this;this.formError=!1,this.errorMessages="",this.formObject={};var a=function(e){var a=null,l=e.attr("name");!1!==t.settings.LabelErrorClass&&$("label[for='".concat(l,"']")).removeClass(t.settings.LabelErrorClass);var i=e.attr("id"),n=e.attr("type");if(e.hasClass("select2-focusser")||e.hasClass("select2-input"))return!0;if(jQuery.inArray(n,t.inputTypes)>=0){if(e.hasClass("uploadInput"))a=e.attr("val");else if("radio"===n||"checkbox"===n)a=$("input[name='".concat(l,"']:checked")).val();else if(e.hasClass("select2Field"))a=null!=$("#".concat(t.formId," #").concat(i)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(i)).select2("data")?$("#".concat(t.formId," #").concat(i)).select2("data").id:"";else if(e.hasClass("select2Multi"))if(null!=$("#".concat(t.formId," #").concat(i)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(i)).select2("data")){var o=$("#".concat(t.formId," #").concat(i)).select2("data");a=[];for(var r=0;r<o.length;r++)a.push(o[r].id);a=JSON.stringify(a)}else a="";else a=e.hasClass("signatureField")?$("#".concat(t.formId," #").concat(i)).data("signaturePad").isEmpty()?"":$("#".concat(i)).data("signaturePad").toDataURL():e.hasClass("simplemde")?$("#".concat(t.formId," #").concat(i)).data("simplemde").value():e.hasClass("code")?$("#".concat(t.formId," #").concat(i)).data("codemirror").getValue():e.hasClass("tinymce")?tinyMCE.get(i).getContent({format:"raw"}):e.val();var s=e.attr("validation"),c=!1;void 0!==s&&null!=s&&void 0!==t.validator[s]&&null!=t.validator[s]?c=t.validator[s](a):(c=!t.validateAll||void 0!==s&&null!=s&&"none"===s||t.validator.input(a),t.formObject[i]=a),c?(t.clearError(e,null),t.formObject[i]=a):t.addError(e,null)}},l=$("#".concat(this.formId," :input"));return l.each((function(){a($(this))})),(l=$("#".concat(this.formId," .uploadInput"))).each((function(){a($(this))})),this.showErrors(),this.tempOptions={},!this.formError}},{key:"getFormParameters",value:function(){return this.formObject}},{key:"alert",value:function(e){function t(t,a){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e,t){alert(t)}))}],n=[{key:"getValidationRules",value:function(){return i}}],a&&l(t.prototype,a),n&&l(t,n),e}();a.default=n},{}],6:[function(e,t,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var l,i=(l=e("./FormValidation"))&&l.__esModule?l:{default:l};function n(e,t){for(var a=0;a<t.length;a++){var l=t[a];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(e,l.key,l)}}var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.deleteParams={},this.createRemoteTable=!1,this.instanceId="None",this.ga=[],this.showEdit=!0,this.showDelete=!0,this.showSave=!0,this.showCancel=!0,this.showFormOnPopup=!1,this.filtersAlreadySet=!1,this.currentFilterString="",this.sorting=0,this.settings={},this.translations={},this.customFields=[],this.csrfRequired=!1,this.fieldTemplates=null,this.templates=null,this.customTemplates=null,this.emailTemplates=null,this.fieldMasterData=null,this.fieldMasterDataKeys=null,this.fieldMasterDataCallback=null,this.sourceMapping=null,this.currentId=null,this.currentElement=null,this.user=null,this.currentProfile=null,this.permissions={},this.baseUrl=null}var t,a,l;return t=e,(a=[{key:"init",value:function(e,t,a,l){}},{key:"setNoJSONRequests",value:function(e){this.noJSONRequests=e}},{key:"setPermissions",value:function(e){this.permissions=e}},{key:"sortingStarted",value:function(e){this.sorting=e}},{key:"checkPermission",value:function(e){return void 0===this.permissions[e]||null==this.permissions[e]||"Yes"===this.permissions[e]?"Yes":this.permissions[e]}},{key:"setBaseUrl",value:function(e){this.baseUrl=e}},{key:"setUser",value:function(e){this.user=e}},{key:"getUser",value:function(){return this.user}},{key:"setInstanceId",value:function(e){this.instanceId=e}},{key:"setCSRFRequired",value:function(e){this.csrfRequired=e}},{key:"scrollToTop",value:function(){$("html, body").animate({scrollTop:0},"fast")}},{key:"scrollToBottom",value:function(){$("html, body").animate({scrollTop:$(document).height()},"slow")}},{key:"scrollToElement",value:function(e){$(window).height()<=e.offset().top&&$("html, body").animate({scrollTop:e.offset().top},"slow")}},{key:"scrollToElementBottom",value:function(e){$(window).height()<=e.offset().top+e.height()&&$("html, body").animate({scrollTop:e.offset().top+e.height()},"slow")}},{key:"setTranslations",value:function(e){this.translations=e.messages[""]}},{key:"setTranslationsSubModules",value:function(e){this.translations=e}},{key:"gt",value:function(e){return void 0===this.translations[e]||null===this.translations[e]?e:this.translations[e][0]}},{key:"addToLangTerms",value:function(e){var t,a=localStorage.getItem("terms");if(void 0===a)t={};else try{t=JSON.parse(a)}catch(e){t={}}void 0===this.translations[e]&&(t[e]=e,localStorage.setItem("terms",JSON.stringify(t)))}},{key:"showActionButtons",value:function(){return!0}},{key:"trackEvent",value:function(e,t,a){try{void 0===t||null==t?this.ga.push(["_trackEvent",this.instanceId,e]):void 0===a||null==a?this.ga.push(["_trackEvent",this.instanceId,e,t]):this.ga.push(["_trackEvent",this.instanceId,e,t,a])}catch(e){}}},{key:"setCurrentProfile",value:function(e){this.currentProfile=e}},{key:"getCurrentProfile",value:function(){return this.currentProfile}},{key:"initFieldMasterData",value:function(e,t,a){var l;void 0!==this.showAddNew&&null!=this.showAddNew||(this.showAddNew=!0),this.fieldMasterData={},this.fieldMasterDataKeys={},this.fieldMasterDataCallback=t,this.fieldMasterDataCallbackData=a,this.sourceMapping={};var i=this.getFormFields(),n=this.getFilters();if(null!=n)for(var o=0;o<n.length;o++)(null==(l=this.getMetaFieldValues(n[o][0],i))||"select"!==l.type&&"select2"!==l.type&&"select2multi"!==l.type)&&i.push(n[o]);for(var r=[],s=[],c=null,u=null,d=0;d<i.length;d++)if(void 0!==(c=i[d])[1]["remote-source"]&&null!==c[1]["remote-source"]){var h="".concat(c[1]["remote-source"][0],"_").concat(c[1]["remote-source"][1],"_").concat(c[1]["remote-source"][2]);r.push(c),s.push(h)}else if(void 0!==c[1].form&&null!==c[1].form)for(var f=0;f<c[1].form.length;f++)if(void 0!==(u=c[1].form[f])[1]["remote-source"]&&null!==u[1]["remote-source"]){var p="".concat(u[1]["remote-source"][0],"_").concat(u[1]["remote-source"][1],"_").concat(u[1]["remote-source"][2]);s.indexOf(p)<0&&(r.push(u),s.push(p))}for(var m=0;m<r.length;m++){var v=r[m];if(void 0!==v[1]["remote-source"]&&null!=v[1]["remote-source"]){var g="".concat(v[1]["remote-source"][0],"_").concat(v[1]["remote-source"][1],"_").concat(v[1]["remote-source"][2]);this.fieldMasterDataKeys[g]=!1,this.sourceMapping[v[0]]=v[1]["remote-source"];var y={callBack:"initFieldMasterDataResponse"};y.callBackData=[g],null!=e&&(y.callBackSuccess=e),this.getFieldValues(v[1]["remote-source"],y)}}}},{key:"setShowFormOnPopup",value:function(e){this.showFormOnPopup=e}},{key:"setRemoteTable",value:function(e){this.createRemoteTable=e}},{key:"setSettings",value:function(e){this.settings=e}},{key:"getRemoteTable",value:function(){return this.createRemoteTable}},{key:"isAllLoaded",value:function(e){for(var t in e)if(!1===e[t])return!1;return!0}},{key:"initFieldMasterDataResponse",value:function(e,t,a,l){this.fieldMasterData[e]=t,this.fieldMasterDataKeys[e]=!0,null!=a&&a(),null!==this.fieldMasterDataCallback&&void 0!==this.fieldMasterDataCallback&&this.isAllLoaded(this.fieldMasterDataKeys)&&null!==this.fieldMasterDataCallbackData&&void 0!==this.fieldMasterDataCallbackData?this.fieldMasterDataCallback(this.fieldMasterDataCallbackData):null!==this.fieldMasterDataCallback&&void 0!==this.fieldMasterDataCallback&&this.isAllLoaded(this.fieldMasterDataKeys)&&this.fieldMasterDataCallback()}},{key:"getMetaFieldValues",value:function(e,t){for(var a=0;a<t.length;a++)if(e===t[a][0])return t[a][1];return null}},{key:"getThemeColors",value:function(){return["red","yellow","aqua","blue","light-blue","green","navy","teal","olive","orange","fuchsia","purple"]}},{key:"getColorByRandomString",value:function(e){var t=this.getThemeColors();return t[e.charCodeAt(0)%t.length]}},{key:"getColorByFileType",value:function(e){e=e.toLowerCase();var t={pdf:"red",csv:"yellow",xls:"green",xlsx:"green",doc:"light-blue",docx:"light-blue"};return t.docx="blue",t.ppt="orange",t.pptx="orange",t.jpg="teal",t.jpeg="teal",t.gif="green",t.png="yellow",t.bmp="fuchsia",void 0!==t[e]||null!=t[e]?t[e]:this.getColorByRandomString(e)}},{key:"getIconByFileType",value:function(e){var t={pdf:"fa fa-file-pdf-o",csv:"fa fa fa-file-code-o",xls:"fa fa-file-excel-o",xlsx:"fa fa-file-excel-o",doc:"fa fa-file-word-o",docx:"fa fa-file-word-o",ppt:"fa fa-file-powerpoint-o",pptx:"fa fa-file-powerpoint-o",jpg:"fa fa-file-image-o",jpeg:"fa fa-file-image-o",gif:"fa fa-file-image-o",png:"fa fa-file-image-o",bmp:"fa fa-file-image-o",txt:"fa fa-file-text-o",rtf:"fa fa-file-text-o"};return void 0!==t[e=e.toLowerCase()]||null!=t[e]?t[e]:"fa fa-file-o"}},{key:"getSourceMapping",value:function(){return this.sourceMapping}},{key:"setTesting",value:function(e){this.testing=e}},{key:"consoleLog",value:function(e){this.testing&&console.log(e)}},{key:"setClientMessages",value:function(e){this.msgList=e}},{key:"setTemplates",value:function(e){this.templates=e}},{key:"getWSProperty",value:function(e,t){return e.hasOwnProperty(t)?e[t]:null}},{key:"getClientMessage",value:function(e){return this.getWSProperty(this.msgList,e)}},{key:"getTemplate",value:function(e){return this.getWSProperty(this.templates,e)}},{key:"setGoogleAnalytics",value:function(e){this.gaq=e}},{key:"showView",value:function(e){null!=this.currentView&&(this.previousView=this.currentView,$("#".concat(this.currentView)).hide()),$("#".concat(e)).show(),this.currentView=e,this.moveToTop()}},{key:"showPreviousView",value:function(){this.showView(this.previousView)}},{key:"moveToTop",value:function(){}},{key:"callFunction",value:function(e,t,a){if($.isFunction(e))try{null==a?e.apply(document,t):e.apply(a,t)}catch(e){console.log(e.message)}else{var l=this[e];if($.isFunction(l))try{l.apply(this,t)}catch(e){console.log(e.message)}}}},{key:"getTableTopButtonHtml",value:function(){var e="";return this.getShowAddNew()&&(e='<button onclick="modJs.renderForm();return false;" class="btn btn-small btn-primary">'.concat(this.gt(this.getAddNewLabel()),' <i class="fa fa-plus"></i></button>')),null!=this.getFilters()&&(""!==e&&(e+=" "),e+='<button onclick="modJs.showFilters();return false;" class="btn btn-small btn-primary">'.concat(this.gt("Filter"),' <i class="fa fa-filter"></i></button>'),e+=" ",this.filtersAlreadySet?e+='<button id="__id___resetFilters" onclick="modJs.resetFilters();return false;" class="btn btn-small btn-default">__filterString__ <i class="fa fa-times"></i></button>':e+='<button id="__id___resetFilters" onclick="modJs.resetFilters();return false;" class="btn btn-small btn-default" style="display:none;">__filterString__ <i class="fa fa-times"></i></button>'),e=e.replace(/__id__/g,this.getTableName()),""!==(e=""!==this.currentFilterString&&null!=this.currentFilterString?e.replace(/__filterString__/g,this.currentFilterString):e.replace(/__filterString__/g,"Reset Filters"))&&(e='<div class="row"><div class="col-xs-12">'.concat(e,"</div></div>")),e}},{key:"getActionButtonHeader",value:function(){return{sTitle:"",sClass:"center"}}},{key:"getTableHTMLTemplate",value:function(){return'<div class="box-body table-responsive"><table cellpadding="0" cellspacing="0" border="0" class="table table-bordered table-striped" id="grid"></table></div>'}},{key:"isSortable",value:function(){return!0}},{key:"createTable",value:function(e){if(this.getRemoteTable())this.createTableServer(e);else{var t=this.getHeaders();for(var a in t)t[a].sTitle=this.gt(t[a].sTitle);var l,i=this.getTableData();if(this.showActionButtons()&&t.push(this.getActionButtonHeader()),this.showActionButtons())for(var n=0;n<i.length;n++)i[n].push(this.getActionButtonsHtml(i[n][0],i[n]));l=this.getTableTopButtonHtml()+this.getTableHTMLTemplate();var o=$("#".concat(e," .dataTables_paginate .active a")).html(),r=0;void 0!==o&&null!=o&&(r=15*parseInt(o,10)-15),$("#".concat(e)).html(l);var s={oLanguage:{sLengthMenu:"_MENU_ records per page"},aaData:i,aoColumns:t,bSort:this.isSortable(),iDisplayLength:15,iDisplayStart:r},c=this.getCustomTableParams();$.extend(s,c),$("#".concat(e," #grid")).dataTable(s),$(".dataTables_paginate ul").addClass("pagination"),$(".dataTables_length").hide(),$(".dataTables_filter input").addClass("form-control"),$(".dataTables_filter input").attr("placeholder","Search"),$(".dataTables_filter label").contents().filter((function(){return 3===this.nodeType})).remove(),$(".tableActionButton").tooltip()}}},{key:"createTableServer",value:function(e){var t,a=this.getHeaders();for(var l in a.push({sTitle:"",sClass:"center"}),a)a[l].sTitle=this.gt(a[l].sTitle);t=this.getTableTopButtonHtml()+this.getTableHTMLTemplate();var i=$("#".concat(e," .dataTables_paginate .active a")).html(),n=0;void 0!==i&&null!=i&&(n=15*parseInt(i,10)-15),$("#".concat(e)).html(t);var o={oLanguage:{sLengthMenu:"_MENU_ records per page"},bProcessing:!0,bServerSide:!0,sAjaxSource:this.getDataUrl(this.getDataMapping()),aoColumns:a,bSort:this.isSortable(),parent:this,iDisplayLength:15,iDisplayStart:n};this.showActionButtons()&&(o.aoColumnDefs=[{fnRender:this.getActionButtons,aTargets:[this.getDataMapping().length]}]);var r=this.getCustomTableParams();$.extend(o,r),$("#".concat(e," #grid")).dataTable(o),$(".dataTables_paginate ul").addClass("pagination"),$(".dataTables_length").hide(),$(".dataTables_filter input").addClass("form-control"),$(".dataTables_filter input").attr("placeholder","Search"),$(".dataTables_filter label").contents().filter((function(){return 3===this.nodeType})).remove(),$(".tableActionButton").tooltip()}},{key:"getHeaders",value:function(){}},{key:"getDataMapping",value:function(){}},{key:"getFormFields",value:function(){}},{key:"getTableData",value:function(){}},{key:"getFilters",value:function(){return null}},{key:"edit",value:function(e){this.currentId=e,this.getElement(e,[])}},{key:"copyRow",value:function(e){this.getElement(e,[],!0)}},{key:"renderModel",value:function(e,t,a){$("#".concat(e,"ModelBody")).html(""),void 0!==a&&null!=a||(a=""),$("#".concat(e,"ModelLabel")).html(t),$("#".concat(e,"ModelBody")).html(a)}},{key:"renderYesNoModel",value:function(e,t,a,l,i,n){var o=this,r="#yesnoModel";void 0!==t&&null!=t||(t=""),$("".concat(r,"Label")).html(e),$("".concat(r,"Body")).html(t),null!=a&&$("".concat(r,"YesBtn")).html(a),null!=l&&$("".concat(r,"NoBtn")).html(l),$("".concat(r,"YesBtn")).off().on("click",(function(){void 0!==i&&null!=i&&(i.apply(o,n),o.cancelYesno())})),$(r).modal({backdrop:"static"})}},{key:"renderModelFromDom",value:function(e,t,a){$("#".concat(e,"ModelBody")).html(""),void 0!==a&&null!=a||(a=$("<div></div>")),$("#".concat(e,"ModelLabel")).html(t),$("#".concat(e,"ModelBody")).html(""),$("#".concat(e,"ModelBody")).append(a)}},{key:"deleteRow",value:function(e){this.deleteParams.id=e,this.renderModel("delete","Confirm Deletion","Are you sure you want to delete this item ?"),$("#deleteModel").modal("show")}},{key:"showMessage",value:function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],n=this,o="";o=i?"#plainMessageModel":"#messageModel",$(o).off(),i?this.renderModel("plainMessage",e,t):this.renderModel("message",e,t),null!=a?($(o).modal({show:!0}),$(o).on("hidden.bs.modal",(function(){a.apply(n,l),$(".modal-backdrop").remove()}))):$(o).modal({backdrop:"static"})}},{key:"showDomElement",value:function(e,t,a,l,i){var n=this,o="";o=i?"#dataMessageModel":"#messageModel",$(o).unbind("hide"),i?this.renderModelFromDom("dataMessage",e,t):this.renderModelFromDom("message",e,t),null!=a?($(o).modal({show:!0}),$(o).on("hidden.bs.modal",(function(){a.apply(n,l),$(".modal-backdrop").remove()}))):$(o).modal({backdrop:"static"})}},{key:"confirmDelete",value:function(){void 0===this.deleteParams.id&&null==this.deleteParams.id||this.deleteObj(this.deleteParams.id,[]),$("#deleteModel").modal("hide")}},{key:"cancelDelete",value:function(){$("#deleteModel").modal("hide"),this.deleteParams.id=null}},{key:"closeMessage",value:function(){$("#messageModel").modal("hide")}},{key:"cancelYesno",value:function(){$("#yesnoModel").modal("hide")}},{key:"closePlainMessage",value:function(){$("#plainMessageModel").modal("hide"),$("#dataMessageModel").modal("hide")}},{key:"closeDataMessage",value:function(){$("#dataMessageModel").modal("hide")}},{key:"save",value:function(e,t){var a=new i.default("".concat(this.getTableName(),"_submit"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(a.checkValues()){var l=a.getFormParameters();l=this.forceInjectValuesBeforeSave(l);var n=this.doCustomValidation(l);if(null==n){this.csrfRequired&&(l.csrf=$("#".concat(this.getTableName(),"Form")).data("csrf"));var o=$("#".concat(this.getTableName(),"_submit #id")).val();null!=o&&void 0!==o&&""!==o&&(l.id=o),l=this.makeEmptyDateFieldsNull(l),this.add(l,[],e,t)}else $("#".concat(this.getTableName(),"Form .label")).html(n),$("#".concat(this.getTableName(),"Form .label")).show(),this.scrollToTop()}}},{key:"makeEmptyDateFieldsNull",value:function(e){return this.getFormFields().forEach((function(t){"date"!==t[1].type&&"datetime"!==t[1].type||""!==e[t[0]]&&"0000-00-00"!==e[t[0]]&&"0000-00-00 00:00:00"!==e[t[0]]||("none"===t[1].validation?e[t[0]]="NULL":delete e[t[0]])})),e}},{key:"validatePassword",value:function(e){return e.length<8?this.gt("Password too short"):e.length>20?this.gt("Password too long"):e.match(/.*[0-9]+.*$/)?e.match(/.*[a-z]+.*$/)?e.match(/.*[A-Z]+.*$/)?e.match(/.*[\W]+.*$/)?null:this.gt("Password must include at least one symbol"):this.gt("Password must include at least one uppercase letter"):this.gt("Password must include at least one lowercase letter"):this.gt("Password must include at least one number")}},{key:"forceInjectValuesBeforeSave",value:function(e){return e}},{key:"doCustomValidation",value:function(e){return null}},{key:"filterQuery",value:function(){var e=new i.default("".concat(this.getTableName(),"_filter"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(e.checkValues()){var t=e.getFormParameters();if(this.doCustomFilterValidation(t)){for(var a in t)t.hasOwnProperty(a)&&"NULL"===t[a]&&delete t[a];this.setFilter(t),this.filtersAlreadySet=!0,$("#".concat(this.getTableName(),"_resetFilters")).show(),this.currentFilterString=this.getFilterString(t),this.get([]),this.closePlainMessage()}}}},{key:"getFilterString",value:function(e){var t,a,l,i,n,o,r="",s=this.getFilters();for(var c in null==l&&(l=[]),e)if(e.hasOwnProperty(c)){if(n="",o=null,"select"===(l=this.getMetaFieldValues(c,s)).type||"select2"===l.type){if(void 0!==l["remote-source"]&&null!=l["remote-source"])t=l["remote-source"],"NULL"===e[c]?n=void 0!==l["null-label"]&&null!=l["null-label"]?l["null-label"]:"Not Selected":o=n=this.fieldMasterData["".concat(t[0],"_").concat(t[1],"_").concat(t[2])][e[c]];else if(a=l.source[0],"NULL"===e[c])n=void 0!==l["null-label"]&&null!=l["null-label"]?l["null-label"]:"Not Selected";else for(var u=0;u<a.length;u++)if(e[c]===l.source[u][0]){o=n=l.source[u][1];break}}else if("select2multi"===l.type){i=[];try{i=JSON.parse(e[c])}catch(e){}""!==(n=i.join(","))&&(o=n)}else""!==(n=e[c])&&(o=n);null!=o&&(""!==r&&(r+=" | "),r+="".concat(l.label," = ").concat(n))}return r}},{key:"doCustomFilterValidation",value:function(e){return!0}},{key:"resetFilters",value:function(){this.filter=this.origFilter,this.filtersAlreadySet=!1,$("#".concat(this.getTableName(),"_resetFilters")).hide(),this.currentFilterString="",this.get([])}},{key:"showFilters",value:function(e){for(var t=this.templates.filterTemplate,a="",l=this.getFilters(),i=0;i<l.length;i++){var n=this.getMetaFieldForRendering(l[i][0]);if(""===n||void 0===n)a+=this.renderFormField(l[i]);else{var o=e[n];""!==o&&null!=o&&void 0!==o&&""!==o.trim()?a+=this.renderFormField(JSON.parse(o)):a+=this.renderFormField(l[i])}}t=(t=t.replace(/_id_/g,"".concat(this.getTableName(),"_filter"))).replace(/_fields_/g,a);var r=this.generateRandom(14),s=$('<div class="reviewBlock popupForm" data-content="Form"></div>');s.attr("id",r),s.html(t),s.find(".datefield").datepicker({viewMode:2}),s.find(".timefield").datetimepicker({language:"en",pickDate:!1}),s.find(".datetimefield").datetimepicker({language:"en"}),s.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(s.attr("id")," .tinymce"),height:"400"}),s.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)})),s.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),s.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),a=t.find(".select2-choices").height();t.height(parseInt(a,10))}))})),this.showDomElement("Edit",s,null,null,!0),$(".filterBtn").off(),$(".filterBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.filterQuery()}catch(e){}return!1})),void 0!==this.filter&&null!=this.filter&&""!==this.filter&&this.fillForm(this.filter,"#".concat(this.getTableName(),"_filter"),this.getFilters())}},{key:"preRenderForm",value:function(e){}},{key:"renderForm",value:function(e){var t=[];null!=e&&void 0!==e||(this.currentId=null),this.preRenderForm(e);for(var a,l=this.templates.formTemplate,i="",n=this.getFormFields(),o=0;o<n.length;o++){var r=this.getMetaFieldForRendering(n[o][0]);if(""===r||void 0===r)i+=this.renderFormField(n[o]);else{var s=e[r];""!==s&&null!=s&&void 0!==s&&""!==s.trim()?i+=this.renderFormField(JSON.parse(s)):i+=this.renderFormField(n[o])}}l=(l=l.replace(/_id_/g,"".concat(this.getTableName(),"_submit"))).replace(/_fields_/g,i);var c=this.generateRandom(14);this.showFormOnPopup?(a=$('<div class="reviewBlock popupForm" data-content="Form"></div>')).attr("id",c):a=$("#".concat(this.getTableName(),"Form")),a.html(l),a.find(".datefield").datepicker({viewMode:2}),a.find(".timefield").datetimepicker({language:"en",pickDate:!1}),a.find(".datetimefield").datetimepicker({language:"en"}),a.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(a.attr("id")," .tinymce"),height:"400"}),a.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)}));var u=this.codeMirror;u&&a.find(".code").each((function(){var e=u.fromTextArea($(this)[0],{lineNumbers:!1,matchBrackets:!0,continueComments:"Enter",extraKeys:{"Ctrl-Q":"toggleComment"}});$(this).data("codemirror",e)})),a.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),a.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),a=t.find(".select2-choices").height();t.height(parseInt(a,10))}))})),a.find(".signatureField").each((function(){t.push($(this).attr("id"))}));for(var d=0;d<n.length;d++)"datagroup"===n[d][1].type&&a.find("#".concat(n[d][0])).data("field",n[d]);if(!1===this.showSave?a.find(".saveBtn").remove():(a.find(".saveBtn").off(),a.find(".saveBtn").data("modJs",this),a.find(".saveBtn").on("click",(function(){return null!=$(this).data("modJs").saveSuccessItemCallback&&void 0!==$(this).data("modJs").saveSuccessItemCallback?$(this).data("modJs").save($(this).data("modJs").retriveItemsAfterSave(),$(this).data("modJs").saveSuccessItemCallback):$(this).data("modJs").save(),!1}))),!1===this.showCancel?a.find(".cancelBtn").remove():(a.find(".cancelBtn").off(),a.find(".cancelBtn").data("modJs",this),a.find(".cancelBtn").on("click",(function(){return $(this).data("modJs").cancel(),!1}))),a.find("[mask]").each((function(){$(this).inputmask($(this).attr("mask"))})),a.find("[datemask]").each((function(){$(this).inputmask({mask:"y-1-2",placeholder:"YYYY-MM-DD",leapday:"-02-29",separator:"-",alias:"yyyy/mm/dd"})})),a.find("[datetimemask]").each((function(){$(this).inputmask("datetime",{mask:"y-2-1 h:s:00",placeholder:"YYYY-MM-DD hh:mm:ss",leapday:"-02-29",separator:"-",alias:"yyyy/mm/dd"})})),this.showFormOnPopup){this.showMessage("Edit","",null,null,!0),$("#plainMessageModel .modal-body").html(""),$("#plainMessageModel .modal-body").append(a);for(var h=0;h<t.length;h++)$("#".concat(t[h])).data("signaturePad",new SignaturePad(document.getElementById(t[h])));void 0!==e&&null!=e?this.fillForm(e,"#".concat(c)):this.setDefaultValues("#".concat(c))}else{$("#".concat(this.getTableName(),"Form")).show(),$("#".concat(this.getTableName())).hide();for(var f=0;f<t.length;f++)$("#".concat(t[f])).data("signaturePad",new SignaturePad(document.getElementById(t[f])));void 0!==e&&null!=e?this.fillForm(e):this.setDefaultValues(),this.scrollToTop()}this.postRenderForm(e,a)}},{key:"setDefaultValues",value:function(e,t){null!=t&&void 0!==t||(t=this.getFormFields()),null!=e&&void 0!==e&&""!==e||(e="#".concat(this.getTableName(),"Form"));for(var a=0;a<t.length;a++)"text"!==t[a][1].type&&"textarea"!==t[a][1].type||void 0!==t[a][1].default&&null!==t[a][1].default&&$("".concat(e," #").concat(t[a][0])).val(t[a][1].default)}},{key:"retriveItemsAfterSave",value:function(){return!0}},{key:"postRenderForm",value:function(e,t){}},{key:"dataGroupToHtml",value:function(e,t){var a,l,i,n,o=JSON.parse(e),r=t[1].html;null!=o&&void 0!==o&&void 0!==t[1]["sort-function"]&&null!=t[1]["sort-function"]&&o.sort(t[1]["sort-function"]);for(var s=$('<div id="'.concat(t[0],'_div_inner"></div>')),c=0;c<o.length;c++){for(var u in l=o[c],void 0!==t[1]["pre-format-function"]&&null!=t[1]["pre-format-function"]&&(l=t[1]["pre-format-function"].apply(this,[l])),a=(a=(a=(a=r).replace("#_delete_#",'<a id="#_id_#_delete" onclick="modJs.deleteDataGroupItem(\'#_id_#\');return false;" type="button" style="float:right;margin-right:3px;" tooltip="Delete"><li class="fa fa-times"></li></a>')).replace("#_edit_#",'<a id="#_id_#_edit" onclick="modJs.editDataGroupItem(\'#_id_#\');return false;" type="button" style="float:right;margin-right:5px;" tooltip="Edit"><li class="fa fa-edit"></li></a>')).replace(/#_id_#/g,l.id),l)void 0!==(n=l[u])&&null!=n&&"string"==typeof n&&(n=n.replace(/(?:\r\n|\r|\n)/g,"<br />")),a=a.replace("#_".concat(u,"_#"),n);void 0!==t[1].render&&null!=t[1].render&&(a=a.replace("#_renderFunction_#",t[1].render(l))),(i=$(a)).attr("fieldId","".concat(t[0],"_div")),s.append(i)}return s}},{key:"resetDataGroup",value:function(e){$("#".concat(e[0])).val(""),$("#".concat(e[0],"_div")).html("")}},{key:"showDataGroup",value:function(e,t){var a=this.templates.datagroupTemplate,l="",i=e[1].form;void 0!==t&&null!=t&&void 0!==t.id?this.currentDataGroupItemId=t.id:this.currentDataGroupItemId=null;for(var n=0;n<i.length;n++)l+=this.renderFormField(i[n]);a=(a=a.replace(/_id_/g,"".concat(this.getTableName(),"_field_").concat(e[0]))).replace(/_fields_/g,l);var o=this.generateRandom(14),r=$('<div class="reviewBlock popupForm" data-content="Form"></div>');r.attr("id",o),r.html(a),r.find(".datefield").datepicker({viewMode:2}),r.find(".timefield").datetimepicker({language:"en",pickDate:!1}),r.find(".datetimefield").datetimepicker({language:"en"}),r.find(".colorpick").colorpicker(),tinymce.init({selector:"#".concat(r.attr("id")," .tinymce"),height:"400"}),r.find(".simplemde").each((function(){var e=new SimpleMDE({element:$(this)[0]});$(this).data("simplemde",e)})),r.find(".select2Field").each((function(){$(this).select2().select2("val",$(this).find("option:eq(0)").val())})),r.find(".select2Multi").each((function(){$(this).select2().on("change",(function(e){var t=$(this).parents(".row"),a=t.find(".select2-choices").height();t.height(parseInt(a,10))}))})),this.currentDataGroupField=e,this.showDomElement("Add ".concat(e[1].label),r,null,null,!0),void 0!==t&&null!=t?this.fillForm(t,"#".concat(this.getTableName(),"_field_").concat(e[0]),e[1].form):this.setDefaultValues("#".concat(this.getTableName(),"_field_").concat(e[0]),e[1].form),$(".groupAddBtn").off(),void 0!==t&&null!=t&&void 0!==t.id?$(".groupAddBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.editDataGroup()}catch(e){console.log("Error editing data group: ".concat(e.message))}return!1})):$(".groupAddBtn").on("click",(function(e){e.preventDefault(),e.stopPropagation();try{modJs.addDataGroup()}catch(e){console.log("Error adding data group: ".concat(e.message))}return!1}))}},{key:"addDataGroup",value:function(){var e,t=this.currentDataGroupField;$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).html(""),$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).hide();var a=new i.default("".concat(this.getTableName(),"_field_").concat(t[0]),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(a.checkValues()){var l=a.getFormParameters();if(void 0!==t[1]["custom-validate-function"]&&null!=t[1]["custom-validate-function"]){if(!(e=t[1]["custom-validate-function"].apply(this,[l])).valid)return $("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).html(e.message),$("#".concat(this.getTableName(),"_field_").concat(t[0],"_error")).show(),!1;l=e.params}var n=$("#".concat(t[0])).val();""===n&&(n="[]");var o=JSON.parse(n);l.id="".concat(t[0],"_").concat(this.dataGroupGetNextAutoIncrementId(o)),o.push(l),void 0!==t[1]["sort-function"]&&null!=t[1]["sort-function"]&&o.sort(t[1]["sort-function"]),n=JSON.stringify(o);var r=this.dataGroupToHtml(n,t);$("#".concat(t[0],"_div")).html(""),$("#".concat(t[0],"_div")).append(r),this.makeDataGroupSortable(t,$("#".concat(t[0],"_div_inner"))),$("#".concat(t[0])).val(n),this.orderDataGroup(t),this.closeDataMessage(),this.showMessage("Item Added","This change will be effective only when you save the form")}return!0}},{key:"nl2br",value:function(e,t){var a="";try{for(var l=e.split(" "),i=0,n=0;n<l.length;n++)(i+=l[n].length+1)>t?(a+="".concat(l[n],"<br/>"),i=0):a+="".concat(l[n]," ")}catch(e){}return a}},{key:"makeDataGroupSortable",value:function(e,t){t.data("field",e),t.data("firstSort",!0),t.sortable({create:function(){$(this).height($(this).height())},"ui-floating":!1,start:function(e,t){$("#sortable-ul-selector-id").sortable({sort:function(e,t){var a=$(e.target);if(!/html|body/i.test(a.offsetParent()[0].tagName)){var l=e.pageY-a.offsetParent().offset().top-t.helper.outerHeight(!0)/2;t.helper.css({top:"".concat(l,"px")})}}})},revert:!0,stop:function(){modJs.orderDataGroup($(this).data("field"))},axis:"y",scroll:!1,placeholder:"sortable-placeholder",cursor:"move"})}},{key:"orderDataGroup",value:function(e){var t,a=[],l=$("#".concat(e[0],"_div_inner [fieldid='").concat(e[0],"_div']")),i=$("#".concat(e[0])).val();""===i&&(i="[]");var n=JSON.parse(i);l.each((function(){for(var e in t=$(this).attr("id"),n)if(n[e].id===t){a.push(n[e]);break}})),$("#".concat(e[0])).val(JSON.stringify(a))}},{key:"editDataGroup",value:function(){var e=this.currentDataGroupField,t=this.currentDataGroupItemId,a=new i.default("".concat(this.getTableName(),"_field_").concat(e[0]),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(a.checkValues()){var l=a.getFormParameters();if(void 0!==e[1]["custom-validate-function"]&&null!=e[1]["custom-validate-function"]){var n=e[1]["custom-validate-function"].apply(this,[l]);if(!n.valid)return $("#".concat(this.getTableName(),"_field_").concat(e[0],"_error")).html(n.message),$("#".concat(this.getTableName(),"_field_").concat(e[0],"_error")).show(),!1;l=n.params}if(this.doCustomFilterValidation(l)){var o=$("#".concat(e[0])).val();""===o&&(o="[]");for(var r=JSON.parse(o),s={},c=-1,u=[],d=0;d<r.length;d++){var h=r[d];h.id===t&&(s=h,c=d),u.push(h)}l.id=s.id,u[c]=l,void 0!==e[1]["sort-function"]&&null!=e[1]["sort-function"]&&u.sort(e[1]["sort-function"]),o=JSON.stringify(u),$("#".concat(e[0])).val(o);var f=this.dataGroupToHtml(o,e);this.orderDataGroup(e),$("#".concat(e[0],"_div")).html(""),$("#".concat(e[0],"_div")).append(f),this.makeDataGroupSortable(e,$("#".concat(e[0],"_div_inner"))),this.closeDataMessage(),this.showMessage("Item Edited","This change will be effective only when you save the form")}}return!0}},{key:"editDataGroupItem",value:function(e){for(var t=e.substring(0,e.lastIndexOf("_")),a=$("#".concat(t)).val(),l=JSON.parse(a),i={},n=0;n<l.length;n++){var o=l[n];o.id===e&&(i=o)}this.showDataGroup($("#".concat(t)).data("field"),i)}},{key:"dataGroupGetNextAutoIncrementId",value:function(e){for(var t,a=1,l=0;l<e.length;l++){var i=e[l];void 0!==i.id&&null!=i.id||(i.id=1),(t=i.id.substring(i.id.lastIndexOf("_")+1,i.id.length))>=a&&(a=parseInt(t,10)+1)}return a}},{key:"deleteDataGroupItem",value:function(e){for(var t=e.substring(0,e.lastIndexOf("_")),a=$("#".concat(t)).val(),l=JSON.parse(a),i=[],n=0;n<l.length;n++){var o=l[n];o.id!==e&&i.push(o)}$("#".concat(t)).val(JSON.stringify(i)),$("#".concat(e)).remove(),this.showMessage("Item Removed","Item removed. This change will be effective only when you save the form")}},{key:"fillForm",value:function(e,t,a){var l;null!=a&&void 0!==a||(a=this.getFormFields()),null!=t&&void 0!==t&&""!==t||(t="#".concat(this.getTableName(),"Form"));for(var i=0;i<a.length;i++)if("date"===a[i][1].type)"0000-00-00"!==e[a[i][0]]&&""!==e[a[i][0]]&&null!=e[a[i][0]]&&void 0!==e[a[i][0]]&&$("".concat(t," #").concat(a[i][0],"_date")).datepicker("setValue",e[a[i][0]]);else if("colorpick"===a[i][1].type)null!=e[a[i][0]]&&void 0!==e[a[i][0]]&&($("".concat(t," #").concat(a[i][0],"_colorpick")).colorpicker("setValue",e[a[i][0]]),$("".concat(t," #").concat(a[i][0])).val(e[a[i][0]]));else if("datetime"===a[i][1].type||"time"===a[i][1].type){if("0000-00-00 00:00:00"!==e[a[i][0]]&&""!==e[a[i][0]]&&null!=e[a[i][0]]&&void 0!==e[a[i][0]]){var n=e[a[i][0]].split(" "),o=n[0].split("-"),r=n[1].split(":");$("".concat(t," #").concat(a[i][0],"_datetime")).data("datetimepicker").setLocalDate(new Date(o[0],parseInt(o[1],10)-1,o[2],r[0],r[1],r[2]))}}else if("label"===a[i][1].type)$("".concat(t," #").concat(a[i][0])).html(e[a[i][0]]);else if("placeholder"===a[i][1].type){if(void 0!==a[i][1]["remote-source"]&&null!=a[i][1]["remote-source"]){var s="".concat(a[i][1]["remote-source"][0],"_").concat(a[i][1]["remote-source"][1],"_").concat(a[i][1]["remote-source"][2]);l=this.fieldMasterData[s][e[a[i][0]]]}else l=e[a[i][0]];if(void 0===l||null==l)l="";else try{l=l.replace(/(?:\r\n|\r|\n)/g,"<br />")}catch(e){}if(void 0!==a[i][1].formatter&&a[i][1].formatter&&$.isFunction(a[i][1].formatter))try{l=a[i][1].formatter(l)}catch(e){}$("".concat(t," #").concat(a[i][0])).html(l)}else if("fileupload"===a[i][1].type)null!=e[a[i][0]]&&void 0!==e[a[i][0]]&&""!==e[a[i][0]]&&($("".concat(t," #").concat(a[i][0])).html(e[a[i][0]]),$("".concat(t," #").concat(a[i][0])).attr("val",e[a[i][0]]),$("".concat(t," #").concat(a[i][0])).show(),$("".concat(t," #").concat(a[i][0],"_download")).show(),$("".concat(t," #").concat(a[i][0],"_remove")).show()),!0===a[i][1].readonly&&$("".concat(t," #").concat(a[i][0],"_upload")).remove();else if("select"===a[i][1].type)void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]]||(e[a[i][0]]="NULL"),$("".concat(t," #").concat(a[i][0])).val(e[a[i][0]]);else if("select2"===a[i][1].type)void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]]||(e[a[i][0]]="NULL"),$("".concat(t," #").concat(a[i][0])).select2("val",e[a[i][0]]);else if("select2multi"===a[i][1].type){void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]]||(e[a[i][0]]="NULL");var c=[];if(void 0!==e[a[i][0]]&&null!=e[a[i][0]]&&""!==e[a[i][0]])try{c=JSON.parse(e[a[i][0]])}catch(e){}$("".concat(t," #").concat(a[i][0])).select2("val",c);var u=$("".concat(t," #").concat(a[i][0])).find(".select2-choices").height();$("".concat(t," #").concat(a[i][0])).find(".controls").css("min-height","".concat(u,"px")),$("".concat(t," #").concat(a[i][0])).css("min-height","".concat(u,"px"))}else if("datagroup"===a[i][1].type)try{var d=this.dataGroupToHtml(e[a[i][0]],a[i]);$("".concat(t," #").concat(a[i][0])).val(e[a[i][0]]),$("".concat(t," #").concat(a[i][0],"_div")).html(""),$("".concat(t," #").concat(a[i][0],"_div")).append(d),this.makeDataGroupSortable(a[i],$("".concat(t," #").concat(a[i][0],"_div_inner")))}catch(e){}else if("signature"===a[i][1].type)""===e[a[i][0]]&&void 0===e[a[i][0]]&&null==e[a[i][0]]||$("".concat(t," #").concat(a[i][0])).data("signaturePad").fromDataURL(e[a[i][0]]);else if("simplemde"===a[i][1].type)$("".concat(t," #").concat(a[i][0])).data("simplemde").value(e[a[i][0]]);else if("code"===a[i][1].type){var h=$("".concat(t," #").concat(a[i][0])).data("codemirror");h&&h.getDoc().setValue(e[a[i][0]])}else $("".concat(t," #").concat(a[i][0])).val(e[a[i][0]])}},{key:"cancel",value:function(){$("#".concat(this.getTableName(),"Form")).hide(),$("#".concat(this.getTableName())).show()}},{key:"renderFormField",value:function(e){var t=0;if(void 0===this.fieldTemplates[e[1].type]||null==this.fieldTemplates[e[1].type])return"";var a=this.fieldTemplates[e[1].type];if(e[1].label=this.gt(e[1].label),"none"!==e[1].validation&&"emailOrEmpty"!==e[1].validation&&"numberOrEmpty"!==e[1].validation&&"placeholder"!==e[1].type&&e[1].label.indexOf("*")<0&&(["select","select2"].indexOf(e[1].type)>=0&&!0===e[1]["allow-null"]||(e[1].label="".concat(e[1].label,'<font class="redFont">*</font>'))),"select"===e[1].type||"select2"===e[1].type||"select2multi"===e[1].type){if(a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label),void 0!==e[1].source&&null!=e[1].source)a=a.replace("_options_",this.renderFormSelectOptions(e[1].source,e));else if(void 0!==e[1]["remote-source"]&&null!=e[1]["remote-source"]){var l="".concat(e[1]["remote-source"][0],"_").concat(e[1]["remote-source"][1],"_").concat(e[1]["remote-source"][2]);a=a.replace("_options_",this.renderFormSelectOptionsRemote(this.fieldMasterData[l],e))}}else if("colorpick"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("date"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("datetime"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("time"===e[1].type)a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);else if("fileupload"===e[1].type){a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);var i=this.getCurrentProfile();t=null!=i&&void 0!==i?i.id:-1*this.getUser().id,a=(a=a.replace(/_userId_/g,t)).replace(/_group_/g,this.tab),a=(a=void 0!==e[1].filetypes&&null!=e[1].filetypes?a.replace(/_filetypes_/g,e[1].filetypes):a.replace(/_filetypes_/g,"all")).replace(/_rand_/g,this.generateRandom(14))}else"datagroup"===e[1].type||"signature"===e[1].type||"tinymce"===e[1].type||e[1].type,a=(a=a.replace(/_id_/g,e[0])).replace(/_label_/g,e[1].label);return a=void 0!==e[1].validation&&null!=e[1].validation&&""!==e[1].validation?a.replace(/_validation_/g,'validation="'.concat(e[1].validation,'"')):a.replace(/_validation_/g,""),a=void 0!==e[1].help&&null!==e[1].help?(a=a.replace(/_helpline_/g,e[1].help)).replace(/_hidden_class_help_/g,""):(a=a.replace(/_helpline_/g,"")).replace(/_hidden_class_help_/g,"hide"),a=void 0!==e[1].placeholder&&null!==e[1].placeholder?a.replace(/_placeholder_/g,'placeholder="'.concat(e[1].placeholder,'"')):a.replace(/_placeholder_/g,""),a=void 0!==e[1].mask&&null!==e[1].mask?a.replace(/_mask_/g,'mask="'.concat(e[1].mask,'"')):a.replace(/_mask_/g,"")}},{key:"renderFormSelectOptions",value:function(e,t){var a="";null!=t&&void 0!==t&&!0===t[1]["allow-null"]&&(void 0!==t[1]["null-label"]&&null!=t[1]["null-label"]?a+='<option value="NULL">'.concat(this.gt(t[1]["null-label"]),"</option>"):a+='<option value="NULL">Select</option>');var l=[];for(var i in e)l.push(e[i]);!0===t[1].sort&&l.sort((function(e,t){return(e=e[1])<(t=t[1])?-1:e>t?1:0}));for(var n=0;n<l.length;n++){var o=l[n][0],r=l[n][1],s='<option value="_id_">_val_</option>';a+=s=(s=s.replace("_id_",o)).replace("_val_",this.gt(r))}return a}},{key:"renderFormSelectOptionsRemote",value:function(e,t){var a="";!0===t[1]["allow-null"]&&(void 0!==t[1]["null-label"]&&null!=t[1]["null-label"]?a+='<option value="NULL">'.concat(this.gt(t[1]["null-label"]),"</option>"):a+='<option value="NULL">Select</option>');var l=[];for(var i in e)l.push([i,e[i]]);"true"===t[1].sort&&l.sort((function(e,t){return(e=e[1])<(t=t[1])?-1:e>t?1:0}));for(var n=0;n<l.length;n++){var o=l[n][0],r=l[n][1],s='<option value="_id_">_val_</option>';a+=s=(s=s.replace("_id_",o)).replace("_val_",this.gt(r))}return a}},{key:"setCustomTemplates",value:function(e){this.customTemplates=e}},{key:"setEmailTemplates",value:function(e){this.emailTemplates=e}},{key:"getCustomTemplate",value:function(e){return this.customTemplates[e]}},{key:"setFieldTemplates",value:function(e){this.fieldTemplates=e}},{key:"getMetaFieldForRendering",value:function(e){return""}},{key:"clearDeleteParams",value:function(){this.deleteParams={}}},{key:"getShowAddNew",value:function(){return this.showAddNew}},{key:"getAddNewLabel",value:function(){return"Add New"}},{key:"setShowAddNew",value:function(e){this.showAddNew=e}},{key:"setShowDelete",value:function(e){this.showDelete=e}},{key:"setShowEdit",value:function(e){this.showEdit=e}},{key:"setShowSave",value:function(e){this.showSave=e}},{key:"setShowCancel",value:function(e){this.showCancel=e}},{key:"getCustomTableParams",value:function(){return{}}},{key:"getActionButtons",value:function(e){return modJs.getActionButtonsHtml(e.aData[0],e.aData)}},{key:"getActionButtonsHtml",value:function(e,t){var a='<div style="width:80px;">_edit__delete__clone_</div>';return a=this.showAddNew?a.replace("_clone_",'<img class="tableActionButton" src="_BASE_images/clone.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Copy" onclick="modJs.copyRow(_id_);return false;"></img>'):a.replace("_clone_",""),a=this.showDelete?a.replace("_delete_",'<img class="tableActionButton" src="_BASE_images/delete.png" style="margin-left:15px;cursor:pointer;" rel="tooltip" title="Delete" onclick="modJs.deleteRow(_id_);return false;"></img>'):a.replace("_delete_",""),a=(a=(a=this.showEdit?a.replace("_edit_",'<img class="tableActionButton" src="_BASE_images/edit.png" style="cursor:pointer;" rel="tooltip" title="Edit" onclick="modJs.edit(_id_);return false;"></img>'):a.replace("_edit_","")).replace(/_id_/g,e)).replace(/_BASE_/g,this.baseUrl)}},{key:"generateRandom",value:function(e){for(var t=new Date,a="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",l="",i=e;i>0;--i)l+=a[Math.round(Math.random()*(a.length-1))];return l+t.getTime()}},{key:"checkFileType",value:function(e,t){var a=document.getElementById(e),l="";return a.value.lastIndexOf(".")>0&&(l=a.value.substring(a.value.lastIndexOf(".")+1,a.value.length)),l=l.toLowerCase(),!(t.split(",").indexOf(l)<0&&(a.value="",this.showMessage("File Type Error","Selected file type is not supported"),this.clearFileElement(e),1))}},{key:"clearFileElement",value:function(e){var t=$("#".concat(e));t.replaceWith(t=t.val("").clone(!0))}},{key:"fixJSON",value:function(e){return"1"===this.noJSONRequests&&(e=window.btoa(e)),e}},{key:"getClientDate",value:function(e){var t=this.getClientGMTOffset();return e.addMinutes(60*t)}},{key:"getClientGMTOffset",value:function(){var e=new Date,t=new Date(e.getFullYear(),0,1,0,0,0,0),a=t.toGMTString();return(t-new Date(a.substring(0,a.lastIndexOf(" ")-1)))/36e5}},{key:"getHelpLink",value:function(){return null}},{key:"showLoader",value:function(){$("#iceloader").show()}},{key:"hideLoader",value:function(){$("#iceloader").hide()}},{key:"generateOptions",value:function(e){var t="";for(var a in e)t+='<option value="__val__">__text__</option>'.replace("__val__",a).replace("__text__",e[a]);return t}},{key:"isModuleInstalled",value:function(e,t){return void 0!==modulesInstalled&&null!==modulesInstalled&&1===modulesInstalled["".concat(e,"_").concat(t)]}},{key:"setCustomFields",value:function(e){for(var t,a,l=0;l<e.length;l++)if("Hidden"!==(t=e[l]).display&&""!==t.data&&void 0!==t.data)try{if(void 0===(a=JSON.parse(t.data))||null==a)continue;if(2!==a.length)continue;if(void 0===a[1].type||null==a[1].type)continue;this.customFields.push(a)}catch(e){}}},{key:"addCustomFields",value:function(e){for(var t=0;t<this.customFields.length;t++)e.push(this.customFields[t]);return e}}])&&n(t.prototype,a),l&&n(t,l),e}();a.default=o},{"./FormValidation":5}]},{},[1]);
|
|
//# sourceMappingURL=clients.js.map
|