lms/public/build/assets/newsletter-send-4PZqhM2j.js
2025-12-15 12:26:23 +01:00

2 lines
1.8 KiB
JavaScript

import{r as j,b as g,j as e,S as f}from"./vendor-BKmmeuxg.js";import{I as S}from"./input-error-LaPr_4wd.js";import{L as b}from"./loading-button-BnTVAMJ7.js";import{B as n}from"./button-BpNwv2aE.js";import{D,a as y,b as N,c as _,d as v,e as w,f as C}from"./dialog-B2gN9MvT.js";import{L}from"./label-HmIcv5Yx.js";import{S as B}from"./scroll-area-C8HGru-R.js";import{S as E,a as I,b as T,c as z,d as F}from"./select-CD9o3HN1.js";import{u as O}from"./use-lang-YfV87_zl.js";import"./utils-DxSsnXxD.js";import"./index-WW_1X1qx.js";const U=({id:o,translate:V})=>{const[i,r]=j.useState(!1),{dashboard:s,button:a}=O(),{data:c,setData:d,post:m,errors:p,processing:u}=g({user_type:"",newsletter_id:o}),h=t=>{t.preventDefault(),m(route("newsletters.send"),{onSuccess:()=>r(!1)})},x=[{title:s.all,value:"all"},{title:s.student,value:"student"},{title:a.instructor,value:"instructor"}];return e.jsxs(D,{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(N,{className:"p-0",children:e.jsxs(B,{className:"max-h-[90vh] p-6",children:[e.jsx(_,{className:"mb-6",children:e.jsx(v,{children:s.send_newsletter})}),e.jsxs("form",{onSubmit:h,className:"space-y-4 p-0.5",children:[e.jsxs("div",{children:[e.jsx(L,{children:s.send_to}),e.jsxs(E,{value:c.user_type,onValueChange:t=>d("user_type",t),children:[e.jsx(I,{children:e.jsx(T,{placeholder:s.select_user_type})}),e.jsx(z,{children:x.map(({title:t,value:l})=>e.jsx(F,{value:l,className:"capitalize",children:t},l))})]}),e.jsx(S,{message:p.user_type})]}),e.jsxs(w,{className:"flex justify-end space-x-2 pt-4",children:[e.jsx(C,{asChild:!0,children:e.jsx(n,{type:"button",variant:"outline",children:a.close})}),e.jsx(b,{loading:u,children:a.submit})]})]})]})})]})};export{U as default};