import{r as j,aU as g,j as e,aZ as f}from"./react-vendor-xYZnmIII.js";import{I as S}from"./input-error-_LAmvivg.js";import{L as N}from"./loading-button-D7aXR3K4.js";import{J as v,K as y,B as n,M as D,e as _,N as b,O as w,L as C,at as L,au as B,av as E,aw as I,ax as O,Q as T,U as z}from"./ui-components-CQM92IK3.js";import{u as F}from"./use-lang-Dg6I_Fym.js";import"./inertia-vendor-cBbDTmhJ.js";import"./ui-vendor-Ds9iwIxa.js";import"./interactive-vendor-B1OgcAgP.js";const Z=({id:o,translate:U})=>{const[i,r]=j.useState(!1),{dashboard:s,button:t}=F(),{data:c,setData:d,post:u,errors:p,processing:m}=g({user_type:"",newsletter_id:o}),x=a=>{a.preventDefault(),u(route("newsletters.send"),{onSuccess:()=>r(!1)})},h=[{title:s.all,value:"all"},{title:s.student,value:"student"},{title:t.instructor,value:"instructor"}];return e.jsxs(v,{open:i,onOpenChange:r,children:[e.jsx(y,{children:e.jsx(n,{size:"icon",variant:"secondary",className:"h-7 w-7",children:e.jsx(f,{className:"h-3 w-3"})})}),e.jsx(D,{className:"p-0",children:e.jsxs(_,{className:"max-h-[90vh] p-6",children:[e.jsx(b,{className:"mb-6",children:e.jsx(w,{children:s.send_newsletter})}),e.jsxs("form",{onSubmit:x,className:"space-y-4 p-0.5",children:[e.jsxs("div",{children:[e.jsx(C,{children:s.send_to}),e.jsxs(L,{value:c.user_type,onValueChange:a=>d("user_type",a),children:[e.jsx(B,{children:e.jsx(E,{placeholder:s.select_user_type})}),e.jsx(I,{children:h.map(({title:a,value:l})=>e.jsx(O,{value:l,className:"capitalize",children:a},l))})]}),e.jsx(S,{message:p.user_type})]}),e.jsxs(T,{className:"flex justify-end space-x-2 pt-4",children:[e.jsx(z,{asChild:!0,children:e.jsx(n,{type:"button",variant:"outline",children:t.close})}),e.jsx(N,{loading:m,children:t.submit})]})]})]})})]})};export{Z as default};
