YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/basic/modules/HelpDesk/resources/Edit.min.js.map

Summary

Maintainability
Test Coverage
{"version":3,"file":"Edit.min.js","sources":["Edit.js"],"sourcesContent":["/* {[The file is published on the basis of YetiForce Public License 6.5 that can be found in the following directory: licenses/LicenseEN.txt or yetiforce.com]} */\n'use strict';\n\nVtiger_Edit_Js(\n\t'HelpDesk_Edit_Js',\n\t{},\n\t{\n\t\t/**\n\t\t * Register pre save event\n\t\t * @param {jQuery} form\n\t\t */\n\t\tregisterRecordPreSaveEventEvent: function (form) {\n\t\t\tthis._super(form);\n\t\t\tform.on(Vtiger_Edit_Js.recordPreSave, (e, data) => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.validateToClose(form).done((response) => {\n\t\t\t\t\t\tif (response !== true) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\tapp.errorLog(error);\n\t\t\t\t\tapp.showNotify({\n\t\t\t\t\t\ttext: app.vtranslate('JS_ERROR'),\n\t\t\t\t\t\ttype: 'error'\n\t\t\t\t\t});\n\t\t\t\t\te.preventDefault();\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\tvalidateToClose: function (form) {\n\t\t\tconst aDeferred = $.Deferred();\n\t\t\tlet closedStatus = app.getMainParams('closeTicketForStatus', true);\n\t\t\tlet status = form.find('[name=\"ticketstatus\"] :selected').val();\n\t\t\tlet progress = $.progressIndicator({ position: 'html', blockInfo: { enabled: true } });\n\t\t\tlet isClosedStatusSet = status in closedStatus;\n\t\t\tconst recordId = form.find('[name=\"record\"]').val();\n\t\t\tif (\n\t\t\t\t(app.getMainParams('checkIfRecordHasTimeControl') || app.getMainParams('checkIfRelatedTicketsAreClosed')) &&\n\t\t\t\tisClosedStatusSet &&\n\t\t\t\trecordId\n\t\t\t) {\n\t\t\t\tlet formData = {\n\t\t\t\t\taction: 'CheckValidateToClose',\n\t\t\t\t\tmodule: app.getModuleName(),\n\t\t\t\t\trecord: recordId,\n\t\t\t\t\tstatus: form.find('[name=\"ticketstatus\"] :selected').val()\n\t\t\t\t};\n\t\t\t\tAppConnector.request({\n\t\t\t\t\tasync: false,\n\t\t\t\t\turl: 'index.php',\n\t\t\t\t\ttype: 'POST',\n\t\t\t\t\tdata: formData\n\t\t\t\t}).done((response) => {\n\t\t\t\t\tprogress.progressIndicator({ mode: 'hide' });\n\t\t\t\t\tif (response.result.hasTimeControl.result && response.result.relatedTicketsClosed.result) {\n\t\t\t\t\t\taDeferred.resolve(true);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (!response.result.hasTimeControl.result) {\n\t\t\t\t\t\t\tapp.showNotify({\n\t\t\t\t\t\t\t\ttext: response.result.hasTimeControl.message,\n\t\t\t\t\t\t\t\ttype: 'info'\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tthis.addTimeControl({\n\t\t\t\t\t\t\t\trecordId: recordId,\n\t\t\t\t\t\t\t\turl: `index.php?module=OSSTimeControl&view=Edit&sourceModule=HelpDesk&sourceRecord=${recordId}&relationOperation=true&subprocess=${recordId}&subprocess=${recordId}`\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!response.result.relatedTicketsClosed.result) {\n\t\t\t\t\t\t\tapp.showNotify({\n\t\t\t\t\t\t\t\ttext: response.result.relatedTicketsClosed.message,\n\t\t\t\t\t\t\t\ttype: 'info'\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\taDeferred.resolve(false);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else if (isClosedStatusSet && !recordId) {\n\t\t\t\tapp.showNotify({\n\t\t\t\t\ttext: app.vtranslate('JS_CANT_CLOSE_NEW_RECROD'),\n\t\t\t\t\ttype: 'info'\n\t\t\t\t});\n\t\t\t\tprogress.progressIndicator({ mode: 'hide' });\n\t\t\t\taDeferred.resolve(false);\n\t\t\t} else {\n\t\t\t\taDeferred.resolve(true);\n\t\t\t}\n\n\t\t\treturn aDeferred.promise();\n\t\t},\n\t\t/**\n\t\t * Add time control when closed ticket\n\t\t * @param {array} params\n\t\t * @returns {Promise}\n\t\t */\n\t\taddTimeControl: function (params) {\n\t\t\tlet aDeferred = jQuery.Deferred();\n\t\t\tlet referenceModuleName = 'OSSTimeControl';\n\t\t\tlet parentId = params.recordId;\n\t\t\tlet parentModule = 'HelpDesk';\n\t\t\tlet quickCreateParams = {};\n\t\t\tlet relatedParams = {};\n\t\t\tlet relatedField = 'subprocess';\n\t\t\tlet fullFormUrl = params.url;\n\t\t\trelatedParams[relatedField] = parentId;\n\t\t\tlet eliminatedKeys = new Array('view', 'module', 'mode', 'action');\n\n\t\t\tlet preQuickCreateSave = function (data) {\n\t\t\t\tlet index, queryParam, queryParamComponents;\n\t\t\t\tlet queryParameters = [];\n\n\t\t\t\tif (typeof fullFormUrl !== 'undefined' && fullFormUrl.indexOf('?') !== -1) {\n\t\t\t\t\tlet urlSplit = fullFormUrl.split('?');\n\t\t\t\t\tlet queryString = urlSplit[1];\n\t\t\t\t\tqueryParameters = queryString.split('&');\n\t\t\t\t\tfor (index = 0; index < queryParameters.length; index++) {\n\t\t\t\t\t\tqueryParam = queryParameters[index];\n\t\t\t\t\t\tqueryParamComponents = queryParam.split('=');\n\t\t\t\t\t\tif (queryParamComponents[0] == 'mode' && queryParamComponents[1] == 'Calendar') {\n\t\t\t\t\t\t\tdata.find('a[data-tab-name=\"Task\"]').trigger('click');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tjQuery('<input type=\"hidden\" name=\"sourceModule\" value=\"' + parentModule + '\" />').appendTo(data);\n\t\t\t\tjQuery('<input type=\"hidden\" name=\"sourceRecord\" value=\"' + parentId + '\" />').appendTo(data);\n\t\t\t\tjQuery('<input type=\"hidden\" name=\"relationOperation\" value=\"true\" />').appendTo(data);\n\n\t\t\t\tif (typeof relatedField !== 'undefined') {\n\t\t\t\t\tlet field = data.find('[name=\"' + relatedField + '\"]');\n\t\t\t\t\tif (field.length == 0) {\n\t\t\t\t\t\tjQuery('<input type=\"hidden\" name=\"' + relatedField + '\" value=\"' + parentId + '\" />').appendTo(data);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor (index = 0; index < queryParameters.length; index++) {\n\t\t\t\t\tqueryParam = queryParameters[index];\n\t\t\t\t\tqueryParamComponents = queryParam.split('=');\n\t\t\t\t\tif (\n\t\t\t\t\t\tjQuery.inArray(queryParamComponents[0], eliminatedKeys) == '-1' &&\n\t\t\t\t\t\tdata.find('[name=\"' + queryParamComponents[0] + '\"]').length == 0\n\t\t\t\t\t) {\n\t\t\t\t\t\tjQuery(\n\t\t\t\t\t\t\t'<input type=\"hidden\" name=\"' + queryParamComponents[0] + '\" value=\"' + queryParamComponents[1] + '\" />'\n\t\t\t\t\t\t).appendTo(data);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\tif (typeof fullFormUrl !== 'undefined' && fullFormUrl.indexOf('?') !== -1) {\n\t\t\t\tlet urlSplit = fullFormUrl.split('?');\n\t\t\t\tlet queryString = urlSplit[1];\n\t\t\t\tlet queryParameters = queryString.split('&');\n\t\t\t\tfor (let index = 0; index < queryParameters.length; index++) {\n\t\t\t\t\tlet queryParam = queryParameters[index];\n\t\t\t\t\tlet queryParamComponents = queryParam.split('=');\n\t\t\t\t\tif (jQuery.inArray(queryParamComponents[0], eliminatedKeys) == '-1') {\n\t\t\t\t\t\trelatedParams[queryParamComponents[0]] = queryParamComponents[1];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tquickCreateParams['data'] = relatedParams;\n\t\t\tquickCreateParams['callbackFunction'] = function () {};\n\t\t\tquickCreateParams['callbackPostShown'] = preQuickCreateSave;\n\t\t\tquickCreateParams['noCache'] = true;\n\t\t\tApp.Components.QuickCreate.createRecord(referenceModuleName, quickCreateParams);\n\t\t\treturn aDeferred.promise();\n\t\t}\n\t}\n);\n"],"names":["Vtiger_Edit_Js","registerRecordPreSaveEventEvent","form","_this","_super","on","recordPreSave","e","validateToClose","done","response","preventDefault","error","app","errorLog","showNotify","text","vtranslate","type","_this2","aDeferred","$","Deferred","closedStatus","getMainParams","status","find","val","progress","progressIndicator","position","blockInfo","enabled","isClosedStatusSet","recordId","formData","action","module","getModuleName","record","AppConnector","request","async","url","data","mode","result","hasTimeControl","relatedTicketsClosed","resolve","message","addTimeControl","concat","promise","params","jQuery","parentId","quickCreateParams","relatedParams","relatedField","fullFormUrl","eliminatedKeys","Array","preQuickCreateSave","index","queryParam","queryParamComponents","queryParameters","indexOf","urlSplit","split","queryString","length","trigger","appendTo","field","inArray","callbackFunction","callbackPostShown","noCache","App","Components","QuickCreate","createRecord"],"mappings":";;AAAA,kKACA,YAAY,CAEZA,cAAc,CACb,kBAAkB,CAClB,EAAE,CACF;AAED;AACA;AACA,KACEC,+BAA+B,CAAE,SAAAA,+BAAUC,CAAAA,IAAI,CAAE,CAAAC,IAAAA,KAAA,CAChD,IAAA,CAAA,IAAI,CAACC,MAAM,CAACF,IAAI,CAAC,CACjBA,IAAI,CAACG,EAAE,CAACL,cAAc,CAACM,aAAa,CAAE,SAACC,CAAC,CAAW,CAClD,GAAI,CACHJ,KAAI,CAACK,eAAe,CAACN,IAAI,CAAC,CAACO,IAAI,CAAC,SAACC,QAAQ,CAAK,CACzC,CAAAA,CAAAA,GAAAA,QAAiB,EACpBH,CAAC,CAACI,cAAc,GAElB,CAAC,EACF,CAAE,MAAOC,KAAK,CAAE,CACfC,GAAG,CAACC,QAAQ,CAACF,KAAK,CAAC,CACnBC,GAAG,CAACE,UAAU,CAAC,CACdC,IAAI,CAAEH,GAAG,CAACI,UAAU,CAAC,UAAU,CAAC,CAChCC,IAAI,CAAE,OACP,CAAC,CAAC,CACFX,CAAC,CAACI,cAAc,GACjB,CACD,CAAC,EACF,CAAC,CACDH,eAAe,CAAE,SAAAA,eAAAA,CAAUN,IAAI,C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