import{r as k,c as r,a as u,u as V,Z as S,w as i,b as e,d as m,o as a,F as p,e as _,t as l,v as g,h as U,k as A,N as v}from"./app-z_grtNg1.js";import{_ as N}from"./AdminLayout-D8-5CkB9.js";import{_ as h}from"./AppCard-C2KBW1s0.js";import{_ as T}from"./StatusBadge-DAu0ZF3H.js";import"./ToastStack-xenoaUxd.js";const j={class:"mx-auto max-w-7xl space-y-6 px-4 py-6 sm:px-6 lg:px-8"},B={class:"flex gap-3"},C=["value"],F={class:"space-y-4"},$={class:"space-y-4"},D={class:"flex flex-wrap items-start justify-between gap-3"},M={class:"text-sm font-semibold text-gray-900"},O={class:"mt-1 text-xs text-gray-500"},q={class:"rounded bg-gray-50 p-3 text-sm text-gray-700"},E={class:"grid gap-3 sm:grid-cols-2"},I=["onUpdate:modelValue"],L=["value"],R=["onClick"],Z=["onUpdate:modelValue"],Q={__name:"Index",props:{tickets:Object,filters:Object,statuses:Array},setup(d){var x;const c=k({status:((x=d.filters)==null?void 0:x.status)||""}),b=()=>{v.get(route("admin.tickets.index"),c,{preserveState:!0,replace:!0})},w=n=>{v.patch(route("admin.tickets.update",n.id),{status:n.status,admin_reply:n.admin_reply||""},{preserveScroll:!0})};return(n,o)=>(a(),r(p,null,[u(V(S),{title:"Tickets"}),u(N,null,{header:i(()=>[...o[1]||(o[1]=[e("div",null,[e("h2",{class:"text-xl font-semibold text-gray-800"},"Support Tickets"),e("p",{class:"mt-1 text-sm text-gray-500"},"Respond to user tickets and link issues to transactions.")],-1)])]),default:i(()=>[e("div",j,[u(h,{title:"Filter"},{default:i(()=>[e("div",B,[m(e("select",{"onUpdate:modelValue":o[0]||(o[0]=t=>c.status=t),class:"rounded-md border-gray-300 text-sm shadow-sm"},[o[2]||(o[2]=e("option",{value:""},"All statuses",-1)),(a(!0),r(p,null,_(d.statuses,t=>(a(),r("option",{key:t,value:t},l(t),9,C))),128))],512),[[g,c.status]]),e("button",{type:"button",class:"rounded-md border border-gray-300 px-3 py-2 text-sm",onClick:b},"Apply")])]),_:1}),e("div",F,[(a(!0),r(p,null,_(d.tickets.data,t=>(a(),U(h,{key:t.id},{default:i(()=>{var y,f;return[e("div",$,[e("div",D,[e("div",null,[e("h3",M,l(t.subject),1),e("p",O,l((y=t.user)==null?void 0:y.name)+" | Tx: "+l(((f=t.transaction)==null?void 0:f.internal_reference)||"N/A"),1)]),u(T,{status:t.status},null,8,["status"])]),e("p",q,l(t.message),1),e("div",E,[m(e("select",{"onUpdate:modelValue":s=>t.status=s,class:"rounded-md border-gray-300 text-sm shadow-sm"},[(a(!0),r(p,null,_(d.statuses,s=>(a(),r("option",{key:s,value:s},l(s),9,L))),128))],8,I),[[g,t.status]]),e("button",{type:"button",class:"rounded-md border border-gray-300 px-3 py-2 text-sm",onClick:s=>w(t)}," Save Update ",8,R)]),m(e("textarea",{"onUpdate:modelValue":s=>t.admin_reply=s,rows:"3",class:"w-full rounded-md border-gray-300 text-sm shadow-sm",placeholder:"Admin reply"},null,8,Z),[[A,t.admin_reply]])])]}),_:2},1024))),128))])])]),_:1})],64))}};export{Q as default};
