1import{aj as oe,d as r,j as e,ak as ne,al as P,am as I,an as G,ao as M,ap as B,aq as H,H as de,l as ie,s as m,z as A,C as x,e as T,p as ce}from"./vendor-DMXidktG.js";import{c as d,b as q,B as g}from"./button-Dri5X2zT.js";import{B as me}from"./BpDashboardLayout-BUKX0rx6.js";import{P as D,a as E,b as k,C as L,c as R,d as _,e as O,f as F,g as p}from"./popover-BdbJV9qC.js";import"./Header-cboKSJuE.js";import"./input-D0DcIAGY.js";const xe=oe,pe=ne,z=r.forwardRef(({className:t,...a},o)=>e.jsx(H,{className:d("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...a,ref:o}));z.displayName=H.displayName;const U=r.forwardRef(({className:t,...a},o)=>e.jsxs(pe,{children:[e.jsx(z,{}),e.jsx(P,{ref:o,className:d("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...a})]}));U.displayName=P.displayName;const V=({className:t,...a})=>e.jsx("div",{className:d("flex flex-col space-y-2 text-center sm:text-left",t),...a});V.displayName="AlertDialogHeader";const Y=({className:t,...a})=>e.jsx("div",{className:d("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a});Y.displayName="AlertDialogFooter";const $=r.forwardRef(({className:t,...a},o)=>e.jsx(I,{ref:o,className:d("text-lg font-semibold",t),...a}));$.displayName=I.displayName;const W=r.forwardRef(({className:t,...a},o)=>e.jsx(G,{ref:o,className:d("text-sm text-muted-foreground",t),...a}));W.displayName=G.displayName;const J=r.forwardRef(({className:t,...a},o)=>e.jsx(B,{ref:o,className:d(q(),t),...a}));J.displayName=B.displayName;const K=r.forwardRef(({className:t,...a},o)=>e.jsx(M,{ref:o,className:d(q({variant:"outline"}),"mt-2 sm:mt-0",t),...a}));K.displayName=M.displayName;const Ne=({products:t})=>{const[a,o]=r.useState(""),[i,b]=r.useState([]),[c,j]=r.useState([]),[N,w]=r.useState(null),[Q,h]=r.useState(!1),[y,X]=r.useState(!1),[v,Z]=r.useState(!1),ee=r.useMemo(()=>{const s=t.flatMap(n=>n.categories||[]);return[...Array.from(new Set(s)).sort()]},[t]),se=r.useMemo(()=>{const s=t.flatMap(n=>n.tags||[]);return[...Array.from(new Set(s)).sort()]},[t]),C=t.filter(s=>{const l=s.title.toLowerCase().includes(a.toLowerCase()),n=i.length===0||s.categories&&s.categories.some(f=>i.includes(f)),u=c.length===0||s.tags&&s.tags.some(f=>c.includes(f));return l&&n&&u}),S=s=>{T.get(m("products.edit",s))},te=()=>{N&&T.delete(m("products.destroy",N),{preserveScroll:!0,onSuccess:()=>{h(!1),w(null),ce.success("Deleted",{description:"Product removed successfully"})}})},ae=(s,l)=>{s.stopPropagation(),w(l),h(!0)},le=s=>{switch(s){case"published":return"bg-[#30BF5133] text-[#30BF51] border-[#30BF51]";case"pending_review":return"bg-yellow-100 text-yellow-700 border-yellow-500";case"rejected":return"bg-red-100 text-red-600 border-red-500";case"draft":default:return"bg-[#dcdcdc] text-[#707070] border-[#7f7f7f]"}},re=s=>{switch(s){case"pending_review":return"PENDING REVIEW";default:return s.toUpperCase()}};return e.jsxs(me,{children:[e.jsx(de,{title:"My Products",children:e.jsx("meta",{name:"robots",content:"noindex, nofollow"})}),e.jsx("main",{className:"flex-1 w-full bg-[#F8F8F8] min-h-screen",children:e.jsxs("section",{className:"px-8 lg:px-[60px] py-8",children:[e.jsx("div",{className:"flex justify-end items-center mb-6",children:e.jsx(ie,{href:m("products.create"),children:e.jsx(g,{className:"w-full sm:w-auto bg-black py-7 px-14 rounded-2xl text-white hover:bg-black",children:"ADD PRODUCTS +"})})}),e.jsxs("div",{className:"mb-14",children:[e.jsx("h1",{className:"text-sm font-medium uppercase tracking-wide mb-5",children:"SEARCH FOR PRODUCTS"}),e.jsx("div",{className:"bg-black rounded-2xl overflow-hidden border border-solid border-[#707070] border-b-0 md:border-b md:border-r-0",children:e.jsxs("div",{className:"flex flex-col md:grid md:grid-cols-12 md:divide-x md:divide-[#707070]",children:[e.jsx("button",{className:"rounded-none px-6 py-4 text-left text-black bg-white transition-colors col-span-2 border-0",children:e.jsx("span",{className:"text-sm font-medium",children:"FILTER BY"})}),e.jsxs(D,{open:y,onOpenChange:X,children:[e.jsx(E,{asChild:!0,children:e.jsxs(g,{variant:"outline",role:"combobox","aria-expanded":y,className:"bg-black h-full px-6 py-4 flex items-center justify-between text-white/90 hover:bg-white/5 transition-colors col-span-3 border-b border-[#707070] md:border-b-0 rounded-none hover:text-white",children:[i.length===0?"CATEGORY":`${i.length} SELECTED`,e.jsx(A,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(k,{className:"w-[90%] mx-auto p-0",children:e.jsxs(L,{children:[e.jsx(R,{placeholder:"Filter category..."}),e.jsxs(_,{children:[e.jsx(O,{children:"No category found."}),e.jsxs(F,{children:[e.jsxs(p,{onSelect:()=>b([]),className:"cursor-pointer",children:[e.jsx(x,{className:d("mr-2 h-4 w-4",i.length===0?"opacity-100":"opacity-0")}),"ALL CATEGORIES"]}),ee.map(s=>e.jsxs(p,{value:s,onSelect:l=>{b(n=>n.includes(s)?n.filter(u=>u!==s):[...n,s])},children:[e.jsx(x,{className:d("mr-2 h-4 w-4",i.includes(s)?"opacity-100":"opacity-0")}),s==="ALL"?"ALL CATEGORIES":s.trim()]},s))]})]})]})})]}),e.jsxs(D,{open:v,onOpenChange:Z,children:[e.jsx(E,{asChild:!0,children:e.jsxs(g,{variant:"outline",role:"combobox","aria-expanded":v,className:"bg-black h-full px-6 py-4 flex items-center justify-between text-white/90 hover:bg-white/5 transition-colors col-span-3 border-b border-[#707070] md:border-b-0 rounded-none hover:text-white",children:[c.length===0?"TAGS":`${c.length} SELECTED`,e.jsx(A,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(k,{className:"w-[90%] mx-auto p-0",children:e.jsxs(L,{children:[e.jsx(R,{placeholder:"Filter tags..."}),e.jsxs(_,{children:[e.jsx(O,{children:"No tag found."}),e.jsxs(p,{onSelect:()=>j([]),className:"cursor-pointer",children:[e.jsx(x,{className:d("mr-2 h-4 w-4",c.length===0?"opacity-100":"opacity-0")}),"ALL TAGS"]}),e.jsx(F,{children:se.map(s=>e.jsxs(p,{value:s,onSelect:()=>{j(l=>l.includes(s)?l.filter(n=>n!==s):[...l,s])},children:[e.jsx(x,{className:d("mr-2 h-4 w-4",c.includes(s)?"opacity-100":"opacity-0")}),s==="ALL"?"ALL TAGS":s]},s))})]})]})})]}),e.jsx("div",{className:"px-6 py-4 flex items-center gap-2 col-span-4",children:e.jsx("input",{type:"text",placeholder:"SEARCHING FOR SOMETHING?",className:"bg-transparent border-0 text-sm text-white placeholder:text-white focus:outline-none w-full",value:a,onChange:s=>o(s.target.value)})})]})})]}),C.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[e.jsx("p",{className:"text-lg font-semibold text-gray-600",children:"No products found"}),e.jsx("p",{className:"text-sm text-gray-400 mt-2",children:"Try adjusting your filters or add a new product"})]}):e.jsxs("div",{className:"bg-[#F8F8F8]",children:[e.jsxs("div",{className:"px-4 hidden md:grid grid-cols-[80px_0.5fr_0.5fr_0.5fr_1fr] gap-4 pb-4 border-b border-border border-dashed items-center",children:[e.jsx("div",{}),e.jsx("div",{className:"font-bold uppercase tracking-wide",children:"PRODUCT NAME"}),e.jsx("div",{className:"font-bold uppercase tracking-wide",children:"CATEGORY"}),e.jsx("div",{className:"font-bold uppercase tracking-wide",children:"TAGS"}),e.jsx("div",{})]}),e.jsx("div",{className:"divide-y divide-border",children:C.map(s=>e.jsxs("div",{onClick:()=>S(s.id),className:"px-4 py-6 grid grid-cols-1 md:grid-cols-[80px_0.5fr_0.5fr_0.5fr_1fr] gap-4 hover:bg-secondary/50 transition-colors cursor-pointer border-b border-border border-dashed items-centers",children:[e.jsxs("div",{className:"flex items-center gap-4 w-full min-w-0 col-span-12 md:col-auto",children:[e.jsx("div",{className:"w-20 h-20 bg-foreground flex items-center justify-center shrink-0",children:e.jsx("img",{src:s.image_url,alt:s.title,className:"w-full h-full object-cover"})}),e.jsx("span",{className:"md:hidden text-base font-bold break-words",children:s.title})]}),e.jsx("div",{className:"hidden md:flex items-center font-bold pr-4",children:s.title}),e.jsxs("div",{className:"flex flex-row md:flex-col gap-2 md:gap-0 items-center md:items-start",children:[e.jsx("span",{className:"md:hidden text-xs font-bold uppercase text-gray-400 min-w-[70px]",children:"Category:"}),e.jsx("span",{className:"text-sm md:text-base font-medium",dangerouslySetInnerHTML:{__html:s.category_list}})]}),e.jsxs("div",{className:"flex items-center col-span-12 md:col-auto",children:[e.jsx("span",{className:"md:hidden text-xs font-bold uppercase text-gray-400 min-w-[70px]",children:"Tags:"}),e.jsx("span",{className:"text-sm md:text-base font-medium truncate w-full",dangerouslySetInnerHTML:{__html:s.tag_list}})]}),e.jsxs("div",{className:"flex flex-wrap md:flex-nowrap items-center justify-between md:justify-end gap-4 mt-2 md:mt-0",children:[e.jsxs("div",{className:"flex flex-wrap gap-4",children:[e.jsx("button",{className:"text-[#707070] hover:text-foreground underline text-sm",onClick:l=>{l.stopPropagation();const n=m("brand.show",{slug:s.brand_slug,preview_product:s.slug});window.open(n,"_blank")},children:"PREVIEW"}),e.jsx("button",{onClick:l=>{l.stopPropagation(),S(s.id)},className:"text-[#707070] hover:text-foreground underline text-sm",children:"EDIT"}),e.jsx("button",{onClick:l=>ae(l,s.id),className:"text-[#707070] hover:text-foreground underline text-sm",children:"DELETE"})]}),e.jsx("div",{className:`w-auto min-w-[150px] px-3 py-1 rounded-full text-center text-xs md:text-sm font-semibold border border-solid whitespace-nowrap ${le(s.status)}`,children:re(s.status)})]})]},s.id))})]})]})}),e.jsx(xe,{open:Q,onOpenChange:h,children:e.jsxs(U,{className:"bg-white",children:[e.jsxs(V,{children:[e.jsx($,{children:"Are you absolutely sure?"}),e.jsx(W,{children:"This action cannot be undone. This will permanently delete the product from our servers."})]}),e.jsxs(Y,{children:[e.jsx(K,{children:"Cancel"}),e.jsx(J,{onClick:te,className:"bg-red-600 hover:bg-red-700 text-white",children:"Delete Product"})]})]})})]})};export{Ne 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.