import{r as I,u as k,b as E,j as e}from"./vendor-BKmmeuxg.js";import{D as H}from"./datetime-picker-ZgzPotAT.js";import{I as d}from"./input-error-LaPr_4wd.js";import{B as _}from"./button-BpNwv2aE.js";import{D as L,a as T,b as w,c as B,d as F,f as M}from"./dialog-B2gN9MvT.js";import{I as O}from"./input-DM0goJrn.js";import{L as p}from"./label-HmIcv5Yx.js";import{S as P}from"./scroll-area-C8HGru-R.js";import{k as q}from"./richtor-CRcM6Du2.js";import"./utils-DxSsnXxD.js";import"./popover-B4kBsMuI.js";import"./select-CD9o3HN1.js";import"./use-lang-YfV87_zl.js";import"./index-WW_1X1qx.js";const v=({title:u,liveClass:s,handler:h,courseId:x})=>{const[j,o]=I.useState(!1),{props:g}=k(),{translate:f}=g,{dashboard:a,input:r,button:m}=f,{data:n,setData:c,post:D,put:b,reset:S,errors:i,processing:l}=E({course_id:x,class_topic:(s==null?void 0:s.class_topic)||"",class_note:(s==null?void 0:s.class_note)||"",class_date_and_time:s!=null&&s.class_date_and_time?new Date(s.class_date_and_time):new Date}),y=t=>{t.preventDefault(),s?b(route("live-class.update",s.id),{onSuccess:()=>o(!1)}):D(route("live-class.store"),{onSuccess:()=>{S(),o(!1)}})};return e.jsxs(L,{open:j,onOpenChange:o,children:[e.jsx(T,{children:h}),e.jsx(w,{className:"p-0",children:e.jsxs(P,{className:"max-h-[90vh] p-6",children:[e.jsx(B,{className:"mb-6",children:e.jsx(F,{children:u})}),e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs(p,{children:[a.class_topic," *"]}),e.jsx(O,{type:"text",value:n.class_topic,onChange:t=>c("class_topic",t.target.value),placeholder:r.class_topic,required:!0}),e.jsx(d,{message:i.class_topic})]}),e.jsxs("div",{children:[e.jsxs(p,{children:[a.start_date_time," *"]}),e.jsx(H,{date:n.class_date_and_time,setDate:t=>c("class_date_and_time",t)}),e.jsx(d,{message:i.class_date_and_time})]}),e.jsxs("div",{children:[e.jsx(p,{children:a.class_notes}),e.jsx(q,{output:"html",placeholder:{paragraph:r.description,imageCaption:r.image_url_placeholder},contentMinHeight:256,contentMaxHeight:640,initialContent:n.class_note,onContentChange:t=>c(N=>({...N,class_note:t}))}),e.jsx(d,{message:i.class_note})]}),e.jsxs("div",{className:"flex justify-end gap-3",children:[e.jsx(M,{asChild:!0,children:e.jsx(_,{type:"button",variant:"outline",children:m.cancel})}),e.jsx(_,{type:"submit",disabled:l,children:l?a.scheduling:m.schedule_class})]})]})]})})]})};export{v as default};
