PageSourceSearch

https://app.pawsitivefoster.com/assets/FosterPreferencesPage-Dld700-V.js

js pawsitivefoster.com collected 2026-10-02 01:40:54 UTC 5,826 bytes, 1 lines download raw bytes

1import{aQ as e,E as a,w as l,aR as s,aS as i,u as t,aT as r,l as n,r as o,e as c,aV as u,aW as d,aX as p,bo as v,bI as b,bs as y,bp as f,bA as m,aZ as g,bn as h,bJ as _,bx as k,bC as w,by as S,bz as A,a_ as z,a$ as C,t as E,aU as O,b1 as P,bm as j}from"./index-B0wWhsKS.js";import V from"./foster-Ce7nl-LN.js";import{u as I}from"./useActiveOrganization-WSiCsbhd.js";import{V as x}from"./capabilities-BxxUeBCF.js";import{O as T}from"./programs-BU1zaTfV.js";import{d as B,S as N,s as U,e as q}from"./fosterOnboardingStep2Options-tDhfC8Pr.js";import"./submitError-Crrxf9mD.js";const F={class:"container"},J={class:"hero-title"},L={key:0,class:"empty-state"},Q={class:"empty-state__icon"},R={key:1,class:"loading-state","aria-live":"polite"},W={key:2,class:"section"},X={key:0,class:"capability-groups"},Z={class:"capability-group__heading"},$={class:"capability-list"},D=["aria-pressed","onClick"],G={class:"capability-card__checkbox","aria-hidden":"true"},H={class:"capability-card__content"},K={class:"capability-card__title-row"},M={class:"capability-card__title"},Y={class:"capability-card__description"},ee={key:1,class:"empty-state empty-state--inline"},ae={class:"empty-state__icon empty-state__icon--small"},le=j(e({__name:"FosterPreferencesPage",setup(e){const j=O(),{activeOrganizationId:le,currentOrganization:se}=I(),ie=o(!1),te=o(!1),re=o([]),ne=c(()=>Boolean(le.value&&se.value)),oe=c(()=>{var e;const a=Array.isArray(null==(e=se.value)?void 0:e.enabledPrograms)?se.value.enabledPrograms:[];return new Set(a.map(e=>"string"==typeof e?e:(null==e?void 0:e.programId)||(null==e?void 0:e.id)||null).filter(e=>Boolean(e)))}),ce=c(()=>{var e;const a=Array.isArray(null==(e=se.value)?void 0:e.enabledCapabilities)?se.value.enabledCapabilities:[];return new Set(a.filter(e=>"string"==typeof e&&e.length>0))}),ue=c(()=>{const e=new Set;return T.forEach(a=>{oe.value.has(a.id)&&a.requiresCapabilities.forEach(a=>{e.add(a)})}),e}),de=c(()=>{var e;return(Array.isArray(null==(e=se.value)?void 0:e.animalTypes)?se.value.animalTypes:[]).filter(e=>"cat"===e||"dog"===e||"rabbit"===e)}),pe=c(()=>{const e=ce.value.size>0,a=de.value.length>0;return x.filter(l=>{const s=!a||!l.species||l.species.some(e=>de.value.includes(e)),i=!e||ce.value.has(l.id),t=ue.value.has(l.id);return s&&i||t}).sort(q)}),ve=c(()=>{const e=[],a=new Set;
1N.forEach(l=>{if(de.value.length>0&&!de.value.includes(l))return;const s=pe.value.filter(e=>{var a;return null==(a=e.species)?void 0:a.includes(l)});s.length&&(s.forEach(e=>a.add(e.id)),e.push({key:l,label:U(l),capabilities:s}))});const l=pe.value.filter(e=>!a.has(e.id));return l.length&&e.push({key:"all",label:"All animals",capabilities:l}),e}),be=async()=>{if(ne.value){ie.value=!0;try{const e=await V.getVolunteerPreferences(le.value);re.value=Array.isArray(null==e?void 0:e.capabilitiesOptedIn)?e.capabilitiesOptedIn:[]}catch(e){n.error("Error loading volunteer preferences:",e),re.value=[]}finally{ie.value=!1}}else re.value=[]},ye=async()=>{if(ne.value){te.value=!0;try{await V.updateVolunteerPreferences(re.value,le.value);const e=await E.create({message:"Volunteer preferences updated.",duration:1800,position:"top",color:"success"});await e.present(),j.back()}catch(e){n.error("Error saving volunteer preferences:",e);const a=await E.create({message:"Unable to save volunteer preferences right now.",duration:2200,position:"top",color:"danger"});await a.present()}finally{te.value=!1}}},fe=()=>{j.back()};return a(()=>{be()}),l(le,()=>{be()}),(e,a)=>(P(),s(t(r),null,{default:i(()=>[u(t(g),{class:"ion-no-border"},{default:i(()=>[u(t(d),{class:"ion-no-border"},{default:i(()=>[u(t(p),{slot:"start"},{default:i(()=>[u(t(v),{fill:"clear","aria-label":"Back",onClick:fe},{default:i(()=>[u(b,{name:"arrow-back-outline"})]),_:1})]),_:1}),u(t(y),{class:"ion-text-center"},{default:i(()=>[...a[0]||(a[0]=[f("Volunteer Preferences",-1)])]),_:1}),u(t(p),{slot:"end"},{default:i(()=>[u(t(v),{fill:"clear",disabled:te.value||ie.value||!ne.value,onClick:ye},{default:i(()=>[f(m(te.value?"Saving...":"Save"),1)]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1}),u(t(C),{class:"preferences-content"},{default:i(()=>{var e;return[h("div",F,[h("section",{class:_(["hero-card",{"is-muted":!ne.value}])},[a[1]||(a[1]=h("p",{class:"eyebrow"},"Preferences for",-1)),h("h2",J,m((null==(e=t(se))?void 0:e.name)||"Select an organization"),1),a[2]||(a[2]=h("p",{class:"hero-copy"},"Choose the ways you'd like to help this organization.",-1))],2),ne.value?ie.value?(P(),k("div",R,[u(t(w),{name:"crescent"}),a[5]||(a[5]=h("span",null,"Loading preferences…",-1))])):(P(),k("section",W,[ve.value.length?(P(),k("div",X,[(P(!0),k(S,null,A(ve.value,e=>(P(),k("div",{key:e.key,class:"capability-group"},[h("h4",Z,m(e.label),1),h("div",$,[(P(!0),k(S,null,A(e.capabilities,e=>(P(),k("button",{key:e.id,type:"button",class:_(["capability-card",{selected:re.value.includes(e.id)}]),"aria-pressed":re.value.includes(e.id),onClick:a=>{return l=e.id,void(te.value||(re.value.includes(l)?re.value=re.value.filter(e=>e!==l):re.value=[...re.value,l]));var l}},[h("span",G,[re.value.includes(e.id)?(P(),s(b,{key:0,name:"checkmark-outline"})):z("",!0)]),h("div",H,[h("div",K,[h("h5",M,m(t(B)(e.displayName)),1)]),h("p",Y,m(e.description),1)])],10,D))),128))])]))),128))])):(P(),k("div",ee,[h("div",ae,[u(b,{name:"paw-outline"})]),a[6]||(a[6]=h("h3",null,"No capabilities available",-1)),a[7]||(a[7]=h("p",null,"This organization hasn't opened any volunteer capabilities for your active scope yet.",-1))]))])):(P(),k("div",L,[h("div",Q,[u(b,{name:"business-outline"})]),a[3]||(a[3]=h("h3",null,"No active organization selected",-1)),a[4]||(a[4]=h("p",null,"Switch your Viewing organization in Settings to manage volunteer preferences for that org.",-1))]))])]}),_:1})]),_:1}))}}),[["__scopeId","data-v-3d708311"]]);export{le as default};

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.