import{r as _,aT as v,aU as b,j as e,bk as q}from"./react-vendor-xYZnmIII.js";import{I as c}from"./input-error-_LAmvivg.js";import{L as H}from"./loading-button-D7aXR3K4.js";import{J as S,K as E,B as p,M as I,N as L,O as N,L as d,I as y,Q as B,U as F}from"./ui-components-CQM92IK3.js";import{o as M}from"./inertia-FIn3q7f1.js";import{j as O}from"./richtor-BECSBxkh.js";import"./inertia-vendor-cBbDTmhJ.js";import"./ui-vendor-Ds9iwIxa.js";import"./interactive-vendor-B1OgcAgP.js";const R=({url:u,forum:a})=>{const[h,n]=_.useState(!1),{props:m}=v(),{translate:x}=m,{button:i,input:t,frontend:j}=x,{data:r,setData:o,put:g,errors:l,processing:f,reset:C}=b({url:u,title:a.title,description:a.description}),D=s=>{s.preventDefault(),g(route("course-forums.update",a.id),{onSuccess:()=>{C(),n(!1)}})};return e.jsxs(S,{open:h,onOpenChange:n,children:[e.jsx(E,{asChild:!0,children:e.jsxs(p,{size:"sm",variant:"ghost",className:"w-full cursor-pointer justify-start px-2",children:[e.jsx(q,{className:"h-4 w-4"}),e.jsx("span",{children:i.edit})]})}),e.jsxs(I,{children:[e.jsx(L,{children:e.jsx(N,{children:j.edit_forum_question})}),e.jsxs("form",{onSubmit:D,className:"space-y-4 p-0.5",children:[e.jsxs("div",{children:[e.jsx(d,{children:t.question_title}),e.jsx(y,{required:!0,type:"text",name:"title",value:r.title,placeholder:t.question_title_placeholder,onChange:s=>M(s,o)}),e.jsx(c,{message:l.title})]}),e.jsxs("div",{children:[e.jsx(d,{children:t.description}),e.jsx(O,{ssr:!0,output:"html",placeholder:{paragraph:t.content_placeholder,imageCaption:t.image_caption_placeholder},contentMinHeight:260,contentMaxHeight:600,initialContent:r.description,onContentChange:s=>o("description",s)}),e.jsx(c,{message:l.description})]}),e.jsxs(B,{children:[e.jsx(H,{loading:f,children:i.update}),e.jsx(F,{asChild:!0,children:e.jsx(p,{variant:"outline",children:i.cancel})})]})]})]})]})};export{R as default};
