1import{z as y,r as s,t as u,j as e,L as j}from"./index-CfcSdzPN.js";import{u as k}from"./useQuery-DDNSg42L.js";import{u as v}from"./useMutation-e7_SgXT4.js";import{u as m}from"./useServerFn-DgcYVCxo.js";import{l as w,a as N}from"./tickets.functions-DoEv6rlK.js";import{a as S,c as C,M,d as T}from"./mobile-ui-DuR_KxHn.js";import{C as L}from"./chevron-right-DveOVDzo.js";import{P as q}from"./plus-CyGZBdyg.js";function R(){const p=m(w),x=m(N),b=y(),[g,i]=s.useState(!1),[r,l]=s.useState(""),[a,d]=s.useState(""),[c,h]=s.useState("technical"),{data:o,isLoading:f}=k({queryKey:["m-tickets"],queryFn:()=>p()}),n=v({mutationFn:async()=>x({data:{subject:r,body:a,category:c,priority:"normal"}}),onSuccess:async()=>{u.success("Ticket created"),l(""),d(""),i(!1),await b.invalidateQueries({queryKey:["m-tickets"]})},onError:t=>u.error(t.message)});return e.jsxs(S,{title:"Support",subtitle:"We usually reply within one business day",action:e.jsxs("button",{onClick:()=>i(t=>!t),className:"inline-flex items-center gap-1 rounded-full bg-brand px-3 py-1.5 text-xs font-semibold text-brand-foreground",children:[e.jsx(q,{className:"h-3.5 w-3.5"})," New"]}),children:[g&&e.jsxs(C,{className:"space-y-2",children:[e.jsx("input",{value:r,onChange:t=>l(t.target.value),placeholder:"Subject",className:"w-full rounded-xl border border-border bg-background px-3 py-2 text-sm"}),e.jsxs("select",{value:c,onChange:t=>h(t.target.value),className:"w-full rounded-xl border border-border bg-background px-3 py-2 text-sm",children:[e.jsx("option",{value:"technical",children:"Technical"}),e.jsx("option",{value:"fleet",children:"Fleet"}),e.jsx("option",{value:"billing",children:"Billing"}),e.jsx("option",{value:"other",children:"Other"})]}),e.jsx("textarea",{value:a,onChange:t=>d(t.target.value),placeholder:"Describe what is happening",rows:4,className:"w-full rounded-xl border border-border bg-background px-3 py-2 text-sm"}),e.jsx("button",{onClick:()=>n.mutate(),disabled:n.isPending||!r.trim()||!a.trim(),className:"w-full rounded-xl bg-brand px-3 py-2.5 text-sm font-semibold text-brand-foreground disabled:opacity-60",children:n.isPending?"Sendingâ¦":"Send ticket"})]}),f?e.jsx(M,{}):!o||o.length===0?e.jsx(T,{title:"No tickets yet",hint:"Tap New to talk to our team."}):e.jsx("div",{className:"overflow-hidden rounded-2xl border border-border bg-card",children:o.map(t=>e.jsxs(j,{to:"/m/support/$id",params:{id:t.id},className:"flex items-center gap-3 border-b border-border px-4 py-3 last:border-b-0 active:bg-muted/50",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm font-semibold",children:t.subject}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.status," · ",new Date(t.updated_at).toLocaleDateString()]})]}),e.jsx(L,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]},t.id))})]})}export{R as component};
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.