System.register(["./p-5b6828db.system.js","./p-d3871a3c.system.js","./p-23628d1c.system.js","./p-75920676.system.js","./p-5e238e1a.system.js","./p-1b089731.system.js","./p-9424fd5c.system.js","./p-f1345828.system.js","./p-58f2f536.system.js","./p-fa32c614.system.js","./p-ac291838.system.js","./p-b42ad17a.system.js","./p-5f835359.system.js"],(function(e){"use strict";var t,i,n,s,r,a,o,c,d,l,u,f;return{setters:[function(e){t=e.r;i=e.c;n=e.h;s=e.H;r=e.g},function(e){a=e.R;o=e.a},function(e){c=e.D},function(e){d=e.L},function(e){l=e.P;u=e.c;f=e.b},function(){},function(){},function(){},function(){},function(){},function(){},function(){},function(){}],execute:function(){var v=e("dvn_app_view_atama_member_pairs_overview_view",function(){function e(e){var n=this;t(this,e);this.action=i(this,"action",7);this.list=d.init();this.shownTab="pairs";this.onSizeChange=function(e){n.size=e}}e.prototype.componentWillLoad=function(){this.fetchMembershipConfigOfMemberToShow()};e.prototype.componentDidLoad=function(){this.uiHelper=new a(this.el,this.onSizeChange)};e.prototype.fetchMembershipConfigOfMemberToShow=function(){var e=this;var t;var i=this,n=i.notifier,s=i.view,r=s.table,a=s.ui.i18n;var o=this.params.memberToViewRefFieldId;var c=(t=r.fields.find((function(e){return e.type==="reference"&&e.id===o})))===null||t===void 0?void 0:t.otherCollection;this.apiUye.getMembershipConfigWithName(c).then((function(t){e.membershipConfigToShow=t;e.fetchList()}),(function(e){return n.alert(a.fetchConfigurationError||"Getting configuration failed.",e.status)}))};e.prototype.fetchList=function(){var e=this;var t=this.list;if(t.isPending){return}var i=this,n=i.membership,s=i.notifier,r=i.view,a=r.table,o=r.ui.i18n;var c=this.params.userRefFieldId;this.list=t.beforeFetch();this.apiAtama.getPairsOfUser(a.base,a.name,c,n._id).then((function(i){return e.list=t.afterFetch(i,false)}),(function(i){e.list=t.afterFetchError(i);s.alert(o.fetchListError||"Fetching list failed.",i.status)}))};e.prototype.onRequestAcceptOrReject=function(){this.fetchList()};e.prototype.onClickReceivedRequestUser=function(e){this.action.emit({type:"navigation",direction:"forward",resetHistory:true,viewId:this.params.viewIdToViewRequestSender,params:{item:e}})};e.prototype.render=function(){var e;var t=this;var i;var r=this,a=r.list,d=r.membershipConfigToShow,v=r.shownTab,p=r.size,h=r.view;var m=h.ui.i18n;var b=p<o.Medium;if(!d){return n("div",{class:"d-flex justify-content-center pt-3"},n("dvn-progress",{indefinite:true}))}var g=this.params,y=g.memberToViewRefFieldId,w=g.userRefFieldId;var C=(a.data||[]).map((function(e){var t=c.decode(e[y][0]);t.pairId=e._id;return t}));var R=!!a.data;var j=l.decode(h.table);var T=f(j,w);var q=u(j,w);var S=R&&(T===null||T===void 0?void 0:T.isActive())&&(T.pairLimit===0||T.pairLimit>C.length);var L=v==="pairs"||!b;var A=!!q;var I=!!A&&(v==="pair-requests"||!b);var P=!b;return n(s,{class:"d-block"},b&&A&&n("div",{class:"d-flex justify-content-center pt-3"},n("dvn-content-switcher",{options:[{label:m.pairs||"Pairs",value:"pairs"},{label:m.receivedRequests||"Received Requests",value:"pair-requests"}],onChange:function(e){return t.shownTab=e.detail},value:this.shownTab})),S&&n("div",{class:"pt-3"},n("dvn-card",{elevation:0,leaned:true,tint:m.selectionCardTint||"primary"},n("dvn-card-header",{slot:"header",tint:m.selectionCardTint||"primary",title:m.selectionCardTitle||"Selection is on!"}),m.selectionCardMessage||"You can view all available users and send them requests.",n("dvn-card-footer",{slot:"footer",alignRight:true},n("dvn-button",{tint:m.selectionCardActionTint||"secondary",onClick:function(){return t.action.emit({type:"navigation",direction:"forward",resetHistory:true,viewId:t.params.viewIdToNavigateToSelectPair})}},m.selectionCardActionLabel||"Go to selection page")))),n("div",{class:"row"},L&&n("div",{class:{"col-md-12 pt-3":true,"col-lg-8":I}},I&&n("div",{class:"ml-2 mb-2 d-flex align-items-center"},P&&n("small",null,n("b",null,((i=m.pairs)===null||i===void 0?void 0:i.toLocaleUpperCase())||"PAIRS")," "),a.isPending&&a.data&&n("dvn-progress",{indefinite:true,size:14,strokeWidth:2,tint:"primary"})),a.isPending&&!a.data&&n("div",{class:"d-flex justify-content-center"},n("dvn-progress",{indefinite:true})),a.data&&n("div",null,C.length>0?n("dvn-card-list-view",{config:h.ui,fields:d.fields,items:C}):n("dvn-card",{elevation:0,leaned:true,tint:"warning"},m.noPairsMessage||"You don't have any pairs."))),I&&n("div",{class:(e={},e["col-sm-12 col-md-4 pt-3"]=!b,e["col-sm-12 col-md-12 pt-3"]=b,e)},n("atama-received-request-list",{i18n:m,apiAtama:this.apiAtama,onActionDone:function(){return t.onRequestAcceptOrReject()},onViewRequestSender:function(e){return t.onClickReceivedRequestUser(e)},showHeader:P,table:this.view.table}))))};Object.defineProperty(e.prototype,"el",{get:function(){return r(this)},enumerable:false,configurable:true});return e}())}}}));