import{r as i,u as c,j as e,H as f}from"./app-C6SiEMGn.js";import{B as x}from"./createLucideIcon-CPpF-2ww.js";import{I as g}from"./input-DYhKGVpQ.js";import{L as o}from"./label-BB9HLxkE.js";import{A as h}from"./app-layout-B4kweoSW.js";import{F as j,t as b,r as F,p as N,a as S}from"./index-BQ4sA8lt.js";import"./app-6D7Y1jSv.js";import"./index-B7t1D_co.js";import"./sheet-BvPq5L9Z.js";import"./index-FUlYkgbj.js";import"./index-CxjaVpyF.js";import"./app-logo-icon-B_KiS1IV.js";import"./package-DTdg9l_D.js";F(N,S);function H(){const[s,m]=i.useState(null),{data:n,setData:t,post:u,processing:r,errors:l,wasSuccessful:p}=c({alt:"",image_url:null});i.useEffect(()=>{s&&t("image_url",s.file)},[s,t]);const d=a=>{a.preventDefault(),u("/carousel",{forceFormData:!0}),p&&b.success("Slider image successfully uploaded")};return e.jsxs(h,{children:[e.jsx(f,{title:"Add Carousel"}),e.jsxs("section",{className:"flex flex-col gap-8 px-8 py-8",children:[e.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:"Add Slider Image"}),e.jsxs("form",{onSubmit:d,method:"POST",encType:"multipart/formdata",children:[e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx(o,{htmlFor:"title",children:"Title"}),e.jsx(g,{type:"text",id:"title",value:n.alt,onChange:a=>t("alt",a.target.value),className:"rounded border p-2"}),l.alt&&e.jsx("span",{className:"text-red-600",children:l.alt})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx(o,{children:"Image"}),e.jsx(j,{files:s?[s]:[],onupdatefiles:a=>{m(a[0]||null)},allowMultiple:!1,maxFiles:1,name:"image_url",instantUpload:!1,storeAsFile:!0,labelIdle:'Drag & Drop your image or Browse'}),l.image_url&&e.jsx("span",{className:"text-red-600",children:l.image_url})]}),e.jsx(x,{type:"submit",disabled:r,className:"cursor-pointer",children:r?"Uploading...":"Submit"})]})]})]})}export{H as default};