1import{e as P,c as a,x as N,a as e,t as m,n as h,v,i as U,q as n,o as r,M as q,h as l,Q as _,F as T,r as L,b as O,k}from"./BeMSUy9H.js";import{u as z}from"./DAIawc7I.js";import"./D6jLQzgL.js";const A={class:"relative mx-auto p-5 border w-full max-w-md shadow-lg rounded-md bg-white"},R={class:"mt-3 text-center"},W={class:"text-lg leading-6 font-medium text-gray-900"},G={class:"mt-2 px-7 py-3"},H=P({__name:"MessageModal",props:{show:{type:Boolean,required:!0},recipient:{type:Object,required:!0}},emits:["close","send"],setup(x,{emit:i}){const c=x,d=i,s=n(""),g=()=>{s.value.trim()&&(d("send",{recipientId:c.recipient.id,content:s.value}),s.value="")},u=()=>{d("close")};return(w,p)=>x.show?(r(),a("div",{key:0,class:"fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full flex items-center justify-center",onClick:N(u,["self"])},[e("div",A,[e("div",R,[e("h3",W,"Send Message to "+m(x.recipient.name),1),e("div",G,[h(e("textarea",{"onUpdate:modelValue":p[0]||(p[0]=y=>s.value=y),class:"w-full h-32 px-3 py-2 text-base text-gray-700 placeholder-gray-600 border rounded-lg focus:shadow-outline",placeholder:"Type your message..."},null,512),[[v,s.value]])]),e("div",{class:"items-center px-4 py-3"},[e("button",{onClick:g,class:"px-4 py-2 bg-blue-500 text-white text-base font-medium rounded-md w-full shadow-sm hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-blue-300"}," Send "),e("button",{onClick:u,class:"mt-3 px-4 py-2 bg-gray-200 text-gray-800 text-base font-medium rounded-md w-full shadow-sm hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-gray-300"}," Cancel ")])])])])):U("",!0)}}),I=Object.assign(H,{__name:"MessageModal"}),Q={class:"bg-[#f8fafc] pt-10 min-h-[calc(100vh-84px-68px)]"},J={class:"container mx-auto py-10"},K={class:"mb-8"},X={class:"flex flex-col"},Y={class:"flex flex-col"},Z={class:"flex flex-col"},ee={key:0,class:"text-center"},te={key:1,class:"text-center text-red-500"},se={key:2},oe={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-8"},le=["src"],ae={class:"pt-4 flex flex-col items-center w-full"},re={class:"text-lg font-bold text-gray-900"},ne={class:"text-sm font-medium text-gray-600"},de={class:"text-xs text-gray-400 mt-2"},ie=["onClick"],ce={key:1,disabled:"",class:"mt-4 w-full bg-gray-400 text-white py-2 rounded-md cursor-not-allowed"},ue={class:"flex justify-center items-center gap-2 mt-8"},ge=["disabled"],pe=["disabled"],be=P({__name:"index",setup(x){const i=n(""),c=n(""),d=n(""),s=n(1),g=n(12),u=n(!1),w=n({id:"",name:""}),p=k(()=>({page:s.value,perPage:g.value,name:i.value,company:c.value,chapter:d.value})),{data:y,pending:S,error:$,refresh:f}=z("/api/members",{query:p},"$WxbGd6WTha");q(p,()=>{f()});const j=k(()=>y.value?.members||[]),M=k(()=>y.value?.total||0),V=b=>{w.value=b,u.value=!0},C=()=>{u.value=!1},E=async b=>{try{await $fetch("/api/messages/send",{method:"POST",body:b}),C()}catch(t){console.error("Failed to send message:",t)}},B=()=>{s.value=1,f()},D=()=>{s.value>1&&(s.value--,f())},F=()=>{s.value*g.value<M.value&&(s.value++,f())};return(b,t)=>(r(),a("div",Q,[t[9]||(t[9]=e("div",{class:"py-10"},[e("div",{class:"container mx-auto"},[e("h1",{class:"text-4xl font-bold text-gray-900"},"NAPE Member Directory"),e("p",{class:"text-gray-500 mt-2"}," Connect with fellow NAPE members. Use the filters below to find colleagues. ")])],-1)),e("div",J,[e("div",K,[e("form",{onSubmit:N(B,["prevent"]),class:"grid grid-cols-1 md:grid-cols-4 gap-4 items-end"},[e("div",X,[t[3]||(t[3]=e("label",{for:"searchName",class:"block text-sm font-medium text-gray-700 mb-1"}," Name ",-1)),h(e("input",{id:"searchName","onUpdate:modelValue":t[0]||(t[0]=o=>_(i)?i.value=o:null),type:"text",placeholder:"Enter member name",class:"px-4 py-2 border border-gray-300 bg-white rounded-lg placeholder:text-gray-400 text-gray-900"},null,512),[[v,l(i)]])]),e("div",Y,[t[4]||(t[4]=e("label",{for:"searchCompany",class:"block text-sm font-medium text-gray-700 mb-1"}," Company ",-1)),h(e("input",{"onUpdate:modelValue":t[1]||(t[1]=o=>_(c)?c.value=o:null),type:"text",placeholder:"Enter company name",class:"px-4 py-2 border border-gray-300 bg-white rounded-lg placeholder:text-gray-400 text-gray-900"},null,512),[[v,l(c)]])]),e("div",Z,[t[5]||(t[5]=e("label",{for:"searchChapter",class:"block text-sm font-medium text-gray-700 mb-1"}," Chapter ",-1)),h(e("input",{"onUpdate:modelValue":t[2]||(t[2]=o=>_(d)?d.value=o:null),type:"text",placeholder:"Enter chapter name",class:"px-4 py-2 border border-gray-300 bg-white rounded-lg placeholder:text-gray-400 text-gray-900"},null,512),[[v,l(d)]])]),t[6]||(t[6]=e("div",null,[e("button",{type:"submit",class:"bg-[#facc15] text-[#15803d] px-4 py-3 font-bold rounded-lg hover:brightness-95 w-full"}," Search ")],-1))],32)]),l(S)?(r(),a("div",ee,[...t[7]||(t[7]=[e("div",{class:"flex flex-col items-center justify-center"},[e("svg",{class:"animate-spin h-8 w-8 text-[#15803d] mb-3",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"}
1)]),e("p",null,"Loading members...")],-1)])])):l($)?(r(),a("div",te,[...t[8]||(t[8]=[e("p",null,"Failed to load members. Please try again later.",-1)])])):(r(),a("div",se,[e("div",oe,[(r(!0),a(T,null,L(l(j),o=>(r(),a("div",{key:o.id,class:"bg-white flex flex-col items-center rounded-xl border border-gray-200 shadow-sm overflow-hidden p-8"},[e("img",{src:o.profilePhoto||"/svg/avatar-default.svg",alt:"Profile photo",class:"w-32 h-32 rounded-full object-cover ring-4 ring-[#facc15]/30"},null,8,le),e("div",ae,[e("h3",re,m(o.name),1),e("p",ne,m(o.designation)+" - "+m(o.company),1),e("p",de,m(o.chapter)+" Chapter",1),o.messagingDisabled?(r(),a("button",ce," Messaging Disabled ")):(r(),a("button",{key:0,onClick:me=>V(o),class:"mt-4 w-full bg-[#15803d] text-white py-3 flex items-center justify-center rounded-lg font-bold hover:bg-[#15803d]/90"}," Message ",8,ie))])]))),128))]),e("div",ue,[e("button",{onClick:D,disabled:l(s)===1,class:"border border-gray-300 bg-white text-gray-600 px-4 py-2 rounded-lg hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed"}," Previous ",8,ge),e("button",{onClick:F,disabled:l(s)*l(g)>=l(M),class:"border border-gray-300 bg-white text-gray-600 px-4 py-2 rounded-lg hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed"}," Next ",8,pe)])]))]),O(I,{show:l(u),recipient:l(w),onClose:C,onSend:E},null,8,["show","recipient"])]))}});export{be 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.