inventory-asset-app / sales.html
aaadejumo's picture
include the visualisation page of this data: 1/1/2024 P12345 S28576 TX Tech Traders 12345 Texas San Antonio 0.00 1,896.00 -1,896.00 Paid Pending
b8a5d0e verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sales Data Visualization</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
<style>
.chart-container {
position: relative;
height: 400px;
width: 100%;
}
.grid-item:hover {
transform: translateY(-5px);
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
</style>
</head>
<body class="bg-gray-50">
<header class="bg-indigo-600 text-white shadow-lg">
<div class="container mx-auto px-4 py-6">
<div class="flex justify-between items-center">
<h1 class="text-3xl font-bold flex items-center">
<i data-feather="dollar-sign" class="mr-2"></i> Sales Dashboard
</h1>
<nav>
<ul class="flex space-x-6">
<li><a href="index.html" class="hover:text-indigo-200 transition">Components</a></li>
<li><a href="sales.html" class="hover:text-indigo-200 transition font-bold">Sales</a></li>
<li><a href="customers.html" class="hover:text-indigo-200 transition">Customers</a></li>
</ul>
</nav>
</div>
</div>
</header>
<main class="container mx-auto px-4 py-8">
<section class="mb-12" data-aos="fade-up">
<h2 class="text-2xl font-semibold mb-6 text-gray-800 border-b pb-2">Sales Performance</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
<div class="bg-white rounded-xl shadow-md p-6">
<h3 class="text-lg font-medium mb-4 text-gray-700">Revenue by State</h3>
<div class="chart-container">
<canvas id="stateRevenueChart"></canvas>
</div>
</div>
<div class="bg-white rounded-xl shadow-md p-6">
<h3 class="text-lg font-medium mb-4 text-gray-700">Profit Distribution</h3>
<div class="chart-container">
<canvas id="profitChart"></canvas>
</div>
</div>
</div>
</section>
<section class="mb-12" data-aos="fade-up">
<h2 class="text-2xl font-semibold mb-6 text-gray-800 border-b pb-2">Key Metrics</h2>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="bg-white rounded-xl shadow-md p-6 text-center">
<div class="text-indigo-500 mb-3">
<i data-feather="trending-up" class="w-12 h-12 mx-auto"></i>
</div>
<h3 class="text-xl font-semibold mb-2">Highest Revenue</h3>
<p class="text-3xl font-bold text-gray-800">$988,971</p>
<p class="text-gray-500">Lone Star Gaming Hardware</p>
</div>
<div class="bg-white rounded-xl shadow-md p-6 text-center">
<div class="text-green-500 mb-3">
<i data-feather="dollar-sign" class="w-12 h-12 mx-auto"></i>
</div>
<h3 class="text-xl font-semibold mb-2">Highest Profit</h3>
<p class="text-3xl font-bold text-gray-800">$961,487</p>
<p class="text-gray-500">Lone Star Gaming Hardware</p>
</div>
<div class="bg-white rounded-xl shadow-md p-6 text-center">
<div class="text-red-500 mb-3">
<i data-feather="alert-circle" class="w-12 h-12 mx-auto"></i>
</div>
<h3 class="text-xl font-semibold mb-2">Lowest Profit</h3>
<p class="text-3xl font-bold text-gray-800">-$2,894</p>
<p class="text-gray-500">DDR Dynamo LLC</p>
</div>
</div>
</section>
<section data-aos="fade-up">
<h2 class="text-2xl font-semibold mb-6 text-gray-800 border-b pb-2">Sales Details</h2>
<div class="bg-white rounded-xl shadow-md overflow-hidden">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Company</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Phone</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Email</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">State</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">City</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Revenue</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Cost</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Profit</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<!-- Data rows will be inserted here by JavaScript -->
</tbody>
</table>
</div>
</div>
</section>
</main>
<footer class="bg-gray-800 text-white py-8">
<div class="container mx-auto px-4">
<div class="flex flex-col md:flex-row justify-between items-center">
<div class="mb-4 md:mb-0">
<h2 class="text-xl font-bold flex items-center">
<i data-feather="database" class="mr-2"></i> Sales Dashboard
</h2>
<p class="text-gray-400 mt-2">Visualizing sales performance data</p>
</div>
<div class="flex space-x-4">
<a href="#" class="text-gray-400 hover:text-white transition">
<i data-feather="github"></i>
</a>
<a href="#" class="text-gray-400 hover:text-white transition">
<i data-feather="twitter"></i>
</a>
<a href="#" class="text-gray-400 hover:text-white transition">
<i data-feather="linkedin"></i>
</a>
</div>
</div>
<div class="border-t border-gray-700 mt-6 pt-6 text-center text-gray-400 text-sm">
<p>© 2023 Sales Dashboard. All rights reserved.</p>
</div>
</div>
</footer>
<script>
// Initialize AOS and Feather Icons
AOS.init();
feather.replace();
// Sales data
const salesData = [
{id: "S28563", company: "Suncoast CPU Solutions", phone: "(813) 555-0143", email: "jessica@suncoastcpu.com", state: "Florida", city: "Tampa", revenue: 48537.30, cost: 29779.00, profit: 18758.30},
{id: "S28564", company: "Silicon Beach Tech Distributors", phone: "(310) 555-0189", email: "mike.chen@siliconbeachdist.com", state: "California", city: "Santa Monica", revenue: 371316.40, cost: 55280.00, profit: 316036.40},
{id: "S28565", company: "Lone Star Gaming Hardware", phone: "(214) 555-0211", email: "carlos@lonestargaming.com", state: "Texas", city: "Dallas", revenue: 988971.40, cost: 27484.01, profit: 961487.39},
{id: "S28566", company: "Desert Valley Parts", phone: "(602) 555-0083", email: "aisha@desertvalleyparts.com", state: "Arizona", city: "Phoenix", revenue: 64985.96, cost: 25597.00, profit: 39388.96},
{id: "S28568", company: "Memory Masters Corp.", phone: "(512) 555-0317", email: "emily@memorymasters.com", state: "Texas", city: "Austin", revenue: 85029.29, cost: 61902.00, profit: 23127.29},
{id: "S28569", company: "ROG Enthusiasts Outlet", phone: "(520) 555-0129", email: "victor@rogoutlet.com", state: "Arizona", city: "Tucson", revenue: 86354.36, cost: 27615.00, profit: 58739.36},
{id: "S28570", company: "PrimeBoard Direct", phone: "(407) 555-0456", email: "olivia.green@primeboard.com", state: "Florida", city: "Orlando", revenue: 55403.18, cost: 37028.00, profit: 18375.18},
{id: "S28571", company: "GPU Central USA", phone: "(713) 555-0633", email: "brandon.lee@gpucentralusa.com", state: "Texas", city: "Houston", revenue: 81320.09, cost: 44350.00, profit: 36970.09},
{id: "S28572", company: "DDR Dynamo LLC", phone: "(408) 555-0592", email: "samantha@ddrdynamo.com", state: "California", city: "San Jose", revenue: 45196.51, cost: 48091.00, profit: -2894.49},
{id: "S28573", company: "AZ Tech Distributors", phone: "(480) 555-0741", email: "rajiv@aztechdist.com", state: "Arizona", city: "Mesa", revenue: 65456.65, cost: 44707.11, profit: 20749.54},
{id: "S28574", company: "FL Component Supply", phone: "(904) 555-0902", email: "marisol@flcomponentsupply.com", state: "Florida", city: "Jacksonville", revenue: 66859.44, cost: 65507.00, profit: 1352.44},
{id: "S28575", company: "West Coast PC Imports", phone: "(510) 555-0811", email: "daniel@wcpcimports.com", state: "California", city: "Oakland", revenue: 71516.30, cost: 20299.00, profit: 51217.30},
{id: "S28576", company: "TX Tech Traders", phone: "(210) 555-0957", email: "andrea.j@txtechtraders.com", state: "Texas", city: "San Antonio", revenue: 67847.88, cost: 36613.00, profit: 31234.88},
{id: "S28577", company: "Phoenix CPU & GPU Solutions", phone: "(602) 555-0778", email: "chris.oneil@phxcpu-gpu.com", state: "Arizona", city: "Phoenix", revenue: 80530.95, cost: 33444.00, profit: 47086.95}
];
// Populate table
const tableBody = document.querySelector('tbody');
salesData.forEach(sale => {
const row = document.createElement('tr');
row.className = 'hover:bg-gray-50 transition';
row.innerHTML = `
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${sale.id}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${sale.company}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${sale.phone}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${sale.email}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${sale.state}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${sale.city}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">$${sale.revenue.toLocaleString()}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">$${sale.cost.toLocaleString()}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">$${sale.profit.toLocaleString()}</td>
`;
tableBody.appendChild(row);
});
// State Revenue Chart
const stateRevenue = salesData.reduce((acc, sale) => {
acc[sale.state] = (acc[sale.state] || 0) + sale.revenue;
return acc;
}, {});
const stateRevenueCtx = document.getElementById('stateRevenueChart').getContext('2d');
new Chart(stateRevenueCtx, {
type: 'bar',
data: {
labels: Object.keys(stateRevenue),
datasets: [{
label: 'Revenue by State',
data: Object.values(stateRevenue),
backgroundColor: [
'#6366F1',
'#10B981',
'#F59E0B',
'#EF4444',
'#8B5CF6'
],
borderWidth: 0,
borderRadius: 4
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true,
ticks: {
callback: function(value) {
return '$' + (value / 1000).toFixed(0) + 'K';
}
}
}
}
}
});
// Profit Distribution Chart
const profitCtx = document.getElementById('profitChart').getContext('2d');
new Chart(profitCtx, {
type: 'pie',
data: {
labels: salesData.map(sale => sale.company),
datasets: [{
data: salesData.map(sale => sale.profit),
backgroundColor: [
'#6366F1', '#10B981', '#F59E0B', '#EF4444', '#8B5CF6',
'#EC4899', '#14B8A6', '#F97316', '#8B5CF6', '#EC4899',
'#14B8A6', '#F97316', '#8B5CF6', '#EC4899'
],
borderWidth: 0
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: false
},
tooltip: {
callbacks: {
label: function(context) {
return context.label + ': $' + context.raw.toLocaleString();
}
}
}
}
}
});
</script>
</body>
</html>