(function(){"use strict";u8.Crm.DataQuality=function(e){$.extend(this,u8.Crm.DataQuality.defaults,e);this.commandBindings={"DataQuality/CopyFromSignature":{queryState:this._onCommandCopyFromSignatureQueryState.bind(this),execute:this._onCommandCopyFromSignature.bind(this)}}};u8.Crm.DataQuality.defaults={};$.extend(u8.Crm.DataQuality.prototype,{_onApplySignature:function(e,t,a){a.values.forEach(function(t){e.model.setFieldValue(t.field.alias,t.field.fieldId,t.value)})},_onCommandCopyFromSignature:function(e,t,a){var i=a.target;if(!u8.tools.isInstanceOfClass(i,"ExpandView")){return}var n=i.model.getInfoAreaId();if(!this.signatureParser){return u8.services.notification.error("TXT_DataQuality_4")}u8.using({types:"SignatureParseView"},function(){u8.Crm.Widgets.SignatureParseView.showAsPopup({parser:this.signatureParser,infoAreaId:n,fieldGroupName:n+".Signature",onApply:this._onApplySignature.bind(this,i)})}.bind(this))},_onCommandCopyFromSignatureQueryState:function(e,t,a){var i=u8.Base.Widgets.Tools.closest(e,"ExpandView");if(!i){a.disabled=true;return}var n=e.executeOptions&&e.executeOptions.arguments;var u=n&&n.uid;if(u&&!u8.equalsRecordUid(i.model.getUid(),u)){a.disabled=true;return}i.bind("ViewModeChange",r);a.disabled=i.getViewMode()!="Edit";function r(){i.unbind("ViewModeChange",r);u8.services.commands.updateState(i,[t])}}});u8.Crm.DataQuality.makeClass({name:"DataQuality"});u8.services.add({name:"dataQuality",scope:"Session",ctor:u8.Crm.DataQuality})})();