2 lines
1.6 KiB
JavaScript
2 lines
1.6 KiB
JavaScript
import{r as b,u as D,b as S,j as e}from"./vendor-BKmmeuxg.js";import{I as C}from"./input-error-LaPr_4wd.js";import{L as v}from"./loading-button-BnTVAMJ7.js";import{B as N}from"./button-BpNwv2aE.js";import{D as y,a as I,b as L,c as _,d as B,e as E,f as F}from"./dialog-B2gN9MvT.js";import{I as H}from"./input-DM0goJrn.js";import{L as O}from"./label-HmIcv5Yx.js";import{S as T}from"./scroll-area-C8HGru-R.js";import{o as q}from"./inertia-SZXqLvQm.js";import"./utils-DxSsnXxD.js";import"./index-WW_1X1qx.js";const U=({title:i,section:s,handler:l})=>{const[n,t]=b.useState(!1),{props:o}=D(),{translate:c}=o,{dashboard:p,input:m,button:r}=c,{data:d,setData:u,post:h,put:x,errors:f,processing:j}=S({title:s?s.title:"",sort:s?s.sort:o.lastSectionSort+1,course_id:o.course.id}),g=a=>{a.preventDefault(),s?x(route("section.update",{id:s.id}),{onSuccess:()=>t(!1)}):h(route("section.store"),{onSuccess:()=>t(!1)})};return e.jsxs(y,{open:n,onOpenChange:t,children:[e.jsx(I,{children:l}),e.jsx(L,{className:"p-0",children:e.jsxs(T,{className:"max-h-[90vh] p-6",children:[e.jsx(_,{className:"mb-6",children:e.jsx(B,{children:i})}),e.jsxs("form",{onSubmit:g,className:"space-y-4 p-0.5",children:[e.jsxs("div",{children:[e.jsx(O,{children:p.section_title}),e.jsx(H,{required:!0,type:"text",name:"title",value:d.title,placeholder:m.section_title_placeholder,onChange:a=>q(a,u)}),e.jsx(C,{message:f.title})]}),e.jsxs(E,{className:"flex justify-end space-x-2 pt-4",children:[e.jsx(F,{asChild:!0,children:e.jsx(N,{type:"button",variant:"outline",children:r.close})}),e.jsx(v,{loading:j,children:r.submit})]})]})]})})]})};export{U as default};
|