1import{a9 as T,_ as x,v as w,t as R,K as e,a as S,a0 as L,b as O,c as z,d as h,V as $,E as D,z as B,m as K,l as M}from"./index-DAzuBH0e.js";import{D as W}from"./DashboardLayout-DpX0uNqd.js";import{p as _}from"./parseISO-CNvTXZrE.js";const C={submitted:{label:"Submitted",color:"#d97706",bg:"#fef3c7"},under_review:{label:"Under Review",color:"#2563eb",bg:"#dbeafe"},action_taken:{label:"Action Taken",color:"#16a34a",bg:"#dcfce7"},closed:{label:"Closed",color:"#6b7280",bg:"#f3f4f6"}},E=({status:c})=>{const a=C[c]??C.submitted;return e.jsx("span",{style:{display:"inline-block",padding:"3px 10px",borderRadius:12,fontSize:"0.78rem",fontWeight:600,color:a.color,background:a.bg},children:a.label})},F={width:"100%",borderCollapse:"collapse",fontFamily:"'Inter', system-ui, sans-serif",fontSize:"0.9rem"},m={textAlign:"left",padding:"12px 16px",background:"#f9fafb",borderBottom:"2px solid #e5e7eb",color:"#374151",fontWeight:600,fontSize:"0.82rem",textTransform:"uppercase",letterSpacing:"0.3px",cursor:"pointer",userSelect:"none"},r={padding:"12px 16px",borderBottom:"1px solid #e5e7eb",color:"#1f2937"},y=({label:c,sortKey:a,current:n,direction:d,onClick:j})=>e.jsx("th",{style:m,onClick:()=>j(a),children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[c,n===a&&e.jsx(S,{icon:d==="asc"?K:M,style:{fontSize:12}})]})}),V=()=>{const c=T(),a=w,n=R,[d,j]=x.useState(""),[b,I]=x.useState("all"),[l,A]=x.useState("date"),[i,v]=x.useState("desc"),p=t=>{l===t?v(s=>s==="asc"?"desc":"asc"):(A(t),v("asc"))},g=x.useMemo(()=>{let t=[...a];if(b!=="all"&&(t=t.filter(s=>s.status===b)),d.trim()){const s=d.toLowerCase();t=t.filter(o=>(n.caseRef??"").toLowerCase().includes(s)||o.location.toLowerCase().includes(s)||o.description.toLowerCase().includes(s))}return t.sort((s,o)=>{let f="",u="";switch(l){case"date":f=s.$createdAt,u=o.$createdAt;break;case"status":f=s.status,u=o.status;break;case"violationType":f=s.violationType??"",u=o.violationType??"";break;case"location":f=s.location,u=o.location;break;default:f=s.$createdAt,u=o.$createdAt}const k=f.localeCompare(u);return i==="asc"?k:-k}),t},[a,d,b,l,i,n]);return e.jsxs(W,{activeTab:"cases",children:[e.jsxs("div",{style:{marginBottom:24},children:[e.jsx("h1",{style:{margin:0,fontSize:"1.5rem",fontWeight:700,color:"#1a2744"},children:"Case Management"}),e.jsxs("p",{style:{margin:"4px 0 0",color:"#6b7280",fontSize:"0.9rem"},children:[g.length," case",g.length!==1?"s":""," found"]})]}),e.jsxs("div",{style:{display:"flex",gap:16,marginBottom:20,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,background:"#fff",borderRadius:8,padding:"0 12px",border:"1px solid #e5e7eb",flex:"1 1 320px",maxWidth:400},children:[e.jsx(S,{icon:L,style:{fontSize:18,color:"#9ca3af"}}),e.jsx(O,{placeholder:"Search by case ref, location, or descriptionâ¦",value:d,onIonInput:t=>j(t.detail.value??""),style:{"--padding-start":"0","--padding-top":"8px","--padding-bottom":"8px"}})]}),e.jsx("div",{style:{minWidth:180},children:e.jsxs(z,{value:b,onIonChange:t=>I(t.detail.value),interface:"popover",placeholder:"Filter by status",style:{background:"#fff",borderRadius:8,border:"1px solid #e5e7eb",padding:"0 12px",fontSize:"0.9rem"},children:[e.jsx(h,{value:"all",children:"All Statuses"}),e.jsx(h,{value:"submitted",children:"Submitted"}),e.jsx(h,{value:"under_review",children:"Under Review"}),e.jsx(h,{value:"action_taken",children:"Action Taken"}),e.jsx(h,{value:"closed",children:"Closed"})]})})]}),e.jsx("div",{style:{background:"#fff",borderRadius:8,boxShadow:"0 1px 3px rgba(0,0,0,0.08)",overflow:"hidden"},children:e.jsxs("table",{style:F,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx(y,{label:"Case #",sortKey:"caseRef",current:l,direction:i,onClick:p}),e.jsx("th",{style:m,children:"PO #"}),e.jsx("th",{style:m,children:"Detective"}),e.jsx(y,{label:"Violation Type",sortKey:"violationType",current:l,direction:i,onClick:p}),e.jsx(y,{label:"Location",sortKey:"location",current:l,direction:i,onClick:p}),e.jsx(y,{label:"Date",sortKey:"date",current:l,direction:i,onClick:p}),e.jsx(y,{label:"Status",sortKey:"status",current:l,direction:i,onClick:p}),e.jsx("th",{style:m,children:"Actions"})]})}),e.jsxs("tbody",{children:[g.map((t,s)=>e.jsxs("tr",{style:{background:s%2===1?"#f9fafb":"#fff",cursor:"pointer"},onClick:()=>c.push(`/dashboard/cases/${t.$id}`),onMouseEnter:o=>{o.currentTarget.style.background="#f0f4ff"},onMouseLeave:o=>{o.currentTarget.style.background=s%2===1?"#f9fafb":"#fff"},children:[e.jsx("td",{style:{...r,fontWeight:600,color:"#3880ff"},children:n.caseRef}),e.jsx("td",{style:r,children:n.protectiveOrderRef}),e.jsx("td",{style:r,children:n.detectiveName}),e.jsx("td",{style:r,children:$[t.violationType??"other"]}),e.jsx("td",{style:r,children:t.location}),e.jsx("td",{style:r,children:D(_(t.$createdAt),"MMM d, yyyy")}),e.jsx("td",{style:r,children:e.jsx(E,{status:t.status})}),e.jsx("td",{style:r,children:e.jsx(S,{icon:B,style:{fontSize:20,color:"#3880ff",cursor:"pointer"},onClick:o=>{o.stopPropagation(),c.push(`/dashboard/cases/${t.$id}`)}})})]},t.$id)),g.length===0&&e.jsx("tr",{children:e.jsx("td",{style:{...r,textAlign:"center",color:"#9ca3af",padding:32},colSpan:8,children:"No cases match your search criteria."})})]})]})})]})};export{V 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.