PageSourceSearch

https://app.pawsitivefoster.com/assets/FosterAvailabilityPage-B0C7HagY.js

js pawsitivefoster.com collected 2026-09-24 14:51:11 UTC 5,920 bytes, 2 lines download raw bytes

1import{aQ as a,E as e,w as l,aR as i,aS as t,u as o,aT as n,l as s,r,e as u,aV as v,aW as c,aX as d,bo as b,bI as p,bs as y,bp as f,bA as m,aZ as g,bn as h,bJ as k,bx as A,bC as w,a_ as _,by as z,a$ as V,t as C,aU as j,b1 as x,bm as E}from"./index-B7717Xy-.js";import U from"./foster-BfLPifi5.js";import{E as S}from"./ExpectedEndDateField-BKJ1O7vp.js";import{u as B}from"./useActiveOrganization-RC_Af1mK.js";import{g as O,i as I,t as F,f as L}from"./fosterAvailability-DNq5ZMWb.js";import"./submitError-BPyI4y-r.js";const N={class:"container"},R={class:"hero-title"},T={key:0,class:"empty-state"},D={class:"empty-state__icon"},J={key:1,class:"loading-state","aria-live":"polite"},M={class:"page-subtitle"},P={class:"option-list",role:"radiogroup","aria-label":"Availability"},Q=["aria-checked"],W=["aria-checked"],X={key:0,class:"return-date-card"},Y={key:0,id:"return-date-error",class:"return-date-error",role:"alert"},Z={key:1,id:"return-date-help",class:"return-date-confirmation"},$={key:1,class:"unavailable-hint",role:"note"},q=E(a({__name:"FosterAvailabilityPage",setup(a){const E=j(),{activeOrganizationId:q,currentOrganization:G}=B(),H=r(!0),K=r(null),aa=r(!1),ea=r(!1),la=r({}),ia=u(()=>Boolean(q.value&&G.value)),ta=O(),oa=u(()=>Boolean(K.value)&&!I(K.value)),na=u(()=>oa.value?"":L(K.value)),sa=u(()=>H.value||!oa.value),ra=a=>{H.value=a},ua=async()=>{if(!ia.value)return la.value={},H.value=!0,void(K.value=null);aa.value=!0;try{const a=await U.getVolunteerAvailability(q.value);la.value=(null==a?void 0:a.availability)&&"object"==typeof a.availability?a.availability:{};const e=la.value;H.value="boolean"!=typeof e.isAvailable||Boolean(e.isAvailable),K.value=!1===H.value&&"string"==typeof e.unavailableUntil&&I(e.unavailableUntil)?e.unavailableUntil:null}catch(a){s.error("Error loading volunteer availability:",a),la.value={},H.value=!0,K.value=null}finally{aa.value=!1}},va=async()=>{if(ia.value&&sa.value){ea.value=!0;try{await U.updateVolunteerAvailability({...la.value||{},isAvailable:H.value,unavailableUntil:H.value||!K.value?null:K.value,availableAgainAt:H.value||!K.value?null:F(K.value)},q.value);const a=await C.create({message:"Availability updated.",duration:1800,position:"top",color:"success"});await a.present(),E.back()}catch(a){s.error("Error saving availability:",a);const e=await C.create({message:"Unable to save availability right now.",duration:2200,position:"top",color:"danger"});await e.present()}finally{ea.value=!1}}},ca=()=>{E.back()};return e(()=>{ua()}),l(q,()=>{ua()}),(a,e)=>(x(),i(o(n),{class:"foster-availability-page"},{default:t(()=>[v(o(g),{class:"ion-no-border"},{default:t(()=>[v(o(c),{class:"ion-no-border"},{default:t(()=>[v(o(d),{slot:"start"},{default:t(()=>[v(o(b),{fill:"clear","aria-label":"Back",onClick:ca},{default:t(()=>[v(p,{name:"arrow-back-outline"})]),_:1})]),_:1}),v(o(y),{class:"ion-text-center"},{default:t(()=>[...e[3]||(e[3]=[f("My Availability",-1)])]),_:1}),v(o(d),{slot:"end"},{default:t(()=>[v(o(b),{fill:"clear",disabled:ea.value||aa.value||!ia.value||!sa.value,onClick:va},{default:t(()=>[f(m(ea.value?"Saving...":"Save"),1)]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1}),v(o(V),{class:"availability-content"},{default:t(()=>{var a,l,i;return[h("div",N,[h("section",{class:k(["hero-card",{"is-muted":!ia.value}])},[e[4]||(e[4]=h("p",{class:"eyebrow"},"Viewing",-1)),h("h2",R,m((null==(a=o(G))?void 0:a.name)||"Select an organization"),1),e[5]||(e[5]=h("p",{class:"hero-copy"},"Availability is saved per organization, so you can pause one without affecting the others.",-1))],2),ia.value?aa.value?(x(),A("div",J,[v(o(w),{name:"crescent"}),e[8]||(e[8]=h("span",null,"Loading availability…",-1))])):(x(),A(z,{key:2},[h("p",M,"Are you currently available to foster for "+m(null==(l=o(G))?void 0:l.name)+"?",1),h("div",P,[h("button",{type:"button",role:"radio","aria-checked":!0===H.value,class:k(["option-card",!0===H.value&&"selected"]),onClick:e[0]||(e[0]=a=>ra(!0))},[...e[9]||(e[9]=[h("span",{class:"radio-indicator","aria-hidden":"true"},null,-1),h("div",{class:"option-text"},[h("span",{class:"option-label"},"Available"),h("span",{class:"option-description"},"Ready to receive placements from this organization")],-1)])],10,Q),h("button",{type:"button",role:"radio","aria-checked":!1===H.value,class:k(["option-card",!1===H.value&&"selected"]),onClick:e[1]||(e[1]=a=>ra(!1))},[...e[10]||(e[10]=[h("span",{class:"radio-indicator","aria-hidden":"true"},null,-1),h("div",{class:"option-text"},[h("span",{class:"option-label"},"Not Available"),h("span",{class:"option-description"},"Take a break for this organization without affecting your other orgs")],-1)])],10,W)]),!1===H.value?(x(),A("section",X,[v(S,{modelValue:K.value,"onUpdate:modelValue":e[2]||(e[2]=a=>K.value=a),"datetime-id":"foster-available-again-date",label:"Available again","clear-label":"Clear available-again date",min:o(ta)},null,8,["modelValue","min"]),e[11]||(e[11]=h("p",{class:"return-date-description"},"Optional. Leave this blank if you don't know yet.",-1)),oa.value?(x(),A("p",Y,"Choose a date after today.")):na.value?(x(),A("p",Z,[v(p,{name:"calendar-outline"}),f(" You'll automatically be marked available on "+m(na.value)+". ",1)])):_("",!0)])):_("",!0),!1===H.value?(x(),A("div",$,[v(p,{name:"information-circle-outline",class:"unavailable-hint__icon"}),h("p",null," Coordinators at "+m(null==(i=o(G))?void 0:i.name)+" will see "+m(na.value?"that you're unavailable until ".concat(na.value):"that you're unavailable until you switch this back on")+". ",1)])):_("",!0)],64)):(x(),A("div",T,[h("div",D,[v(p,{name:"business-outline"})]),e[6]||(e[6]=h("h3",null,"No active organization selected",-1)),e[7]||(e[7]=h("p",null,"Switch your Viewing organization in Settings to manage availability for that org.",-1))]))])]}),_:1})]),_:1}))}}),[["__scopeId","data-v-0f4c77af"]]);export{q as default};
2//# sourceMappingURL=FosterAvailabilityPage-B0C7HagY.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.