import{j as B,q as D,f as a,i as T,b as e,w as A,H as $,C as j,F as x,t as v,v as n,e as p,z,A as F,s as l,r as o,o as g}from"./index-DLUb5LSe.js";import{u as H}from"./data-D7xXWmPy.js";import{_ as M}from"./TopBar.vue_vue_type_script_setup_true_lang-DNeo4_WD.js";const R={class:"pb-24 min-h-dvh"},q={class:"max-w-md mx-auto px-4 pt-2"},E={class:"flex items-center gap-2 py-3"},I={class:"rounded-card bg-surface shadow-card p-5"},L={class:"mt-3 flex flex-wrap gap-2"},P=["onClick"],U={class:"mt-3 flex items-center gap-3"},G={class:"text-meta text-ink-muted"},J={key:0,class:"text-red-600 text-meta mt-2"},K=["disabled"],O={class:"mt-5"},Q={key:0,class:"text-meta text-ink-muted py-6 text-center"},W={class:"flex items-center gap-2 flex-wrap"},X={class:"text-meta text-ink-muted"},Y={class:"text-body mt-2 whitespace-pre-wrap"},Z={key:0,class:"mt-2 flex gap-2 overflow-x-auto"},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"},le=B({__name:"SymptomDiaryView",setup(ae){const w=z(),k=F(),f=H(),h=Number(w.params.id),b=l([]),i=l(""),u=l("low"),c=l([]),m=l(!1),d=l("");D(y);async function y(){const r=await f.loadSymptoms(h);b.value=r.entries}function C(r){const t=r.target;t.files&&(c.value=Array.from(t.files).slice(0,3))}async function S(){if(!i.value.trim()){d.value="Tell the clinic what you noticed.";return}m.value=!0,d.value="";const r=await f.addSymptom(h,i.value.trim(),u.value,c.value);m.value=!1,r.ok?(i.value="",u.value="low",c.value=[],await y()):d.value="Could not submit."}const N=r=>({low:"bg-slate-100 text-slate-700",moderate:"bg-amber-100 text-amber-800",high:"bg-orange-100 text-orange-800",urgent:"bg-red-100 text-red-800"})[r];return(r,t)=>(o(),a("div",R,[T(M),e("main",q,[e("div",E,[e("button",{class:"w-9 h-9 rounded-pill bg-surface-muted text-ink-muted",onClick:t[0]||(t[0]=s=>A(k).back())},"←"),t[2]||(t[2]=e("h1",{class:"text-title flex-1"},"Symptom diary",-1))]),e("div",I,[t[4]||(t[4]=e("div",{class:"text-micro uppercase text-ink-subtle tracking-wider mb-2"},"Tell us what you've noticed",-1)),$(e("textarea",{"onUpdate:modelValue":t[1]||(t[1]=s=>i.value=s),rows:"3",placeholder:"e.g. Bella's been scratching her left ear since Tuesday",class:"w-full px-3 py-2 rounded-card bg-surface-muted border border-ink/10 text-body"},null,512),[[j,i.value]]),e("div",L,[(o(),a(x,null,v(["low","moderate","high","urgent"],s=>e("button",{key:s,class:g(["px-3 h-9 rounded-pill text-meta font-semibold",u.value===s?"bg-brand-500 text-white":"bg-surface-muted text-ink"]),onClick:_=>u.value=s},n(s),11,P)),64))]),e("label",U,[t[3]||(t[3]=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:C},null,32),e("span",G,n(c.value.length)+"/3",1)]),d.value?(o(),a("p",J,n(d.value),1)):p("",!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:m.value,onClick:S},n(m.value?"Sending…":"Send to clinic"),9,K)]),e("div",O,[t[6]||(t[6]=e("div",{class:"text-micro uppercase text-ink-subtle tracking-wider mb-2 px-1"},"History",-1)),b.value.length===0?(o(),a("div",Q,"No entries yet.")):p("",!0),(o(!0),a(x,null,v(b.value,s=>(o(),a("article",{key:s.id,class:"rounded-card bg-surface shadow-card p-4 mb-3"},[e("div",W,[e("span",{class:g(["px-2 py-0.5 rounded-pill text-[10px] font-bold uppercase",N(s.severity)])},n(s.severity),3),e("span",X,n(s.date_label),1)]),e("p",Y,n(s.body),1),s.photo_paths.length?(o(),a("div",Z,[(o(!0),a(x,null,v(s.photo_paths,(_,V)=>(o(),a("img",{key:V,src:_,class:"w-20 h-20 rounded-card object-cover"},null,8,ee))),128))])):p("",!0),s.reply_body?(o(),a("div",te,[t[5]||(t[5]=e("div",{class:"text-micro uppercase text-brand-700 font-bold tracking-wider"},"Clinic reply",-1)),e("p",se,n(s.reply_body),1)])):p("",!0)]))),128))])])]))}});export{le as default};
//# sourceMappingURL=SymptomDiaryView-DT2Xd92X.js.map
