Spaces:
Running

undefined / index.html
Nckiler's picture
remova o o filtro de semanas, ele não está funcionando e bugou as outras visualizações. Os dados dos KPI estão errados.
300581c verified
Raw History Blame Contribute Delete
22.8 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RevenueViz: Financial Dashboard</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: {
500: '#6366f1',
},
secondary: {
500: '#ec4899',
}
}
}
}
}
</script>
<style>
.glow {
box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}
.data-card:hover {
transform: translateY(-5px);
transition: all 0.3s ease;
}
.chart-container {
height: 400px;
}
#vanta-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
opacity: 0.2;
}
</style>
</head>
<body class="bg-gray-900 text-white min-h-screen">
<div id="vanta-bg"></div>
<div class="container mx-auto px-4 py-8">
<!-- Header -->
<header class="mb-12 text-center">
<h1 class="text-4xl md:text-5xl font-bold mb-4 bg-gradient-to-r from-primary-500 to-secondary-500 text-transparent bg-clip-text">
Dashboard Financeiro Loja de Afiliados
</h1>
<p class="text-gray-400 max-w-2xl mx-auto">
Dados atualizados dia 13 de Outubro
</p>
</header>
<!-- Key Metrics Cards -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-12">
<div class="data-card bg-gray-800 rounded-xl p-6 glow border border-gray-700">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-400 mb-1">Receita Total</p>
<h3 class="text-2xl font-bold">$27.06M</h3>
<p class="text-gray-400 text-sm">(Faturamento + Recuperação)</p>
</div>
<div class="bg-primary-500/20 p-2 rounded-lg">
<i data-feather="dollar-sign" class="text-primary-500"></i>
</div>
</div>
<div class="mt-4">
<div class="h-1 w-full bg-gray-700 rounded-full overflow-hidden">
<div class="h-full bg-gradient-to-r from-primary-500 to-secondary-500" style="width: 100%"></div>
</div>
</div>
</div>
<div class="data-card bg-gray-800 rounded-xl p-6 glow border border-gray-700">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-400 mb-1">Margem Direta</p>
<h3 class="text-2xl font-bold">$1.84M</h3>
<p class="text-gray-400 text-sm">(6.8% do faturamento)</p>
</div>
<div class="bg-secondary-500/20 p-2 rounded-lg">
<i data-feather="trending-up" class="text-secondary-500"></i>
</div>
</div>
<div class="mt-4">
<div class="h-1 w-full bg-gray-700 rounded-full overflow-hidden">
<div class="h-full bg-gradient-to-r from-secondary-500 to-primary-500" style="width: 68%"></div>
</div>
</div>
</div>
<div class="data-card bg-gray-800 rounded-xl p-6 glow border border-gray-700">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-400 mb-1">Taxa de Recuperação</p>
<h3 class="text-2xl font-bold">4.6%</h3>
</div>
<div class="bg-green-500/20 p-2 rounded-lg">
<i data-feather="repeat" class="text-green-500"></i>
</div>
</div>
<div class="mt-4">
<div class="h-1 w-full bg-gray-700 rounded-full overflow-hidden">
<div class="h-full bg-gradient-to-r from-green-500 to-blue-500" style="width: 46%"></div>
</div>
<p class="text-gray-400 text-sm mt-2">+0.4% da semana passada</p>
</div>
</div>
<div class="data-card bg-gray-800 rounded-xl p-6 glow border border-gray-700">
<div class="flex justify-between items-start">
<div>
<p class="text-gray-400 mb-1">Reembolsos + Chargeback</p>
<h3 class="text-2xl font-bold">6.2%</h3>
</div>
<div class="bg-red-500/20 p-2 rounded-lg">
<i data-feather="alert-triangle" class="text-red-500"></i>
</div>
</div>
<div class="mt-4">
<div class="h-1 w-full bg-gray-700 rounded-full overflow-hidden">
<div class="h-full bg-gradient-to-r from-red-500 to-orange-500" style="width: 62%"></div>
</div>
</div>
</div>
</div>
<!-- Main Chart -->
<div class="bg-gray-800 rounded-xl p-6 mb-12 border border-gray-700 glow">
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-bold">Visão Geral do Desempenho Financeiro</h2>
<div class="flex space-x-2">
<button class="bg-primary-500 hover:bg-primary-600 px-3 py-1 rounded-lg text-sm transition-colors">Semanal</button>
</div>
</div>
<div class="chart-container">
<canvas id="mainChart"></canvas>
</div>
</div>
<!-- Secondary Charts -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-12">
<div class="bg-gray-800 rounded-xl p-6 border border-gray-700 glow">
<h3 class="text-lg font-bold mb-4">Receita vs Margem Direta</h3>
<div class="chart-container" style="height: 300px;">
<canvas id="revenueChart"></canvas>
</div>
</div>
<div class="bg-gray-800 rounded-xl p-6 border border-gray-700 glow">
<h3 class="text-lg font-bold mb-4">Custos como % do Faturamento</h3>
<div class="chart-container" style="height: 300px;">
<canvas id="costChart"></canvas>
</div>
</div>
</div>
<!-- Data Table -->
<div class="bg-gray-800 rounded-xl p-6 border border-gray-700 glow overflow-x-auto">
<h3 class="text-lg font-bold mb-4">Dados Semanais Detalhados</h3>
<table class="min-w-full divide-y divide-gray-700">
<thead>
<tr>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Semana</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Receita</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">HelpGrid</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">SMS</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Recebível</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-400 uppercase tracking-wider">Resultado Final</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-700">
<tr>
<td class="px-4 py-3 whitespace-nowrap">06 a 12.10</td>
<td class="px-4 py-3 whitespace-nowrap">$3.396M</td>
<td class="px-4 py-3 whitespace-nowrap">$93.9K</td>
<td class="px-4 py-3 whitespace-nowrap">$62.9K</td>
<td class="px-4 py-3 whitespace-nowrap">$954.5K</td>
<td class="px-4 py-3 whitespace-nowrap text-primary-500">$765.0K</td>
</tr>
<tr>
<td class="px-4 py-3 whitespace-nowrap">29 a 05.10</td>
<td class="px-4 py-3 whitespace-nowrap">$3.672M</td>
<td class="px-4 py-3 whitespace-nowrap">$94.4K</td>
<td class="px-4 py-3 whitespace-nowrap">$60.1K</td>
<td class="px-4 py-3 whitespace-nowrap">$973.8K</td>
<td class="px-4 py-3 whitespace-nowrap text-primary-500">$756.9K</td>
</tr>
<tr>
<td class="px-4 py-3 whitespace-nowrap">22 a 28.09</td>
<td class="px-4 py-3 whitespace-nowrap">$3.597M</td>
<td class="px-4 py-3 whitespace-nowrap">$61.7K</td>
<td class="px-4 py-3 whitespace-nowrap">$75.9K</td>
<td class="px-4 py-3 whitespace-nowrap">$833.3K</td>
<td class="px-4 py-3 whitespace-nowrap text-primary-500">$661.1K</td>
</tr>
<tr>
<td class="px-4 py-3 whitespace-nowrap">15 a 21.09</td>
<td class="px-4 py-3 whitespace-nowrap">$3.550M</td>
<td class="px-4 py-3 whitespace-nowrap">$67.2K</td>
<td class="px-4 py-3 whitespace-nowrap">$78.3K</td>
<td class="px-4 py-3 whitespace-nowrap">$750.7K</td>
<td class="px-4 py-3 whitespace-nowrap text-primary-500">$524.8K</td>
</tr>
<tr>
<td class="px-4 py-3 whitespace-nowrap">08 a 14.09</td>
<td class="px-4 py-3 whitespace-nowrap">$3.478M</td>
<td class="px-4 py-3 whitespace-nowrap">$74.5K</td>
<td class="px-4 py-3 whitespace-nowrap">$73.9K</td>
<td class="px-4 py-3 whitespace-nowrap">$700.1K</td>
<td class="px-4 py-3 whitespace-nowrap text-primary-500">$442.0K</td>
</tr>
<tr>
<td class="px-4 py-3 whitespace-nowrap">01 a 07.09</td>
<td class="px-4 py-3 whitespace-nowrap">$4.223M</td>
<td class="px-4 py-3 whitespace-nowrap">$89.1K</td>
<td class="px-4 py-3 whitespace-nowrap">$32.5K</td>
<td class="px-4 py-3 whitespace-nowrap">$780.8K</td>
<td class="px-4 py-3 whitespace-nowrap text-primary-500">$469.8K</td>
</tr>
<tr>
<td class="px-4 py-3 whitespace-nowrap">25 a 31.08</td>
<td class="px-4 py-3 whitespace-nowrap">$2.881M</td>
<td class="px-4 py-3 whitespace-nowrap">$63.5K</td>
<td class="px-4 py-3 whitespace-nowrap">$0</td>
<td class="px-4 py-3 whitespace-nowrap">$478.5K</td>
<td class="px-4 py-3 whitespace-nowrap text-primary-500">$286.7K</td>
</tr>
<tr>
<td class="px-4 py-3 whitespace-nowrap">18 a 24.08</td>
<td class="px-4 py-3 whitespace-nowrap">$906.6K</td>
<td class="px-4 py-3 whitespace-nowrap">$12.3K</td>
<td class="px-4 py-3 whitespace-nowrap">$0</td>
<td class="px-4 py-3 whitespace-nowrap">$162.2K</td>
<td class="px-4 py-3 whitespace-nowrap text-primary-500">$69.5K</td>
</tr>
<tr>
<td class="px-4 py-3 whitespace-nowrap">11 a 17.08</td>
<td class="px-4 py-3 whitespace-nowrap">$405.1K</td>
<td class="px-4 py-3 whitespace-nowrap">$10.5K</td>
<td class="px-4 py-3 whitespace-nowrap">$0</td>
<td class="px-4 py-3 whitespace-nowrap">$51.2K</td>
<td class="px-4 py-3 whitespace-nowrap text-primary-500">$8.7K</td>
</tr>
<!-- More rows... -->
</tbody>
</table>
</div>
</div>
<script>
</script>
<script>
// Initialize Vanta.js background
VANTA.GLOBE({
el: "#vanta-bg",
mouseControls: true,
touchControls: true,
gyroControls: false,
minHeight: 200.00,
minWidth: 200.00,
scale: 1.00,
scaleMobile: 1.00,
color: 0x6366f1,
backgroundColor: 0x111827,
size: 0.8
});
// Initialize Feather Icons
feather.replace();
// Chart data
const weeks = [
'06-12.10', '29-05.10', '22-28.09',
'15-21.09', '08-14.09', '01-07.09',
'25-31.08', '18-24.08', '11-17.08'
];
// Updated revenue calculation (faturamento + recuperação)
const revenueData = [3396115 + 93944 + 62927,
3672289 + 94357 + 60073,
3597099 + 61731 + 75882,
3549509 + 67172 + 78344,
3478023 + 74485 + 73933,
4223167 + 89118 + 32502,
2880623 + 63483,
906564 + 12322,
405099 + 10539];
const receivableData = [954534, 973781, 833303, 750733, 700088, 780824, 478496, 162175, 51183];
const finalResultData = [765002, 756892, 661139, 524812, 442019, 469774, 286655, 69542, 8666];
const helpGridData = [93944, 94357, 61731, 67172, 74485, 89118, 63483, 12322, 10539];
const smsData = [62927, 60073, 75882, 78344, 73933, 32502, 0, 0, 0];
const costData = {
refunds: [114223, 139911, 223912, 291876, 308076, 378223, 285723, 85849, 42778],
chargeBacks: [70958, 155249, 193508, 231280, 326830, 439764, 310894, 112581, 42424],
cartPanda: [288670, 312145, 305753, 301708, 295632, 358969, 244853, 77058, 34433],
shipOffers: [346404, 371318, 309778, 371437, 406487, 432669, 255324, 104955, 53056]
};
// Main Chart
const mainCtx = document.getElementById('mainChart').getContext('2d');
new Chart(mainCtx, {
type: 'line',
data: {
labels: weeks,
datasets: [
{
label: 'Receita',
data: revenueData,
borderColor: '#6366f1',
backgroundColor: 'rgba(99, 102, 241, 0.1)',
borderWidth: 3,
tension: 0.3,
fill: true
},
{
label: 'Recebível',
data: receivableData,
borderColor: '#ec4899',
backgroundColor: 'rgba(236, 72, 153, 0.1)',
borderWidth: 3,
tension: 0.3,
fill: true
},
{
label: 'Resultado Final',
data: finalResultData,
borderColor: '#10b981',
backgroundColor: 'rgba(16, 185, 129, 0.1)',
borderWidth: 3,
tension: 0.3,
fill: true
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'top',
labels: {
color: '#fff'
}
},
tooltip: {
mode: 'index',
intersect: false,
callbacks: {
label: function(context) {
return context.dataset.label + ': $' + context.raw.toLocaleString();
}
}
}
},
scales: {
x: {
grid: {
color: 'rgba(255, 255, 255, 0.1)'
},
ticks: {
color: '#fff'
}
},
y: {
grid: {
color: 'rgba(255, 255, 255, 0.1)'
},
ticks: {
color: '#fff',
callback: function(value) {
return '$' + (value / 1000).toFixed(0) + 'K';
}
}
}
}
}
});
// Revenue Chart
const revenueCtx = document.getElementById('revenueChart').getContext('2d');
new Chart(revenueCtx, {
type: 'bar',
data: {
labels: weeks,
datasets: [
{
label: 'Receita',
data: revenueData,
backgroundColor: 'rgba(99, 102, 241, 0.7)',
borderColor: '#6366f1',
borderWidth: 1
},
{
label: 'Margem Direta',
data: finalResultData,
backgroundColor: 'rgba(16, 185, 129, 0.7)',
borderColor: '#10b981',
borderWidth: 1
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'top',
labels: {
color: '#fff'
}
},
tooltip: {
callbacks: {
label: function(context) {
return context.dataset.label + ': $' + context.raw.toLocaleString();
}
}
}
},
scales: {
x: {
grid: {
color: 'rgba(255, 255, 255, 0.1)'
},
ticks: {
color: '#fff'
}
},
y: {
grid: {
color: 'rgba(255, 255, 255, 0.1)'
},
ticks: {
color: '#fff',
callback: function(value) {
return '$' + (value / 1000).toFixed(0) + 'K';
}
}
}
}
}
});
// Cost Chart
const costCtx = document.getElementById('costChart').getContext('2d');
new Chart(costCtx, {
type: 'doughnut',
data: {
labels: ['Refunds', 'ChargeBacks', 'CartPanda', 'ShipOffers', 'Afiliados', 'Outros'],
datasets: [{
data: [
(costData.refunds.reduce((a, b) => a + b, 0) / revenueData.reduce((a, b) => a + b, 0)) * 100,
(costData.chargeBacks.reduce((a, b) => a + b, 0) / revenueData.reduce((a, b) => a + b, 0)) * 100,
(costData.cartPanda.reduce((a, b) => a + b, 0) / revenueData.reduce((a, b) => a + b, 0)) * 100,
(costData.shipOffers.reduce((a, b) => a + b, 0) / revenueData.reduce((a, b) => a + b, 0)) * 100,
15.2, // Placeholder for affiliates percentage
8.5 // Placeholder for other costs percentage
],
backgroundColor: [
'rgba(239, 68, 68, 0.7)',
'rgba(249, 115, 22, 0.7)',
'rgba(234, 179, 8, 0.7)',
'rgba(20, 184, 166, 0.7)',
'rgba(139, 92, 246, 0.7)',
'rgba(6, 182, 212, 0.7)'
],
borderColor: [
'#ef4444',
'#f97316',
'#eab308',
'#14b8a6',
'#8b5cf6',
'#06b6d4'
],
borderWidth: 1
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'right',
labels: {
color: '#fff'
}
},
tooltip: {
callbacks: {
label: function(context) {
const label = context.label || '';
const value = context.raw || 0;
const total = context.dataset.data.reduce((a, b) => a + b, 0);
const percentage = Math.round((value / total) * 100);
return label + ': $' + value.toLocaleString() + ' (' + percentage + '%)';
}
}
}
}
}
});
</script>
</body>
</html>