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