You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
8.2 KiB
1 lines
8.2 KiB
var E=Object.defineProperty;var M=(t,e,o)=>e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var d=(t,e,o)=>M(t,typeof e!="symbol"?e+"":e,o);import{V as O,f as A,e as V,a9 as G,a as S,C as j,_ as P,g as y,h as m,i as u,j as i,l as g,F as k,z as U,k as v,t as C,m as b,o as D,s as H,x as p}from"./index-BLqts8WY.js";import{D as I}from"./datetime-BDQ5ptpc.js";import{Q as N}from"./QuickNav-DgCyvgDx.js";import{T as Q}from"./TopMessage-BE0GBIgW.js";import{g as W,a6 as x,F as _,aS as F,ar as L,aQ as $,aT as R}from"./index-MyY_xqVN.js";import"./index-CsfPLOYu.js";var Y=Object.defineProperty,z=Object.getOwnPropertyDescriptor,q=(t,e,o,a)=>{for(var r=a>1?void 0:a?z(e,o):e,s=t.length-1,l;s>=0;s--)(l=t[s])&&(r=(a?l(e,o,r):l(r))||r);return a&&r&&Y(e,o,r),r};let w=class extends O{constructor(){super(...arguments);d(this,"$notify");d(this,"activeDid","");d(this,"allContacts",[]);d(this,"allMyDids",[]);d(this,"apiServer","");d(this,"claimCountByUser",0);d(this,"claimCountWithHidden",0);d(this,"claimsToConfirm",[]);d(this,"claimsToConfirmSelected",[]);d(this,"description","breakfast");d(this,"loadingConfirms",!0);d(this,"someoneGave",!1);d(this,"supplyGiftDetails",!1)}async created(){this.loadingConfirms=!0;const e=await A();this.apiServer=e.apiServer||"",this.activeDid=e.activeDid||"",this.allContacts=await V.contacts.toArray();let o=I.now().setZone("America/Denver");o.weekday<6&&(o=o.minus({week:1}));const r=o.set({weekday:6}).set({hour:9}).startOf("hour").toISO({suppressMilliseconds:!0})||"",s=await G;await s.open();const l=await s.accounts.toArray();this.allMyDids=l.map(c=>c.did);const h=await W(this.activeDid);try{const c=await fetch(this.apiServer+"/api/claim/?issuedAt_greaterThanOrEqualTo="+encodeURIComponent(r)+"&excludeConfirmations=true",{headers:h});if(!c.ok)throw console.error("Bad response",c),new Error("Bad response when retrieving claims.");await c.json().then(n=>{const f=x(B=>B.issuer===this.activeDid,n),T=x(_,f);this.claimsToConfirm=T,this.claimCountByUser=n.length-f.length,this.claimCountWithHidden=f.length-T.length})}catch(c){console.error("Error:",c),this.$notify({group:"alert",type:"danger",title:"Error",text:"There was an error retrieving today's claims to confirm."},5e3)}this.loadingConfirms=!1}onClickLoadClaim(e){const o={path:"/claim/"+encodeURIComponent(e)};this.$router.push(o)}async record(){var e;try{this.claimsToConfirmSelected.length>0&&this.$notify({group:"alert",type:"toast",title:"Sent..."},1e3);const o=await Promise.allSettled(this.claimsToConfirmSelected.map(async s=>{const l=this.claimsToConfirm.find(h=>h.id===s);return l?F(this.activeDid,l.claim,l.id,l.handleId,this.apiServer,S):{type:"error",error:"Record not found."}})),a=o.filter(s=>s.status==="fulfilled"&&s.value.type==="success");if(a.length<this.claimsToConfirmSelected.length){console.error("Error sending confirmations:",o);const s=a.length===0?"all":"some";this.$notify({group:"alert",type:"danger",title:"Error",text:`There was an error sending ${s} of the confirmations.`},5e3)}let r=!1;if(this.someoneGave&&!this.supplyGiftDetails){const s=await L(S,this.apiServer,this.activeDid,void 0,this.activeDid,this.description,void 0,void 0,void 0,void 0,!1,void 0,$);r=s.type==="success",r||(console.error("Error sending give:",s),this.$notify({group:"alert",type:"danger",title:"Error",text:((e=s==null?void 0:s.error)==null?void 0:e.userMessage)||"There was an error sending that give."},5e3))}if(this.someoneGave&&this.supplyGiftDetails){if(a.length>0){const s=a.length===1?"Your confirmation has been recorded.":"Your confirmations have been recorded.";this.$notify({group:"alert",type:"success",title:"Success",text:s},3e3)}this.$router.push({name:"gifted-details",query:{description:this.description,destinationPathAfter:"/",providerProjectId:$,recipientDid:this.activeDid}})}else if(a.length>0||r){const s=a.length===1?"confirmation":"confirmations",l=a.length>0&&r?`Your ${s} and that give have been recorded.`:r?"That give has been recorded.":"Your "+s+" "+(a.length===1?"has":"have")+" been recorded.";this.$notify({group:"alert",type:"success",title:"Success",text:l},3e3),this.$router.push({path:"/"})}}catch(o){console.error("Error sending claims.",o),this.$notify({group:"alert",type:"danger",title:"Error",text:o.userMessage||"There was an error sending claims."},5e3)}}};w=q([j({methods:{claimSpecialDescription:R},components:{QuickNav:N,TopMessage:Q}})],w);const J={id:"Content",class:"p-6 pb-24 max-w-3xl mx-auto"},Z={class:"text-lg text-center font-light relative px-7"},K={key:0,class:"flex justify-center"},X={key:1},ee={class:"border-t border-slate-300 m-2"},te={class:"grid grid-cols-12"},se={class:"col-span-11 justify-self-start"},ie=["checked","onClick"],oe=["onClick"],ne={key:0,class:"border-b border-slate-300 pb-2"},re={key:1,class:"border-b border-slate-300 pb-2"},ae={class:"m-2 flex"},le={key:0},de={key:1,class:"h-6"},ce={key:2,class:"flex justify-center mt-4"},me={key:3,class:"flex justify-center mt-4"};function pe(t,e,o,a,r,s){const l=y("QuickNav"),h=y("TopMessage"),c=y("fa");return p(),m(k,null,[u(l),u(h),i("section",J,[i("div",Z,[i("h1",{class:"text-lg text-center px-2 py-1 absolute -left-2 -top-1",onClick:e[0]||(e[0]=n=>t.$router.back())},[u(c,{icon:"chevron-left",class:"fa-fw"})])]),e[13]||(e[13]=i("h1",{id:"ViewHeading",class:"text-4xl text-center font-light px-4 mb-4"}," End of BVC Saturday Meeting ",-1)),i("div",null,[e[5]||(e[5]=i("h2",{class:"text-2xl m-2"},"Confirm",-1)),t.loadingConfirms?(p(),m("div",K,[u(c,{icon:"spinner",class:"animate-spin"})])):t.claimsToConfirm.length===0?(p(),m("div",X," There are no claims yet today for you to confirm. ")):g("",!0),i("ul",ee,[(p(!0),m(k,null,U(t.claimsToConfirm,n=>(p(),m("li",{class:"border-b border-slate-300 py-2",key:n.id},[i("div",te,[i("span",se,[i("span",null,[i("input",{type:"checkbox",checked:t.claimsToConfirmSelected.includes(n.id),onClick:f=>t.claimsToConfirmSelected.includes(n.id)?t.claimsToConfirmSelected.splice(t.claimsToConfirmSelected.indexOf(n.id),1):t.claimsToConfirmSelected.push(n.id),class:"mr-2 h-6 w-6"},null,8,ie)]),v(" "+C(t.claimSpecialDescription(n,t.activeDid,t.allMyDids,t.allContacts))+" ",1),i("a",{onClick:f=>t.onClickLoadClaim(n.id)},[u(c,{icon:"file-lines",class:"pl-2 text-blue-500 cursor-pointer"})],8,oe)])])]))),128))])]),t.claimCountWithHidden>0?(p(),m("div",ne,[i("span",null,[v(C(t.claimCountWithHidden===1?"There is 1 other claim with hidden details,":`There are ${t.claimCountWithHidden} other claims with hidden details,`)+" so if you expected but do not see details from someone then ask them to check that their activity is visible to you on their Contacts ",1),u(c,{icon:"users",class:"text-slate-500"}),e[6]||(e[6]=v(" page. "))])])):g("",!0),t.claimCountByUser>0?(p(),m("div",re,[i("span",null,C(t.claimCountByUser===1?"There is 1 other claim by you":`There are ${t.claimCountByUser} other claims by you`)+" which you don't need to confirm. ",1)])):g("",!0),i("div",null,[e[11]||(e[11]=i("h2",{class:"text-2xl m-2"},"Anything else?",-1)),i("div",ae,[b(i("input",{type:"checkbox","onUpdate:modelValue":e[1]||(e[1]=n=>t.someoneGave=n),class:"h-6 w-6"},null,512),[[D,t.someoneGave]]),e[10]||(e[10]=i("span",{class:"pb-2 pl-2 pr-2"},"The group provided",-1)),t.someoneGave?(p(),m("span",le,[b(i("input",{type:"text","onUpdate:modelValue":e[2]||(e[2]=n=>t.description=n),size:"20",class:"border border-slate-400 h-6 px-2"},null,512),[[H,t.description]]),e[7]||(e[7]=i("br",null,null,-1)),e[8]||(e[8]=v(" (Everyone likes personalized messages! 😁 ... and for a pic: ")),b(i("input",{type:"checkbox","onUpdate:modelValue":e[3]||(e[3]=n=>t.supplyGiftDetails=n)},null,512),[[D,t.supplyGiftDetails]]),e[9]||(e[9]=v(") "))])):(p(),m("span",de,"..."))])]),t.claimsToConfirmSelected.length||t.someoneGave&&t.description?(p(),m("div",ce,[i("button",{onClick:e[4]||(e[4]=n=>t.record()),class:"block text-center text-md font-bold bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md w-56"}," Sign & Send ")])):(p(),m("div",me,e[12]||(e[12]=[i("button",{class:"block text-center text-md font-bold bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md w-56"}," Choose What To Confirm ",-1)])))])],64)}const be=P(w,[["render",pe]]);export{be as default};
|
|
|