1import{j as e}from"./vendor-motion-D_eWtC2i.js";import{u as T,r as g}from"./vendor-react-C5-rmG_I.js";import{u as S}from"./usePixTransfers-nRp2ijvV.js";import{B as v,ak as P,m as r,F as o,I as h,K as x,b as F}from"./index-BB35H7Wo.js";import{I}from"./input-ChxEbcIp.js";import{B as _}from"./badge-Bh_ckV5a.js";import{T as B,a as L,b as j,c as n,d as H,e as t}from"./table-OzS6JEnE.js";import{S as k,a as R,b as A,c as D,d as c}from"./select-x5tgiaXZ.js";import{P as V}from"./PageHeader-B-h5e2bL.js";import X from"./trending-up-D8pW3Xds.js";import E from"./download-BlHhrhT8.js";import{f as z}from"./format-CXUDrD0n.js";import{p as K}from"./pt-BR-CvHFxr10.js";import"./vendor-supabase-CfDyWxaF.js";import"./vendor-charts-BzSnLuq2.js";import"./index-BdQq_4o_.js";import"./index-Bnb-0OWf.js";import"./chevron-up-BItnVi1a.js";import"./en-US-BMDxpvZG.js";const N={pending:{label:"Pendente",variant:"secondary"},processing:{label:"Processando",variant:"default"},completed:{label:"ConcluÃda",variant:"default"},failed:{label:"Falhou",variant:"destructive"},cancelled:{label:"Cancelada",variant:"destructive"}},M={cpf:"CPF",cnpj:"CNPJ",email:"Email",phone:"Telefone",random:"Chave Aleatória"};function re(){const b=T(),[p,C]=g.useState("all"),[u,w]=g.useState(""),{data:a,isLoading:y}=S(p!=="all"?{status:p}:void 0),i=a==null?void 0:a.filter(s=>{var d,f;const l=u.toLowerCase();return s.pix_key.toLowerCase().includes(l)||((d=s.description)==null?void 0:d.toLowerCase().includes(l))||((f=s.asaas_transfer_id)==null?void 0:f.toLowerCase().includes(l))}),m={total:(a==null?void 0:a.length)||0,completed:(a==null?void 0:a.filter(s=>s.status==="completed").length)||0,pending:(a==null?void 0:a.filter(s=>s.status==="processing"||s.status==="pending").length)||0,failed:(a==null?void 0:a.filter(s=>s.status==="failed"||s.status==="cancelled").length)||0,totalAmount:(a==null?void 0:a.reduce((s,l)=>s+parseFloat(l.amount.toString()),0))||0};return e.jsxs("div",{className:"space-y-6",children:[e.jsx(V,{title:"Transferências PIX",description:"Gerencie todas as transferências PIX realizadas",children:e.jsxs(v,{onClick:()=>b("/admin/balances"),className:"gap-2",children:[e.jsx(P,{className:"h-4 w-4"}),"Nova Transferência"]})}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(r,{children:[e.jsxs(o,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(h,{className:"text-sm font-medium",children:"Total de Transferências"}),e.jsx(X,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(x,{children:e.jsx("div",{className:"text-2xl font-bold",children:m.total})})]}),e.jsxs(r,{children:[e.jsx(o,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:e.jsx(h,{className:"text-sm font-medium",children:"ConcluÃdas"})}),e.jsx(x,{children:e.jsx("div",{className:"text-2xl font-bold text-green-600",children:m.completed.toString()})})]}),e.jsxs(r,{children:[e.jsx(o,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:e.jsx(h,{className:"text-sm font-medium",children:"Pendentes"})}),e.jsx(x,{children:e.jsx("div",{className:"text-2xl font-bold text-orange-600",children:m.pending})})]}),e.jsxs(r,{children:[e.jsx(o,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:e.jsx(h,{className:"text-sm font-medium",children:"Valor Total"})}),e.jsx(x,{children:e.jsxs("div",{className:"text-2xl font-bold",children:["R$ ",m.totalAmount.toFixed(2)]})})]})]}),e.jsxs(r,{children:[e.jsx(o,{children:e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("div",{className:"flex gap-2 flex-1 max-w-sm",children:e.jsxs("div",{className:"relative flex-1",children:[e.jsx(F,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(I,{placeholder:"Buscar por chave PIX, descrição...",value:u,onChange:s=>w(s.target.value),className:"pl-8"})]})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(k,{value:p,onValueChange:C,children:[e.jsx(R,{className:"w-[180px]",children:e.jsx(A,{placeholder:"Status"})}),e.jsxs(D,{children:[e.jsx(c,{value:"all",children:"Todos os status"}),e.jsx(c,{value:"pending",children:"Pendente"}),e.jsx(c,{value:"processing",children:"Processando"}),e.jsx(c,{value:"completed",children:"ConcluÃda"}),e.jsx(c,{value:"failed",children:"Falhou"}),e.jsx(c,{value:"cancelled",children:"Cancelada"})]})]}),e.jsx(v,{variant:"outline",size:"icon",children:e.jsx(E,{className:"h-4 w-4"})})]})]})}),e.jsx(x,{children:e.jsx("div",{className:"rounded-md border",children:e.jsxs(B,{children:[e.jsx(L,{children:e.jsxs(j,{children:[e.jsx(n,{children:"Data"}),e.jsx(n,{children:"Chave PIX"}),e.jsx(n,{children:"Tipo"}),e.jsx(n,{className:"text-right",children:"Valor"}),e.jsx(n,{children:"Status"}),e.jsx(n,{children:"Asaas ID"})]})}),e.jsx(H,{children:y?e.jsx(j,{children:e.jsx(t,{colSpan:6,className:"text-center py-8",children:"Carregando..."})}):(i==null?void 0:i.length)===0?e.jsx(j,{children:e.jsx(t,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"Nenhuma transferência encontrada"})}):i==null?void 0:i.map(s=>{var l,d;return e.jsxs(j,{children:[e.jsx(t,{children:z(new Date(s.created_at),"dd/MM/yyyy HH:mm",{locale:K})}),e.jsx(t,{className:"font-medium",children:s.pix_key}),e.jsx(t,{children:M[s.pix_key_type]}),e.jsxs(t,{className:"text-right font-semibold",children:["R$ ",parseFloat(s.amount.toString()).toFixed(2)]}),e.jsx(t,{children:e.jsx(_,{variant:(l=N[s.status])==null?void 0:l.variant,children:(d=N[s.status])==null?void 0:d.label})}),e.jsx(t,{className:"font-mono text-xs",children:s.asaas_transfer_id||"-"})]},s.id)})})]})})})]})]})}export{re 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.