1import{j as e,L as N}from"./vendor-react-CbELOEYt.js";import{r as d}from"./charts-DbFxHTAl.js";import{c as b,g as k,O as u,cL as j,B as i,cx as S,L as _,S as L,aU as T,T as M,o as R,q as g,W as A,X as B,Y as I,Z as D,_ as f}from"./index-C3TIOleg.js";import{E as w,a as E}from"./ExampleNotice-CrTGbar1.js";import{m as y}from"./useMarketplace-BNxUzdg6.js";import{u as $,a as z,b as O,R as Q}from"./RequestQuoteDialog-C4t3bfbe.js";import{i as P,b as Y,a7 as H}from"./useBusinessNetwork-DyzBKEhz.js";import{an as K,c as U,e as V,S as W,W as v,bp as F,aB as X,bi as Z,cv as G}from"./icons-Bx4C25jK.js";import{B as J}from"./BusinessMessageDialog-D_suW9yF.js";import"./vendor-ui-CMQ6LlpP.js";import"./vendor-supabase-DFdou4aS.js";import"./vendor-date-cgj7qViA.js";import"./alert-BXfBOGKC.js";import"./imageUtils-DQUrWVWA.js";function q({request:s,onMessage:n,defaultOpen:m}){const[l,h]=d.useState(m??!1),{data:c,isLoading:o}=$(l?s.id:void 0),x=z();return e.jsx(b,{children:e.jsxs(k,{className:"p-5 space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.item_kind&&e.jsx(u,{variant:"outline",children:P(s.item_kind)}),s.status!=="open"&&e.jsx(u,{variant:"secondary",children:"Closed"}),s.is_example&&e.jsx(w,{})]}),e.jsx("h3",{className:"font-semibold text-lg leading-tight",children:s.title})]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.is_mine?"Asked by you":`Asked by ${s.asker_name??"a member"}`," â ",j(s.created_at)]})]}),e.jsx("p",{className:"text-sm whitespace-pre-line leading-relaxed",children:s.body}),e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[s.sector&&e.jsx("span",{children:s.sector}),s.country&&e.jsxs("span",{children:["To reach ",s.country]}),s.budget_note&&e.jsxs("span",{children:["Budget: ",s.budget_note]}),s.needed_by&&e.jsxs("span",{children:["Needed by ",j(s.needed_by)]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[e.jsxs(i,{variant:"outline",size:"sm",onClick:()=>h(a=>!a),children:[l?e.jsx(K,{className:"h-4 w-4 mr-2"}):e.jsx(U,{className:"h-4 w-4 mr-2"}),s.matches>0?`${s.matches} possible ${s.matches===1?"match":"matches"}`:"Look for matches"]}),!s.is_mine&&s.status==="open"&&e.jsxs(i,{size:"sm",onClick:()=>n({kind:"quote",requestId:s.id,title:`Offer a quote: ${s.title}`,description:"Tell them what you can supply and what it would cost. The clan handles no money â you settle it between yourselves.",placeholder:"I can supply this. Here is what it would cost and how soonâ¦"}),children:[e.jsx(V,{className:"h-4 w-4 mr-2"})," Offer a quote"]}),s.is_mine&&e.jsx(i,{size:"sm",variant:"ghost",onClick:()=>x.mutate({id:s.id,status:s.status==="open"?"closed":"open"}),children:s.status==="open"?"Close this request":"Open it again"})]}),l&&e.jsxs("div",{className:"pt-2 border-t space-y-3",children:[e.jsxs("p",{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(W,{className:"h-4 w-4 text-muted-foreground"})," Closest things members sell"]}),o?e.jsx("div",{className:"py-6 grid place-items-center",children:e.jsx(v,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):(c??[]).length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Nothing on sale matches this yet. Sellers reading the board can still write with an offer."}):e.jsx("ul",{className:"space-y-3",children:(c??[]).map(a=>{var r;return e.jsxs("li",{className:"flex gap-3",children:[e.jsx("div",{className:"h-14 w-14 shrink-0 rounded bg-muted grid place-items-center overflow-hidden",children:y(a.photo)?e.jsx("img",{src:y(a.photo)??"",alt:a.title,loading:"lazy",className:"h-full w-full object-cover"}):e.jsx(F,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(N,{to:`/business/marketplace/${a.slug}`,className:"font-medium hover:underline",children:a.title}),a.is_example&&e.jsx(w,{})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[Y(a)," â ",a.seller_name??"a Maclaine member"]}),((r=a.why)==null?void 0:r.length)>0&&e.jsx("p",{className:"text-xs text-muted-foreground",children:a.why.join(" · ")}),s.is_mine&&e.jsx(i,{size:"sm",variant:"outline",onClick:()=>n({kind:"marketplace",itemId:a.id,title:`Request a quote: ${a.title}`,description:"Ask the seller what this would cost for what you need. Your email address is not shared.",placeholder:`I am looking for ${s.title.toLowerCase()}. Could you tell me what that would cost?`}),children:"Request a quote"})]})]},a.id)})})]})]})})}const p="any";function pe(){const{isMember:s}=S(),[n,m]=d.useState("all"),[l,h]=d.useState(p),[c,o]=d.useState(!1),[x,a]=d.useState(null),{data:r,isLoading:C}=O(l===p?void 0:l,n==="mine");return e.jsxs(_,{children:[e.jsx(L,{title:"Requests for quotes â Maclaine Marketplace",description:"What Maclaine members are looking for, and the closest things fellow members offer for sale.",path:"/business/marketplace/quotes"}),e.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-4xl",children:[e.jsx(i,{asChild:!0,variant:"ghost",size:"sm",className:"mb-6",children:e.jsxs(N,{to:"/business/marketplace",children:[e.jsx(X,{className:"h-4 w-4 mr-2"})," The Marketplace"]})}),e.jsx("div",{className:"mb-6",children:e.jsx(E,{})}),e.jsx("h1",{className:"text-3xl font-serif font-bold",children:"Looking for something?"}),e.jsx("p",{className:"text-muted-foreground mt-2 max-w-2xl",children:"Say
1what you need and the Marketplace will show you the closest things members already sell. Sellers reading the board can write back with what they can do. Nobody's email address is shown, and no money passes through the clan."}),s?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[e.jsxs(i,{onClick:()=>o(!0),children:[e.jsx(Z,{className:"h-4 w-4 mr-2"})," Request a quote"]}),e.jsx(M,{value:n,onValueChange:t=>m(t),children:e.jsxs(R,{children:[e.jsx(g,{value:"all",children:"Everything asked"}),e.jsx(g,{value:"mine",children:"My requests"})]})}),e.jsxs(A,{value:l,onValueChange:h,children:[e.jsx(B,{className:"w-44",children:e.jsx(I,{placeholder:"Any kind"})}),e.jsxs(D,{children:[e.jsx(f,{value:p,children:"Any kind"}),H.map(t=>e.jsx(f,{value:t.value,children:t.label},t.value))]})]})]}),e.jsx("div",{className:"mt-8 space-y-4",children:C?e.jsx("div",{className:"py-20 grid place-items-center",children:e.jsx(v,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):(r??[]).length===0?e.jsx(b,{children:e.jsxs(k,{className:"p-10 text-center space-y-3",children:[e.jsx(G,{className:"h-8 w-8 mx-auto text-muted-foreground"}),e.jsx("p",{className:"font-medium",children:n==="mine"?"You have not asked for anything yet":"Nothing asked yet"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-md mx-auto",children:"Describe what you are after and we will look through everything members sell for the nearest match."}),e.jsx("div",{className:"pt-2",children:e.jsx(i,{onClick:()=>o(!0),children:"Request a quote"})})]})}):(r??[]).map(t=>e.jsx(q,{request:t,onMessage:a,defaultOpen:t.is_mine},t.id))})]}):e.jsx("div",{className:"mt-6",children:e.jsx(T,{action:"ask members for a quote",returnTo:"/business/marketplace/quotes"})})]}),e.jsx(Q,{open:c,onClose:()=>o(!1)}),e.jsx(J,{target:x,onClose:()=>a(null)})]})}export{pe 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.