1import{r as d,U as i,j as e,az as o}from"./index-Dmg69QaJ.js";import{C as f,a as S,b,c as C}from"./card-BwIY_KKB.js";import{T as g,a as v,b as u,c as a,d as y,e as r}from"./table-D0Rm9-5h.js";import{B as h}from"./badge-BJGk5ZwU.js";import{S as T,a as w,b as R,c as _,d as l}from"./select-Ch7ZN6DW.js";import"./index-D17hSi50.js";function P(){const[c,x]=d.useState([]);d.useEffect(()=>{n()},[]);const n=async()=>{const{data:s,error:t}=await i.from("support_requests").select("*").order("created_at",{ascending:!1});!t&&s&&x(s)},j=async(s,t)=>{const{error:m}=await i.from("support_requests").update({status:t}).eq("id",s);m?o.error("Failed to update status"):(o.success("Status updated"),n())},p=s=>{switch(s){case"high":return"destructive";case"medium":return"default";case"low":return"secondary";default:return"secondary"}};return e.jsxs("div",{className:"space-y-6",children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Support Requests"}),e.jsxs(f,{children:[e.jsx(S,{children:e.jsxs(b,{children:["All Requests (",c.length,")"]})}),e.jsx(C,{children:e.jsxs(g,{children:[e.jsx(v,{children:e.jsxs(u,{children:[e.jsx(a,{children:"Date"}),e.jsx(a,{children:"Client"}),e.jsx(a,{children:"Subject"}),e.jsx(a,{children:"Priority"}),e.jsx(a,{children:"Status"}),e.jsx(a,{children:"Actions"})]})}),e.jsx(y,{children:c.map(s=>e.jsxs(u,{children:[e.jsx(r,{children:new Date(s.created_at).toLocaleDateString()}),e.jsx(r,{className:"font-medium",children:s.client_name}),e.jsx(r,{children:s.subject}),e.jsx(r,{children:e.jsx(h,{variant:p(s.priority),children:s.priority})}),e.jsx(r,{children:e.jsx(h,{variant:s.status==="open"?"default":"secondary",children:s.status})}),e.jsx(r,{children:e.jsxs(T,{value:s.status,onValueChange:t=>j(s.id,t),children:[e.jsx(w,{className:"w-32",children:e.jsx(R,{})}),e.jsxs(_,{children:[e.jsx(l,{value:"open",children:"Open"}),e.jsx(l,{value:"in-progress",children:"In Progress"}),e.jsx(l,{value:"resolved",children:"Resolved"}),e.jsx(l,{value:"closed",children:"Closed"})]})]})})]},s.id))})]})})]})]})}export{P 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.