1import{_ as H}from"./DlP9uqBQ.js";import{_ as A}from"./DC66rAUS.js";import{_ as Y}from"./ugxTuq8r.js";import{_ as Q}from"./DGPryvhF.js";import{e as W,q as G,A as g,x as J,z as N,P as O,fa as X,a3 as Z,B as ee,c,o as l,M as I,g as _,f as p,b,H as te,a as t,w as v,t as n,e3 as se,bh as w,n as $,f6 as ae,d as y,S as z,T as V,U as a}from"#entry";import{_ as ie}from"./U0GqvIMx.js";import"./kC3kxybx.js";import"./D5Td5aVQ.js";import"./CvtDo0MO.js";import"./Dmhids7v.js";import"./BBoVSIOO.js";import"./Ltqd2rAr.js";import"./DippbqLN.js";import"./C3DONDKa.js";const re={key:0,class:"flex justify-center items-center h-64"},oe={key:1,class:"bg-red-50 border border-red-200 rounded-lg p-4"},ne={key:2,class:"bg-yellow-50 border border-yellow-200 rounded-lg p-4"},le={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-4 mb-8"},de={class:"font-medium"},ce={class:"font-medium"},pe={class:"font-medium"},ue={class:"font-medium"},me={class:"font-medium"},ge={class:"font-medium"},ye={class:"font-medium"},fe={class:"font-medium"},_e={class:"font-medium"},be={key:0},ve={class:"font-medium"},xe={class:"mb-8 bg-[#F9F9FF] p-4"},he={class:"flex items-center gap-2 mb-2"},ke={class:"flex gap-2"},Ae={key:0,class:"text-gray-700 my-4"},Ne={key:1,class:"text-gray-500 my-4 italic"},we={key:0,class:"mb-4 p-3 bg-blue-50 border border-blue-200 rounded-lg"},Ce={class:"text-sm text-blue-700"},Be={key:0},Pe={class:"space-y-1"},Qe=W({__name:"[prescriptionId]",setup(De){const u=G(),x=g(()=>u.params.prescriptionId),h=J([]),F=r=>r?Array.isArray(r)?r.map(e=>e?.toString().trim()).filter(Boolean):r.toString().split(";").map(e=>e.trim()).filter(Boolean):[];N(x,()=>{h.value=[]},{immediate:!0});const f=g(()=>u.params.patientId),{result:K,loading:C,error:B,refetch:P}=O(X,()=>({patientId:f.value,first:Number(u.query.first)||10,page:Number(u.query.page)||1}),{fetchPolicy:"cache-and-network",enabled:g(()=>!!f.value),errorPolicy:"all"});N([x,f],async([r,e])=>{r&&e&&await P()},{immediate:!0});const s=g(()=>(K.value?.patientPrescriptions?.data||[]).find(e=>e.id===x.value)),T=()=>s.value?.prescription_details?.payment_info?.payment_type||"N/A",q=()=>s.value?.prescription_details?.clinical_info?.diagnosis||[],j=()=>!!s.value?.prescription_details?.medications?.some(e=>e.remarks),E=()=>(s.value?.prescription_details?.medications?.filter(e=>e.remarks)||[]).map(e=>`${e.name}: ${e.remarks}`).join("; "),R=()=>{const r=s.value?.status?.toLowerCase(),e=s.value?.status_summary;return[{accessorKey:"name",header:"Medication",cell:({row:i})=>{const o=i.original,d=o.name||o.medical_name,m=H;if(r==="fulfilled")return a("div",{class:"flex items-center gap-2"},[a(m,{modelValue:!0,disabled:!0}),a("span",{class:"text-gray-900"},d)]);if(r==="on-going"){const L=e?.issued_count||0;return(s.value?.prescription_details?.medications||[]).findIndex(U=>(U.id||U.name)===(o.id||o.name))<L?a("div",{class:"flex items-center gap-2"},[a("div",{class:"relative inline-block"},[a("div",{class:"w-4 h-4 border-2 border-blue-600 rounded flex items-center justify-center bg-white"},[a("div",{class:"w-2 h-0.5 bg-blue-600 rounded"})])]),a("div",{class:"flex flex-col ml-2"},[a("span",{class:"text-gray-900 font-medium"},d),a("span",{class:"text-sm text-orange-500"},"Processing")])]):a("span",{class:"text-gray-900"},d)}else if(r==="rejected")return a("span",{class:"text-red-600 line-through"},d);return a("span",{class:"text-gray-900"},d)},enableSorting:!1},{accessorKey:"dosage",header:"Dose",cell:({row:i})=>a("span",{class:"text-gray-500"},i.getValue("dosage")||"N/A"),enableSorting:!1},{accessorKey:"route",header:"Route",cell:({row:i})=>a("span",{class:"text-gray-500"},i.getValue("route")||"N/A"),enableSorting:!1},{accessorKey:"frequency",header:"Frequency",cell:({row:i})=>a("span",{class:"text-gray-500"},i.getValue("frequency")||"N/A"),enableSorting:!1},{accessorKey:"duration",header:"Duration",cell:({row:i})=>a("span",{class:"text-gray-500"},i.getValue("duration")||"N/A"),enableSorting:!1},{accessorKey:"quantity",header:"Quantity",cell:({row:i})=>a("span",{class:"text-gray-500"},i.getValue("quantity")||"N/A"),enableSorting:!1},{accessorKey:"status",header:()=>a("div",{class:"whitespace-nowrap"},"Status"),cell:({row:i})=>{const o=i.original.status;return a("div",{class:"flex items-center justify-start"},[a(A,{label:o?o.charAt(0).toUpperCase()+o.slice(1):"N/A",color:o?"primary":"gray",variant:"subtle"})])}},{accessorKey:"authorization_code_status",header:()=>a("div",{class:"whitespace-nowrap"},"Authorization Code Status"),cell:({row:i})=>{const o=i.original.authorization_code_status;return a("div",{class:"flex items-center justify-start"},[a(A,{label:o?o.charAt(0).toUpperCase()+o.slice(1):"N/A",color:o?"primary":"gray",variant:"subtle"})])}},{accessorKey:"authorization_code",header:a("div",{class:"whitespace-nowrap"},"Authorization Code"),cell:({row:i})=>{const o=i.original.authorization_code;return a("div",{class:"whitespace-nowrap"},o??"N/A")}},{accessorKey:"remarks",header:"Remarks",cell:({row:i})=>a("span",{class:"text-gray-500"},i.getValue("remarks")||"N/A"),enableSorting:!1}]},{createCustomBreadcrumbs:D,setBreadcrumbs:M}=Z(),S=g(()=>[{to:"/emr/dashboard",label:"Home",order:0},{to:`/emr/${f.value}/medication-history`,label:"Medication History",order:1},{label:"Prescription Details",order:2}]);return ee(async()=>{const r=D(S.value,u.path);M(r)}),N(()=>u.path,async r=>{const e=D(S.value,r);M(e)}),(r,e)=>{const k=A,i=Y,o=Q;return l(),c("div",null,[p(C)||!s.value&&!p(B)?(l(),c("div",re,[b(p(te),{size:"xl",loading:"",color:"primary",variant:"ghost"})])):p(B)?(l(),c("div",oe,[e[2]||(e[2]=t("div",{class:"text-danger"},"Error loading prescription details",-1)),t("button",{class:"mt-2 px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700",onClick:e[0]||(e[0]=d=>p(P)())}," Try Again ")])):!s.value&&!p(C)?(l(),c("div",ne,[e[3]||(e[3]=t("div",{class:"text-yellow-800"},"Prescription not found",-1)),t("button",{class:"mt-2 px-4 py-2 bg-yellow-600 text-white rounded hover:bg-yellow-700",onClick:e[1]||(e[1]=d=>r.$router.go(-1))}," Go Back ")])):s.value?(l(),I(o,{key:3,class:"p-8"},{default:v(()=>[t("div",null,[e[18]||(e[18]=t("h1",{class:"text-2xl font-bold mb-8"},"Prescription Details",-1)),e[19]||(e[19]=t("div",{class:"border-b border-gray-200 mb-8"},null,-1)),t("div",le,[t("div",null,[e[4]||(e[4]=t("p",{class:"text-sm text-gray-500"},"Patient name",-1)),t("p",de,n(s.value.prescription_details?.patient_info?.name||"N/A"),1)]),t("div",null,[e[5]||
1(e[5]=t("p",{class:"text-sm text-gray-500"},"Card number",-1)),t("p",ce,n(s.value.prescription_details?.patient_info?.card_number||"N/A"),1)]),t("div",null,[e[6]||(e[6]=t("p",{class:"text-sm text-gray-500"}," Medication price ",-1)),t("p",pe,n(p(se)(s.value.prescription_details?.payment_info?.total_price)),1)]),t("div",null,[e[7]||(e[7]=t("p",{class:"text-sm text-gray-500"},"Payment type",-1)),t("p",ue,n(T()),1)]),t("div",null,[e[8]||(e[8]=t("p",{class:"text-sm text-gray-500"}," Date/Time prescribed ",-1)),t("p",me,n(p(w)(s.value.prescription_details?.prescription_info?.date_prescribed)),1)]),t("div",null,[e[9]||(e[9]=t("p",{class:"text-sm text-gray-500"},"Payment status ",-1)),t("div",{class:$(["text-sm inline-flex items-center gap-2 px-4 py-1 border rounded-full",s.value.prescription_details?.payment_info?.payment_status==="unpaid"?"border-amber-400 text-amber-400":"border-green-700 text-green-700"])},[t("span",{class:$(["w-3 h-3 rounded-full",s.value.prescription_details?.payment_info?.payment_status==="unpaid"?"bg-amber-400":"bg-green-700"])},null,2),t("span",ge,n(s.value.prescription_details?.payment_info?.payment_status==="unpaid"?"Unpaid":s.value.prescription_details?.payment_info?.payment_status==="paid"?"Paid":"Unknown"),1)],2)]),t("div",null,[e[10]||(e[10]=t("p",{class:"text-sm text-gray-500"}," Prescription ID: ",-1)),t("p",ye,n(s.value.id),1)]),t("div",null,[e[11]||(e[11]=t("p",{class:"text-sm text-gray-500"},"Age",-1)),t("p",fe,n(p(ae)(p(w)(s.value.prescription_details?.patient_info?.dob,"DD-MM-YYYY"))),1)]),t("div",null,[e[12]||(e[12]=t("p",{class:"text-sm text-gray-500"},"Prescribed by",-1)),t("p",_e,n(s.value.prescription_details?.prescription_info?.prescribed_by||"N/A"),1)]),t("div",null,[e[13]||(e[13]=t("p",{class:"text-sm text-gray-500"},"Hospital Card Type",-1)),b(k,{variant:"solid",class:"bg-primary/10 text-primary px-3 py-1 rounded-full"},{default:v(()=>[y(n(s.value.prescription_details?.patient_info?.hospital_card_type||"N/A"),1)]),_:1})]),s.value.prescription_details?.prescription_info?.date_fulfilled?(l(),c("div",be,[e[14]||(e[14]=t("p",{class:"text-sm text-gray-500"},[y(" Date/Time Fulfilled "),t("span",{class:"text-red-500"},"*")],-1)),t("p",ve,n(p(w)(s.value.prescription_details.prescription_info.date_fulfilled)),1)])):_("",!0)]),e[20]||(e[20]=t("div",{class:"border-b border-gray-200 mb-8"},null,-1)),t("div",xe,[t("div",he,[e[15]||(e[15]=t("h6",{class:"text-xl font-semibold"},"Diagnosis",-1)),t("div",ke,[(l(!0),c(z,null,V(q(),(d,m)=>(l(),I(k,{key:m,color:"primary",variant:"solid",class:"bg-[#4A4DE4]/10 text-[#4A4DE4] px-3 py-1"},{default:v(()=>[y(n(d),1)]),_:2},1024))),128))])]),s.value.prescription_details?.clinical_info?.clinical_notes?(l(),c("p",Ae,[e[16]||(e[16]=t("strong",null,"Clinical Notes:",-1)),y(" "+n(s.value.prescription_details.clinical_info.clinical_notes),1)])):(l(),c("p",Ne,[...e[17]||(e[17]=[t("strong",null,"Clinical Notes:",-1),y(" No clinical notes provided ",-1)])]))]),h.value.length>0&&s.value.status?.toLowerCase()==="pending"?(l(),c("div",we,[t("p",Ce,n(h.value.length)+" medication(s) selected for action ",1)])):_("",!0)]),b(i,{data:s.value.prescription_details?.medications||[],columns:R(),class:"flex-1 mb-8"},{empty:v(()=>[b(p(ie),{title:"No medications",subtitle:"There are no medications in this prescription."})]),_:1},8,["data","columns"]),j()?(l(),c("div",Be,[e[21]||(e[21]=t("h5",{class:"font-semibold mb-2"},"Additional Notes:",-1)),t("div",Pe,[(l(!0),c(z,null,V(F(E()),(d,m)=>(l(),c("p",{key:m,class:"text-gray-700 text-sm"}," ⢠"+n(d),1))),128))])])):_("",!0)]),_:1})):_("",!0)])}}});export{Qe 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.