PageSourceSearch

https://app.pawsitivefoster.com/assets/FosterStaffDirectoryPage-DXYPxINA.js

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

1import{aQ as a,w as e,E as s,b4 as t,aR as r,aS as n,u as o,aT as l,l as i,r as u,cf as c,aV as d,cg as f,ch as p,bn as m,bx as v,bz as b,by as g,bA as y,a_ as h,bC as I,ci as _,cj as k,a$ as w,e as N,aU as C,b1 as S,ck as j,bO as x,bo as L,bp as A,bY as E,bh as F,bm as O}from"./index-B0wWhsKS.js";import P from"./foster-Ce7nl-LN.js";import{A as M}from"./AppHeader-D15vuOvQ.js";import{A as U}from"./AppSearchBar-DZ7aME-3.js";import{F as V}from"./FosterBottomNav-BSDuFNe1.js";import{F as z}from"./FallbackAvatar-BN3XXAeu.js";import"./submitError-Crrxf9mD.js";import"./BaseCoachMark.vue_vue_type_style_index_0_lang-PURWAZbn.js";import"./OllieNavAction-DJZod8U5.js";const B={class:"search-container"},D={class:"staff-list"},T=["onClick","onKeydown"],K={class:"staff-info"},Q={class:"staff-avatar"},R=["src","alt","onError"],G={class:"staff-details"},H={class:"staff-name"},Y={key:0,class:"staff-position"},$={key:0,class:"empty-state"},q={class:"empty-subtext"},J={key:1,class:"loading-state"},W=O(a({__name:"FosterStaffDirectoryPage",setup(a){const O=C(),W=u([]),X=u(""),Z=u(!1),aa=u(!1),ea=u(!0),sa=u(0),ta=u(!1),ra=E(new Set);e(W,()=>{ra.clear()});const na=async({reset:a=!1}={})=>
1{if(!ta.value&&(a||ea.value))try{ta.value=!0,a?(Z.value=!0,sa.value=0,ea.value=!0,W.value=[]):aa.value=!0;const e=a?1:sa.value+1,s=await P.getMyOrganizationStaffPage({page:e,limit:25}),t=(s.data||[]).filter(a=>{var e,s;const t=null!=(e=a.id)?e:a.staff_id,r=null!=(s=a.userId)?s:a.user_id,n="number"==typeof t?t:parseInt(t,10),o="number"==typeof r?r:parseInt(r,10);return!(!Number.isInteger(n)||n<=0||!Number.isInteger(o)||o<=0)}).map(a=>{var e,s;const t="number"==typeof a.id?a.id:parseInt(null!=(e=a.id)?e:a.staff_id,10),r="number"==typeof a.userId?a.userId:parseInt(null!=(s=a.userId)?s:a.user_id,10);return{id:String(t),userId:String(r),name:a.name||"Unknown",photo_url:a.photo_url,position:c(a.position),isLoading:!1}});W.value=a?t:((a,e)=>{const s=new Map;for(const t of a)s.set(String(t.id),t);for(const t of e)s.set(String(t.id),t);return Array.from(s.values())})(W.value,t),sa.value=s.pagination.page,ea.value=s.pagination.hasNext}catch(e){i.error("Error loading staff:",e)}finally{ta.value=!1,Z.value=!1,aa.value=!1}};s(()=>{na({reset:!0})}),t(async()=>{await na({reset:!0})});const oa=async a=>{var e,s;try{await na({reset:!0})}finally{null==(s=null==(e=null==a?void 0:a.target)?void 0:e.complete)||s.call(e)}},la=async a=>{try{await na()}finally{a.target.complete()}},ia=N(()=>
1{if(!X.value)return W.value;const a=X.value.toLowerCase();return W.value.filter(e=>{var s;return e.name.toLowerCase().includes(a)||(null==(s=e.position)?void 0:s.toLowerCase().includes(a))})}),ua=a=>{X.value=a},ca=a=>{a.id&&!isNaN(parseInt(a.id,10))&&O.push("/staff-profile/".concat(a.id))};function da(a){switch(a){case"home":O.push("/foster/home");break;case"animals":O.push("/foster/animals");break;case"resources":O.push("/foster/resources");break;case"messages":O.push("/foster/messages")}}return(a,e)=>(S(),r(o(l),null,{default:n(()=>[d(M,{title:"Organization Staff"}),d(o(w),{class:"staff-content"},{default:n(()=>[d(o(f),{slot:"fixed",onIonRefresh:oa},{default:n(()=>[d(o(p))]),_:1}),m("div",B,[d(U,{modelValue:X.value,"onUpdate:modelValue":e[0]||(e[0]=a=>X.value=a),placeholder:"Search staff by name...",clearable:!0,onChange:ua},null,8,["modelValue"])]),m("div",D,[(S(!0),v(g,null,b(ia.value,a=>(S(),v("div",{key:a.id,class:"staff-card clickable",role:"button",tabindex:"0",onClick:e=>ca(a),onKeydown:[j(x(e=>ca(a),["prevent"]),["enter"]),j(x(e=>ca(a),["prevent"]),["space"])]},[m("div",K,[m("div",Q,[a.photo_url&&!ra.has(a.id)?(S(),v("img",{key:0,src:a.photo_url,alt:a.name,onError:e=>ra.add(a.id)},null,40,R)):(S(),r(z,{key:1,name:a.name},null,8,["name"]))]),m("div",G,[m("h3",H,y(a.name),1),a.position?(S(),v("p",Y,y(a.position),1)):h("",!0)])]),d(o(L),{class:"button-sm-secondary",fill:"outline",onClick:x(e=>(async a=>{try{if(a.isLoading=!0,!a.userId||isNaN(parseInt(a.userId,10)))throw new Error("Invalid staff user ID: ".concat(a.userId));const e=await F.createDirectChat(a.userId);O.push({path:"/foster-message/".concat(e.id),state:{conversationId:String(e.id),conversationName:a.name,counterpartyProfileId:a.id,counterpartyUserId:a.userId,counterpartyProfileType:"staff"}})}catch(e){i.error("Error starting chat:",e),alert(e.message||"Failed to start chat. Please try again.")}finally{a.isLoading=!1}})(a),["stop"]),disabled:a.isLoading},{default:n(()=>[...e[1]||(e[1]=[A(" Message ",-1)])]),_:1},8,["onClick","disabled"])],40,T))),128)),0!==ia.value.length||Z.value?h("",!0):(S(),v("div",$,[e[2]||(e[2]=m("p",{class:"empty-text"},"No staff members found",-1)),m("p",q,y(X.value?"Try adjusting your search":"No staff available"),1)])),Z.value?(S(),v("div",J,[d(o(I),{name:"crescent"}),e[3]||(e[3]=m("p",null,"Loading staff...",-1))])):h("",!0)]),d(o(_),{threshold:"120px",disabled:!ea.value||Z.value||aa.value,onIonInfinite:la},{default:n(()=>[d(o(k),{"loading-spinner":"bubbles","loading-text":"Loading more staff..."})]),_:1},8,["disabled"])]),_:1}),d(V,{"active-tab":"messages",onNavChange:da})]),_:1}))}}),[["__scopeId","data-v-5bf83d34"]]);export{W 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.