2 lines
2.0 KiB
JavaScript
2 lines
2.0 KiB
JavaScript
import{r as C,b as D,j as e}from"./vendor-BKmmeuxg.js";import{I as l}from"./input-error-LaPr_4wd.js";import{L as S}from"./loading-button-BnTVAMJ7.js";import{B as v}from"./button-BpNwv2aE.js";import{D as N,a as y,b as H,c as I,d as L,e as B,f as E}from"./dialog-B2gN9MvT.js";import{I as F}from"./input-DM0goJrn.js";import{L as p}from"./label-HmIcv5Yx.js";import{S as _}from"./scroll-area-C8HGru-R.js";import{o as k}from"./inertia-SZXqLvQm.js";import{k as M}from"./richtor-CRcM6Du2.js";import"./utils-DxSsnXxD.js";import"./index-WW_1X1qx.js";const V=({title:u,newsletter:s,handler:m,translate:d})=>{const[h,r]=C.useState(!1),{input:t,button:a}=d||{input:{subject:"Subject"},button:{close:"Close",submit:"Submit"}},{data:i,setData:n,post:j,put:x,errors:c,processing:g}=D({subject:s?s.subject:"",description:s?s.description:""}),b=o=>{o.preventDefault(),s?x(route("newsletters.update",{id:s.id}),{onSuccess:()=>r(!1)}):j(route("newsletters.store"),{onSuccess:()=>r(!1)})};return e.jsxs(N,{open:h,onOpenChange:r,children:[e.jsx(y,{children:m}),e.jsx(H,{className:"p-0",children:e.jsxs(_,{className:"max-h-[90vh] p-6",children:[e.jsx(I,{className:"mb-6",children:e.jsx(L,{children:u})}),e.jsxs("form",{onSubmit:b,className:"space-y-4 p-0.5",children:[e.jsxs("div",{children:[e.jsx(p,{children:t.subject}),e.jsx(F,{required:!0,type:"text",name:"subject",value:i.subject,placeholder:t.subject,onChange:o=>k(o,n)}),e.jsx(l,{message:c.subject})]}),e.jsxs("div",{children:[e.jsx(p,{children:t.description}),e.jsx(M,{ssr:!0,output:"html",placeholder:{paragraph:t.description_placeholder,imageCaption:t.image_url_placeholder},contentMinHeight:256,contentMaxHeight:640,initialContent:i.description,onContentChange:o=>n(f=>({...f,description:o}))}),e.jsx(l,{message:c.description})]}),e.jsxs(B,{className:"flex justify-end space-x-2 pt-4",children:[e.jsx(E,{asChild:!0,children:e.jsx(v,{type:"button",variant:"outline",children:a.close})}),e.jsx(S,{loading:g,children:a.submit})]})]})]})})]})};export{V as default};
|