1import{j as e}from"./query-vendor-kvu6DCO6.js";import{r as o}from"./react-vendor-DhN5vIHY.js";import{A as f}from"./AdminPageHeader-B2SwnN4O.js";import{h as j,B as v}from"./index-x3WCjE4v.js";import{C as w}from"./chevron-up-0tzgS05w.js";import{C as N}from"./chevron-down-DNxMMbfW.js";import"./AppMenu-Dxo3E6_e.js";import"./EventTicketsIcon-BFiAN6uM.js";import"./log-out--eS9EmGX.js";import"./calendar-TCRS5DbI.js";import"./trophy-SiyA38pi.js";import"./user-Bq-muTRk.js";import"./handshake-CvpPpoLO.js";import"./share-2-nJsljdm-.js";import"./HeaderLogos-CcCTX1ha.js";import"./kwagi-heath-group.png.asset-DwX5yxpU.js";import"./apl-a-mark.png.asset-Dn5Bhq-r.js";import"./chevron-left-D7o3RYBl.js";const p="ghoe_business_products",c={name:"",price:"",imageDataUrl:"",description:""},l="w-full bg-white/5 border border-white/15 rounded-lg px-3 py-2.5 text-white placeholder:text-white/35 focus:outline-none focus:border-[#f5c518]",J=()=>{const{toast:n}=j(),[m,d]=o.useState([{...c},{...c},{...c}]),[x,h]=o.useState(1);o.useEffect(()=>{const s=localStorage.getItem(p);if(s)try{const t=JSON.parse(s);Array.isArray(t)&&t.length&&d(t)}catch{}},[]);const i=(s,t)=>d(r=>r.map((a,g)=>g===s?{...a,...t}:a)),u=(s,t)=>{if(!t)return;const r=new FileReader;r.onload=()=>i(s,{imageDataUrl:String(r.result)}),r.readAsDataURL(t)},b=()=>{try{localStorage.setItem(p,JSON.stringify(m)),n({title:"Saved",description:"Your products have been updated."})}catch{n({title:"Could not save",description:"Try smaller images.",variant:"destructive"})}};return e.jsxs("div",{className:"min-h-screen bg-[#0a1530] text-white",children:[e.jsx(f,{title:"Products",showBack:!0,backTo:"/business",showMenu:!1,showLogos:!0}),e.jsxs("main",{className:"px-4 sm:px-6 pt-4 pb-12 max-w-[1600px] mx-auto",children:[e.jsx("div",{className:"bg-white/[0.04] border border-white/10 rounded-2xl divide-y divide-white/10",children:m.map((s,t)=>{const r=x===t;return e.jsxs("div",{className:"p-5",children:[e.jsxs("button",{onClick:()=>h(r?null:t),className:"w-full flex items-center justify-between",children:[e.jsxs("span",{className:`text-lg font-bold ${r?"text-[#f5c518] underline":"text-white"}`,children:["Product #",t+1]}),r?e.jsx(w,{size:20,className:"text-[#f5c518]"}):e.jsx(N,{size:20,className:"text-[#f5c518]"})]}),r&&e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-[#f5c518] mb-1.5",children:"Product Name"}),e.jsx("input",{className:l,value:s.name,onChange:a=>i(t,{name:a.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-[#f5c518] mb-1.5",children:"Price"}),e.jsx("input",{type:"number",step:"0.01",className:l,value:s.price,onChange:a=>i(t,{price:a.target.value})})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm text-[#f5c518] mb-1.5",children:["Image ",t+1]}),e.jsxs("div",{className:"flex items-center gap-4",children:[s.imageDataUrl?e.jsx("img",{src:s.imageDataUrl,alt:s.name||`Product ${t+1} image`,className:"w-20 h-20 rounded-lg object-cover border border-white/15"}):e.jsx("div",{className:"w-20 h-20 rounded-lg border border-dashed border-white/20 flex items-center justify-center text-white/35 text-xs text-center px-1",children:"No image"}),e.jsxs("label",{className:"cursor-pointer bg-white/10 hover:bg-white/15 border border-white/15 rounded-lg px-4 py-2 text-sm text-white",children:["Browse...",e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:a=>u(t,a.target.files?.[0])})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-[#f5c518] mb-1.5",children:"Short Description"}),e.jsx("textarea",{rows:4,className:`${l} resize-y`,value:s.description,onChange:a=>i(t,{description:a.target.value})})]})]})]},t)})}),e.jsx("div",{className:"flex justify-end mt-5",children:e.jsx(v,{onClick:b,className:"bg-[#f5c518] text-[#0a1530] hover:bg-[#f5c518]/90 font-bold px-8",children:"Save"})})]})]})};export{J as default};
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.