import{jsxs as t,jsx as e,Fragment as s}from"react/jsx-runtime";import{A as x}from"./layout-CssQHtfO.js";import{Head as S,Link as d}from"@inertiajs/react";import{B as a}from"./button-BvFBRYHq.js";import{C as b,a as C}from"./card-Zg0WOx-j.js";import{B as L}from"./badge-CFi7bqqA.js";import{ArrowLeft as w,Loader2 as I,Save as y}from"lucide-react";import{u as D,a as F}from"./useItemNameLookup-i1Z88vba.js";import{ItemPreviewCard as _}from"./ItemPreviewCard-ByMAocBm.js";import{BasicInfoForm as A}from"./BasicInfoForm-BNF0eCzN.js";import{AdvancedSettingsForm as B}from"./AdvancedSettingsForm-COuv3-T7.js";import"./app-sidebar-header-BX2s-HO_.js";import"react";import"@radix-ui/react-collapsible";import"./dropdown-menu-BP80qPHw.js";import"@radix-ui/react-dropdown-menu";import"./utils-CMbmcP35.js";import"clsx";import"tailwind-merge";import"./app-logo-icon-beRg1XGs.js";import"./fonts-CqawFh47.js";import"@radix-ui/react-slot";import"class-variance-authority";import"@radix-ui/react-dialog";import"@radix-ui/react-tooltip";import"@radix-ui/react-avatar";import"../app.js";/* empty css     */import"axios";import"sonner";import"react-dom/client";import"./toaster-DuLpwsc2.js";import"./shop-helpers-CW6YR2iv.js";import"./separator-BDLxzoJ8.js";import"@radix-ui/react-separator";import"./input-qMvM9qch.js";import"./label-DMnntKPk.js";import"@radix-ui/react-label";import"./select-DfhewM4T.js";import"@radix-ui/react-select";function Ne({item:i,masks:p}){const c=[{title:"Dashboard",href:"/admin"},{title:"Shop Management",href:"/admin/shop"},{title:"Edit",href:`/admin/shop/${i.id}/edit`}],{formData:r,errors:o,isLoading:m,setFormData:n,handleUpdate:l}=D(i),{itemName:h,itemColor:f,isLoadingItemName:u,fetchItemName:g}=F(i.item_name||"",i.item_color||""),v=N=>{N.preventDefault(),l(i.id)};return t(x,{breadcrumbs:c,children:[e(S,{title:`Edit Shop Item - ${i.item_name||"Unknown"}`}),t("div",{className:"space-y-6",children:[t("div",{className:"flex items-center justify-between",children:[t("div",{className:"flex items-center gap-4",children:[e(d,{href:"/admin/shop",children:e(a,{variant:"ghost",size:"icon",children:e(w,{className:"h-4 w-4"})})}),t("div",{children:[e("h1",{className:"text-2xl font-bold",children:"Edit Shop Item"}),e("p",{className:"text-muted-foreground text-sm",children:"Update item details and pricing"})]})]}),e(L,{variant:i.is_active?"default":"secondary",children:i.is_active?"Active":"Inactive"})]}),e("form",{onSubmit:v,children:t("div",{className:"grid gap-6 lg:grid-cols-3",children:[e("div",{className:"lg:col-span-1",children:e(_,{item:i,formData:r,itemName:h,itemColor:f,isLoadingItemName:u})}),t("div",{className:"lg:col-span-2 space-y-6",children:[e(A,{formData:r,onFormDataChange:n,errors:o,onItemNameLookup:g}),e(B,{formData:r,onFormDataChange:n,masks:p,errors:o}),e(b,{children:e(C,{className:"pt-6",children:t("div",{className:"flex items-center justify-between",children:[t("p",{className:"text-sm text-muted-foreground",children:["Last modified: ",new Date(i.created_at).toLocaleDateString()]}),t("div",{className:"flex gap-3",children:[e(d,{href:"/admin/shop",children:e(a,{type:"button",variant:"outline",children:"Cancel"})}),e(a,{type:"submit",disabled:m,children:m?t(s,{children:[e(I,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):t(s,{children:[e(y,{className:"mr-2 h-4 w-4"}),"Save Changes"]})})]})]})})})]})]})})]})]})}export{Ne as default};
