text: BX.namespace("BX.Crm");if(typeof BX.Crm.OrderPaymentVoucher==="undefined"){BX.Crm.OrderPaymentVoucher=function(){this._id="";this._settings={}};BX.Crm.OrderPaymentVoucher.prototype={initialize:function(e,t){this._id=BX.type.isNotEmptyString(e)?e:BX.util.getRandomString(4);this._settings=t?t:{};if(BX.Crm.EntityEditor!=="undefined"){this._editor=BX.Crm.EntityEditor.getDefault();this.setEditorSaveSuccess();this.setEditorInnerCancel();this.setEditorHasChangedControl()}window.top.BX.SidePanel.Instance.postMessage(window,"CrmOrderPaymentVoucher::Initialized",{entityTypeId:BX.CrmEntityType.enumeration.orderpayment,entityId:BX.prop.getString(t,"entityId",0),voucherObject:this})},setField:function(e,t){this._editor._model.setField(e,t);var i;if(i=this._editor.getControlByIdRecursive("name")){i.onModelChange()}},setEditorHasChangedControl:function(){this._editor.hasChangedControls=function(){return true}},setEditorSaveSuccess:function(){var e=this._settings,t=this;this._editor.save=function(){this._toolPanel.setLocked(false);this._toolPanel.clearErrors();var i=t._editor.getAllControls();var n=t._editor._model.getIntegerField("ENTITY_ID",0);if(n===0){n=BX.prop.getInteger(e,"entityId",0)}var r={entityTypeId:BX.CrmEntityType.enumeration.orderpayment,entityId:n};for(var o in i){if(i.hasOwnProperty(o)){r[i[o].getId()]=i[o].getRuntimeValue()}}r["PAID"]=t._editor._model.getField("PAID");r["source"]=t._editor._model.getField("source");window.top.BX.SidePanel.Instance.postMessage(window,"CrmOrderPaymentVoucher::Update",r);if(typeof top.BX.SidePanel!=="undefined"){this._enableCloseConfirmation=false;t.closeSlider()}}},closeSlider:function(){window.setTimeout(function(){var e=top.BX.SidePanel.Instance.getSliderByWindow(window);if(e&&e.isOpen()){e.close(false);setTimeout(function(){e.destroy()},500)}},250)},setEditorInnerCancel:function(){var e=this;this._editor.innerCancel=function(){if(typeof top.BX.SidePanel!=="undefined"){this._enableCloseConfirmation=false;e.closeSlider()}}}};BX.Crm.OrderPaymentVoucher.create=function(e,t){var i=new BX.Crm.OrderPaymentVoucher;i.initialize(e,t);return i}}
  //# sourceMappingURL=script.map.js