import{T as g,h as x,f as p,o as a,a as e,t,e as b,k,u as r,l as w,c as d,g as y,n as $,b as f,d as C,F as S,O as V}from"./app-43851608.js";import{_ as B}from"./App-26099fac.js";import"./index-17cd980e.js";import{_ as L}from"./FormTextArea-a182534a.js";import"./Sidebar-13bbdf6e.js";import"./Menu-7a7609fd.js";import"./Modal-22a49fae.js";import"./ProfileModal-628e5b7c.js";import"./FormInput-4a309017.js";import"./LangToggle-8d05b0dc.js";import"./index-99011d5f.js";import"./MobileSidebar-64958b6d.js";/* empty css              */const N={class:"bg-white md:bg-inherit pt-0 px-4 md:pt-8 md:p-8 rounded-[5px] text-[#000] overflow-y-scroll"},T={class:"flex justify-between mt-8 md:mt-0"},j={class:"text-xl mb-1"},z=e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16"},[e("path",{fill:"currentColor","fill-rule":"evenodd",d:"M5.841 5.28a.75.75 0 0 0-1.06-1.06L1.53 7.47L1 8l.53.53l3.25 3.25a.75.75 0 0 0 1.061-1.06l-1.97-1.97H24.25a.75.75 0 0 0 0-1.5H3.871l1.97-1.97Z","clip-rule":"evenodd"})],-1),A={class:"grid grid-cols-2 md:flex gap-x-6 mt-4 md:mt-10"},D={class:"col-span-2 md:order-1 md:w-[70%]"},U={class:"bg-white border py-5 px-5 rounded-[0.5rem] mb-4 text-sm"},F={class:"text-xl"},I={class:"border border-dashed py-2 px-2 mt-8 bg-slate-100"},M={key:0,class:"bg-white border py-5 px-5 rounded-[0.5rem] mb-4"},H={type:"submit",class:"mb-2 rounded-md bg-black px-3 py-2 text-sm text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2"},O={class:"flex space-x-4 text-sm"},E={class:"bg-slate-100 rounded-full h-12 w-12 p-4 flex justify-center items-center"},P={class:"space-x-4 mb-1"},R={class:"col-span-2 w-[100%] md:order-2 md:w-[30%]"},Z={class:"bg-white border p-4 text-sm rounded-[0.5rem]"},q={class:"bg-slate-100 p-2 rounded mb-2 space-x-3"},G={class:"capitalize"},J={class:"bg-slate-100 p-2 rounded mb-2 space-x-3"},K={class:"capitalize"},Q={class:"bg-slate-100 p-2 rounded mb-2 space-x-3"},W={class:"capitalize"},X={class:"bg-slate-100 p-2 rounded mb-2 space-x-3"},Y={key:0,class:"flex grid grid-cols-2 space-x-2 mt-4"},pe={__name:"View",props:["ticket"],setup(h){const o=h,n=g({message:null}),u=s=>{const l={month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"};return new Date(s).toLocaleString("en-US",l)},v=(s,l)=>{const i=s.charAt(0).toUpperCase(),c=l.charAt(0).toUpperCase();return`${i}${c}`},_=()=>{n.post("/support/"+o.ticket.uuid+"/comment",{preserveScroll:!0,onSuccess:()=>n.reset()})},m=s=>{V.post("/support/"+o.ticket.uuid+"/status",{status:s})};return(s,l)=>(a(),x(B,null,{default:p(()=>[e("div",N,[e("div",T,[e("div",null,[e("h2",j,t(s.$t("Ticket ref"))+": "+t(o.ticket.reference),1)]),e("div",null,[b(r(w),{href:"/support",class:"flex items-center space-x-4 rounded-md bg-indigo-600 px-3 py-2 text-sm text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"},{default:p(()=>[z,k(" "+t(s.$t("Back")),1)]),_:1})])]),e("div",A,[e("div",D,[e("div",U,[e("h2",F,t(s.$t("Subject"))+": "+t(o.ticket.subject),1),e("div",I,t(o.ticket.message),1)]),o.ticket.status==="open"||o.ticket.status==="pending"?(a(),d("div",M,[e("form",{onSubmit:l[1]||(l[1]=y(i=>_(),["prevent"]))},[b(L,{modelValue:r(n).message,"onUpdate:modelValue":l[0]||(l[0]=i=>r(n).message=i),name:s.$t("Comment"),type:"text",showLabel:!0,error:r(n).errors.message,textAreaRows:3,class:$("sm:col-span-6 mb-5")},null,8,["modelValue","name","error"]),e("button",H,t(s.$t("Add comment")),1)],32)])):f("",!0),(a(!0),d(S,null,C(o.ticket.comments_with_user,(i,c)=>(a(),d("div",{key:c,class:"bg-white border py-5 px-5 rounded-[0.5rem] mb-2"},[e("div",O,[e("div",null,[e("div",E,t(v(i.user.first_name,i.user.last_name)),1)]),e("div",null,[e("div",P,[e("span",null,t(i.user.first_name+" "+i.user.last_name),1),e("span",null,t(u(i.created_at)),1)]),e("div",null,t(i.message),1)])])]))),128))]),e("div",R,[e("div",Z,[e("div",q,[e("span",null,t(s.$t("Category"))+":",1),e("span",G,t(o.ticket.category.name),1)]),e("div",J,[e("span",null,t(s.$t("Status"))+":",1),e("span",K,t(o.ticket.status),1)]),e("div",Q,[e("span",null,t(s.$t("Priority"))+":",1),e("span",W,t(o.ticket.priority??s.$t("Not set")),1)]),e("div",X,[e("span",null,t(s.$t("Date created"))+":",1),e("span",null,t(u(o.ticket.created_at)),1)]),o.ticket.status==="open"||o.ticket.status==="pending"?(a(),d("div",Y,[e("button",{onClick:l[2]||(l[2]=i=>m("closed")),class:"mb-2 rounded-md bg-black px-3 py-2 text-sm text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2"},t(s.$t("Close ticket")),1),e("button",{onClick:l[3]||(l[3]=i=>m("resolved")),class:"mb-2 rounded-md bg-black px-3 py-2 text-sm text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2"},t(s.$t("Mark as resolved")),1)])):f("",!0)])])])])]),_:1}))}};export{pe as default};
