import{u,r as p,j as e,H as x}from"./app-BRoRPa4x.js";import{A as h}from"./AdminLayout-DCcA2Aje.js";import{I as o}from"./InputLabel-Cxvncq_R.js";import{T as f,I as m}from"./TextInput-B6_WtKv0.js";import{P as g}from"./PrimaryButton-CI9diFCm.js";import{s as j,a as v}from"./ToastNote-Vtzm4n0q.js";import"./Dropdown-B4bpLCgK.js";import"./transition-u43f5Dc-.js";import"./proxy-iYr3ghlA.js";import"./sweetalert2.esm.all-UgF8mXO5.js";import"./ChevronRightIcon-BDYMGWwz.js";function _({auth:d,productCategory:s}){const{data:r,setData:a,post:n,processing:c,errors:i,reset:N}=u({name:s.name||"",description:s.description||"",_method:"put"});p.useEffect(()=>{a({name:s.name||"",description:s.description||"",_method:"put"})},[s]);const l=t=>{t.preventDefault(),n(route("admin.product-categories.update",s.id),{onSuccess:()=>{v("Product category updated successfully!")},onError:()=>{j("Failed to update product category. Please check the form for errors.")}})};return e.jsxs(h,{user:d.user,header:e.jsx("h2",{className:"font-semibold text-xl text-gray-800 leading-tight",children:"Edit Product Category"}),children:[e.jsx(x,{title:"Edit Product Category"}),e.jsx("div",{className:"py-12",children:e.jsx("div",{className:"max-w-7xl mx-auto sm:px-6 lg:px-8",children:e.jsx("div",{className:"bg-white overflow-hidden shadow-sm sm:rounded-lg",children:e.jsx("div",{className:"p-6 text-gray-900",children:e.jsxs("form",{onSubmit:l,className:"mt-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx(o,{htmlFor:"name",value:"Category Name"}),e.jsx(f,{id:"name",type:"text",name:"name",value:r.name,className:"mt-1 block w-full",isFocused:!0,onChange:t=>a("name",t.target.value),required:!0}),e.jsx(m,{message:i.name,className:"mt-2"})]}),e.jsxs("div",{children:[e.jsx(o,{htmlFor:"description",value:"Description"}),e.jsx("textarea",{id:"description",name:"description",value:r.description,className:"mt-1 block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md shadow-sm",onChange:t=>a("description",t.target.value)}),e.jsx(m,{message:i.description,className:"mt-2"})]}),e.jsx("div",{className:"flex items-center gap-4",children:e.jsx(g,{disabled:c,children:"Update Category"})})]})})})})})]})}export{_ as default};
