import{q as b,j as a,J as h}from"./app-DB4YCWeF.js";import{A as w}from"./AuthenticatedLayout-DqLtl3fm.js";import{T as j,D,R as M,a as f,b as S}from"./DetailModalContent-CbTh58kC.js";import{M as d}from"./WithModal-BI-p938E.js";import{u as g}from"./BaseForm-CkSb_d40.js";import{b as k,s as _}from"./lib-C9iOZMGt.js";import"./clsx-B-dksMZM.js";import"./Select-DXXQNVxU.js";import"./index-D_LogWT2.js";function Y(e){var r,m,u,x;const n=y(),c=v(),[l,o]=k(_),i=t=>{o(t)};return a.jsxs(w,{title:e==null?void 0:e.title,children:[a.jsx(j,{search:!0,filter:!0,filterOptions:c,tableHeader:n,tableBody:((m=e==null?void 0:e[(r=e==null?void 0:e.page)==null?void 0:r.name])==null?void 0:m.data)??[],tablePage:(x=e==null?void 0:e[(u=e==null?void 0:e.page)==null?void 0:u.name])==null?void 0:x.links,headerButton:()=>{var t,s;return a.jsx(a.Fragment,{children:a.jsxs(h,{href:`${(t=e==null?void 0:e.page)==null?void 0:t.url}/create`,className:"btn btn-primary w-max btn-sm text-white",children:["Tambah ",(s=e==null?void 0:e.page)==null?void 0:s.label]})})},tableAction:t=>{var s;return a.jsxs(a.Fragment,{children:[a.jsx("li",{children:a.jsx(d,{id:`detail_${t==null?void 0:t.id}`,onClick:()=>i(t),children:a.jsx("span",{children:"Lihat Detail"})})}),t.deleted_at?a.jsx("li",{children:a.jsx(d,{id:`modal_restore_${t==null?void 0:t.id}`,onClick:()=>i(t),children:"Pulihkan Data"})}):a.jsx("li",{children:a.jsx(h,{href:`${(s=e==null?void 0:e.page)==null?void 0:s.url}/${t.id}/edit`,className:"",children:"Edit"})}),a.jsx("li",{children:a.jsxs(d,{id:`modal_delete_${t==null?void 0:t.id}`,onClick:()=>i(t),children:["Hapus ",t.deleted_at?"Permanen":""]})})]})}}),l?a.jsxs(a.Fragment,{children:[a.jsx(D,{id:l==null?void 0:l.id,label:l.name,isForceDelete:l.deleted_at!=null,handleClick:()=>i(null)}),a.jsx(M,{id:l==null?void 0:l.id,label:l.name,handleClick:()=>i(null)}),a.jsx(f,{id:l==null?void 0:l.id,tableHeader:n,data:l,handleClick:()=>i(null),content:t=>S(t,n),size:"max-w-2xl"})]}):null]})}const y=()=>{const{page:e,isAdmin:n,location:c}=b().props;return g(c),[{label:"#",value:"id",type:"numbering"},{label:"Dokter",value:"doctor.name",isSearchable:!0,isModalDetail:!0,className:"text-[13px] w-[10%] md:w-[100px] !whitespace-pre"},{label:"Pasien",value:"patient.name",isSearchable:!0,isModalDetail:!0,className:"text-[13px] w-[10%] md:w-[100px] !whitespace-pre"},{label:"Tanggal",value:"date",type:"date",dateFormat:"DD MMM YYYY",isSearchable:!0,isModalDetail:!0,className:"text-[13px] w-[10%] md:w-[100px] !whitespace-pre"},{label:"Keluhan",value:"complaint",isSearchable:!0,isModalDetail:!0,type:"list",className:"text-[13px] w-[10%] md:w-[200px] !whitespace-pre"},{label:"Keterangan",value:"note",isSearchable:!0,isModalDetail:!0,type:"list",className:"text-[13px] w-[10%] md:w-[200px] !whitespace-pre"},{label:"Tindakan",value:"treatment",isSearchable:!0,isModalDetail:!0,type:"list",className:"text-[13px] w-[10%] md:w-[200px] !whitespace-pre"},{label:"Ditambahkan",value:"created_at",type:"date",isSearchable:!0,className:"text-[13px] w-[10%] md:w-[100px] !whitespace-pre"},{label:"Diperbarui",value:"updated_at",type:"date",isSearchable:!0,className:"text-[13px] w-[10%] md:w-[100px] !whitespace-pre"},{label:"Aksi",value:"action",type:"action",isSortable:!1}]},v=()=>{const{props:e}=b();return[{name:"doctor_id",data:e==null?void 0:e.doctor_id,label:"Filter Dokter",isReactSelect:!0},{name:"institute",data:e==null?void 0:e.institute,label:"Filter Instansi Dokter",isReactSelect:!0},{name:"patient_id",data:e==null?void 0:e.patient_id,label:"Filter Pasien",isReactSelect:!0}]};export{Y as default,y as useTableHeader};
