1import{r,j as e,S as w,x as h,A as n}from"./app-Mnt2IEGe.js";import{A as v}from"./AdminLayout-BmUjNvXu.js";import{D as C}from"./download-CiQft0wG.js";import{S}from"./search-BeXkNHdv.js";import{F as k}from"./funnel-EMzM2dYZ.js";import{P as D}from"./phone-DSAsYLtt.js";import{M as _}from"./mail-Ce-sk81h.js";import{M as F}from"./map-pin-BuVEKMGp.js";import{C as A}from"./clock-Dnho5FNh.js";import{E as P}from"./eye-D7lGIL4B.js";import{F as E}from"./file-text-CWVCBaYs.js";import{C as g}from"./circle-alert-S9ghvfS7.js";import{C as M}from"./circle-check-big-DOBAhIbM.js";import"./ApplicationLogo-JvKRx6b1.js";import"./ResponsiveNavLink-xYyYAnIm.js";import"./transition-caWIvkel.js";import"./chevron-down-BlAiga6f.js";function X({consultations:s,filters:a}){const[l,c]=r.useState(a.search||""),[i,d]=r.useState(a.status||"all"),[x,o]=r.useState(a.from_date||""),[m,p]=r.useState(a.to_date||""),u=t=>{t.preventDefault(),n.get(route("admin.consultations.index"),{search:l,status:i,from_date:x,to_date:m})},y=()=>{c(""),d("all"),o(""),p(""),n.get(route("admin.consultations.index"))},j=()=>{n.get(route("admin.consultations.export"),{search:l,status:i})},f=t=>{switch(t){case"pending":return"bg-yellow-100 text-yellow-800";case"reviewed":return"bg-blue-100 text-blue-800";case"responded":return"bg-green-100 text-green-800";case"completed":return"bg-gray-100 text-gray-800";default:return"bg-gray-100 text-gray-800"}},N=t=>{switch(t){case"pending":return e.jsx(g,{className:"w-4 h-4"});case"reviewed":case"responded":case"completed":return e.jsx(M,{className:"w-4 h-4"});default:return e.jsx(g,{className:"w-4 h-4"})}};return e.jsxs(v,{children:[e.jsx(w,{title:"Consultations"}),e.jsx("div",{className:"py-12",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Online Consultations"}),e.jsx("p",{className:"text-gray-600 mt-2",children:"Manage and track patient consultations"})]}),e.jsxs("button",{onClick:j,className:"inline-flex items-center gap-2 bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg transition",children:[e.jsx(C,{className:"w-4 h-4"}),"Export CSV"]})]}),e.jsx("form",{onSubmit:u,className:"bg-white rounded-lg shadow p-6 space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-5 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Search"}),e.jsxs("div",{className:"relative",children:[e.jsx(S,{className:"absolute left-3 top-3 w-4 h-4 text-gray-400"}),e.jsx("input",{type:"text",value:l,onChange:t=>c(t.target.value),placeholder:"Name, mobile, email...",className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Status"}),e.jsxs("select",{value:i,onChange:t=>d(t.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary",children:[e.jsx("option",{value:"all",children:"All Status"}),e.jsx("option",{value:"pending",children:"Pending"}),e.jsx("option",{value:"reviewed",children:"Reviewed"}),e.jsx("option",{value:"responded",children:"Responded"}),e.jsx("option",{value:"completed",children:"Completed"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"From Date"}),e.jsx("input",{type:"date",value:x,onChange:t=>o(t.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"To Date"}),e.jsx("input",{type:"date",value:m,onChange:t=>p(t.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary"})]}),e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsxs("button",{type:"submit",className:"flex-1 bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg transition",children:[e.jsx(k,{className:"w-4 h-4 inline mr-2"}),"Filter"]}),e.jsx("button",{type:"button",onClick:y,className:"bg-gray-300 hover:bg-gray-400 text-gray-700 px-4 py-2 rounded-lg transition",children:"Clear"})]})]})})]}),e.jsxs("div",{className:"mb-4 text-sm text-gray-600",children:["Found"," ",e.jsx("span",{className:"font-semibold",children:s.total})," ","consultation(s)"]}),e.jsx("div",{className:"bg-white rounded-lg shadow overflow-hidden",children:s.data.length>0?e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50 border-b border-gray-200",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Patient"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Contact"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"City"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Status"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Date"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider",children:"Action"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200",children:s.data.map(t=>e.jsxs("tr",{className:"hover:bg-gray-50 transition",children:[e.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[e.jsx("div",{className:"text-sm font-medium text-gray-900",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500",children:t.name_identifier?`ID: ${t.name_identifier}`:"New Patient"})]}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"text-sm text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(D,{className:"w-3 h-3"}),t.mobile]}),e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(_,{className:"w-3 h-3"}),t.email||"N/A"]})]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"text-sm flex items-center gap-1 text-gray-600",children:[e.jsx(F,{className:"w-3 h-3"}),t.city]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("span",{className:`inline-flex items-center gap-1 px-3 py-1 rounded-full text-xs font-semibold ${f(t.status)}`,children:[N(t.status),t.status.charAt(0).toUpperCase()+t.status.slice(1)]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"text-sm text-gray-600 flex items-center gap-1",children:[e.jsx(A,{className:"w-3 h-3"}),new Date(t.created_at).toLocaleDateString("en-IN")]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs(h,{href:route("admin.consultations.show",t.id),className:"inline-flex items-center gap-1 bg-primary hover:bg-blue-700 text-white px-3 py-1 rounded text-sm transition",children:[e.jsx(P,{className:"w-4 h-4"}),"View"]}
1)})]},t.id))})]})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(E,{className:"w-12 h-12 text-gray-300 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"No consultations found"}),e.jsx("p",{className:"text-gray-500 mt-2",children:"Try adjusting your filters"})]})}),s.last_page>1&&e.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[e.jsxs("div",{className:"text-sm text-gray-600",children:["Page ",s.current_page," of"," ",s.last_page]}),e.jsx("div",{className:"flex gap-2",children:s.links.map((t,b)=>e.jsx(h,{href:t.url||"#",className:`px-3 py-1 rounded text-sm ${t.active?"bg-primary text-white":"bg-gray-200 text-gray-700 hover:bg-gray-300"} ${t.url?"":"cursor-not-allowed opacity-50"}`,dangerouslySetInnerHTML:{__html:t.label}},b))})]})]})})]})}export{X 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.