PageSourceSearch

https://portal.galatabusinesscenter.com.tr/assets/CBLeadList-BvZusgB5.js

js galatabusinesscenter.com.tr collected 2026-10-08 10:49:25 UTC 46,564 bytes, 14 lines download raw bytes

1import{l as e}from"./index-BCz1FotW.js";import{r as n}from"./vendor-dnd-D7Z1dhuR.js";import{u as at,M as vt,a as wt,b as St,L as kt,v as _t,c as Ct,d as At,f as Tt}from"./useNeoOfisLeads-DmmussTF.js";import{u as rt}from"./useNeoOfisProperties-Ccsw6qBz.js";import{u as Ot}from"./useNeoOfisReadyOffices-C-hRoyLm.js";import{F as lt,J as He,W as it,P as De,k as Me,M as Le,f as Ee,e as we,_ as Mt,U as ze,y,j as Dt,a4 as Ne,O as We,z as Qe,D as Lt,am as Ze,l as Et,X as Xe,w as zt}from"./useMarketplaceSettings-C77VSiH-.js";import{u as nt,aV as Rt,d as ee,aW as Je,aI as Ve,al as Ue,as as ot,at as Ft,aO as Pt,aX as qt,ao as Q,aY as et,aZ as $t,D as ct,a_ as Bt,aQ as It,aP as Kt,a$ as L,b0 as Gt,b1 as Yt,b2 as Ht,b3 as Wt,b4 as Qt,aR as Zt,a3 as Xt,b5 as Jt,b6 as Vt,b7 as Ut,b8 as tt,b9 as es,e as ts,c as ss,ba as as,bb as st,aT as rs,bc as ls,bd as is,be as ns}from"./App-TdcU-xIC.js";import{Q as os}from"./QuickStatusSwitcher-Dzd6B11L.js";import{R as dt}from"./ruler-Bul1Bftl.js";import"./notificationsService-4XLc8WSw.js";const cs=({isOpen:I,onClose:v,lead:r,onUpdate:u,onDelete:f,onConvertToOpportunity:h})=>{var be,ye;const{update:R,remove:Z,updateStatus:C,calculateMatchScore:g,PIPELINE_STAGES:X,STATUS_OPTIONS:te,INTEREST_TYPES:c,LOSS_REASONS:p}=at(),{getAvailable:k}=rt(),{user:j}=nt(),[J,K]=n.useState("details"),[m,G]=n.useState({}),[ie,F]=n.useState(!1),[P,A]=n.useState([]),[se,M]=n.useState([]),[ne,w]=n.useState(!1),[T,q]=n.useState(""),[oe,N]=n.useState(""),[ce,Y]=n.useState(!1),[E,D]=n.useState("");if(n.useEffect(()=>{if(r){G({...r}),xe();const s=Array.isArray(r.activities)?r.activities:[];s.length>0?A(s):A([{id:"init_"+r.id,type:"create",label:"Talep oluşturuldu",date:r.created_at||r.createdAt,user:"Sistem"}])}},[r==null?void 0:r.id,(be=r==null?void 0:r.activities)==null?void 0:be.length,r==null?void 0:r.updated_at]),!r)return null;const z=s=>{const o=[L.NOTE,L.PHONE,L.EMAIL,L.MEETING];return s.filter(i=>(i==null?void 0:i.content)&&o.includes(i.type)).map(i=>i.type===L.NOTE?i.content:`[${i.label}] ${i.content}`).join(`
2
3`)},H=async(s,o=L.NOTE)=>{if(!(s!=null&&s.trim())||!(r!=null&&r.id))return;const i=Ht(o,s,j),b=[...P,i];A(b);const fe=o===L.NOTE?s:`[${i.label}] ${s}`;try{await R(r.id,{activities:b,notes:r.notes?`${r.notes}
4
5${fe}`:fe,updatedAt:new Date().toISOString()},{silent:!0,partial:!0}),u==null||u()}catch(ae){console.error("Not eklenemedi:",ae),y.error("Not eklenemedi")}},V=async(s,o)=>{if(!(r!=null&&r.id)||!(s!=null&&s.id)||!(o!=null&&o.trim()))return;const i=P.map(b=>b.id===s.id?{...b,content:o.trim(),edited_at:new Date().toISOString()}:b);A(i);try{await R(r.id,{activities:i,notes:z(i),updatedAt:new Date().toISOString()},{silent:!0,partial:!0}),G(b=>({...b,notes:z(i)})),u==null||u(),y.success("Not güncellendi")}catch(b){throw console.error("Not guncellenemedi:",b),y.error("Not güncellenemedi"),A(P),b}},$=async s=>{if(!(r!=null&&r.id)||!(s!=null&&s.id))return;const o=P.filter(i=>i.id!==s.id);A(o);try{await R(r.id,{activities:o,notes:z(o),updatedAt:new Date().toISOString()},{silent:!0,partial:!0}),G(i=>({...i,notes:z(o)})),u==null||u(),y.success("Aktivite silindi")}catch(i){console.error("Aktivite silinemedi:",i),y.error("Aktivite silinemedi"),A(P)}},xe=async()=>{if(!r)return;const o=(await k()).map(i=>({...i,matchResult:g(r,i)})).sort((i,b)=>b.matchResult.score-i.matchResult.score);M(o.slice(0,10))},W=async(s,o)=>{if(G(i=>({...i,[s]:o})),!!(r!=null&&r.id))try{await R(r.id,{[s]:o},{silent:!0,partial:!0}),u==null||u()}catch{y.error(`${s} güncellenemedi`)}},me=async()=>{if(T){F(!0);try{const s=await C(r.id,T,T==="Olumsuz"?{loss_reason:oe}:{});y.success("Durum güncellendi"),s.opportunityCreated&&y.success("🔥 Otomatik fırsat oluşturuldu!",{description:"Sıcak Takip boarduna eklendi"}),w(!1),q(""),N(""),u==null||u()}catch{y.error("Güncelleme başarısız")}finally{F(!1)}}},U=async()=>{if(window.confirm("Bu talebi silmek istediğinize emin misiniz?"))try{await Z(r.id),y.success("Talep silindi"),f==null||f(),v()}catch{y.error("Silme başarısız")}},ge=s=>{const o=X.find(b=>b.id===s);return{gray:"gray",yellow:"orange",blue:"blue",purple:"purple",orange:"orange",green:"green",red:"red",indigo:"purple"}[o==null?void 0:o.color]||"gray"},Se=s=>({"NeoOfis Web":"bg-green-100 text-green-700",Sahibinden:"bg-orange-100 text-orange-700","Hürriyet Emlak":"bg-red-100 text-red-700","GBC Yönlendirme":"bg-purple-100 text-purple-700",Referans:"bg-pink-100 text-pink-700",Telefon:"bg-gray-100 text-gray-700","Walk-in":"bg-blue-100 text-blue-700","Meta Ads":"bg-indigo-100 text-indigo-700","Google Ads":"bg-yellow-100 text-yellow-700"})[s]||"bg-gray-100 text-gray-700",ke=[{id:"name",label:"İsim",type:"text"},{id:"phone",label:"Telefon",type:"phone"},{id:"email",label:"E-posta",type:"email"},{id:"company",label:"Firma",type:"text"}],_e=[{id:"interest_type",label:"İlgi Alanı",type:"select",options:c.map(s=>s.id),displayMap:c.reduce((s,o)=>(s[o.id]=o.label,s),{})},{id:"budget",label:"Bütçe",type:"currency"},{id:"m2_request",label:"Metrekare",type:"text"},{id:"capacity_request",label:"Kapasite",type:"number"}],pe=Rt(r),de=[{id:"details",label:"Detaylar",icon:lt},{id:"matching",label:"Eşleşmeler",icon:ee,count:se.filter(s=>s.matchResult.score>=60).length},...pe?[{id:"campaign",label:"Kampanya",icon:Je}]:[],{id:"activity",label:"Aktivite",icon:Ve}],Ce=[{id:"status",label:"Durum Güncelle",icon:He,onClick:()=>w(!0)},...m.status!=="Süreç Devam Ediyor"&&m.status!=="Müşteri"?[{id:"convert",label:"Sıcak Takibe Al",icon:Ue,onClick:()=>{q("Süreç Devam Ediyor"),w(!0)}}]:[],{divider:!0},{id:"delete",label:"Sil",icon:it,danger:!0,onClick:U}],he=[{id:"call",label:"Ara",icon:De,color:"bg-green-100 text-green-700 hover:bg-green-200",onClick:()=>window.open(`tel:${m.phone}`)},{id:"whatsapp",label:"WhatsApp",icon:Me,color:"bg-emerald-100 text-emerald-700 hover:bg-emerald-200",onClick:()=>{var s;return window.open(`https://wa.me/90${(s=m.phone)==null?void 0:s.replace(/\D/g,"")}`)}},{id:"email",label:"E-posta",icon:Le,color:"bg-blue-100 text-blue-700 hover:bg-blue-200",onClick:()=>window.open(`mailto:${m.email}`)}];return e.jsxs(e.Fragment,{children:[e.jsx(ot,{isOpen:I,onClose:v,title:m.name||"İsimsiz Talep",subtitle:e.jsxs("span",{className:"flex items-center gap-2",children:[m.company&&e.jsxs(e.Fragment,{children:[e.jsx(Gt,{className:"w-3.5 h-3.5"}),m.company,e.jsx("span",{className:"text-gray-300",children:"•"})]}),e.jsx("span",{className:`px-2 py-0.5 rounded-full text-xs font-medium ${Se(m.source)}`,children:m.source})]}),badge:m.status,badgeColor:ge(m.status),tabs:de,activeTab:J,onTabChange:K,actions:Ce,size:"xl",footer:e.jsx(Kt,{onSubmit:H,placeholder:"Not ekle...",activityTypes:[{id:L.NOTE,label:"Not",icon:Me},{id:L.PHONE,label:"Telefon",icon:De},{id:L.EMAIL,label:"E-posta",icon:Le},{id:L.MEETING,label:"Görüşme",icon:ze}]}),children:e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsx(Ft,{stats:[{label:"Bütçe",value:m.budget,format:"currency",bgColor:"bg-blue-50",labelColor:"text-blue-600",valueColor:"text-blue-700"},{label:"Metrekare",value:m.m2_request||"-",bgColor:"bg-purple-50",labelColor:"text-purple-600",valueColor:"text-purple-700"},{label:"Eşleşme",value:se.filter(s=>s.matchResult.score>=60).length,subtext:"uygun portföy",bgColor:"bg-green-50",labelColor:"text-green-600",valueColor:"text-green-700"},{label:"Oluşturulma",value:m.created_at,format:"date",bgColor:"bg-gray-50",labelColor:"text-gray-500",valueColor:"text-gray-900"}]}),m.phone&&e.jsx(Pt,{actions:he}),e.jsx(os,{label:"Durum",currentStatus:m.status,options:te,colorMap:{Aranmadı:{active:"bg-gray-500 text-white shadow-md scale-105 cursor-default"},"Süreç Devam Ediyor":{active:"bg-blue-600 text-white shadow-md scale-105 cursor-default"},"Süreç Durduruldu":{active:"bg-orange-500 text-white shadow-md scale-105 cursor-default"},Müşteri:{active:"bg-green-600 text-white shadow-md scale-105 cursor-default"},"Müşteri Başka Yerden Tuttu":{active:"bg-pink-500 text-white shadow-md scale-105 cursor-default"},Alakasız:{active:"bg-purple-500 text-white shadow-md scale-105 cursor-default"},Olumsuz:{active:"bg-red-600 text-white shadow-md scale-105 cursor-default"},GBC:{active:"bg-indigo-600 text-white shadow-md scale-105 cursor-default"}},onUpdate:async s=>{if(s==="Olumsuz")return D(""),Y(!0),!1;await C(r.id,s),G(o=>({...o,status:s})),u==null||u()}}),J==="details"&&e.jsxs("div",{className:"space-y-6",children:[e.jsx(qt,{lead:r,table:"neoofis_leads",onUpdate:()=>u==null?void 0:u()}),e.jsx(Q,{title:"İletişim Bilgileri",icon:Ee,children:e.jsx(et,{data:m,columns:ke,editable:!0,onFieldChange:W,gridCols:2})}),e.jsx(Q,{title:"Talep Detayları",icon:ee,children:e.jsx(et,{data:m,columns:_e,editable:!0,onFieldChange:W,gridCols:2})}),e.jsx(Q,{title:"Lokasyon Tercihleri",icon:we,children:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[(m.location_request||[]).map(s=>e.jsx("span",{className:"px-3 py-1.5 bg-blue-50 text-blue-700 rounded-lg text-sm font-medium",children:s},s)),(!m.location_request||m.location_request.length===0)&&e.jsx("span",{className:"text-gray-400 text-sm",children:"Belirtilmemiş"})]})}),m.loss_reason&&e.jsx(Q,{title:"Kayıp Bilgisi",children:e.jsxs("div",{className:"px-3 py-2 bg-red-50 rounded-lg border border-red-100",children:[e.jsx("p",{className:"text-[11px] text-red-500 leading-tight",children:"Kayıp Nedeni"}),e.jsx("p",{className:"text-xs font-medium text-red-700 mt-0.5",children:((ye=p==null?void 0:p.find(s=>s.id===m.loss_reason))==null?void 0:ye.label)||m.loss_reason})]})}),e.jsx(Q,{title:"Notlar",icon:Me,children:e.jsx($t,{activities:P,onDelete:$,onEdit:V,emptyMessage:"Henüz not eklenmemiş. Eklemek için alttaki çubuğu kullan."})})]}),J==="matching"&&e.jsx("div",{className:"space-y-6",children:e.jsx(Q,{title:"Eşleşen Portföyler",icon:ee,actions:e.jsxs("button",{onClick:xe,className:"text-xs text-blue-600 hover:text-blue-700 flex items-center gap-1",children:[e.jsx(He,{className:"w-3 h-3"}),"Yenile"]}),children:e.jsx("div",{className:"space-y-3",children:se.length>0?se.map(s=>e.jsx("div",{className:"bg-white border border-gray-100 rounded-xl p-4 hover:shadow-md transition-shadow cursor-pointer",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h4",{className:"font-medium text-gray-900",children:s.title}),e.jsxs("span",{className:`
6                                px-2 py-0.5 rounded-full text-xs font-bold
7                                ${s.matchResult.score>=80?"bg-green-100 text-green-700":s.matchResult.score>=60?"bg-blue-100 text-blue-700":s.matchResult.score>=40?"bg-yellow-100 text-yellow-700":"bg-gray-100 text-gray-600"}
8                              `,children:["%",s.matchResult.score]})]}),e.jsxs("div",{className:"text-sm text-gray-500 flex items-center gap-3",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(we,{className:"w-3 h-3"}),s.location]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(dt,{className:"w-3 h-3"}),s.m2," m²"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ct,{className:"w-3 h-3"}),Mt(s.price)]})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:s.matchResult.factors.map((o,i)=>e.jsxs("span",{className:`
9                                    text-xs px-2 py-0.5 rounded-full
10                                    ${o.match?"bg-green-50 text-green-600":"bg-gray-50 text-gray-500"}
11                                  `,children:[o.name,": +",o.score]}
11,i))})]}),e.jsx("div",{className:"text-right",children:e.jsx("span",{className:"text-xs text-gray-500",children:s.matchResult.recommendation})})]})},s.id)):e.jsxs("div",{className:"text-center py-8 text-gray-400",children:[e.jsx(ee,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),e.jsx("p",{children:"Eşleşen portföy bulunamadı"})]})})})}),J==="campaign"&&e.jsx("div",{className:"space-y-4",children:e.jsx(Q,{title:"Kaynak",icon:Je,children:e.jsx(Bt,{lead:r})})}),J==="activity"&&e.jsxs("div",{className:"space-y-4",children:[e.jsx(Q,{title:"Aktivite Geçmişi",icon:Ve,children:e.jsx(It,{items:P,emptyMessage:"Henüz aktivite yok",onDelete:$,canDelete:s=>!(["create","status_change","lost","converted","assigned"].includes(s.type)||typeof s.id=="string"&&s.id.startsWith("init_"))})}),e.jsx("p",{className:"text-xs text-gray-500 italic px-2",children:"💡 Yorum/not eklemek için aşağıdaki çubuğu kullanın — her tab'tan erişilir."})]})]})}),e.jsx(Yt,{isOpen:ce,LOSS_REASONS:p,selectedReason:E,onSelectReason:D,onClose:()=>{Y(!1),D("")},onConfirm:async()=>{var s;if(!E){y.error("Lütfen kayıp nedeni seçin");return}try{await C(r.id,"Olumsuz",{loss_reason:E}),G(i=>({...i,status:"Olumsuz",loss_reason:E}));const o=((s=p.find(i=>i.id===E))==null?void 0:s.label)||E;y.success(`Olumsuz olarak işaretlendi: ${o}`),Y(!1),D(""),u==null||u()}catch(o){y.error((o==null?void 0:o.message)||"Güncelleme hatası")}}}),ne&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[60]",children:e.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-md mx-4 overflow-hidden",children:[e.jsxs("div",{className:"p-6 border-b",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Durum Güncelle"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Yeni durumu seçin"})]}),e.jsxs("div",{className:"p-6 space-y-4",children:[e.jsx("div",{className:"grid grid-cols-2 gap-2",children:X.map(s=>e.jsx("button",{onClick:()=>q(s.id),className:`
12                      px-4 py-3 rounded-xl text-sm font-medium border-2 transition-all
13                      ${T===s.id?"border-blue-500 bg-blue-50 text-blue-700":"border-gray-200 hover:border-gray-300 text-gray-700"}
14                    `,children:s.label},s.id))}),T==="Olumsuz"&&e.jsxs("div",{className:"mt-4",children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 block mb-2",children:"Kayıp Nedeni"}),e.jsxs("select",{value:oe,onChange:s=>N(s.target.value),className:"w-full px-4 py-2.5 border border-gray-200 rounded-xl",children:[e.jsx("option",{value:"",children:"Seçiniz"}),p.map(s=>e.jsx("option",{value:s.id,children:s.label},s.id))]})]}),T==="Süreç Devam Ediyor"&&e.jsx("div",{className:"mt-4 p-4 bg-orange-50 border border-orange-200 rounded-xl",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Ue,{className:"w-5 h-5 text-orange-500 mt-0.5"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium text-orange-800",children:"Otomatik Sıcak Takip Kaydı Oluşturulacak"}),e.jsx("p",{className:"text-sm text-orange-600 mt-1",children:'Bu talep "Süreç Devam Ediyor" olarak işaretlendiğinde otomatik olarak Sıcak Takip listesine eklenecek.'})]})]})})]}),e.jsxs("div",{className:"p-6 border-t bg-gray-50 flex justify-end gap-3",children:[e.jsx("button",{onClick:()=>{w(!1),q(""),N("")},className:"px-4 py-2 text-gray-700 hover:bg-gray-100 rounded-lg",children:"İptal"}),e.jsx("button",{onClick:me,disabled:!T||T==="Olumsuz"&&!oe||ie,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50",children:ie?"Kaydediliyor...":"Güncelle"})]})]})})]})},ds=[...Qt,"Diğerleri"],O=({label:I,icon:v,required:r,children:u})=>e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1.5 flex items-center gap-1.5",children:[v&&e.jsx(v,{size:14,className:"text-gray-500"}),I,r&&e.jsx("span",{className:"text-red-500",children:"*"})]}),u]}),ve=({icon:I,children:v,hint:r})=>e.jsxs("h3",{className:"text-sm font-semibold text-gray-700 uppercase tracking-wide mb-3 flex items-center gap-2",children:[e.jsx(I,{size:16,className:"text-blue-600"}),v,r&&e.jsx("span",{className:"text-xs font-normal text-gray-400 normal-case",children:r})]}),_="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-colors",us={name:"",company:"",phone:"",email:"",source:"Telefon",interest_type:"",location_request:[],m2_request:"",capacity_request:"",budget:"",status:"Aranmadı",loss_reason:"",assignee:"",notes:""},xs=({onCreate:I,onSuccess:v,onCancel:r,assigneeOptions:u=[]})=>{const{user:f}=nt(),[h,R]=n.useState(us),[Z,C]=n.useState(!1),g=c=>{const{name:p,value:k}=c.target;R(j=>({...j,[p]:k}))},X=c=>{R(p=>{const k=p.location_request.includes(c);return{...p,location_request:k?p.location_request.filter(j=>j!==c):[...p.location_request,c]}})},te=async c=>{c.preventDefault();const p=_t(h);if(p){y.error(p);return}C(!0);try{const k=Ct(h,{user:f}),j=await I(k);if(!(j!=null&&j.success))throw new Error((j==null?void 0:j.error)||"Kayıt başarısız");y.success("Satış talebi oluşturuldu"),v==null||v({id:j.id,...k})}catch(k){console.error("CBLeadForm error:",k),y.error(`Kayıt başarısız: ${k.message}`)}finally{C(!1)}};return e.jsxs("form",{onSubmit:te,className:"space-y-6",children:[e.jsxs("section",{children:[e.jsx(ve,{icon:Ee,children:"Müşteri Bilgileri"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(O,{label:"Ad Soyad",icon:Ee,required:!0,children:e.jsx("input",{type:"text",name:"name",value:h.name,onChange:g,placeholder:"Ahmet Yılmaz",className:_,required:!0})}),e.jsx(O,{label:"Firma",icon:Dt,children:e.jsx("input",{type:"text",name:"company",value:h.company,onChange:g,placeholder:"Firma adı (varsa)",className:_})}),e.jsx(O,{label:"Telefon",icon:De,required:!0,children:e.jsx("input",{type:"tel",name:"phone",value:h.phone,onChange:g,placeholder:"0532...",className:_,required:!0})}),e.jsx(O,{label:"E-posta",icon:Le,children:e.jsx("input",{type:"email",name:"email",value:h.email,onChange:g,placeholder:"[email protected]",className:_})})]})]}),e.jsxs("section",{children:[e.jsx(ve,{icon:ee,children:"Talep Detayları"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(O,{label:"Kaynak",required:!0,children:e.jsx("select",{name:"source",value:h.source,onCh
14ange:g,className:_,required:!0,children:vt.map(c=>e.jsx("option",{value:c,children:c},c))})}),e.jsx(O,{label:"Tip",children:e.jsxs("select",{name:"interest_type",value:h.interest_type,onChange:g,className:_,children:[e.jsx("option",{value:"",children:"Seçiniz"}),wt.map(c=>e.jsx("option",{value:c,children:c},c))]})}),e.jsx(O,{label:"m² Talebi",icon:dt,children:e.jsx("input",{type:"text",name:"m2_request",value:h.m2_request,onChange:g,placeholder:"örn. 150",className:_})}),e.jsx(O,{label:"Kişi Sayısı",icon:ze,children:e.jsx("input",{type:"text",name:"capacity_request",value:h.capacity_request,onChange:g,placeholder:"örn. 5 veya 10-20",className:_})}),e.jsx(O,{label:"Bütçe (₺)",icon:ct,children:e.jsx("input",{type:"number",name:"budget",value:h.budget,onChange:g,min:"0",step:"100",placeholder:"Aylık bütçe",className:_})}),e.jsxs(O,{label:"Satışçı",icon:Wt,children:[e.jsx("input",{type:"text",name:"assignee",value:h.assignee,onChange:g,list:"cb-lead-assignees",placeholder:"Seç veya yaz",className:_}),e.jsx("datalist",{id:"cb-lead-assignees",children:u.map(c=>e.jsx("option",{value:c},c))})]}),e.jsx(O,{label:"Durum",children:e.jsx("select",{name:"status",value:h.status,onChange:g,className:_,children:St.map(c=>e.jsx("option",{value:c.id,children:c.label},c.id))})}),h.status==="Olumsuz"&&e.jsx(O,{label:"Kayıp Nedeni",children:e.jsxs("select",{name:"loss_reason",value:h.loss_reason,onChange:g,className:_,children:[e.jsx("option",{value:"",children:"Seçiniz"}),kt.map(c=>e.jsx("option",{value:c.id,children:c.label},c.id))]})})]})]}),e.jsxs("section",{children:[e.jsx(ve,{icon:we,hint:"(birden fazla seçilebilir)",children:"Lokasyon Tercihleri"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ds.map(c=>{const p=h.location_request.includes(c);return e.jsx("button",{type:"button",onClick:()=>X(c),className:`px-3 py-1.5 rounded-lg text-sm border transition-colors ${p?"bg-blue-50 text-blue-700 border-blue-300 font-medium":"bg-white text-gray-600 border-gray-200 hover:bg-gray-50"}`,"aria-pressed":p,children:c},c)})})]}),e.jsxs("section",{children:[e.jsx(ve,{icon:lt,children:"Notlar"}),e.jsx("textarea",{name:"notes",value:h.notes,onChange:g,rows:"3",placeholder:"Görüşme notu, talep detayı, müşteri tercihleri...",className:_})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-4 border-t border-gray-200",children:[e.jsx("button",{type:"button",onClick:r,disabled:Z,className:"px-4 py-2 text-sm text-gray-600 hover:bg-gray-100 rounded-lg disabled:opacity-50",children:"İptal"}),e.jsx("button",{type:"submit",disabled:Z,className:"px-4 py-2 bg-blue-600 text-white text-sm rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:Z?"Kaydediliyor...":"Kaydet"})]})]})},ms={gray:"gray",yellow:"yellow",blue:"blue",purple:"purple",orange:"orange",green:"green",pink:"purple",red:"red",indigo:"purple"},gs={Ulaşılamadı:"bg-orange-100 text-orange-700",Ulaşılamıyor:"bg-orange-100 text-orange-700","İhtiyacı Yok":"bg-gray-100 text-gray-600","Tekrarlayan Talep":"bg-yellow-100 text-yellow-700","Alakasız Müşteri":"bg-stone-100 text-stone-600","Farklı Lokasyon":"bg-purple-100 text-purple-700","Konum sebebiyle":"bg-purple-100 text-purple-700","Yetersiz Bütçe":"bg-pink-100 text-pink-700","Fiyat yüksek geldi":"bg-pink-100 text-pink-700","Rakip Firma":"bg-red-100 text-red-700","Rakibe Gitti":"bg-red-100 text-red-700","Bad lead":"bg-rose-100 text-rose-700","Ofisi beğenmedi":"bg-amber-100 text-amber-700","Kendi şirketiyle devam ediyor":"bg-blue-100 text-blue-700","Zaman aşımı":"bg-zinc-100 text-zinc-600","Sözleşme sürecinde anlaşılamadı":"bg-fuchsia-100 text-fuchsia-700","Bilgi alma amaçlı":"bg-cyan-100 text-cyan-700","Test Lead":"bg-slate-200 text-slate-700",Coldwell:"bg-indigo-100 text-indigo-700",Vazgeçti:"bg-neutral-100 text-neutral-600","Prosedürlere uymadı":"bg-violet-100 text-violet-700","Süreci erteledi":"bg-teal-100 text-teal-700","Diğer hazır ofis firmalarıyla görüşmüş":"bg-red-100 text-red-700","Aracı istemiyor":"bg-sky-100 text-sky-700"},ks=({onSelectLead:I,triggerAddModal:v,onModalOpened:r})=>{const u=Zt();At();const{data:f,create:h,remove:R,updateStatus:Z,invalidate:C,PIPELINE_STAGES:g,SOURCE_COLORS:X,LOSS_REASONS:te,calculateMatchScore:c,loading:p}
14=at(),k=rt(),j=Ot(),{customFields:J,columnSettings:K,updateColumnSettings:m}=Xt("neoofis_leads"),[G,ie]=n.useState(!1),[F,P]=n.useState([]),[A,se]=n.useState(""),[M,ne]=n.useState(""),[w,T]=n.useState(""),[q,oe]=n.useState(""),[N,ce]=n.useState(""),[Y,E]=n.useState(""),[D,z]=n.useState(""),[H,V]=n.useState(""),[$,xe]=n.useState("created_at"),[W,me]=n.useState("desc"),[U,ge]=n.useState("table"),[Se,ke]=n.useState(!1),[_e,pe]=n.useState(!1),[de,Ce]=n.useState(null),[he,be]=n.useState([]),[ye,s]=n.useState(!1),[o,i]=n.useState(!1),[b,fe]=n.useState(null),[ae,Re]=n.useState(""),[Ae,Fe]=n.useState(""),[Te,Pe]=n.useState(null),[ut,qe]=n.useState(!1),[$e,ue]=n.useState(!1),xt=n.useMemo(()=>Te&&(Array.isArray(f)?f:[]).find(t=>t.id===Te)||null,[Te,f]),re=t=>{if(t!=null&&t._isNew){ue(!0);return}Pe((t==null?void 0:t.id)||null),qe(!0)},mt=()=>{qe(!1),Pe(null)};n.useEffect(()=>{v&&(ue(!0),r==null||r())},[v]),n.useEffect(()=>{gt()},[f,A,M,w,q,N,Y,D,H,$,W]);const gt=()=>{let t=Array.isArray(f)?[...f]:[];if(A){const a=Ne(A);t=t.filter(l=>{var x;return Ne(l.name).includes(a)||Ne(l.company).includes(a)||((x=l.phone)==null?void 0:x.includes(a))||Ne(l.email).includes(a)})}M&&(t=t.filter(a=>a.status===M)),w&&(t=t.filter(a=>a.source===w)),q&&(t=t.filter(a=>a.loss_reason===q)),N&&(N==="__unassigned__"?t=t.filter(a=>!a.assignee&&!a.assigned_to):t=t.filter(a=>a.assignee===N||a.assigned_to===N)),Y&&(t=t.filter(a=>Jt(a.createdAt||a.created_at,Y))),D&&(t=t.filter(a=>(a.createdAt||a.created_at||"").slice(0,10)>=D)),H&&(t=t.filter(a=>(a.createdAt||a.created_at||"").slice(0,10)<=H)),t.sort((a,l)=>{var B,je;let x=a[$],d=l[$];return $==="created_at"&&(x=((B=x==null?void 0:x.toDate)==null?void 0:B.call(x))||new Date(x||0),d=((je=d==null?void 0:d.toDate)==null?void 0:je.call(d))||new Date(d||0)),x<d?W==="asc"?-1:1:x>d?W==="asc"?1:-1:0}),P(t)},pt=t=>{$===t?me(W==="asc"?"desc":"asc"):(xe(t),me("asc"))},Be=async t=>{window.confirm("Bu lead'i silmek istediğinize emin misiniz?")&&await R(t)},Ie=async t=>{Ce(t),pe(!0),s(!0);try{const[a,l]=await Promise.all([k.getAll(),j.getAll()]),x=a.filter(S=>S.status==="Müsait"),d=l.filter(S=>S.status==="Müsait"),B=x.map(S=>({type:"property",item:S,...c(t,S)})),je=d.map(S=>({type:"ready_office",item:S,...c(t,{...S,price:S.price_monthly??S.monthly_price,m2:S.capacity*5})})),jt=[...B,...je].sort((S,Nt)=>Nt.score-S.score).slice(0,10);be(jt)}catch(a){console.error("Match error:",a)}finally{s(!1)}},ht=t=>{fe(t),Re(t.status),Fe(""),i(!0)},bt=async()=>{if(!b)return;const t={};ae==="Olumsuz"&&Ae&&(t.loss_reason=Ae),await Z(b.id,ae,t),i(!1)},yt=t=>{const a=g.find(d=>d.id===t),l={gray:{bg:"bg-gray-100",text:"text-gray-800",border:"border-gray-300",dot:"bg-gray-500"},yellow:{bg:"bg-yellow-100",text:"text-yellow-800",border:"border-yellow-300",dot:"bg-yellow-500"},blue:{bg:"bg-blue-100",text:"text-blue-800",border:"border-blue-300",dot:"bg-blue-500"},purple:{bg:"bg-purple-100",text:"text-purple-800",border:"border-purple-300",dot:"bg-purple-500"},orange:{bg:"bg-orange-100",text:"text-orange-800",border:"border-orange-300",dot:"bg-orange-500"},green:{bg:"bg-green-100",text:"text-green-800",border:"border-green-300",dot:"bg-green-500"},pink:{bg:"bg-pink-100",text:"text-pink-800",border:"border-pink-300",dot:"bg-pink-500"},red:{bg:"bg-red-100",text:"text-red-800",border:"border-red-300",dot:"bg-red-500"},indigo:{bg:"bg-indigo-100",text:"text-indigo-800",border:"border-indigo-300",dot:"bg-indigo-500"}},x=l[a==null?void 0:a.color]||l.gray;return e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-semibold border ${x.bg} ${x.text} ${x.border} whitespace-nowrap`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${x.dot}`}),t]})},Ke=t=>{const a=X[t]||"gray",l={green:"bg-green-50 text-green-600",orange:"bg-orange-50 text-orange-600",red:"bg-red-50 text-red-600",purple:"bg-purple-50 text-purple-600",pink:"bg-pink-50 text-pink-600",gray:"bg-gray-50 text-gray-600",blue:"bg-blue-50 text-blue-600",indigo:"bg-indigo-50 text-indigo-600",yellow:"bg-yellow-50 text-yellow-600",cyan:"bg-cyan-50 text-cyan-600"};return e.jsx("span",{className:`px-2 py-0.5 rounded text-xs whitespace-nowrap ${l[a]}`,children:t||"Belirsiz"})},ft=t=>t>=80?e.jsx("span",{className:"px-2 py-1 bg-green-100 text-green-700 rounded-full text-xs font-medium",children:"Yüksek Öncelik"}):t>=60?e.jsx("span",{className:"px-2 py-1 bg-blue-100 text-blue-700 rounded-full text-xs font-medium",children:"İyi Eşleşme"}):t>=40?e.jsx("span",{className:"px-2 py-1 bg-yellow-100 text-yellow-700 rounded-full text-xs font-medium",children:"Kısmi Eşleşme"}):e.jsx("span",{className:"px-2 py-1 bg-gray-100 text-gray-600 rounded-full text-xs font-medium",children:"Düşük Eşleşme"}),Ge=[...new Set((Array.isArray(f)?f:[]).map(t=>
14t.source).filter(Boolean))],Oe=[...new Set((Array.isArray(f)?f:[]).flatMap(t=>[t.assignee,t.assigned_to]).filter(Boolean))].sort((t,a)=>t.localeCompare(a,"tr")),le=n.useMemo(()=>[{id:"name",label:"Ad",required:!0,sortable:!0,sortField:"name",width:160,render:t=>e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"font-medium text-sm text-gray-900 truncate max-w-[150px]",children:t.name}),t.company&&e.jsx("div",{className:"text-xs text-gray-500 truncate max-w-[150px]",children:t.company})]})},{id:"created_at",label:"Tarih",sortable:!0,sortField:"created_at",width:110,render:t=>{var d,B;const a=((B=(d=t.created_at)==null?void 0:d.toDate)==null?void 0:B.call(d))||(t.created_at?new Date(t.created_at):null);if(!a||isNaN(a.getTime()))return e.jsx("span",{className:"text-gray-300 text-xs",children:"-"});const l=String(a.getHours()).padStart(2,"0"),x=String(a.getMinutes()).padStart(2,"0");return e.jsxs("div",{className:"text-xs",children:[e.jsx("div",{className:"text-gray-600",children:We(a)}),e.jsxs("div",{className:"text-gray-400 text-[10px] mt-0.5",children:[l,":",x]})]})}},{id:"status",label:"Durum",sortable:!0,sortField:"status",width:130,render:t=>yt(t.status)},{id:"source",label:"Kaynak",width:120,render:t=>Ke(t.source)},{id:"interest_type",label:"Tip",width:100,render:t=>e.jsx("span",{className:"text-xs text-gray-600",children:t.interest_type||"-"})},{id:"phone",label:"Telefon",width:130,render:t=>t.phone?e.jsx("span",{className:"text-xs text-gray-600",children:t.phone}):e.jsx("span",{className:"text-gray-300 text-xs",children:"-"})},{id:"email",label:"E-posta",width:180,truncate:!0,render:t=>t.email?e.jsx("span",{className:"text-xs text-gray-500",title:t.email,children:t.email}):e.jsx("span",{className:"text-gray-300 text-xs",children:"-"})},{id:"size",label:"m² / Kişi",width:130,render:t=>{const a=t.m2_request,l=Tt(t.capacity_request);return!a&&!l?e.jsx("span",{className:"text-gray-300 text-xs",children:"-"}):e.jsxs("span",{className:"text-xs text-gray-600",children:[a&&e.jsxs("span",{children:[a,"m²"]}),a&&l&&e.jsx("span",{className:"text-gray-300",children:" / "}),l&&e.jsxs("span",{children:[l," kişi"]})]})}},{id:"location_request",label:"Lokasyon",width:150,truncate:!0,render:t=>{const a=Array.isArray(t.location_request)?t.location_request.join(", "):t.location_request;return a?e.jsx("span",{className:"text-xs text-gray-600",title:a,children:a}):e.jsx("span",{className:"text-gray-300 text-xs",children:"-"})}},{id:"workspace",label:"İlan / Portföy",width:170,render:t=>t.workspace_name?e.jsxs("div",{title:`${t.workspace_name}${t.ilan_no?` (${t.ilan_no})`:""}`,children:[e.jsx("div",{className:"text-xs font-medium text-gray-900 truncate max-w-[160px]",children:t.workspace_name}),t.ilan_no&&e.jsx("div",{className:"text-[11px] text-gray-400",children:t.ilan_no})]}):e.jsx("span",{className:"text-gray-300 text-xs",children:"-"})},{id:"loss_reason",label:"Kayıp Nedeni",sortable:!0,sortField:"loss_reason",width:150,render:t=>t.loss_reason?e.jsx("span",{className:`inline-block px-2 py-0.5 rounded-full text-xs font-medium whitespace-nowrap ${gs[t.loss_reason]||"bg-red-50 text-red-700"}`,children:t.loss_reason}):e.jsx("span",{className:"text-gray-300 text-xs",children:"-"})},{id:"assignee",label:"Satışçı",sortable:!0,sortField:"assignee",width:130,truncate:!0,render:t=>{const a=t.assignee||t.assigned_to;return a?e.jsx("span",{className:"text-xs text-gray-600",title:a,children:a}):e.jsx("span",{className:"text-gray-300 text-xs",children:"-"})}},{id:"last_modified_by",label:"Son Düzenleyen",width:150,truncate:!0,render:t=>{const a=Vt(t);if(!a)return null;const l=Ut(t);return e.jsx("span",{className:"text-xs text-gray-600",title:l?new Date(l).toLocaleString("tr-TR"):"Eski sistemden aktarıldı",children:a})}},{id:"source_channel",label:"Nereden Geldi",width:190,truncate:!0,render:t=>e.jsx("span",{className:"text-xs text-gray-700",title:tt(t),children:tt(t)})},{id:"notes",label:"Not",width:200,truncate:!0,render:t=>t.notes?e.jsx("span",{className:"text-xs text-gray-500",title:t.notes,children:t.notes}):e.jsx("span",{className:"text-gray-300 text-xs",children:"-"})}],[g,X]),Ye=n.useMemo(()=>{const t=Object.fromEntries(le.map(l=>[l.id,l]));if(!K||K.length===0)return le;const a=K.map(l=>t[l.id]?{...t[l.id],visible:l.visible!==!1}
14:null).filter(Boolean);return le.forEach(l=>{K.find(x=>x.id===l.id)||a.push(l)}),a.filter(l=>l.visible!==!1||l.required)},[le,K]);return e.jsxs("div",{className:"h-full flex flex-col bg-white md:rounded-lg md:shadow",children:[e.jsxs("div",{className:"px-3 py-2.5 sm:p-4 border-b",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 mb-3 sm:mb-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"text-base sm:text-lg font-semibold text-gray-900 truncate",children:"NeoOfis Satış Talepleri"}),e.jsxs("p",{className:"text-[11px] sm:text-sm text-gray-500",children:[F.length," lead"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2 flex-shrink-0",children:[e.jsxs("div",{className:"hidden sm:flex items-center bg-gray-100 rounded-lg p-1",children:[e.jsx("button",{onClick:()=>ge("table"),className:`p-1.5 rounded ${U==="table"?"bg-white shadow-sm":""}`,children:e.jsx(es,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>ge("board"),className:`p-1.5 rounded ${U==="board"?"bg-white shadow-sm":""}`,children:e.jsx(ts,{className:"w-4 h-4"})})]}),U==="table"&&e.jsx("button",{type:"button",onClick:()=>ie(!0),className:"hidden sm:flex p-2 text-gray-500 hover:bg-gray-100 rounded-lg transition-colors",title:"Sütun Ayarları",children:e.jsx(ss,{className:"w-4 h-4"})}),e.jsxs("button",{onClick:()=>re({_isNew:!0}),className:"hidden sm:flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[e.jsx(Qe,{className:"w-4 h-4"}),"Yeni Lead"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(Lt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400 pointer-events-none"}),e.jsx("input",{type:"text",placeholder:"İsim, firma, telefon ara...",value:A,onChange:t=>se(t.target.value),className:"w-full pl-9 pr-3 py-2.5 md:py-2 border rounded-lg text-sm focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("button",{type:"button",onClick:()=>ke(t=>!t),className:`sm:hidden flex-shrink-0 h-10 px-3 border rounded-lg text-sm flex items-center gap-1.5 transition-colors ${M||w||N?"bg-blue-50 border-blue-300 text-blue-700":"border-gray-200 text-gray-600"}`,children:[e.jsx(as,{className:"w-4 h-4"}),(M?1:0)+(w?1:0)+(N?1:0)>0&&e.jsx("span",{className:"bg-blue-600 text-white text-[10px] font-bold rounded-full w-4 h-4 flex items-center justify-center",children:(M?1:0)+(w?1:0)+(N?1:0)})]}),e.jsxs("div",{className:"hidden sm:flex items-center gap-2",children:[e.jsxs("select",{value:M,onChange:t=>ne(t.target.value),className:"px-3 py-2 border rounded-lg text-sm",children:[e.jsx("option",{value:"",children:"Tüm Durumlar"}),g.map(t=>e.jsx("option",{value:t.id,children:t.label},t.id))]}),e.jsxs("select",{value:w,onChange:t=>T(t.target.value),className:"px-3 py-2 border rounded-lg text-sm",children:[e.jsx("option",{value:"",children:"Tüm Kaynaklar"}),Ge.map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsxs("select",{value:q,onChange:t=>oe(t.target.value),className:"px-3 py-2 border rounded-lg text-sm",children:[e.jsx("option",{value:"",children:"Tüm Kayıp Nedenleri"}),(te||[]).map(t=>e.jsx("option",{value:t.id,children:t.label},t.id))]}),e.jsxs("select",{value:N,onChange:t=>ce(t.target.value),className:"px-3 py-2 border rounded-lg text-sm",children:[e.jsx("option",{value:"",children:"Tüm Satışçılar"}),e.jsx("option",{value:"__unassigned__",children:"Atanmamış"}),Oe.map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsx(st,{value:{start:D,end:H},onChange:({start:t,end:a})=>{z(t),V(a),E("")},onClear:()=>{z(""),V("")}})]})]}),Se&&e.jsxs("div",{className:"sm:hidden mt-2 grid grid-cols-2 gap-2 animate-in fade-in slide-in-from-top-2 duration-150",children:[e.jsxs("select",{value:M,onChange:t=>ne(t.target.value),className:"px-3 py-2.5 border rounded-lg text-sm bg-white",children:[e.jsx("option",{value:"",children:"Tüm Durumlar"}),g.map(t=>e.jsx("option",{value:t.id,children:t.label},t.id))]}),e.jsxs("select",{value:w,onChange:t=>T(t.target.value),className:"px-3 py-2.5 border rounded-lg text-sm bg-white",children:[e.jsx("option",{value:"",children:"Tüm Kaynaklar"}),Ge.map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsxs("select",{value:N,onChange:t=>ce(t.target.value),className:"px-3 py-2.5 border rounded-lg text-sm bg-white",children:[e.jsx("option",{value:"",children:"Tüm Satışçılar"}),e.jsx("option",{value:"__unassigned__",children:"Atanmamış"}),Oe.map(t=>e.jsx("option",{value:t,children:t},t))]}),e.jsx("div",{className:"col-span-2",children:e.jsx(st,{value:{start:D,end:H},onChange:({start:t,end:a})=>{z(t),V(a),E("")},onClear:()=>{z(""),V("")}})}),(M||w||N||Y||D||H)&&e.jsx("button",{onClick:()=>{ne(""),T(""),ce(""),E(""),z(""),V("")},className:"col-span-2 text-xs text-red-600 py-1.5 hover:bg-red-50 rounded-lg",children:"Filtreleri Temizle"})]})]}),u&&e.jsx("div",{className:"flex-1 overflow-auto px-2 py-2.5 space-y-2",children:F.length===0?e.jsx("div",{className:"p-12 text-center text-gray-400 text-sm",children:p?"Yükleniyor...":"Lead bulunamadı"}):F.map(t=>{var l,x;const a=g.find(d=>d.id===t.status);return e.jsx(rs,{title:t.name||"—",subtitle:t.phone||t.company||"",subtitleType:t.phone?"tel":"text",badge:{text:t.status||"—",color:ms[a==null?void 0:a.color]||"gray"},fields:[{label:"Kaynak",value:t.source||"—"},{label:"Firma",value:t.company||"—"},{label:"Tarih",value:t.created_at||t.createdAt?We(((x=(l=t.created_at)==null?void 0:l.toDate)==null?void 0:x.call(l))||t.created_at||t.createdAt):"—"}],onClick:()=>re(t),onDelete:()=>Be(t.id)},t.id)})}),U==="table"&&e.jsxs("div",{className:`flex-1 overflow-auto ${u?"hidden":""}`,children:[e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50 sticky top-0",children:e.jsxs("tr",{children:[Ye.map(t=>e.jsx("th",{className:"px-3 py-2 text-left text-[11px] font-medium text-gray-500 uppercase tracking-wider whitespace-nowrap",style:t.truncate?{width:t.width,minWidth:t.width,maxWidth:t.width}:{minWidth:t.width},children:t.sortable?e.jsx(ls,{field:t.sortField||t.id,sortField:$,sortDir:W,onSort:pt,iconSize:12,children:t.label}):t.label},t.id)),e.jsx("th",{className:"px-3 py-2 text-right text-[11px] font-medium text-gray-500 uppercase tracking-wider w-24 whitespace-nowrap",children:"İşlem"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-200",children:F.map(t=>e.jsxs("tr",{className:"hover:bg-gray-50 cursor-pointer",onClick:()=>re(t),children:[Ye.map(a=>e.jsx("td",{className:`px-3 py-1.5 ${a.truncate?"truncate":"whitespace-nowrap"}`,style:a.truncate?{width:a.width,maxWidth:a.width,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:void 0,children:a.render(t)},a.id)),e.jsx("td",{className:"px-3 py-1.5 text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-0.5",onClick:a=>a.stopPropagation(),children:[e.jsx("button",{onClick:()=>Ie(t),className:"p-1.5 text-gray-400 hover:text-purple-600 hover:bg-purple-50 rounded",title:"Portföy Eşleştir",children:e.jsx(Ze,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>ht(t),className:"p-1.5 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded",title:"Durum Güncelle",children:e.jsx(ee,{className:"w-4 h-4"})}),t.phone&&e.jsx("a",{href:`https://wa.me/90${t.phone.replace(/\D/g,"")}`,target:"_blank",rel:"noopener noreferrer",className:"p-1.5 text-gray-400 hover:text-green-600 hover:bg-green-50 rounded",title:"WhatsApp",children:e.jsx(is,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>re(t),className:"p-1.5 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded",title:"Görüntüle",children:e.jsx(Et,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>Be(t.id),className:"p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded",title:"Sil",children:e.jsx(it,{className:"w-4 h-4"})})]})})]},t.id))})]}),F.length===0&&e.jsx("div",{className:"text-center py-12 text-gray-500",children:p?e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-blue-600"}),"Yükleniyor..."]}):e.jsxs("div",{children:[e.jsx(ze,{className:"w-12 h-12 mx-auto mb-3 text-gray-300"}),e.jsx("p",{children:"Lead bulunamadı"})]})})]}),U==="board"&&e.jsx("div",{className:"flex-1 overflow-auto p-4",children:e.jsx("div",{className:"flex gap-4 min-w-max h-full",children:g.filter(t=>!["Alakasız"].includes(t.id)).map(t=>{const a=F.filter(d=>d.status===t.id),l={gray:"bg-gray-50 border-gray-200",yellow:"bg-yellow-50 border-yellow-200",blue:"bg-blue-50 border-blue-200",purple:"bg-purple-50 border-purple-200",orange:"bg-orange-50 border-orange-200",green:"bg-green-50 border-green-200",red:"bg-red-50 border-red-200"},x={gray:"bg-gray-500",yellow:"bg-yellow-500",blue:"bg-blue-500",purple:"bg-purple-500",orange:"bg-orange-500",green:"bg-green-500",red:"bg-red-500"};return e.jsxs("div",{className:`w-72 flex-shrink-0 rounded-xl border-2 ${l[t.color]} flex flex-col`,children:[e.jsx("div",{className:"p-3 border-b border-gray-200",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-3 h-3 rounded-full ${x[t.color]}`}),e.jsx("h3",{className:"font-semibold text-gray-800",children:t.label}),e.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium bg-gray-200 text-gray-600",children:a.length})]})}),e.jsx("div",{className:"flex-1 p-2 space-y-2 overflow-y-auto",children:a.map(d=>e.jsxs("div",{onClick:()=>re(d),className:"bg-white p-3 rounded-lg shadow-sm border border-gray-200 cursor-pointer hover:shadow-md transition-shadow",children:[e.jsx("div",{className:"font-medium text-gray-900 text-sm",children:d.name}),d.company&&e.jsx("div",{className:"text-xs text-gray-500 mt-1",children:d.company}),e.jsxs("div",{className:"flex items-center justify-between mt-2",children:[Ke(d.source),e.jsx("button",{onClick:B=>{B.stopPropagation(),Ie(d)},className:"p-1 text-gray-400 hover:text-purple-600",children:e.jsx(Ze,{className:"w-3 h-3"})})]})]},d.id))})]},t.id)})})}),_e&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-2xl max-h-[80vh] overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Portföy Eşleştirme"}),e.jsxs("p",{className:"text-sm text-gray-500",children:[de==null?void 0:de.name," için öneriler"]})]}),e.jsx("button",{onClick:()=>pe(!1),className:"p-2 hover:bg-gray-100 rounded-lg",children:e.jsx(Xe,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"p-4 overflow-y-auto max-h-[60vh]",children:ye?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto"}),e.jsx("p",{className:"mt-2 text-gray-500",children:"Eşleştirmeler hesaplanıyor..."})]}):he.length===0?e.jsxs("div",{className:"text-center py-8 text-gray-500",children:[e.jsx(ee,{className:"w-12 h-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"Uygun portföy bulunamadı"})]}):e.jsx("div",{className:"space-y-3",children:he.map((t,a)=>{var l;return e.jsxs("div",{className:"border rounded-lg p-4 hover:border-blue-300 transition-colors",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:t.item.title||t.item.name||"İsimsiz"}),e.jsx("span",{className:"text-xs px-2 py-0.5 bg-gray-100 rounded",children:t.type==="property"?"Geleneksel":"Hazır Ofis"})]}),e.jsxs("div",{className:"text-sm text-gray-500 mt-1 flex items-center gap-2",children:[e.jsx(we,{className:"w-3 h-3"}),t.item.location,t.item.m2&&e.jsxs("span",{children:["• ",t.item.m2," m²"]}),t.item.capacity&&e.jsxs("span",{children:["• ",t.item.capacity," kişi"]})]}),e.jsxs("div",{className:"text-sm font-medium text-blue-600 mt-1",children:[(l=t.item.price??t.item.price_monthly)==null?void 0:l.toLocaleStr
14ing("tr-TR")," ₺",t.type==="ready_office"&&"/ay"]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-2xl font-bold text-gray-900",children:t.score}),e.jsx("div",{className:"mt-1",children:ft(t.score)})]})]}),t.factors.length>0&&e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:t.factors.map((x,d)=>e.jsxs("span",{className:"text-xs px-2 py-1 bg-green-50 text-green-700 rounded flex items-center gap-1",children:[e.jsx(zt,{className:"w-3 h-3"}),x.name,": +",x.score]},d))})]},a)})})})]})}),o&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-md",children:[e.jsxs("div",{className:"p-4 border-b flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Durum Güncelle"}),e.jsx("button",{onClick:()=>i(!1),className:"p-2 hover:bg-gray-100 rounded-lg",children:e.jsx(Xe,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Yeni Durum"}),e.jsx("select",{value:ae,onChange:t=>Re(t.target.value),className:"w-full px-3 py-2 border rounded-lg",children:g.map(t=>e.jsx("option",{value:t.id,children:t.label},t.id))})]}),ae==="Olumsuz"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Kayıp Nedeni"}),e.jsxs("select",{value:Ae,onChange:t=>Fe(t.target.value),className:"w-full px-3 py-2 border rounded-lg",children:[e.jsx("option",{value:"",children:"Seçiniz..."}),te.map(t=>e.jsx("option",{value:t.id,children:t.label},t.id))]})]})]}),e.jsxs("div",{className:"p-4 border-t flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>i(!1),className:"px-4 py-2 text-gray-600 hover:bg-gray-100 rounded-lg",children:"İptal"}),e.jsx("button",{onClick:bt,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700",children:"Güncelle"})]})]})}),e.jsx(cs,{isOpen:ut,onClose:mt,lead:xt,onUpdate:C,onDelete:C}),e.jsx(ot,{isOpen:$e,onClose:()=>ue(!1),title:"Yeni Satış Talebi",badge:"Yeni",badgeColor:"green",size:"lg",children:e.jsx("div",{className:"p-4 sm:p-6",children:$e&&e.jsx(xs,{onCreate:h,assigneeOptions:Oe,onSuccess:()=>{ue(!1),C==null||C()},onCancel:()=>ue(!1)})})}),e.jsx(ns,{isOpen:G,onClose:()=>ie(!1),coreColumns:le,customFields:J,columnSettings:K,onSave:m,defaultColumns:le}),e.jsx("button",{onClick:()=>re({_isNew:!0}),className:"sm:hidden fixed right-4 w-14 h-14 bg-blue-600 text-white rounded-full shadow-xl flex items-center justify-center z-30 active:scale-95 transition-transform","aria-label":"Yeni Lead",style:{bottom:"calc(env(safe-area-inset-bottom) + 1rem)"},children:e.jsx(Qe,{className:"w-6 h-6"})})]})};export{ks as CBLeadList,ks 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.