System.register(["./p-5e377a26.system.js","./p-cb044807.system.js","./p-b89addbe.system.js","./p-70552f4e.system.js","./p-82fc216c.system.js","./p-417ebfe3.system.js","./p-0c4c76d0.system.js","./p-7e44bde4.system.js","./p-fe1f76a3.system.js","./p-13713b08.system.js"],(function(e){"use strict";var t,n,s,i,r,a,c,o,u,d;return{setters:[function(e){t=e.r;n=e.h;s=e.H},function(e){i=e.g},function(e){r=e.I},function(e){a=e.L},function(e){c=e.C},function(e){o=e.g},function(e){u=e.g;d=e.a},function(){},function(){},function(){}],execute:function(){var l=e("atama_received_request_list",function(){function e(e){var n=this;t(this,e);this.list=a.init();this.actionStatus=r.init();this.showHeader=true;this.acceptRequest=function(e){return n.performAction("accept",e)};this.rejectRequest=function(e){return n.performAction("reject",e)}}e.prototype.fetchList=function(e){var t=this;if(e===void 0){e=false}var n=this,s=n.list,i=n.table;if(s.isPending||s.error&&!e){return}this.list=s.beforeFetch();this.apiAtama.getReceivedRequests(i.base,i.name).then((function(e){t.list=s.afterFetch(e,false)}),(function(e){t.list=s.afterFetchError(e)}))};e.prototype.performAction=function(e,t){var n=this;var s=this,i=s.actionStatus,r=s.table;if(i.isPending){return}this.actionStatus=i.beforeFetch();var a=function(e){n.actionStatus=i.afterFetch(e);n.onActionDone();n.fetchList()};var c=function(e){n.actionStatus=i.afterFetchError(e)};if(e==="accept"){this.apiAtama.acceptPairRequest(r.base,r.name,t._id).then(a,c)}else{this.apiAtama.rejectPairRequest(r.base,r.name,t._id).then(a,c)}};e.prototype.componentWillLoad=function(){this.fetchList()};e.prototype.render=function(){var e=this;var t;var r=this,a=r.i18n,l=r.actionStatus,f=r.list,m=r.showHeader;var p=f.isPending&&f.data;return n(s,null,(m||p)&&n("div",{class:"ml-2 mb-2 d-flex align-items-center"},m&&n("small",null,n("b",null,((t=a.receivedRequests)===null||t===void 0?void 0:t.toLocaleUpperCase())||"RECEIVED REQUESTS")," "),p&&n("dvn-progress",{indefinite:true,size:14,strokeWidth:2,tint:"primary"})),f.isPending&&!f.data&&n("div",{class:"d-flex justify-content-center"},n("dvn-progress",{indefinite:true})),(f.data&&f.data.length)===0&&n("dvn-card",{elevation:0,leaned:true,tint:"neutral"},a.noReceivedRequests||"There are no pending requests."),f.data&&f.data.map((function(t){return n("dvn-card",{key:t._id,elevation:0,leaned:true,bodyLeaned:true,style:{margin:"0 0 1rem 0"}},n("div",{class:"d-flex justify-content-between align-items-center pr-2"},n("div",{style:{cursor:"pointer"}},n("dvn-info-summary",{title:o(i(t,"sentBy")),subTitle:t.requestedAt?c.format(new Date(t.requestedAt*1e3),a.sentOnDateFormat||"DD MMM YYYY, HH:mm"):undefined,onClick:function(){return e.onViewRequestSender(i(t,"sentBy"))}},n("dvn-image",{slot:"media",src:i(t,"sentBy").imageUrl,shape:"circle"}))),t.status!=="requested"&&n("dvn-button",{leaned:true,scale:"small",shape:"rounded",tagMode:true,tint:u(t),view:"ghost"},d(a.statusLabels,t))),t.status==="requested"&&n("dvn-card-footer",{slot:"footer",alignRight:true},n("dvn-button",{disabled:l.isPending,leaned:true,scale:"small",tint:"secondary",onClick:function(){return e.acceptRequest(t)}},a.accept||"Accept"),n("dvn-button",{disabled:l.isPending,scale:"small",tint:"danger",onClick:function(){return e.rejectRequest(t)}},a.reject||"Reject")))})))};return e}())}}}));