1import{l as s}from"./index-BCz1FotW.js";import{r}from"./vendor-dnd-D7Z1dhuR.js";import{aR as L,bW as C,bX as A,bY as f,bZ as y}from"./App-TdcU-xIC.js";import{a4 as j,p as R,D,m as I,a1 as E,V as b,M as F,P as O,G as $}from"./useMarketplaceSettings-C77VSiH-.js";import"./notificationsService-4XLc8WSw.js";const N=a=>{const i=new Date(a||0).getTime();return Number.isNaN(i)?0:i},Y=({onSelectCustomer:a})=>{const i=L(),{data:u=[],isLoading:v,error:n}=C(),{data:p=[],isLoading:k}=A(),[x,_]=r.useState(""),[c,S]=r.useState(""),[d,z]=r.useState(""),h=r.useMemo(()=>new Map(p.map(e=>[String(e.id),e])),[p]),l=r.useMemo(()=>u.map(e=>{const t=h.get(String(e.member_id))||null;return{...e,customer:t,firma:(t==null?void 0:t.company_name)||(t==null?void 0:t.legal_name)||"(müÅteri kaydı bulunamadı)",durum:f(e),guncelleme:e.updated_at||e.updatedAt||e.createdAt}}).sort((e,t)=>N(t.guncelleme)-N(e.guncelleme)),[u,h]),M=r.useMemo(()=>[...new Set(l.map(e=>e.sector).filter(Boolean))].sort((e,t)=>e.localeCompare(t,"tr")),[l]),T=r.useMemo(()=>l.reduce((e,t)=>(e[t.durum.key]=(e[t.durum.key]||0)+1,e),{}),[l]),m=r.useMemo(()=>{const e=j(x);return l.filter(t=>!(c&&t.durum.key!==c||d&&t.sector!==d||e&&![t.firma,t.sector,t.description,t.contact_email,t.contact_phone,t.website].some(P=>j(P||"").includes(e))))},[l,x,c,d]),o=v||k,g=e=>{e.customer&&(a==null||a(e.customer))};return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[s.jsxs("div",{children:[s.jsxs("h1",{className:"text-lg font-semibold text-gray-900 flex items-center gap-2",children:[s.jsx(R,{size:20,className:"text-[#4C5CA9]"})," Network Rehberi"]}),s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Portalda firma sayfası oluÅturan üyeler. Satıra tıklayınca müÅteri açılır; gizleme müÅteri kartındaki Network Profili bölümünden yapılır."})]}),s.jsxs("div",{className:"flex gap-2 text-xs",children:[s.jsxs("span",{className:"px-2 py-1 rounded-md bg-gray-100 text-gray-700",children:["Toplam ",s.jsx("b",{children:l.length})]}),y.map(e=>s.jsxs("span",{className:`px-2 py-1 rounded-md ${f({published:e.value==="published",hidden_by_staff:e.value==="hidden"}).cls}`,children:[e.label," ",s.jsx("b",{children:T[e.value]||0})]},e.value))]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[s.jsx(D,{size:15,className:"absolute left-3 top-2.5 text-gray-400 pointer-events-none"}),s.jsx("input",{type:"search",value:x,onChange:e=>_(e.target.value),placeholder:"Firma, sektör, açıklama, iletiÅimâ¦",className:"w-full pl-9 pr-3 py-2 border rounded-lg text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none"})]}),s.jsxs("select",{value:c,onChange:e=>S(e.target.value),className:"px-3 py-2 border rounded-lg text-sm bg-white",children:[s.jsx("option",{value:"",children:"Tüm durumlar"}),y.map(e=>s.jsx("option",{value:e.value,children:e.label},e.value))]}),s.jsxs("select",{value:d,onChange:e=>z(e.target.value),className:"px-3 py-2 border rounded-lg text-sm bg-white",children:[s.jsx("option",{value:"",children:"Tüm sektörler"}),M.map(e=>s.jsx("option",{value:e,children:e},e))]})]}),o&&s.jsxs("div",{className:"flex items-center justify-center py-16 text-gray-400 text-sm",children:[s.jsx(I,{size:18,className:"animate-spin mr-2"})," Yükleniyorâ¦"]}),!o&&n&&s.jsxs("div",{className:"flex items-center gap-2 p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700",children:[s.jsx(E,{size:16})," Liste yüklenemedi: ",n.message]}),!o&&!n&&m.length===0&&s.jsx("div",{className:"py-16 text-center text-sm text-gray-500 bg-white border rounded-lg",children:l.length===0?"Henüz firma sayfası oluÅturan üye yok.":"Filtreye uyan kayıt yok."}),!o&&!n&&m.length>0&&(i?s.jsx("div",{className:"space-y-2",children:m.map(e=>s.jsxs("button",{onClick:()=>g(e),disabled:!e.customer,className:"w-full text-left bg-white border rounded-lg p-3 hover:border-blue-400 disabled:opacity-60",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsx("p",{className:"text-sm font-medium text-gray-900",children:e.firma}),s.jsx("span",{className:`shrink-0 px-1.5 py-0.5 rounded text-[10px] font-medium ${e.durum.cls}`,children:e.durum.label})]}),s.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:[e.sector||"â"," · ",b(e.guncelleme)]}),s.jsx(w,{r:e})]},e.id))}):s.jsx("div",{className:"bg-white border rounded-lg overflow-x-auto",children:s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{className:"bg-gray-50 text-xs text-gray-500 uppercase tracking-wide",children:s.jsxs("tr",{children:[s.jsx("th",{className:"text-left px-4 py-2.5 font-medium",children:"Firma"}),s.jsx("th",{className:"text-left px-4 py-2.5 font-medium",children:"Sektör"}),s.jsx("th",{className:"text-left px-4 py-2.5 font-medium",children:"Durum"}),s.jsx("th",{className:"text-left px-4 py-2.5 font-medium",children:"İletiÅim"}),s.jsx("th",{className:"text-left px-4 py-2.5 font-medium whitespace-nowrap",children:"Son güncelleme"})]})}),s.jsx("tbody",{className:"divide-y",children:m.map(e=>s.jsxs("tr",{onClick:()=>g(e),className:e.customer?"hover:bg-blue-50/50 cursor-pointer":"opacity-60",children:[s.jsxs("td",{className:"px-4 py-2.5",children:[s.jsx("p",{className:"font-medium text-gray-900",children:e.firma}),e.description&&s.jsx("p",{className:"text-xs text-gray-500 line-clamp-1 max-w-md",children:e.description})]}),s.jsx("td",{className:"px-4 py-2.5 text-gray-700 whitespace-nowrap",children:e.sector||"â"}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsx("span",{className:`px-1.5 py-0.5 rounded text-[11px] font-medium whitespace-nowrap ${e.durum.cls}`,children:e.durum.label})}),s.jsx("td",{className:"px-4 py-2.5",children:s.jsx(w,{r:e})}),s.jsx("td",{className:"px-4 py-2.5 text-gray-500 whitespace-nowrap",children:b(e.guncelleme)})]},e.id))})]})}))]})},w=({r:a})=>s.jsxs("div",{className:"flex flex-col gap-0.5 text-xs text-gray-600 mt-1",children:[a.contact_email&&s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(F,{size:11})," ",a.contact_email]}),a.contact_phone&&s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(O,{size:11})," ",a.contact_phone]}),a.website&&s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx($,{size:11})," ",a.website.replace(/^https?:\/\//,"")]}),!a.contact_email&&!a.contact_phone&&!a.website&&s.jsx("span",{className:"text-gray-400",children:"â"})]});
1export{Y as NetworkProfileList,Y 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.