import{j as q,q as A,f as a,i as x,b as e,H as g,B,F as h,t as _,C as N,v as o,e as v,G as D,T as j,s as u,c as w,r as l,o as M,_ as P}from"./index-DLUb5LSe.js";import{u as z}from"./data-D7xXWmPy.js";import{_ as F}from"./TopBar.vue_vue_type_script_setup_true_lang-DNeo4_WD.js";import{_ as H}from"./BottomNav.vue_vue_type_script_setup_true_lang-BcRvF8NM.js";const I={class:"pb-32 min-h-dvh"},U={class:"max-w-md mx-auto px-4 pt-2"},W={class:"rounded-card bg-surface shadow-card p-5"},$={class:"block"},E=["value"],G={class:"block mt-3"},L={class:"mt-3 flex items-center gap-3"},Q={class:"text-meta text-ink-muted"},Y={key:0,class:"text-red-600 text-meta mt-2"},J=["disabled"],K={class:"mt-6"},O={class:"flex items-center justify-between gap-2 mb-2"},R={class:"text-meta font-bold"},X={class:"text-body whitespace-pre-wrap"},Z={key:0,class:"mt-2 flex gap-2"},ee=["src"],te={key:1,class:"mt-3 rounded-card bg-brand-50 border border-brand-200 p-3"},se={class:"text-meta mt-1 whitespace-pre-wrap"},ae={class:"text-[10px] uppercase tracking-wider text-ink-subtle font-bold mt-2"},le={key:0,class:"fixed left-1/2 -translate-x-1/2 bottom-[100px] z-40 px-4 py-2 rounded-pill bg-slate-900 text-white text-meta font-semibold shadow-fab max-w-[90%] text-center"},oe=q({__name:"TelehealthView",setup(ne){const d=z(),i=u(""),c=u(""),m=u([]),p=u(!1),r=u(""),b=u(null);A(async()=>{await Promise.all([d.loadHome(),d.loadTelehealth()]),d.home&&d.home.pets.length===1&&(i.value=d.home.pets[0].id)});const f=w(()=>{var n;return((n=d.home)==null?void 0:n.pets)??[]}),y=w(()=>d.telehealth??[]);function k(n){const t=n.target;t.files&&(m.value=Array.from(t.files).slice(0,3))}async function T(){if(!i.value){r.value="Pick which pet";return}if(!c.value.trim()){r.value="Describe the issue";return}p.value=!0,r.value="";const n=await d.submitTelehealth(Number(i.value),c.value.trim(),m.value);p.value=!1,n.ok?(c.value="",m.value=[],i.value=f.value.length===1?f.value[0].id:"",b.value="Question sent. A vet will reply within a few hours.",setTimeout(()=>{b.value=null},3500)):r.value="Could not send. Try again."}const C=n=>({pending:"bg-amber-50 text-amber-800 border-amber-200",answered:"bg-emerald-50 text-emerald-700 border-emerald-200",closed:"bg-slate-50 text-slate-600 border-slate-200"})[n]??"bg-slate-50 text-slate-600 border-slate-200";return(n,t)=>(l(),a("div",I,[x(F),e("main",U,[t[8]||(t[8]=e("h1",{class:"text-display py-4"},"Ask a vet",-1)),t[9]||(t[9]=e("p",{class:"text-meta text-ink-muted -mt-2 mb-4"},"Send photos + a question. A vet replies within a few hours.",-1)),e("div",W,[e("label",$,[t[3]||(t[3]=e("span",{class:"text-meta font-semibold text-ink-muted"},"Which pet?",-1)),g(e("select",{"onUpdate:modelValue":t[0]||(t[0]=s=>i.value=s),class:"mt-1 w-full h-12 px-3 rounded-card bg-surface-muted border border-ink/10"},[t[2]||(t[2]=e("option",{value:"",disabled:""},"Select a pet",-1)),(l(!0),a(h,null,_(f.value,s=>(l(),a("option",{key:s.id,value:s.id},o(s.name),9,E))),128))],512),[[B,i.value]])]),e("label",G,[t[4]||(t[4]=e("span",{class:"text-meta font-semibold text-ink-muted"},"What's going on?",-1)),g(e("textarea",{"onUpdate:modelValue":t[1]||(t[1]=s=>c.value=s),rows:"4",placeholder:"e.g. Bella's been limping on her front-left leg for 2 days. No bleeding, no swelling, eating normally.",class:"mt-1 w-full px-3 py-2 rounded-card bg-surface-muted border border-ink/10 text-body"},null,512),[[N,c.value]])]),e("label",L,[t[5]||(t[5]=e("span",{class:"px-3 h-10 rounded-card bg-surface-muted text-ink text-meta font-semibold inline-flex items-center cursor-pointer"},"📷 Add photos",-1)),e("input",{type:"file",accept:"image/*",multiple:"",class:"hidden",onChange:k},null,32),e("span",Q,o(m.value.length)+"/3 selected",1)]),r.value?(l(),a("p",Y,o(r.value),1)):v("",!0),e("button",{class:"w-full mt-4 h-12 rounded-card bg-brand-500 text-white font-bold shadow-fab disabled:opacity-50",disabled:p.value,onClick:T},o(p.value?"Sending…":"Send to vet"),9,J)]),e("div",K,[t[7]||(t[7]=e("div",{class:"text-micro uppercase text-ink-subtle tracking-wider mb-2 px-1"},"Your questions",-1)),(l(!0),a(h,null,_(y.value,s=>(l(),a("article",{key:s.id,class:"rounded-card bg-surface shadow-card p-4 mb-3"},[e("div",O,[e("div",R,o(s.pet_name),1),e("span",{class:M(["px-2 py-0.5 rounded-pill text-[10px] font-bold uppercase border",C(s.status)])},o(s.status),3)]),e("p",X,o(s.question),1),s.photos.length?(l(),a("div",Z,[(l(!0),a(h,null,_(s.photos,(V,S)=>(l(),a("img",{key:S,src:V,class:"w-16 h-16 rounded-card object-cover"},null,8,ee))),128))])):v("",!0),s.reply?(l(),a("div",te,[t[6]||(t[6]=e("div",{class:"text-micro uppercase text-brand-700 font-bold tracking-wider"},"Vet reply",-1)),e("p",se,o(s.reply),1)])):v("",!0),e("div",ae,o(s.date_label),1)]))),128))])]),x(j,{name:"toast"},{default:D(()=>[b.value?(l(),a("div",le,o(b.value),1)):v("",!0)]),_:1}),x(H)]))}}),ce=P(oe,[["__scopeId","data-v-9a04485b"]]);export{ce as default};
//# sourceMappingURL=TelehealthView-GsIH0B_G.js.map
