1import{r as n,j as e,e as c,M,R as E,aE as H,T as z,B,d as x,z as d}from"./index-BuF13C9R.js";import{T as D}from"./textarea-xKivmc1W.js";import{S as F,a as I,b as P,c as V,d as O}from"./select-J0viKo_P.js";import{P as U}from"./PageHeader-BJWwaOi_.js";import{C as q}from"./chevron-up-CCjitxk2.js";import"./index-BGaOrCq_.js";const T=n.forwardRef(({className:a,...t},r)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:r,className:c("w-full caption-bottom text-sm",a),...t})}));T.displayName="Table";const C=n.forwardRef(({className:a,...t},r)=>e.jsx("thead",{ref:r,className:c("[&_tr]:border-b",a),...t}));C.displayName="TableHeader";const k=n.forwardRef(({className:a,...t},r)=>e.jsx("tbody",{ref:r,className:c("[&_tr:last-child]:border-0",a),...t}));k.displayName="TableBody";const A=n.forwardRef(({className:a,...t},r)=>e.jsx("tfoot",{ref:r,className:c("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...t}));A.displayName="TableFooter";const h=n.forwardRef(({className:a,...t},r)=>e.jsx("tr",{ref:r,className:c("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...t}));h.displayName="TableRow";const o=n.forwardRef(({className:a,...t},r)=>e.jsx("th",{ref:r,className:c("h-11 px-4 text-right text-xs font-semibold text-slate-600 uppercase tracking-wide align-middle bg-slate-50 whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...t}));o.displayName="TableHead";const i=n.forwardRef(({className:a,...t},r)=>e.jsx("td",{ref:r,className:c("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",a),...t}));i.displayName="TableCell";const G=n.forwardRef(({className:a,...t},r)=>e.jsx("caption",{ref:r,className:c("mt-4 text-sm text-muted-foreground",a),...t}));G.displayName="TableCaption";const J={new:{label:"××ש",className:"bg-blue-100 text-blue-700"},in_progress:{label:"×××פ××",className:"bg-yellow-100 text-yellow-700"},contacted:{label:"×××¨× × ××××",className:"bg-purple-100 text-purple-700"},demo_scheduled:{label:"× ×§××¢× ×××××",className:"bg-green-100 text-green-700"},not_relevant:{label:"×× ×¨×××× ××",className:"bg-slate-100 text-slate-500"},closed:{label:"× ×¡×ר",className:"bg-emerald-100 text-emerald-700"}},v=Object.entries(J).map(([a,t])=>({value:a,label:t.label}));function ee(){const[a,t]=n.useState([]),[r,j]=n.useState(!0),[m,g]=n.useState("all"),[u,S]=n.useState(null),[f,N]=n.useState({}),p=async()=>{j(!0);try{const s=await x.entities.MarketingLead.filter({is_deleted:{$ne:!0}},"-created_date",200);t(s)}catch{d.error("ש×××× ×××¢×× ×ª ×××××")}j(!1)};n.useEffect(()=>{p()},[]);const R=async(s,l)=>{try{await x.entities.MarketingLead.update(s,{status:l}),await p(),d.success("×ס×××ס ×¢××××")}catch{d.error("ש×××× ××¢××××")}},_=async s=>{try{await x.entities.MarketingLead.update(s,{notes:f[s]||""}),d.success("×××¢×¨× × ×©×ר×")}catch{d.error("ש×××× ×ש××ר×")}},L=async s=>{if(window.confirm("××× ×××××§ ××× ××?"))try{await x.entities.MarketingLead.update(s,{is_deleted:!0}),await p(),d.success("×××× × ×××§")}catch{d.error("ש×××× ×××××§×")}},w=m==="all"?a:a.filter(s=>s.status===m),y=a.filter(s=>s.status==="new").length,$=s=>s?new Date(s).toLocaleString("he-IL",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}):"";return r?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):e.jsxs("div",{children:[e.jsx(U,{title:"×××××",description:`ס×"× ${a.length} ×¤× ××ת${y>0?` · ${y} ××ש×ת`:""}`}),e.jsxs("div",{className:"flex gap-2 mb-4 overflow-x-auto pb-1",children:[e.jsxs("button",{onClick:()=>g("all"),className:`px-3 py-1.5 rounded-lg text-sm font-medium whitespace-nowrap ${m==="all"?"bg-primary text-white":"bg-white border border-border"}`,children:["××× (",a.length,")"]}),v.map(s=>{const l=a.filter(b=>b.status===s.value).length;return e.jsxs("button",{onClick:()=>
1g(s.value),className:`px-3 py-1.5 rounded-lg text-sm font-medium whitespace-nowrap ${m===s.value?"bg-primary text-white":"bg-white border border-border"}`,children:[s.label," (",l,")"]},s.value)})]}),w.length===0?e.jsxs("div",{className:"text-center py-16 text-muted-foreground",children:[e.jsx(M,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),e.jsx("p",{children:"××× ×¤× ××ת ××צ××"})]}):e.jsx("div",{className:"bg-white rounded-xl border border-border overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(T,{children:[e.jsx(C,{children:e.jsxs(h,{children:[e.jsx(o,{className:"w-8"}),e.jsx(o,{children:"ת×ר××"}),e.jsx(o,{children:"ש×"}),e.jsx(o,{children:"×§××××¥ / ×ר×××"}),e.jsx(o,{children:"××פ××"}),e.jsx(o,{children:"××××××"}),e.jsx(o,{children:"ס×××ס"}),e.jsx(o,{children:"פע×××ת"})]})}),e.jsx(k,{children:w.map(s=>e.jsxs(E.Fragment,{children:[e.jsxs(h,{className:"cursor-pointer hover:bg-accent/50",onClick:()=>{S(u===s.id?null:s.id),N(l=>({...l,[s.id]:s.notes||""}))},children:[e.jsx(i,{children:u===s.id?e.jsx(q,{className:"w-4 h-4"}):e.jsx(H,{className:"w-4 h-4"})}),e.jsx(i,{className:"text-xs whitespace-nowrap",children:$(s.created_date)}),e.jsx(i,{className:"font-medium",children:s.full_name}),e.jsx(i,{children:s.organization||"-"}),e.jsx(i,{dir:"ltr",className:"text-right",children:s.phone||"-"}),e.jsx(i,{dir:"ltr",className:"text-right text-xs",children:s.email||"-"}),e.jsx(i,{onClick:l=>l.stopPropagation(),children:e.jsxs(F,{value:s.status,onValueChange:l=>R(s.id,l),children:[e.jsx(I,{className:"w-36 h-8",children:e.jsx(P,{})}),e.jsx(V,{children:v.map(l=>e.jsx(O,{value:l.value,children:l.label},l.value))})]})}),e.jsx(i,{onClick:l=>l.stopPropagation(),children:e.jsx("button",{onClick:()=>L(s.id),className:"p-1.5 rounded hover:bg-red-50 text-red-500",children:e.jsx(z,{className:"w-4 h-4"})})})]}),u===s.id&&e.jsx(h,{children:e.jsx(i,{colSpan:8,className:"bg-slate-50",children:e.jsxs("div",{className:"p-4 space-y-3",children:[s.role&&e.jsxs("p",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:"תפק××:"})," ",s.role]}),s.message&&e.jsxs("p",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:"××××¢×:"})," ",s.message]}),e.jsxs("p",{className:"text-sm",children:[e.jsx("span",{className:"font-medium",children:"××§×ר:"})," ",s.source||"×תר ש××××§×"]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium block mb-1",children:"××¢×¨× ×¤× ×××ת"}),e.jsx(D,{value:f[s.id]||"",onChange:l=>N(b=>({...b,[s.id]:l.target.value})),rows:2,placeholder:"××סף ×ער×..."}),e.jsx(B,{size:"sm",className:"mt-2",onClick:()=>_(s.id),children:"ש××ר ×ער×"})]})]})})})]},s.id))})]})})})]})}export{ee 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.