uawdijnntqw1x1x1
IP : 18.117.240.120
Hostname : axolotl
Kernel : Linux axolotl 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
OS : Linux
PATH:
/
var
/
www
/
axolotl
/
data
/
www
/
axolotl.ru
/
www
/
bitrix
/
js
/
main
/
..
/
crm
/
partial_entity_editor.min.js
/
/
BX.namespace("BX.Crm");if(typeof BX.Crm.PartialEditorDialog==="undefined"){BX.Crm.PartialEditorDialog=function(){this._id="";this._settings={};this._serviceUrl="";this._entityTypeId=0;this._entityTypeName="";this._entityId=0;this._stageId="";this._fieldNames=null;this._html=null;this._presetValues={};this._editor=null;this._wrapper=null;this._popup=null;this._buttons=null;this._isLocked=false;this._isController=false;this._notAvailableFieldsErrorTextWrapper=null;this._notAvailableFieldsErrorText=[];this._editorEventsBinded=false;this._entityUpdateSuccessHandler=BX.delegate(this.onEntityUpdateSuccess,this);this._entityUpdateFailureHandler=BX.delegate(this.onEntityUpdateFailure,this);this._entityValidationFailureHandler=BX.delegate(this.onEntityValidationFailure,this);this._entityAjaxFormSubmitErrorHandler=BX.delegate(this.onEntityAjaxFormSubmitError,this)};BX.Crm.PartialEditorDialog.prototype={initialize:function(t,i){this._id=BX.type.isNotEmptyString(t)?t:BX.util.getRandomString(4);this._settings=i?i:{};this._entityTypeId=BX.prop.getInteger(this._settings,"entityTypeId",0);if(this._entityTypeId!==BX.CrmEntityType.enumeration.undefined){this._entityTypeName=BX.CrmEntityType.resolveName(this._entityTypeId)}else{this._entityTypeName=BX.prop.getString(this._settings,"entityTypeName","");this._entityTypeId=BX.CrmEntityType.resolveId(this._entityTypeName)}this._entityId=BX.prop.getInteger(this._settings,"entityId",0);this._fieldNames=BX.prop.getArray(this._settings,"fieldNames",[]);this._presetValues=BX.prop.getObject(this._settings,"presetValues",{});this._isAccepted=false;this._isController=BX.prop.getBoolean(this._settings,"isController",false);this._stageId=BX.prop.getString(this._settings,"stageId","")},getSetting:function(t,i){return BX.prop.get(this._settings,t,i)},getId:function(){return this._id},getEditorId:function(){return this._entityTypeName.toLowerCase()+"_"+this._entityId+"_partial_editor"},isLoaded:function(){return this._html!==null},getServiceUrl:function(){return BX.prop.getString(BX.Crm.PartialEditorDialog.entityEditorUrls,this._entityTypeName,"")},load:function(){if(this._isController){BX.ajax.runAction("crm.api.item.getEditor",{data:{entityTypeId:this._entityTypeId,id:this._entityId,stageId:this._stageId,guid:this.getEditorId(),configId:this.getEditorId(),params:{forceDefaultConfig:"Y",requiredFields:this._fieldNames,title:BX.prop.getString(this._settings,"title","")}}}).then(function(t){if(typeof BX.Crm.EntityEditor!=="undefined"){var i=BX.Crm.EntityEditor.get(this.getEditorId());if(i){i.release()}}this.createPopup();this.bindEntityEditorInitEvent();BX.Runtime.html(this._editorNode,t.data.html).then(function(){this._html=t.data.html;this.innerOpen()}.bind(this))}.bind(this)).catch(function(t){BX.onCustomEvent(window,"Crm.PartialEditorDialog.Error",[this,{errors:t.errors}])}.bind(this))}else{BX.ajax.post(this.getServiceUrl(),{ACTION:"PREPARE_EDITOR_HTML",ACTION_ENTITY_TYPE_NAME:this._entityTypeName,ACTION_ENTITY_ID:this._entityId,GUID:this.getEditorId(),FIELDS:this._fieldNames,PARAMS:{},CONTEXT:BX.prop.getObject(this._settings,"context",{}),TITLE:BX.prop.getString(this._settings,"title","No title"),FORCE_DEFAULT_CONFIG:"Y",ENABLE_CONFIG_SCOPE_TOGGLE:"N",ENABLE_CONFIGURATION_UPDATE:"N",ENABLE_FIELDS_CONTEXT_MENU:"N",IS_EMBEDDED:"Y"},function(t){if(typeof BX.Crm.EntityEditor!=="undefined"){var i=BX.Crm.EntityEditor.get(this.getEditorId());if(i){i.release()}}this._html=t;this.createPopup();this.bindEntityEditorInitEvent();this.innerOpen()}.bind(this))}},open:function(){if(!this.isLoaded()){this.load()}else{this.innerOpen()}},createPopup:function(){this._popup=new BX.PopupWindow(this._id,null,{autoHide:false,draggable:false,closeByEsc:true,offsetLeft:0,offsetTop:0,zIndex:BX.prop.getInteger(this._settings,"zIndex",0),bindOptions:{forceBindPosition:true},content:this.prepareContent(),events:{onPopupShow:BX.delegate(this.onPopupShow,this),onPopupClose:BX.delegate(this.onPopupClose,this),onPopupDestroy:BX.delegate(this.onPopupDestroy,this)}})},innerOpen:function(){if(!this.isLoaded()||!this._popup){return}this._popup.show();this._isAccepted=false},close:function(){if(this._popup){this._popup.close()}},isOpen:function(){return this._popup&&this._popup.isShown()},prepareContent:function(){this._editorNode=BX.create("div");this._wrapper=BX.create("div",{props:{id:this._id+"_wrapper"},style:{width:"500px"},children:[this._editorNode]});this._editorNode.innerHTML=this._html;this._notAvailableFieldsErrorTextWrapper=BX.create("div");this._wrapper.appendChild(this._notAvailableFieldsErrorTextWrapper);var t=BX.create("div",{props:{className:"crm-entity-popup-fill-required-fields-btns"}});this._wrapper.appendChild(t);this._buttons={};this._buttons[BX.Crm.DialogButtonType.names.accept]=BX.create("span",{props:{className:"ui-btn ui-btn-primary"},text:BX.message("JS_CORE_WINDOW_SAVE"),events:{click:BX.delegate(this.onSaveButtonClick,this)}});this._buttons[BX.Crm.DialogButtonType.names.cancel]=BX.create("span",{props:{className:"ui-btn ui-btn-link"},text:BX.message("JS_CORE_WINDOW_CANCEL"),events:{click:BX.delegate(this.onCancelButtonClick,this)}});t.appendChild(this._buttons[BX.Crm.DialogButtonType.names.accept]);t.appendChild(this._buttons[BX.Crm.DialogButtonType.names.cancel]);return this._wrapper},onSaveButtonClick:function(t){if(this._isLocked){return}this._isLocked=true;this._isAccepted=true;if(!this.getEditor()){return}BX.addClass(this._buttons[BX.Crm.DialogButtonType.names.accept],"ui-btn-clock");this.bindEditorEvents();this.getEditor().save()},onCancelButtonClick:function(t){if(this._isLocked){return}this._isLocked=true;this._isAccepted=false;if(this._popup){this._popup.close()}},onEntityUpdateSuccess:function(t){if(this._entityTypeId===BX.prop.getInteger(t,"entityTypeId",0)&&this._entityId===BX.prop.getInteger(t,"entityId",0)){this._isLocked=false;BX.removeClass(this._buttons[BX.Crm.DialogButtonType.names.accept],"ui-btn-clock");this.unbindEditorEvents();if(this._popup){this._popup.close()}BX.onCustomEvent(window,"Crm.PartialEditorDialog.Close",[this,{entityTypeId:this._entityTypeId,entityTypeName:BX.CrmEntityType.resolveName(this._entityTypeId),entityId:this._entityId,entityData:BX.prop.getObject(t,"entityData",null),bid:BX.Crm.DialogButtonType.accept,isCancelled:false,stageId:this._stageId}])}},onEntityUpdateFailure:function(t){this._notAvailableFieldsErrorText=[];this._notAvailableFieldsErrorTextWrapper.innerHTML="";BX.removeClass(this._notAvailableFieldsErrorTextWrapper,"crm-entity-widget-content-error-text");if(t.checkErrors){var i=this.getNotAccessibleFieldNames(Object.keys(t.checkErrors));if(i.length){i.forEach(function(i){if(this.isFieldAvailableForCurrentUser(i)){this._notAvailableFieldsErrorText.push(t.checkErrors[i])}},this);if(this._notAvailableFieldsErrorText.length){BX.addClass(this._notAvailableFieldsErrorTextWrapper,"crm-entity-widget-content-error-text");this._notAvailableFieldsErrorTextWrapper.innerHTML=BX.Crm.PartialEditorDialog.messages.entityHasInaccessibleFields+" "+this._notAvailableFieldsErrorText.join("; ")}}}else if(t.error&&(typeof t.error==="string"||t.error instanceof String)){BX.addClass(this._notAvailableFieldsErrorTextWrapper,"crm-entity-widget-content-error-text");this._notAvailableFieldsErrorTextWrapper.innerText=t.error}if(this._entityTypeId===BX.prop.getInteger(t,"entityTypeId",0)&&this._entityId===BX.prop.getInteger(t,"entityId",0)){this._isLocked=false;BX.removeClass(this._buttons[BX.Crm.DialogButtonType.names.accept],"ui-btn-clock");this.unbindEditorEvents()}},onEntityValidationFailure:function(t,i){if(this.getEditor()!==t){return}this._isLocked=false;BX.removeClass(this._buttons[BX.Crm.DialogButtonType.names.accept],"ui-btn-clock");this.unbindEditorEvents()},onEntityAjaxFormSubmitError:function(t){if(!this._isLocked||!this._isAccepted||!this.getEditor()){return}var i="";for(var e in t){if(!t.hasOwnProperty(e)){continue}if(t[e].message){i+=t[e].message+" "}}if(i.length){BX.addClass(this._notAvailableFieldsErrorTextWrapper,"crm-entity-widget-content-error-text");this._notAvailableFieldsErrorTextWrapper.innerText=i}this._isLocked=false;BX.removeClass(this._buttons[BX.Crm.DialogButtonType.names.accept],"ui-btn-clock")},bindEntityEditorInitEvent:function(){BX.addCustomEvent(window,"BX.Crm.EntityEditor:onInit",function(t,i){if(t.getId()!==this.getEditorId()){return}this._editor=t;var e=BX.prop.getObject(this._settings,"helpData",null);if(e){this.getEditor().addHelpLink(e)}if(this._presetValues){for(var r in this._presetValues){if(BX.Type.isArray(this._fieldNames)&&this._fieldNames.indexOf(r)===-1){this._presetValues[r].forEach(function(t){this.addHiddenInputToForm(r,t)}.bind(this))}}}}.bind(this))},bindEditorEvents:function(){if(this._editorEventsBinded){return}this._editorEventsBinded=true;BX.addCustomEvent(window,"onCrmEntityUpdate",this._entityUpdateSuccessHandler);BX.addCustomEvent(window,"onCrmEntityUpdateError",this._entityUpdateFailureHandler);BX.addCustomEvent(window,"BX.Crm.EntityEditor:onFailedValidation",this._entityValidationFailureHandler);if(this._isController){BX.addCustomEvent(window,"BX.Crm.EntityEditorAjax:onSubmitFailure",this._entityAjaxFormSubmitErrorHandler)}},unbindEditorEvents:function(){BX.removeCustomEvent(window,"onCrmEntityUpdate",this._entityUpdateSuccessHandler);BX.removeCustomEvent(window,"onCrmEntityUpdateError",this._entityUpdateFailureHandler);BX.removeCustomEvent(window,"BX.Crm.EntityEditor:onFailedValidation",this._entityValidationFailureHandler);if(this._isController){BX.removeCustomEvent(window,"BX.Crm.EntityEditorAjax:onSubmitFailure",this._entityAjaxFormSubmitErrorHandler)}this._editorEventsBinded=false},onPopupShow:function(){window.setTimeout(function(){if(this._popup)this._popup.adjustPosition()}.bind(this),150)},onPopupClose:function(){if(this.getEditor()){this.getEditor().release()}if(!this._isAccepted){BX.onCustomEvent(window,"Crm.PartialEditorDialog.Close",[this,{entityTypeId:this._entityTypeId,entityTypeName:BX.CrmEntityType.resolveName(this._entityTypeId),entityId:this._entityId,bid:BX.Crm.DialogButtonType.cancel,isCancelled:true,stageId:this.stageId}])}if(this._popup){this._popup.destroy()}},onPopupDestroy:function(){if(this._popup){this._popup=null}delete BX.Crm.PartialEditorDialog.items[this.getId()]},addHiddenInputToForm:function(t,i){var e=this.getEditor();if(!e){return}var r=e._ajaxForm._elementNode.querySelector('input[name="'+t+'"]');if(!r||r.type==="hidden"){r=document.createElement("INPUT");r.type="hidden";r.name=t;e._ajaxForm._elementNode.appendChild(r)}r.value=i},getNotAccessibleFieldNames:function(t){var i=this.getEditor().getScheme().getElements();var e=[];i.forEach(function(t){e=e.concat(t.getElements().map(function(t){return t._name},this))});return t.filter(function(t){return!e.includes(t)})},isFieldAvailableForCurrentUser:function(t){return this.getEditor()._scheme._availableElements.some(function(i){return i._name===t})},getEditor:function(){return this._editor}};if(typeof BX.Crm.PartialEditorDialog.messages=="undefined"){BX.Crm.PartialEditorDialog.messages={}}if(typeof BX.Crm.PartialEditorDialog.entityEditorUrls==="undefined"){BX.Crm.PartialEditorDialog.entityEditorUrls={}}BX.Crm.PartialEditorDialog.registerEntityEditorUrl=function(t,i){BX.Crm.PartialEditorDialog.entityEditorUrls[t]=i};BX.Crm.PartialEditorDialog.items={};BX.Crm.PartialEditorDialog.hasOpenItems=function(){for(var t in this.items){if(!this.items.hasOwnProperty(t)){continue}if(this.items[t].isOpen()){return true}}return false};BX.Crm.PartialEditorDialog.getItem=function(t){return this.items.hasOwnProperty(t)?this.items[t]:null};BX.Crm.PartialEditorDialog.close=function(t){if(this.items.hasOwnProperty(t)){this.items[t].close()}};BX.Crm.PartialEditorDialog.create=function(t,i){var e=new BX.Crm.PartialEditorDialog;e.initialize(t,i);this.items[e.getId()]=e;return e}}if(typeof BX.Crm.QuickFormPartialEditorDialog==="undefined"){BX.Crm.QuickFormPartialEditorDialog=function(){BX.Crm.QuickFormPartialEditorDialog.superclass.constructor.apply(this);this._entityCreateSuccessHandler=this.onEntityCreateSuccess.bind(this);this._entityCreateFailureHandler=this.onEntityCreateFailure.bind(this)};BX.extend(BX.Crm.QuickFormPartialEditorDialog,BX.Crm.PartialEditorDialog);BX.Crm.QuickFormPartialEditorDialog.prototype.unbindEditorEvents=function(){BX.Crm.QuickFormPartialEditorDialog.superclass.unbindEditorEvents.apply(this);BX.removeCustomEvent(window,"onCrmEntityCreate",this._entityCreateSuccessHandler);BX.removeCustomEvent(window,"onCrmEntityCreateError",this._entityCreateFailureHandler)};BX.Crm.QuickFormPartialEditorDialog.prototype.createPopup=function(){if(document.getElementById(this._id)){this.unbindEditorEvents();BX.PopupWindowManager.getPopupById(this._id).destroy()}BX.Crm.QuickFormPartialEditorDialog.superclass.createPopup.apply(this)};BX.Crm.QuickFormPartialEditorDialog.prototype.bindEditorEvents=function(){BX.Crm.QuickFormPartialEditorDialog.superclass.bindEditorEvents.apply(this);BX.addCustomEvent(window,"onCrmEntityCreate",this._entityCreateSuccessHandler);BX.addCustomEvent(window,"onCrmEntityCreateError",this._entityCreateFailureHandler)};BX.Crm.QuickFormPartialEditorDialog.prototype.onEntityCreateFailure=function(t){this._notAvailableFieldsErrorText=[];this._notAvailableFieldsErrorTextWrapper.innerHTML="";BX.removeClass(this._notAvailableFieldsErrorTextWrapper,"crm-entity-widget-content-error-text");if(t.checkErrors){var i=this.getNotAccessibleFieldNames(Object.keys(t.checkErrors));if(i.length){i.forEach(function(i){if(this.isFieldAvailableForCurrentUser(i)){this._notAvailableFieldsErrorText.push(t.checkErrors[i])}},this);if(this._notAvailableFieldsErrorText.length){BX.addClass(this._notAvailableFieldsErrorTextWrapper,"crm-entity-widget-content-error-text");this._notAvailableFieldsErrorTextWrapper.innerHTML=BX.Crm.PartialEditorDialog.messages.entityHasInaccessibleFields+" "+this._notAvailableFieldsErrorText.join("; ")}}}if(this._entityTypeId===BX.prop.getInteger(t,"entityTypeId",0)&&this._entityId===BX.prop.getInteger(t,"entityId",0)){this._isLocked=false;BX.removeClass(this._buttons[BX.Crm.DialogButtonType.names.accept],"ui-btn-clock");this.unbindEditorEvents()}};BX.Crm.QuickFormPartialEditorDialog.prototype.onEntityCreateSuccess=function(t){if(this._entityTypeId===BX.prop.getInteger(t,"entityTypeId",0)){this._isLocked=false;BX.removeClass(this._buttons[BX.Crm.DialogButtonType.names.accept],"ui-btn-clock");this.unbindEditorEvents();if(this._popup){this._popup.close()}BX.onCustomEvent(window,"Crm.QuickFormPartialEditorDialog.Close",[this,{entityTypeId:this._entityTypeId,entityTypeName:BX.CrmEntityType.resolveName(this._entityTypeId),entityId:BX.prop.getInteger(t,"entityId",null),entityData:BX.prop.getObject(t,"entityData",null),bid:BX.Crm.DialogButtonType.accept,isCancelled:false}])}};BX.Crm.QuickFormPartialEditorDialog.prototype.onPopupClose=function(){this._isLocked=false;if(this.getEditor()){this.getEditor().release()}if(!this._isAccepted){BX.onCustomEvent(window,"Crm.QuickFormPartialEditorDialog.Close",[this,{entityTypeId:this._entityTypeId,entityTypeName:BX.CrmEntityType.resolveName(this._entityTypeId),bid:BX.Crm.DialogButtonType.cancel,isCancelled:true}])}if(this._popup){this._popup.destroy()}};BX.Crm.QuickFormPartialEditorDialog.items={};BX.Crm.QuickFormPartialEditorDialog.create=function(t,i){var e=new BX.Crm.QuickFormPartialEditorDialog;e.initialize(t,i);this.items[e.getId()]=e;return e}} //# sourceMappingURL=partial_entity_editor.map.js
/var/www/axolotl/data/www/axolotl.ru/www/bitrix/js/main/../crm/partial_entity_editor.min.js