1import{j as e}from"./vendor-editor-BX0sR0z-.js";import{P as v,G as d,S as p,E as b,a as h}from"./index-D7cCp94-.js";import{u}from"./CentralProvider-DJUXuMKB.js";import{I as g}from"./IconHeartHandshake-D8H1B51G.js";import{I as N}from"./IconRefresh-CX_OS3mR.js";import{I as w}from"./IconRoute-CBzcXfMl.js";import{I as k}from"./IconLayoutKanban-Bk-iTPsl.js";import{I}from"./IconChevronRight-_i4BDM-V.js";import{L as m}from"./vendor-react-BPk9u-w4.js";import"./vendor-charts-Cf-ruFca.js";import"./vendor-ui-utils-Bbg69IUi.js";import"./ConfirmProvider-DHQTVUCD.js";import"./useEscapeKey-BwRSuhVP.js";import"./vendor-icons-D7M_7Je-.js";import"./index-P8wGLujW.js";import"./index-FZUSOwo2.js";import"./vendor-graph-Df3mHyA7.js";import"./vendor-supabase-UBwEW4nm.js";import"./vendor-sonner-DPZ7yCFm.js";import"./vendor-helmet-C74EPpLp.js";import"./IconArrowLeft-Cj4VLDZe.js";import"./createReactComponent-LJ3Rzzl2.js";import"./IconChevronLeft-CWWwj-5H.js";import"./IconLoader2--C_1KE90.js";import"./IconClockPlay-B-LSN6C5.js";function f(s){return(s??0).toLocaleString("pt-BR")}function y({etapas:s,porEtapa:a,carregando:l}){return e.jsx("ol",{className:"flex min-w-max items-stretch gap-1","aria-label":"Etapas do funil",children:s.map((r,i)=>e.jsxs("li",{className:"flex items-center gap-1",children:[e.jsxs("div",{className:"min-w-[104px] rounded-lg border border-slate-200/70 bg-slate-50/60 px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`h-2 w-2 flex-shrink-0 rounded-full ${r.dot}`,"aria-hidden":"true"}),e.jsx("span",{className:"truncate text-[11px] font-medium text-slate-500",children:r.label})]}),l?e.jsx(h,{className:"mt-1 h-5 w-12"}):e.jsx("div",{className:"mt-0.5 text-[18px] font-semibold leading-tight tabular-nums text-slate-900",children:f(a==null?void 0:a[r.id])})]}),i<s.length-1&&e.jsx(I,{size:12,className:"flex-shrink-0 text-slate-300","aria-hidden":"true"})]},r.id))})}function o({label:s,valor:a,carregando:l,tom:r="slate"}){const i={slate:"text-slate-900",emerald:"text-emerald-600",red:"text-red-600"}[r];return e.jsxs("div",{className:"px-5 py-3",children:[e.jsx("div",{className:"text-[11px] font-medium text-slate-400",children:s}),l?e.jsx(h,{className:"mt-1 h-6 w-16"}):e.jsx("div",{className:`mt-0.5 text-[20px] font-semibold leading-tight tabular-nums ${i}`,children:f(a)})]})}function A({produto:s,estado:a}){const l=u(),r=s.icon,i=s.funil,{etapas:c}=l.etapas.useEtapasDoProduto(s.id);if(!i)return null;const t=(a==null?void 0:a.leitura)??null,x=(a==null?void 0:a.erro)??null,n=(a==null?void 0:a.carregando)??!0,j=t?t.atrasados!==null:!1;return e.jsxs(p,{children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-slate-100 px-5 py-4",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-xl bg-violet-600/10 text-violet-700",children:e.jsx(r,{size:18,strokeWidth:1.75})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"truncate text-[15px] font-semibold tracking-tight text-slate-900",children:s.label}),e.jsxs("p",{className:"text-[12px] text-slate-500",children:[s.descricao," · ",i.etapas.length," etapas"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(d,{as:m,to:l.caminhoDasEtapas(s.id),icon:w,children:"Etapas"}),e.jsxs(m,{to:l.caminhoDoPipeline(s.id),className:"inline-flex h-9 items-center gap-1.5 rounded-lg bg-slate-900 px-3.5 text-[13px] font-medium text-white transition-[transform,background-color] hover:bg-slate-800 active:scale-[0.98]",children:[e.jsx(k,{size:15,strokeWidth:2}),"Abrir pipeline"]})]})]}),x&&e.jsx("div",{className:"px-5 pt-4",children:e.jsx(b,{message:x})}),e.jsx("div",{className:"overflow-x-auto px-5 py-4",children:e.jsx(y,{etapas:c,porEtapa:t==null?void 0:t.porEtapa,carregando:n})}),e.jsxs("div",{className:"grid grid-cols-2 divide-x divide-slate-100 border-t border-slate-100 sm:grid-cols-4",children:[e.jsx(o,{label:"Em trabalho",valor:t==null?void 0:t.emTrabalho,carregando:n}),e.jsx(o,{label:"Aprovados",valor:t==null?void 0:t.aprovados,carregando:n,tom:"emerald"}),e.jsx(o,{label:"Perdidos",valor:t==null?void 0:t.perdidos,carregando:n}),(n||j)&&e.jsx(o,{label:"Retomada vencida",valor:(t==null?void 0:t.atrasad
1os)??void 0,carregando:n,tom:((t==null?void 0:t.atrasados)??0)>0?"red":"slate"})]})]})}function Z(){const s=u(),{leituras:a,recarregar:l}=s.leituras.useLeiturasDosFunis(),r=s.produtosSemFunil();return e.jsxs("div",{className:"mx-auto max-w-7xl p-6",children:[e.jsx(v,{title:s.textos.titulo,subtitle:s.textos.visaoGeral,icon:g,actions:e.jsx(d,{icon:N,onClick:l,children:"Atualizar"})}),e.jsx("div",{className:"flex flex-col gap-4",children:s.produtosComFunil().map(i=>e.jsx(A,{produto:i,estado:a[i.id]},i.id))}),r.length>0&&e.jsxs(p,{className:"mt-6",children:[e.jsxs("div",{className:"border-b border-slate-100 px-5 py-4",children:[e.jsx("h2",{className:"text-[14px] font-semibold text-slate-900",children:"Sem funil ativo"}),e.jsx("p",{className:"mt-0.5 text-[12px] text-slate-500",children:"Produtos que ainda vendem fora da central. Ativar um funil é definir as etapas dele."})]}),e.jsx("ul",{className:"divide-y divide-slate-100",children:r.map(i=>{const c=i.icon;return e.jsxs("li",{className:"flex items-center gap-3 px-5 py-3",children:[e.jsx("span",{className:"flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-lg bg-slate-100 text-slate-500",children:e.jsx(c,{size:14,strokeWidth:1.75})}),e.jsx("span",{className:"text-[13px] font-medium text-slate-700",children:i.label}),e.jsx("span",{className:"hidden truncate text-[12px] text-slate-400 sm:inline",children:i.descricao}),i.visaoGeral&&e.jsx(m,{to:i.visaoGeral,className:"ml-auto text-[12px] font-medium text-slate-600 hover:text-slate-900",children:"Abrir produto"})]},i.id)})})]})]})}export{Z 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.