(function(){"use strict";var t="<div id='${id}_top' class='top header'>"+"<h4>${headerText}</h4>"+"<div class='matches'>{{ListView({ id: id + \"_list\", canEdit: false, model: listModel, grid: gridOptions })}}</div>"+"</div>"+"<div id='${id}_center' class='center operations' style='overflow-y:auto;'>"+"<h4>${selectionText}</h4>"+"<ul>"+"{{each operations}}"+"<li>"+"<input type='radio' id='${id}' name='${name}' value='${value}' ${checked ? \"checked\" : \"\"} />"+"<label for='${id}' class='operation-text'>"+"<p>${text1}</p>"+"<p>${text2}</p>"+"</label>"+"</li>"+"{{/each}}"+"</ul>"+"</div>"+"<div id='${id}_buttons' class='bottom buttons'>"+'{{Button({ textId: "TXT_net_mask_text_3", command: "Apply", isDefault: true })}}'+"&nbsp;"+'{{Button({ textId: "TXT_net_mask_text_48", command: "Cancel", isCancel: true })}}'+"</div>";u8.Crm.Widgets.MatchUpView=function(t,e){this.Widget(t,$.extend({},u8.Crm.Widgets.MatchUpView.defaults,e));this.providerName=u8.session.webConfigValues.get("Matchup.BusinessLogic");this.commandBindings={Apply:this._onCommandApply.bind(this),Cancel:this._onCommandCancel.bind(this)};var i=["MatchupTexts","net_mask_text"];$.merge(i,this.customTextGroups||[]);u8.using({texts:i,types:["ListView"]},this._create.bind(this))};u8.Crm.Widgets.MatchUpView.defaults={value:"GoToExisting",matchUpOperations:[{id:"GoToExisting",text1:"TXT_MatchupTexts_2",text2:"TXT_MatchupTexts_3",active:true},{id:"ComplementExisting",text1:"TXT_MatchupTexts_4",text2:"TXT_MatchupTexts_5",active:true},{id:"UpdateExisting",text1:"TXT_MatchupTexts_6",text2:"TXT_MatchupTexts_7",active:true},{id:"UpdateNew",text1:"TXT_MatchupTexts_8",text2:"TXT_MatchupTexts_9",active:true},{id:"ComplementNew",text1:"TXT_MatchupTexts_10",text2:"TXT_MatchupTexts_11",active:true},{id:"CreateNew",text1:"TXT_MatchupTexts_12",text2:"",active:true,requireUid:false}],size:{width:700,height:610}};u8.Crm.Widgets.MatchUpView.makeClass({name:"MatchUpView",events:["Operation"],deriveFrom:u8.Base.Widgets.Widget});$.extend(u8.Crm.Widgets.MatchUpView,{showAsPopup:function(t){var e,i=false,s=new u8.Base.Widgets.Popup("<div></div>",{parent:page,size:u8.Crm.Widgets.MatchUpView.defaults.size,title:"TXT_MatchupTexts_0",__onOperationRaised:false,onCreate:function(s){e=s.getContent().widget("MatchUpView",$.extend(t,{parent:s}))[0];e.bind("Operation",function(){i=true;s.close()})},onClose:function(){if(e&&!i){e.cancel()}}});s.open();return s}});$.extend(u8.Crm.Widgets.MatchUpView.prototype,{applyDecision:function(){var t=$w(this.element);var e=this.matchUpOperations,i=null,s=null;for(var a=0;a<e.length&&!i;a++){s=e[a];if(s.active&&t.$c(this.id+"_radio_"+s.id)){i=s.id}}if(!i){return u8.services.notification.error($t("TXT_MatchupTexts_14"))}var n=this.page.elWindow.$widget(this.id+"_list");var o=n.getSelection({type:"uid"});if(s.requireUid!==false&&!u8.isValidRecordUid(o)){return u8.services.notification.error($t("TXT_MatchupTexts_14"))}if(!o){o={infoAreaId:this.infoAreaId}}var r=s.text1;u8.services.notification.info(r,true);this.raise("Operation",{uid:o,operation:s.id})},cancel:function(){this.raise("Operation",{operation:"Cancel",cancel:true})},_create:function(){this._createList();this._createOperations();var e=this.$(this.element);e.addClass("u8-matchupview").utml({template:t,itemOptions:{parent:this},data:{id:this.id,listModel:this._listModel,gridOptions:this._gridOptions,operations:this._operations,headerText:$t("TXT_MatchupTexts_1"),selectionText:$t("TXT_MatchupTexts_13")}});u8.Base.Dom.layout(e,{name:"dock",splitters:{top:true}})},_createList:function(){this._listModel=this.list||{infoAreaId:this.infoAreaId,link:this.link,maxRows:5,dataProvider:{reader:{endPoint:"MatchupChannel",filters:this.filters,providerName:u8.session.webConfigValues["Matchup.BusinessLogic"]==="web"?"Qbe":"Crm"}}};this._gridOptions={showMiniDetails:true,showDefaultAction:false,showQuickViewAction:false,selectionMode:"single",useDefaultActionOnDblClick:false,showMenu:false,view:{allowSorting:false,allowColumnResizing:false}}},_createOperations:function(){var t=this,e=[];this.matchUpOperations.forEach(function(i,s){if(!i.active){return}e.push({id:t.id+"_radio_"+i.id,name:t.id+"_radio",value:s,checked:t.value===i.id,text1:i.text1?$t(i.text1):"",text2:i.text2?$t(i.text2):""})});this._operations=e},_onCommandApply:function(){this.applyDecision()},_onCommandCancel:function(){this.cancel()}})})();