import{j as k,q as g,f as s,i as p,b as t,e as d,F as m,t as b,G as w,v as o,T as q,s as f,c as C,r as a,o as V,h as N,_ as T}from"./index-DLUb5LSe.js";import{u as P}from"./data-D7xXWmPy.js";import{_ as $}from"./TopBar.vue_vue_type_script_setup_true_lang-DNeo4_WD.js";import{_ as B}from"./BottomNav.vue_vue_type_script_setup_true_lang-BcRvF8NM.js";const D={class:"pb-32 min-h-dvh"},R={class:"max-w-md mx-auto px-4 pt-2"},S={key:0,class:"text-center py-12 text-ink-muted"},j={class:"px-4 py-3 flex items-center gap-3 border-b border-ink/5"},z={class:"w-10 h-10 rounded-card bg-brand-50 text-2xl flex items-center justify-center"},F={class:"flex-1 min-w-0"},I={class:"font-bold truncate"},E={class:"text-meta text-ink-muted"},G={key:0,class:"text-meta text-ink-subtle"},L={key:0,class:"px-4 py-2 border-b border-ink/5 text-meta"},M={class:"px-4 py-3"},A={class:"font-bold text-meta"},H={class:"text-meta text-ink-muted"},J={key:0},K={key:1},O={key:2},Q={key:0,class:"text-meta text-ink-muted"},U={key:1,class:"px-4 py-3 border-t border-ink/5 bg-brand-50/40"},W=["disabled","onClick"],X={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"},Y=k({__name:"PrescriptionsView",setup(Z){const u=P(),l=f(null),c=f(null);g(()=>u.loadPrescriptions());const _=C(()=>u.prescriptions??[]);async function v(i){l.value=i.id;const r=await u.requestRefill(i.id);l.value=null,c.value=r.ok?`Refill request sent for ${i.ref_no}`:"Could not send request.",setTimeout(()=>{c.value=null},3e3)}const x=i=>({active:"bg-emerald-50 text-emerald-700 border-emerald-200",completed:"bg-slate-50 text-slate-700 border-slate-200",cancelled:"bg-red-50 text-red-700 border-red-200"})[i]??"bg-slate-50 text-slate-700 border-slate-200",h=i=>({dog:"🐕",cat:"🐈",rabbit:"🐇",bird:"🦜",fish:"🐟"})[i]??"🐾";return(i,r)=>(a(),s("div",D,[p($),t("main",R,[r[2]||(r[2]=t("h1",{class:"text-display py-4"},"Prescriptions",-1)),_.value.length===0?(a(),s("div",S,[...r[0]||(r[0]=[t("div",{class:"text-5xl mb-3 opacity-60"},"💊",-1),t("p",{class:"text-meta"},"No prescriptions on record.",-1)])])):d("",!0),(a(!0),s(m,null,b(_.value,e=>(a(),s("article",{key:e.id,class:"rounded-card bg-surface shadow-card overflow-hidden mb-3"},[t("header",j,[t("div",z,o(h(e.pet_species)),1),t("div",F,[t("div",I,o(e.pet_name),1),t("div",E,o(e.doctor_name??"—")+" · "+o(e.date_label),1),e.ref_no?(a(),s("div",G,o(e.ref_no),1)):d("",!0)]),t("span",{class:V(["px-2 py-0.5 rounded-pill text-[10px] font-bold uppercase border",x(e.status)])},o(e.status),3)]),e.diagnosis?(a(),s("div",L,[r[1]||(r[1]=t("span",{class:"text-ink-muted"},"Diagnosis:",-1)),N(" "+o(e.diagnosis),1)])):d("",!0),t("div",M,[(a(!0),s(m,null,b(e.items,(n,y)=>(a(),s("div",{key:y,class:"py-1.5 border-b border-ink/5 last:border-b-0"},[t("div",A,o(n.medicine),1),t("div",H,[n.dosage?(a(),s("span",J,o(n.dosage),1)):d("",!0),n.frequency?(a(),s("span",K," · "+o(n.frequency),1)):d("",!0),n.duration?(a(),s("span",O," · "+o(n.duration),1)):d("",!0)]),n.instructions?(a(),s("div",Q,o(n.instructions),1)):d("",!0)]))),128))]),e.status==="active"?(a(),s("div",U,[t("button",{class:"w-full h-10 rounded-pill bg-brand-500 text-white font-bold text-meta disabled:opacity-50",disabled:l.value===e.id,onClick:n=>v(e)},o(l.value===e.id?"Sending…":"💊 Request refill"),9,W)])):d("",!0)]))),128))]),p(q,{name:"toast"},{default:w(()=>[c.value?(a(),s("div",X,o(c.value),1)):d("",!0)]),_:1}),p(B)]))}}),ae=T(Y,[["__scopeId","data-v-bc494b7b"]]);export{ae as default};
//# sourceMappingURL=PrescriptionsView-GXk0LhMz.js.map
