import{j as e,q as m,J as p}from"./app-DB4YCWeF.js";import{u as d}from"./useFormBuilder-DOwOU0AC.js";import{a as c}from"./FormBuilder-Dm7wfKiL.js";import{u as f,A as n}from"./BaseForm-CkSb_d40.js";import{h as i}from"./useFormChange-B0pYJsvh.js";import{c as u,T as b}from"./DetailModalContent-CbTh58kC.js";import{useTableHeader as x}from"./Index-DxlJTSux.js";import{useTableHeader as h}from"./Index-DK-CL8vb.js";import"./Input-BfNm_9oA.js";import"./Select-DXXQNVxU.js";import"./index-D_LogWT2.js";import"./Checkbox-Bn48SEXM.js";import"./clsx-B-dksMZM.js";import"./lib-C9iOZMGt.js";import"./WithModal-BI-p938E.js";import"./AuthenticatedLayout-DqLtl3fm.js";function S({isEdit:a=!1}){const s=d({isEdit:a,getProperties:j});return e.jsx(c,{...s})}const j=a=>{const{props:t,setData:s}=a,{params:r}=f(t.location);return[[{form:"select",props:{isReactSelect:!0,name:"patient_id",label:"Pasien",options:t.patients,handleChange:o=>i({e:o,name:"patient_id",setData:s,params:r,only:["selected_patient","selected_medical_records"]}),alt:e.jsx(n,{path:`/admin/patients/create?ref=${t.location}`})}},{form:"select",props:{isReactSelect:!0,name:"doctor_id",label:"Dokter",options:t.doctors,handleChange:o=>i({e:o,name:"doctor_id",setData:s,params:r}),alt:e.jsx(n,{path:`/admin/doctors/create?ref=${t.location}`})}},{form:"input",props:{type:"date",name:"date",label:"Tanggal"}}],[{form:"textarea",props:{name:"complaint",label:"Keluhan",bottomLabel:"Tekan Enter untuk menambahkan baris baru"}}],[{form:"textarea",props:{name:"note",label:"Keterangan",heightClassName:"h-44",bottomLabel:"Tekan Enter untuk menambahkan baris baru"}},{form:"textarea",props:{name:"treatment",label:"Tindakan",heightClassName:"h-44",bottomLabel:"Tekan Enter untuk menambahkan baris baru"}}],[{custom:o=>e.jsx(g,{...o})}]]},g=()=>{const{selected_patient:a,selected_medical_records:t,location:s}=m().props;if(!a)return e.jsx(e.Fragment,{});let r=h();return r=r==null?void 0:r.filter(l=>["id","date","complaint","note","treatment"].includes(l.value)),e.jsxs("div",{className:"w-full flex flex-col md:flex-row gap-2",children:[e.jsxs("div",{className:"w-full max-w-lg border p-2",children:[e.jsx("div",{className:"flex flex-wrap justify-between",children:e.jsx("p",{className:"text-purple-400 font-semibold",children:"Data Pasien"})}),e.jsx(u,{data:a,tableHeader:x()}),e.jsx("div",{className:"mt-2 flex justify-end",children:e.jsxs(p,{href:`/admin/patients/${a==null?void 0:a.id}/edit?ref=${s}`,className:"btn btn-sm btn-outline",children:[e.jsx("i",{className:"fas fa-edit"}),"Perbarui Data"]})})]}),e.jsxs("div",{className:"flex-1 border p-2 h-full max-h-[25rem] overflow-auto",children:[e.jsx("div",{className:"flex flex-wrap justify-between",children:e.jsx("p",{className:"text-purple-400 font-semibold",children:"Data Rekam Medis"})}),e.jsx(b,{tableHeader:r,tableBody:t??[]})]})]})};export{S as default};
