import{jsxs as i,jsx as e}from"react/jsx-runtime";import{I as F}from"./icon-picker-DlQKexqz.js";import{I as c}from"./input-error-BbsDx4-P.js";import{L as H}from"./loading-button-B_LaGOAp.js";import{H as f,J as q,K as v,e as b,M as S,N as C,L as n,I as d,as as A,at as V,au as w,av as E,aw as x,T as J,O as K,Q as M,B as P}from"./ui-components-B24mpb8o.js";import{u as Q}from"./use-lang-Cw_jKJYs.js";import{o as I}from"./inertia-FIn3q7f1.js";import{useForm as z}from"@inertiajs/react";import{useState as N}from"react";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 Fe=({title:D,category:t,lastPosition:_,handler:O})=>{const[L,p]=N(!1),[T,m]=N(!1),{dashboard:j,input:o,button:h}=Q(),{data:l,setData:a,post:u,errors:s,processing:k,reset:B}=z({title:t?t.title:"",icon:t?t.icon:"",sort:t?t.sort:_+1,status:t?t.status:1,description:t?t.description:"",thumbnail:null});return i(f,{open:L,onOpenChange:p,children:[e(q,{children:O}),e(v,{className:"p-0",children:i(b,{className:"max-h-[90vh] p-6",children:[e(S,{className:"mb-6",children:e(C,{children:D})}),i("form",{onSubmit:r=>{r.preventDefault(),t?u(route("categories.update",t.id),{onSuccess:()=>p(!1)}):u(route("categories.store"),{onSuccess:()=>{B(),p(!1)}})},className:"space-y-4 p-0.5",children:[i("div",{children:[e(n,{children:o.title}),e(d,{required:!0,type:"text",name:"title",value:l.title,placeholder:o.title_placeholder,onChange:r=>I(r,a)}),e(c,{message:s.title})]}),i("div",{children:[e(n,{children:o.category_icon}),e(d,{required:!0,readOnly:!0,type:"text",name:"icon",value:l.icon,placeholder:o.icon_placeholder,onClick:()=>m(!0)}),e(c,{message:s.icon}),e(f,{open:T,onOpenChange:m,children:e(v,{className:"p-0",children:i(b,{className:"max-h-[90vh] p-6",children:[e(S,{className:"mb-6",children:e(C,{children:j.icon_picker})}),e(F,{onSelect:r=>{a("icon",r),m(!1)}})]})})})]}),i("div",{children:[e(n,{children:o.category_status}),i(A,{value:l.status.toString(),onValueChange:r=>a("status",Number(r)),children:[e(V,{children:e(w,{placeholder:o.status_placeholder})}),i(E,{children:[e(x,{value:"1",children:"Active"}),e(x,{value:"0",children:"Inactive"})]})]})]}),i("div",{children:[e(n,{children:o.description}),e(J,{name:"description",value:l.description,placeholder:o.description_placeholder,onChange:r=>I(r,a)}),e(c,{message:s.description})]}),i("div",{children:[e(n,{children:o.thumbnail}),e(d,{type:"file",name:"thumbnail",accept:"image/*",onChange:r=>{var g;return a("thumbnail",(g=r.target.files)==null?void 0:g[0])}}),e(c,{message:s.thumbnail})]}),i(K,{className:"flex justify-end space-x-2 pt-4",children:[e(M,{asChild:!0,children:e(P,{type:"button",variant:"outline",children:h.close})}),e(H,{loading:k,children:h.save_changes})]})]})]})})]})};export{Fe as default};
