PageSourceSearch

https://goneat.co.uk/assets/edit-0o_Zo9HP.js

js goneat.co.uk collected 2026-10-02 02:11:18 UTC 1,726 bytes, 1 lines download raw bytes

1import{j as o}from"./vendor-query-D1Mshrk-.js";import{d as x,u as P,r as m,L as j}from"./vendor-react-BfQMi0FG.js";import{e as n,B as d,q as g,t as r}from"./index-BrXTQpUj.js";import{P as v}from"./page-header-C7x1KRLA.js";import{d as y,e as N}from"./use-promotions-DO-aD3Qv.js";import{c as b,P as S,p as w}from"./promotion-form-BUiaf1NV.js";import"./vendor-ui-87y9m6y2.js";import"./switch-DAP1aJKg.js";import"./checkbox-C2zjyH3b.js";import"./check-DjZQULyt.js";import"./select-CxlFVGv9.js";import"./card-BPl9i0oB.js";import"./chevrons-up-down-BrtwLfHu.js";import"./use-categories-BSxZIg5k.js";import"./use-products-C-d5SucD.js";import"./use-category-options-BODQxJzM.js";function J(){const{id:e}=x(),c=P(),{data:s,isLoading:p}=y(e),a=N(),[t,i]=m.useState(null);if(m.useEffect(()=>{s&&!t&&i(b(s))},[s,t]),p||!t)return o.jsxs("div",{className:"space-y-6",children:[o.jsx(n,{className:"h-8 w-64"}),o.jsx(n,{className:"h-96 w-full"})]});const l=async u=>{if(u.preventDefault(),!t.name.trim()){r.error("Name is required");return}try{await a.mutateAsync({id:e,data:w(t)}),r.success("Promotion updated"),c("/dashboard/promotions")}catch(f){const h=f?.response?.data?.error?.message??"Failed to update promotion";r.error(h)}};return o.jsxs("div",{className:"space-y-6",children:[o.jsx(v,{title:"Edit Promotion",action:o.jsx(d,{variant:"outline",asChild:!0,children:o.jsxs(j,{to:"/dashboard/promotions",children:[o.jsx(g,{className:"mr-2 h-4 w-4"}),"Back"]})})}),o.jsxs("form",{onSubmit:l,className:"space-y-6",children:[o.jsx(S,{form:t,onChange:i}),o.jsx("div",{className:"flex justify-end",children:o.jsx(d,{type:"submit",disabled:a.isPending,children:a.isPending?"Saving...":"Save Changes"})})]})]})}export{J as PromotionEditPage};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.