1import{f as D,b as I,r as n,j as e,H as N,L as T}from"./edge-BOITG1XR.js";function W(){const r=D(),{notify:o}=I(),[d,l]=n.useState([]),[a,c]=n.useState([]),[h,C]=n.useState(""),[m,z]=n.useState(""),[x,b]=n.useState(""),[g,B]=n.useState(""),[j,F]=n.useState("normal"),[f,$]=n.useState([]),[v,S]=n.useState(!1);n.useEffect(()=>{fetch("/api/admin/sue/ticket-departments").then(s=>s.json()).then(s=>{const i=s.data||[];l(i),i[0]&&b(i[0].id)});const t=localStorage.getItem("token");t&&fetch("/api/my/services",{headers:{Authorization:`Bearer ${t}`}}).then(s=>s.ok?s.json():{data:[]}).then(s=>c(s.data||[]))},[]);async function A(t){if(t.preventDefault(),!h||!m)return;S(!0);const s=localStorage.getItem("token");if(!s){r("/auth/login?next=/tickets/new");return}const i=new FormData;i.append("subject",h),i.append("body",m),x&&i.append("department_id",x),g&&i.append("service_id",g),i.append("priority",j);for(const u of f)i.append("files[]",u);const k=await fetch("/api/my/tickets",{method:"POST",headers:{Authorization:`Bearer ${s}`},body:i});if(S(!1),k.ok){const u=await k.json();o({title:"Ticket created",body:`#${u.ticket.id} â we'll respond within ~6 hours.`,tone:"success"}),r(`/ticket/${u.ticket.id}`)}else o({title:"Could not submit",body:"Please check your inputs and try again.",tone:"error"})}return e.jsxs(e.Fragment,{children:[e.jsx(N,{children:e.jsx("title",{children:"Open ticket | SUE"})}),e.jsx("section",{style:{padding:"32px 0 16px",background:"linear-gradient(180deg, #F8FAFC 0%, white 100%)",borderBottom:"1px solid var(--sue-border)"},children:e.jsxs("div",{className:"sue-container",style:{maxWidth:720},children:[e.jsx(T,{to:"/tickets",style:{fontSize:13,color:"var(--sue-blue-600)",textDecoration:"none",fontWeight:600},children:"â All tickets"}),e.jsx("h1",{style:{fontSize:"clamp(22px, 3vw, 28px)",fontWeight:800,margin:"12px 0 4px",letterSpacing:"-0.02em"},children:"Open a new ticket"}),e.jsx("p",{style:{color:"var(--sue-text-muted)",margin:0},children:"Average first response: ~6 hours, 24/7."})]})}),e.jsx("section",{style:{padding:"24px 0 64px"},children:e.jsx("div",{className:"sue-container",style:{maxWidth:720},children:e.jsxs("form",{onSubmit:A,style:{background:"white",border:"1px solid var(--sue-border)",borderRadius:12,padding:24,display:"flex",flexDirection:"column",gap:14},children:[e.jsx(P,{label:"Subject",value:h,onChange:C,required:!0,placeholder:"Short summary of the issue"}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[e.jsx(y,{label:"Department",value:x,onChange:b,options:d.map(t=>[t.id,t.name+(t.description?` â ${t.description}`:"")])}),e.jsx(y,{label:"Priority",value:j,onChange:F,options:[["low","Low"],["normal","Normal"],["high","High"],["urgent","Urgent â service down"]]})]}),a.length>0&&e.jsx(y,{label:"Related service (optional)",value:g,onChange:B,options:[["","â none â"],...a.map(t=>[t.id,`${t.product?.name} (#${String(t.id).padStart(4,"0")}) · ${t.status}`])]}),e.jsxs("div",{children:[e.jsxs("label",{style:p,children:["Message",e.jsx("span",{style:{color:"#B91C1C"},children:" *"})]}),e.jsx("textarea",{value:m,onChange:t=>z(t.target.value),rows:8,required:!0,style:{width:"100%",padding:12,fontSize:14,border:"1px solid var(--sue-border)",borderRadius:6,resize:"vertical",fontFamily:"inherit"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:p,children:"Attachments (optional, max 10MB each)"}),e.jsx("input",{type:"file",multiple:!0,onChange:t=>$(Array.from(t.target.files||[])),style:{display:"block",padding:6,fontSize:13}}),f.length>0&&e.jsx("div",{style:{marginTop:6,fontSize:12,color:"var(--sue-text-muted)"},children:f.map(t=>e.jsxs("div",{children:["ð ",t.name," (",(t.size/1024).toFixed(1)," KB)"]},t.name))})]}),e.jsx("button",{disabled:v,type:"submit",className:"sue-btn sue-btn-primary",children:v?"Submittingâ¦":"Submit ticket"})]})})})]})}function P({label:r,value:o,onChange:d,required:l,placeholder:a}){return e.jsxs("div",{children:[e.jsxs("label",{style:p,children:[r,l&&e.jsx("span",{style:{color:"#B91C1C"},children:" *"})]}),e.jsx("input",{value:o,onChange:c=>d(c.target.value),required:l,placeholder:a,style:w})]})}function y({label:r,value:o,onChange:d,options:l}){return e.jsxs("div",{children:[e.jsx("label",{style:p,children:r}),e.jsx("select",{value:o,onChange:a=>d(a.target.value),style:w,children:l.map(([a,c])=>e.jsx("option",{value:a,children:c},a))})]})}const p={fontSize:12,fontWeight:600,color:"var(--sue-text-muted)",textTransform:"uppercase",letterSpacing:"0.05em",display:"block",marginBottom:6},w={width:"100%",padding:"8px 12px",fontSize:14,border:"1px solid var(--sue-border)",borderRadius:6};export{W 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.