import{jsxs as i,jsx as e}from"react/jsx-runtime";import{I as D}from"./icon-picker-dialog-C9VejAFv.js";import{I as m}from"./input-error-BbsDx4-P.js";import{L as I}from"./loading-button-B_LaGOAp.js";import{H as N,J as _,K as L,e as T,M as j,N as B,L as l,I as u,as as F,at as H,au as O,av as k,aw as g,T as A,O as P,Q as V,B as q}from"./ui-components-B24mpb8o.js";import{u as w}from"./use-lang-Cw_jKJYs.js";import{o as f}from"./inertia-FIn3q7f1.js";import{useForm as y}from"@inertiajs/react";import{useState as E}from"react";import"./icon-picker-DlQKexqz.js";import"./debounce-CWHP_ANh.js";import"lucide-react";import"./icon-picker-tooltip-BfucLgKc.js";import"lucide-react/dynamic";import"next-themes";import"sonner";import"@radix-ui/react-label";import"class-variance-authority";import"@radix-ui/react-checkbox";import"@radix-ui/react-avatar";import"@radix-ui/react-dropdown-menu";import"@radix-ui/react-scroll-area";import"@radix-ui/react-popover";import"@radix-ui/react-radio-group";import"@radix-ui/react-dialog";import"@radix-ui/react-slot";import"clsx";import"@radix-ui/react-separator";import"@radix-ui/react-tooltip";import"@radix-ui/react-tabs";import"@radix-ui/react-accordion";import"@radix-ui/react-progress";import"@radix-ui/react-select";import"cmdk";import"@radix-ui/react-switch";import"react-day-picker";import"@radix-ui/react-slider";import"embla-carousel-react";import"@radix-ui/react-toggle-group";import"vaul";import"tailwind-merge";const Be=({title:v,category:r,handler:S})=>{const[b,c]=E(!1),{input:o,button:p}=w(),{data:n,setData:a,post:d,errors:s,processing:C,reset:x}=y({title:r?r.title:"",icon:r?r.icon:"",status:r?r.status?1:0:1,description:r?r.description:"",thumbnail:null});return i(N,{open:b,onOpenChange:c,children:[e(_,{children:S}),e(L,{className:"p-0",children:i(T,{className:"max-h-[90vh] p-6",children:[e(j,{className:"mb-6",children:e(B,{children:v})}),i("form",{onSubmit:t=>{t.preventDefault(),r?d(route("exam-categories.update",r.id),{onSuccess:()=>c(!1)}):d(route("exam-categories.store"),{onSuccess:()=>{x(),c(!1)}})},className:"space-y-4 p-0.5",children:[i("div",{children:[e(l,{children:o.title}),e(u,{required:!0,type:"text",name:"title",value:n.title,placeholder:o.title_placeholder,onChange:t=>f(t,a)}),e(m,{message:s.title})]}),i("div",{children:[e(l,{children:o.category_icon}),e(D,{name:"icon",value:n.icon||"",placeholder:"Pick your category icon",onSelect:t=>a("icon",t)}),e(m,{message:s.icon})]}),i("div",{children:[e(l,{children:o.category_status}),i(F,{value:n.status.toString(),onValueChange:t=>a("status",Number(t)),children:[e(H,{children:e(O,{placeholder:o.status_placeholder})}),i(k,{children:[e(g,{value:"1",children:"Active"}),e(g,{value:"0",children:"Inactive"})]})]})]}),i("div",{children:[e(l,{children:o.description}),e(A,{name:"description",value:n.description,placeholder:o.description_placeholder,onChange:t=>f(t,a)}),e(m,{message:s.description})]}),i("div",{children:[e(l,{children:o.thumbnail}),e(u,{type:"file",name:"thumbnail",accept:"image/*",onChange:t=>{var h;return a("thumbnail",(h=t.target.files)==null?void 0:h[0])}}),e(m,{message:s.thumbnail})]}),i(P,{className:"flex justify-end space-x-2 pt-4",children:[e(V,{asChild:!0,children:e(q,{type:"button",variant:"outline",children:p.close})}),e(I,{loading:C,children:p.save_changes})]})]})]})})]})};export{Be as default};
