1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2330],{8803:(e,t,a)=>{a.d(t,{A:()=>s});let s=(0,a(71847).A)("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]])},10052:(e,t,a)=>{function s(e){return null==e?"":String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function l(e,t,a){var l;let r=e.length?Object.keys(e[0]):Object.keys(null!=(l=a.headers)?l:{}),n=r.map(t=>{let a=e.find(e=>""!==e[t]&&null!==e[t]&&void 0!==e[t]);return!!a&&function(e){if("number"==typeof e)return!0;if(null==e)return!1;let t=String(e).trim();return/\d/.test(t)&&/^-?\s*R?\$?\s*-?[\d.]+(,\d+)?\s*%?$/.test(t)}(a[t])}),i="<tr>".concat(r.map((e,t)=>{var l,r;return'<th style="text-align:'.concat(n[t]?"right":"left",'">').concat(s(null!=(r=null==(l=a.headers)?void 0:l[e])?r:e),"</th>")}).join(""),"</tr>"),o=e.length?e.map(e=>"<tr>".concat(r.map((t,a)=>'<td style="text-align:'.concat(n[a]?"right":"left",'">').concat(s(e[t]),"</td>")).join(""),"</tr>")).join(""):'<tr><td colspan="'.concat(r.length||1,'" style="text-align:center;color:#94a3b8;padding:24px">Nenhum registro encontrado no per\xedodo.</td></tr>'),d=new Date().toLocaleString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric",hour:"2-digit",minute:"2-digit"}),c='<!DOCTYPE html><html lang="pt-BR"><head><meta charset="utf-8"><title>'.concat(s(t),"</title>\n<style>\n @page { size: ").concat(a.landscape?"landscape":"portrait","; margin: 1.4cm; }\n * { box-sizing: border-box; }\n body { font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif; color: #0F172A; margin: 0; }\n .head { display:flex; justify-content:space-between; align-items:flex-start; border-bottom:2px solid #1A56DB; padding-bottom:10px; margin-bottom:16px; }\n .head h1 { font-size:18px; margin:0; }\n .head .sub { font-size:12px; color:#475569; margin-top:3px; }\n .head .meta { font-size:11px; color:#94a3b8; text-align:right; white-space:nowrap; }\n table { width:100%; border-collapse:collapse; font-size:11px; }\n th { background:#EFF6FF; color:#1E3A8A; font-weight:700; text-transform:uppercase; letter-spacing:.03em; font-size:10px; padding:7px 8px; border-bottom:1px solid #BFDBFE; }\n td { padding:6px 8px; border-bottom:1px solid #E2E8F0; }\n tr:nth-child(even) td { background:#F8FAFC; }\n tr { page-break-inside:avoid; }\n thead { display:table-header-group; }\n .foot { margin-top:14px; font-size:10px; color:#94a3b8; }\n</style></head>\n<body>\n <div class=\"head\">\n <div>\n <h1>").concat(s(a.title),"</h1>\n ").concat(a.subtitle?'<div class="sub">'.concat(s(a.subtitle),"</div>"):"",'\n </div>\n <div class="meta">Gerado em ').concat(s(d),"<br>").concat(e.length," ").concat(1===e.length?"registro":"registros","</div>\n </div>\n <table><thead>").concat(i,"</thead><tbody>").concat(o,"</tbody></table>\n ").concat(a.footer?'<div class="foot">'.concat(s(a.footer),"</div>"):"","\n <script>window.onload=function(){window.focus();window.print();};window.onafterprint=function(){window.close();};<\/script>\n</body></html>"),x=window.open("","_blank");if(!x)return void alert("Permita pop-ups para este site para gerar o PDF.");x.document.open(),x.document.write(c),x.document.close()}a.d(t,{P:()=>l})},12330:(e,t,a)=>{a.r(t),a.d(t,{default:()=>D});var s=a(95155),l=a(12115),r=a(6613),n=a(24033),i=a(89559),o=a(39867),d=a(16485),c=a(91761),x=a(60952),m=a(1524),p=a(95740);let u=(0,a(71847).A)("medal",[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]]);var h=a(26617),g=a(52056),b=a(86651),f=a(8803),v=a(7013),j=a(78384),y=a(34527),N=a(69221),w=a(10052);function k(e){return e.toLocaleString("pt-BR",{style:"currency",currency:"BRL",minimumFractionDigits:2,maximumFractionDigits:2})}function _(e){return e.toLocaleString("pt-BR")}function A(e){if(!e)return"Sem vendas no per\xedodo";let t=Math.floor((Date.now()-new Date(e).getTime())/864e5);return t<=0?"Hoje":1===t?"Ontem":t<7?"".concat(t," dias atr\xe1s"):t<30?"".concat(Math.floor(t/7)," sem. atr\xe1s"):"".concat(Math.floor(t/30)," m\xeas").concat(t>=60?"es":""," atr\xe1s")}let z={"7d":"7 dias","30d":"30 dias","90d":"90 dias",custom:"Customizado"};function S(e){let{icon:t,label:a,value:l,tint:r,hint:n}=e,i={primary:{bg:"bg-primary-light",text:"text-primary"},accent:{bg:"bg-accent-light",text:"text-accent-med"},amber:{bg:"bg-amber-50",text:"text-amber-600"},slate:{bg:"bg-slate-100",text:"text-slate-600"}}[r];return(0,s.jsxs)("div",{className:"bg-white rounded-2xl border border-slate-100 shadow-sm p-5 flex items-start gap-4 max-md:rounded-xl max-md:p-3 max-md:gap-2.5",children:[(0,s.jsx)("div",{className:"w-11 h-11 rounded-2xl ".concat(i.bg," flex items-center justify-center shrink-0 max-md:w-8 max-md:h-8 max-md:rounded-lg"),children:(0,s.jsx)(t,{size:20,className:"".concat(i.text," max-md:h-4 max-md:w-4")}
1)}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("p",{className:"text-[11px] font-bold uppercase tracking-[0.08em] text-slate-400 max-md:text-[9px]",children:a}),(0,s.jsx)("p",{className:"mt-1 text-2xl font-black text-slate-900 tabular-nums truncate max-md:mt-0.5 max-md:text-base",children:l}),n&&(0,s.jsx)("p",{className:"mt-0.5 text-xs text-slate-500 truncate max-md:text-[10px]",children:n})]})]})}function q(e){let{data:t,place:a,scale:l}=e;if(!t)return(0,s.jsx)("div",{className:"flex-1"});let r={1:{ring:"ring-amber-300/50",medal:"bg-gradient-to-br from-amber-400 to-amber-600",label:"text-amber-700",glow:"shadow-[0_8px_28px_rgba(245,158,11,0.18)]"},2:{ring:"ring-slate-300/60",medal:"bg-gradient-to-br from-slate-300 to-slate-500",label:"text-slate-600",glow:"shadow-[0_6px_20px_rgba(100,116,139,0.15)]"},3:{ring:"ring-orange-300/50",medal:"bg-gradient-to-br from-orange-300 to-orange-500",label:"text-orange-700",glow:"shadow-[0_6px_20px_rgba(234,88,12,0.15)]"}}[a],n="lg"===l?{pad:"p-6 max-md:p-3",medal:"w-12 h-12 text-base",name:"text-base",qty:"text-3xl max-md:text-xl",rev:"text-sm"}:{pad:"p-5 max-md:p-3",medal:"w-10 h-10 text-sm",name:"text-sm",qty:"text-2xl max-md:text-lg",rev:"text-xs"};return(0,s.jsxs)("div",{className:"relative flex-1 bg-white rounded-2xl border border-slate-100 ".concat(r.glow," ").concat(n.pad," ring-1 ").concat(r.ring," transition-transform duration-200 hover:-translate-y-0.5"),children:[(0,s.jsx)("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2 ".concat(n.medal," ").concat(r.medal," text-white font-black rounded-full flex items-center justify-center shadow-md ring-4 ring-white"),children:a}),(0,s.jsxs)("div",{className:"pt-4 text-center",children:[(0,s.jsx)("p",{className:"uppercase font-black tracking-[0.12em] text-[10px] ".concat(r.label),children:1===a?"L\xedder de vendas":2===a?"Vice-l\xedder":"3\xba lugar"}),(0,s.jsx)("p",{className:"mt-2 font-black text-slate-900 leading-snug line-clamp-2 ".concat(n.name),children:t.product_name}),t.category_name&&(0,s.jsx)("p",{className:"text-[11px] text-slate-400 mt-0.5",children:t.category_name}),(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsx)("p",{className:"font-black text-slate-900 tabular-nums ".concat(n.qty),children:_(t.qty_sold)}),(0,s.jsx)("p",{className:"text-[10px] uppercase tracking-wider text-slate-400 font-bold",children:"unid. vendidas"})]}),(0,s.jsx)("p",{className:"mt-3 font-black text-primary tabular-nums ".concat(n.rev),children:k(t.revenue)})]})]})}function C(e){let{top3:t}=e;return 0===t.length?(0,s.jsxs)("div",{className:"bg-white rounded-2xl border border-slate-100 shadow-sm p-10 text-center max-md:rounded-xl max-md:p-6",children:[(0,s.jsx)(r.A,{size:28,className:"mx-auto text-slate-300"}),(0,s.jsx)("p",{className:"mt-3 text-sm font-bold text-slate-600",children:"Nenhuma venda no per\xedodo"}),(0,s.jsx)("p",{className:"mt-1 text-xs text-slate-400",children:"Tente ampliar o intervalo para ver o ranking."})]}):(0,s.jsxs)("div",{className:"flex items-end gap-3 md:gap-5 pt-6",children:[(0,s.jsx)(q,{data:t[1],place:2,scale:"md"}),(0,s.jsx)(q,{data:t[0],place:1,scale:"lg"}),(0,s.jsx)(q,{data:t[2],place:3,scale:"md"})]})}function R(e){var t;let{rank:a,product:l,maxRevenue:r,animate:n}=e,i=r>0?Math.max(2,Math.round(l.revenue/r*100)):0,o=1===a?"bg-amber-100 text-amber-700":2===a?"bg-slate-200 text-slate-700":3===a?"bg-orange-100 text-orange-700":"bg-slate-50 text-slate-500";return(0,s.jsxs)("div",{className:"group flex items-center gap-3 py-3 px-2 rounded-xl max-md:py-2 hover:bg-slate-50 transition-colors",children:[(0,s.jsx)("div",{className:"w-7 h-7 rounded-lg ".concat(o," flex items-center justify-center font-black text-xs tabular-nums shrink-0"),children:a}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-baseline justify-between gap-3",children:[(0,s.jsx)("p",{className:"text-sm font-bold text-slate-800 truncate",children:l.product_name}),(0,s.jsx)("p",{className:"text-sm font-black text-slate-900 tabular-nums shrink-0",children:k(l.revenue)})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 mt-1",children:[(0,s.jsxs)("p",{className:"text-[11px] text-slate-400 truncate",children:[null!=(t=l.category_name)?t:"Sem categoria"," \xb7 ",_(l.qty_sold)," un."]}),(0,s.jsxs)("p",{className:"text-[11px] text-slate-400 tabular-nums shrink-0",children:["ticket ",k(l.avg_ticket)]})]}),(0,s.jsx)("div",{className:"mt-2 h-1.5 bg-slate-100 rounded-full overflow-hidden",children:(0,s.jsx)("div",{className:"h-full bg-gradient-to-r from-primary to-primary-med rounded-full transition-all duration-700 ease-out",style:{width:n?"".concat(i,"%"):"0%"}})})]})]})}function F(e){var t;let{product:a}=e,l=0===a.qty_sold;return(0,s.jsxs)("div",{className:"flex items-center gap-3 py-3 px-2 rounded-xl max-md:py-2 hover:bg-amber-50/30 transition-colors",children:[(0,s.jsx)("div",{className:"w-2 h-2 rounded-full shrink-0 ".concat(l?"bg-rose-400":"bg-amber-400")}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-bold text-slate-800 truncate",children:a.product_name}),(0,s.jsxs)("p",{className:"text-[11px] text-slate-400 truncate",children:[null!=(t=a.category_name)?t:"Sem categoria"," \xb7 \xfaltima venda: ",(0,s.jsx)("span",{className:l?"text-rose-600 font-semibold":"",children:A(a.last_sale)})]})]}),(0,s.jsxs)("div",{className:"text-right shrink-0",children:[(0,s.jsxs)("p",{className:"text-sm font-black text-slate-900 tabular-nums",children:[_(a.qty_sold)," ",(0,s.jsx)("span",{className:"text-xs font-bold text-slate-400",children:"un."})]}),(0,s.jsx)("p",{className:"text-[11px] text-slate-400 tabular-nums",children:k(a.revenue)})]})]})}function D(){var e,t,a,f,v,q,D;let{restaurantId:M}=(0,j.p)(),[P,T]=(0,l.useState)("30d"),[B,E]=(0,l.useState)(""),[O,I]=(0,l.useState)(""),[V,U]=(0,l.useState)(""),[Q,$]=(0,l.useState)([]),[G,H]=(0,l.useState)(null),[Y,J]=(0,l.useState)(!0),[
1K,W]=(0,l.useState)(""),[X,Z]=(0,l.useState)(!1),[ee,et]=(0,l.useState)("revenue"),[ea,es]=(0,l.useState)("desc");(0,l.useEffect)(()=>{M&&(0,y.jE)(M).then(e=>{$((null!=e?e:[]).map(e=>{var t;return{id:null!=(t=e.id)?t:"",name:e.name}}).filter(e=>!!e.id))}).catch(()=>{})},[M]);let el=(0,l.useCallback)(async()=>{if(M){J(!0),Z(!1);try{let e=new URLSearchParams;e.set("period",P),"custom"===P&&B&&O&&(e.set("from",new Date(B).toISOString()),e.set("to",new Date(O).toISOString())),V&&e.set("category_id",V),e.set("restaurant_id",M);let t=await (0,N.a)(),a=await fetch("/api/admin/relatorios/produtos?".concat(e.toString()),{credentials:"same-origin",headers:t}),s=await a.json();a.ok?(H(s),requestAnimationFrame(()=>requestAnimationFrame(()=>Z(!0)))):console.error("[relatorios/produtos] erro:",s)}finally{J(!1)}}},[M,P,B,O,V]);(0,l.useEffect)(()=>{("custom"!==P||B&&O)&&el()},[el,P,B,O]);let er=(0,l.useMemo)(()=>{if(!G)return[];let e=K.trim().toLowerCase();return[...e?G.all.filter(t=>{var a;return t.product_name.toLowerCase().includes(e)||(null!=(a=t.category_name)?a:"").toLowerCase().includes(e)}):G.all].sort((e,t)=>{let a=0;switch(ee){case"revenue":a=e.revenue-t.revenue;break;case"qty_sold":a=e.qty_sold-t.qty_sold;break;case"avg_ticket":a=e.avg_ticket-t.avg_ticket;break;case"last_sale":a=(e.last_sale?new Date(e.last_sale).getTime():0)-(t.last_sale?new Date(t.last_sale).getTime():0);break;case"product_name":a=e.product_name.localeCompare(t.product_name)}return"asc"===ea?a:-a})},[G,K,ee,ea]),en=e=>{ee===e?es(e=>"asc"===e?"desc":"asc"):(et(e),es("product_name"===e?"asc":"desc"))},ei=null!=(a=null==G||null==(e=G.top10[0])?void 0:e.revenue)?a:0;return(0,s.jsxs)("div",{className:"space-y-6 p-2 max-md:space-y-4 max-md:p-0",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between max-md:gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-2xl md:text-3xl font-black text-slate-900 tracking-tight font-[family-name:var(--font-heading)] max-md:text-lg",children:"Ranking de Produtos"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-slate-500 max-md:mt-0.5 max-md:text-[11px]",children:"Veja exatamente o que mais sai â e o que merece um empurr\xe3o."})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 max-md:gap-1.5",children:[(0,s.jsx)("div",{className:"inline-flex p-1 rounded-xl bg-white border border-slate-200 shadow-sm max-md:w-full",children:["7d","30d","90d","custom"].map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>T(e),className:"px-3 py-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer max-md:flex-1 max-md:px-2 max-md:py-1 max-md:text-[11px] ".concat(P===e?"bg-primary text-white shadow-sm":"text-slate-500 hover:text-slate-700"),children:z[e]},e))}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsxs)("select",{value:V,onChange:e=>U(e.target.value),className:"appearance-none pr-8 pl-3 py-2 rounded-xl bg-white border border-slate-200 shadow-sm text-xs font-bold text-slate-600 cursor-pointer focus:outline-none focus:ring-2 focus:ring-primary/20 max-md:py-1.5 max-md:text-[11px]",children:[(0,s.jsx)("option",{value:"",children:"Todas as categorias"}),Q.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,s.jsx)(n.A,{size:14,className:"absolute right-2 top-1/2 -translate-y-1/2 text-slate-400 pointer-events-none"})]}),(0,s.jsx)("button",{type:"button",onClick:el,disabled:Y,title:"Atualizar",className:"p-2 rounded-xl bg-white border border-slate-200 text-slate-500 hover:bg-slate-50 cursor-pointer transition-colors disabled:opacity-50",children:(0,s.jsx)(i.A,{size:14,className:Y?"animate-spin":""})}),(0,s.jsxs)("button",{type:"button",onClick:()=>{if(!G)return;let e=e=>Number(e||0).toLocaleString("pt-BR",{style:"currency",currency:"BRL"});(0,w.P)(er.map((t,a)=>{var s;return{posicao:a+1,produto:t.product_name,categoria:null!=(s=t.category_name)?s:"",qtd:t.qty_sold,receita:e(t.revenue),ticket:e(t.avg_ticket),ultima:t.last_sale?new Date(t.last_sale).toLocaleDateString("pt-BR"):""}}),"produtos-".concat(P),{title:"Ranking de Vendas",landscape:!0,headers:{posicao:"Posi\xe7\xe3o",produto:"Produto",categoria:"Categoria",qtd:"Qtd vendida",receita:"Receita",ticket:"Ticket m\xe9dio",ultima:"\xdaltima venda"}})},disabled:!G||0===er.length,className:"inline-flex items-center gap-1.5 px-3 py-2 rounded-xl bg-slate-900 text-white text-xs font-bold hover:bg-slate-800 transition-colors disabled:opacity-50 cursor-pointer",children:[(0,s.jsx)(o.A,{size:13})," PDF"]})]})]}),"custom"===P&&(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4 py-3 rounded-2xl bg-primary-light/40 border border-primary/15",children:[(0,s.jsx)(d.A,{size:14,className:"text-primary"}),(0,s.jsx)("span",{className:"text-xs font-bold text-primary-dark",children:"Per\xedodo customizado:"}),(0,s.jsx)("input",{type:"date",value:B,onChange:e=>E(e.target.value),className:"px-2 py-1 rounded-lg border border-primary/20 bg-white text-xs"}),(0,s.jsx)("span",{className:"text-xs text-slate-500",children:"at\xe9"}),(0,s.jsx)("input",{type:"date",value:O,onChange:e=>I(e.target.value),className:"px-2 py-1 rounded-lg border border-primary/20 bg-white text-xs"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 md:gap-4 max-md:gap-2",children:[(0,s.jsx)(S,{icon:c.A,label:"Receita Total",tint:"primary",value:G?k(G.kpis.total_revenue):"â",hint:Y?"Atualizandoâ¦":"".concat(null!=(f=null==G?void 0:G.kpis.products_count)?f:0," produtos")}),(0,s.jsx)(S,{icon:x.A,label:"Unidades Vendidas",tint:"accent",value:G?_(G.kpis.total_qty):"â",hint:"No per\xedodo"}),(0,s.jsx)(S,{icon:m.A,label:"Ticket M\xe9dio",tint:"slate",value:G?k(G.kpis.avg_ticket):"â",hint:"Receita / unidade"}),(0,s.jsx)(S,{icon:p.A,label:"Produto L\xedder",tint:"amber",value:(null==G?void 0:G.kpis.leader)?_(G.kpis.leader.qty_sold)+" un.":"â",hint:null!=(v=null==G||null==(t=G.kpis.leader)?void 0:t.product_name)?v:"Sem vendas"})]}),(0,s.jsxs)("section",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(r.A,{size:16,className:"text-amber-500"}),(0,s.jsx)("h2",{className:"text-sm font-black uppercase tracking-[0.12em] text-slate-700",children:"Top 3 do per\xedodo"})]}),(0,s.jsx)("span",{className:"text-[11px] text-slate-400 font-medium",children:z[P]})]}),(0,s.jsx)(C,{top3:null!=(q=null==G?void 0:G.top10.slice(0,3))?q:[]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"bg-white rounded-2xl border border-slate-100 shadow-sm p-5 max-md:rounded-xl max-md:p-3.5",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(u,{size:16,className:"text-primary"}),(0,s.jsx)("h2",{className:"text-sm font-black text-slate-800",children:"Mais vendidos"})]}),(0,s.jsx)("span",{className:"text-[11px] font-bold text-slate-400 uppercase tracking-wider",children:"Top 10"})]}),G&&G.top10.length>0?(0,s.jsx)("div",{className:"-mx-2",children:G.top10.map((e,t)=>(0,s.jsx)(R,{rank:t+1,product:e,maxRevenue:ei,animate:X},e.product_id))}):(0,s.jsxs)("div",{className:"py-10 text-center",children:[(0,s.jsx)(h.A,{size:24,className:"mx-auto text-slate-300"}),(0,s.jsx)("p",{className:"mt-2 text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Sem vendas no per\xedodo"})]})]}),(0,s.jsxs)("div",{className:"bg-white rounded-2xl border border-slate-100 shadow-sm p-5 max-md:rounded-xl max-md:p-3.5",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(g.A,{size:16,className:"text-amber-500"}),(0,s.jsx)("h2",{className:"text-sm font-black text-slate-800",children:"Precisam de aten\xe7\xe3o"})]}),(0,s.jsxs)("span",{className:"text-[11px] font-bold text-amber-600 uppercase tracking-wider",children:[null!=(D=null==G?void 0:G.kpis.products_without_sales)?D:0," sem venda"]})]}),G&&G.bottom10.length>0?(0,s.jsx)("div",{className:"-mx-2",children:G.bottom10.map(e=>(0,s.jsx)(F,{product:e},e.product_id))}):(0,s.jsxs)("div",{className:"py-10 text-center",children:[(0,s.jsx)(p.A,{size:24,className:"mx-auto text-accent"}),(0,s.jsx)("p",{className:"mt-2 text-xs font-bold text-slate-500",children:"Tudo girando bem por aqui!"}),(0,s.jsx)("p",{className:"text-[11px] text-slate-400",children:"Nenhum produto ativo est\xe1 parado."})]})]})]}),(0,s.jsxs)("div",{className:"bg-white rounded-2xl border border-slate-100 shadow-sm overflow-hidden",children:[(0,s.jsxs)("div",{className:"p-5 border-b border-slate-100 max-md:p-3.5 flex flex-col md:flex-row md:items-center md:justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-sm font-black text-slate-800",children:"Lista completa"}),(0,s.jsx)("p",{className:"text-xs text-slate-500",children:"Todos os produtos do card\xe1pio neste per\xedodo."})]}),(0,s.jsxs)("div",{className:"relative w-full md:w-72",children:[(0,s.jsx)(b.A,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),(0,s.jsx)("input",{type:"text",value:K,onChange:e=>W(e.target.value),placeholder:"Buscar produto ou categoriaâ¦",className:"w-full pl-9 pr-3 py-2 rounded-xl border border-slate-200 bg-slate-50 text-xs focus:outline-none focus:bg-white focus:border-primary/30 focus:ring-2 focus:ring-primary/15 transition-all"})]})]}),Y&&!G?(0,s.jsxs)("div",{className:"p-10 text-center",children:[(0,s.jsx)(i.A,{size:20,className:"mx-auto text-slate-300 animate-spin"}),(0,s.jsx)("p",{className:"mt-2 text-xs font-bold text-slate-400 uppercase tracking-wider",children:"Carregandoâ¦"})]}):0===er.length?(0,s.jsxs)("div",{className:"p-10 text-center",children:[(0,s.jsx)(h.A,{size:24,className:"mx-auto text-slate-300"}),(0,s.jsx)("p",{className:"mt-2 text-xs font-bold text-slate-400",children:K?"Nenhum produto encontrado.":"Nenhum produto neste per\xedodo."})]}):(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"w-full text-sm",children:[(0,s.jsx)("thead",{className:"bg-slate-50 text-[11px] font-bold uppercase tracking-wider text-slate-500",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-5 py-3 max-md:px-3 max-md:py-2 text-left w-12",children:"#"}),(0,s.jsx)(L,{sortable:!0,label:"Produto",active:"product_name"===ee,dir:ea,onClick:()=>en("product_name"),align:"left"}),(0,s.jsx)(L,{sortable:!0,label:"Categoria",active:!1,dir:ea,onClick:()=>{},align:"left"}),(0,s.jsx)(L,{sortable:!0,label:"Qtd",active:"qty_sold"===ee,dir:ea,onClick:()=>en("qty_sold"),align:"right"}),(0,s.jsx)(L,{sortable:!0,label:"Receita",active:"revenue"===ee,dir:ea,onClick:()=>en("revenue"),align:"right"}),(0,s.jsx)(L,{sortable:!0,label:"Ticket m\xe9d.",active:"avg_ticket"===ee,dir:ea,onClick:()=>en("avg_ticket"),align:"right"}),(0,s.jsx)(L,{sortable:!0,label:"\xdaltima venda",active:"last_sale"===ee,dir:ea,onClick:()=>en("last_sale"),align:"right"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-slate-100",children:er.map((e,t)=>{var a;return(0,s.jsxs)("tr",{className:"hover:bg-slate-50/50 transition-colors",children:[(0,s.jsx)("td",{className:"px-5 py-3 max-md:px-3 max-md:py-2 text-xs font-black text-slate-400 tabular-nums",children:t+1}),(0,s.jsx)("td",{className:"py-3 pr-3 max-md:py-2 text-sm font-bold text-slate-800 truncate max-w-xs",children:e.product_name}),(0,s.jsx)("td",{className:"py-3 pr-3 max-md:py-2 text-xs text-slate-500",children:null!=(a=e.category_name)?a:"â"}),(0,s.jsx)("td",{className:"py-3 pr-3 max-md:py-2 text-sm font-bold text-slate-700 tabular-nums text-right",children:_(e.qty_sold)}),(0,s.jsx)("td",{className:"py-3 pr-3 max-md:py-2 text-sm font-black text-slate-900 tabular-nums text-right",children:k(e.revenue)}),(0,s.jsx)("td",{className:"py-3 pr-3 max-md:py-2 text-sm text-slate-600 tabular-nums text-right",children:e.qty_sold>0?k(e.avg_ticket):"â"}),(0,s.jsx)("td",{className:"px-5 py-3 max-md:px-3 max-md:py-2 text-xs text-slate-500 text-right",children:A(e.last_sale)})]},e.product_id)})})]})})]})]})}function L(e){let{label:t,sortable:a,active:l,dir:r,onClick:n,align:i}=e;return(0,s.jsx)("th",{className:"px-3 py-3 ".concat("right"===i?"text-right":"text-left"),"aria-sort":l?"asc"===r?"ascending":"descending":"none",children:(0,s.jsxs)("button",{type:"button",onClick:a?n:void 0,disabled:!a,className:"inline-flex items-center gap-1 ".concat(a?"cursor-pointer hover:text-slate-700":"cursor-default"," transition-colors ").concat(l?"text-primary":""),children:[t,a&&l&&(0,s.jsx)(f.A,{size:11,className:"transition-transform ".concat("asc"===r?"rotate-180":"")}
1),a&&!l&&(0,s.jsx)(v.A,{size:10,className:"opacity-30"})]})})}},16485:(e,t,a)=>{a.d(t,{A:()=>s});let s=(0,a(71847).A)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]])}}]);
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.