shopsphere-pro-admin-dashboard / admin-dashboard.html
KhingLeo1's picture
can you create admin page to the e-commerce where admin can monitor sales and also update , delete and add new products and ad graph chart to the admin page where he can read sale made in month and total in year
b1bcf9c verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Dashboard | ShopSphere</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<link rel="stylesheet" href="style.css">
<script src="https://cdn.tailwindcss.com"></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/chart.js"></script>
</head>
<body class="bg-gray-100">
<admin-sidebar></admin-sidebar>
<div class="ml-64 p-8">
<div class="flex justify-between items-center mb-8">
<h1 class="text-3xl font-bold">Admin Dashboard</h1>
<div class="flex items-center gap-4">
<div class="relative">
<input type="text" placeholder="Search..." class="pl-10 pr-4 py-2 border rounded-lg">
<i data-feather="search" class="absolute left-3 top-2.5 text-gray-400"></i>
</div>
<button class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg flex items-center">
<i data-feather="plus" class="mr-2"></i>
Generate Report
</button>
</div>
</div>
<!-- Stats Cards -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
<div class="bg-white p-6 rounded-lg shadow">
<div class="flex justify-between">
<div>
<p class="text-gray-500">Total Sales</p>
<h3 class="text-2xl font-bold">$24,780</h3>
<p class="text-green-500 text-sm mt-1">+12% from last month</p>
</div>
<div class="bg-indigo-100 text-indigo-600 p-3 rounded-full">
<i data-feather="dollar-sign"></i>
</div>
</div>
</div>
<div class="bg-white p-6 rounded-lg shadow">
<div class="flex justify-between">
<div>
<p class="text-gray-500">Total Orders</p>
<h3 class="text-2xl font-bold">1,245</h3>
<p class="text-green-500 text-sm mt-1">+8% from last month</p>
</div>
<div class="bg-green-100 text-green-600 p-3 rounded-full">
<i data-feather="shopping-cart"></i>
</div>
</div>
</div>
<div class="bg-white p-6 rounded-lg shadow">
<div class="flex justify-between">
<div>
<p class="text-gray-500">New Customers</p>
<h3 class="text-2xl font-bold">142</h3>
<p class="text-green-500 text-sm mt-1">+15% from last month</p>
</div>
<div class="bg-blue-100 text-blue-600 p-3 rounded-full">
<i data-feather="users"></i>
</div>
</div>
</div>
<div class="bg-white p-6 rounded-lg shadow">
<div class="flex justify-between">
<div>
<p class="text-gray-500">Avg. Order Value</p>
<h3 class="text-2xl font-bold">$89.45</h3>
<p class="text-green-500 text-sm mt-1">+5% from last month</p>
</div>
<div class="bg-purple-100 text-purple-600 p-3 rounded-full">
<i data-feather="trending-up"></i>
</div>
</div>
</div>
</div>
<!-- Charts -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8">
<div class="bg-white p-6 rounded-lg shadow">
<h3 class="text-lg font-bold mb-4">Monthly Sales</h3>
<canvas id="salesChart" height="300"></canvas>
</div>
<div class="bg-white p-6 rounded-lg shadow">
<h3 class="text-lg font-bold mb-4">Revenue by Category</h3>
<canvas id="categoryChart" height="300"></canvas>
</div>
<div class="bg-white p-6 rounded-lg shadow">
<h3 class="text-lg font-bold mb-4">Traffic Sources</h3>
<canvas id="trafficChart" height="300"></canvas>
</div>
<div class="bg-white p-6 rounded-lg shadow">
<h3 class="text-lg font-bold mb-4">Yearly Performance</h3>
<canvas id="yearlyChart" height="300"></canvas>
</div>
</div>
<!-- Recent Orders -->
<div class="bg-white rounded-lg shadow overflow-hidden">
<div class="px-6 py-4 border-b flex justify-between items-center">
<h3 class="text-lg font-bold">Recent Orders</h3>
<a href="/admin-orders.html" class="text-indigo-600 hover:text-indigo-800 text-sm font-medium">View All</a>
</div>
<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">Order ID</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Customer</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Amount</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">#ORD-7842</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Sarah Johnson</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">June 15, 2023</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">$187.99</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Delivered</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<a href="#" class="text-indigo-600 hover:text-indigo-900 mr-3">View</a>
<a href="#" class="text-red-600 hover:text-red-900">Delete</a>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">#ORD-7841</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Michael Chen</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">June 14, 2023</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">$245.50</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">Processing</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<a href="#" class="text-indigo-600 hover:text-indigo-900 mr-3">View</a>
<a href="#" class="text-red-600 hover:text-red-900">Delete</a>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">#ORD-7840</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">David Rodriguez</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">June 13, 2023</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">$98.75</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">Shipped</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<a href="#" class="text-indigo-600 hover:text-indigo-900 mr-3">View</a>
<a href="#" class="text-red-600 hover:text-red-900">Delete</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script src="components/admin-sidebar.js"></script>
<script src="script.js"></script>
<script>
feather.replace();
// Sales Chart
const salesCtx = document.getElementById('salesChart').getContext('2d');
const salesChart = new Chart(salesCtx, {
type: 'line',
data: {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
datasets: [{
label: 'Sales ($)',
data: [8500, 10200, 9800, 12500, 14300, 16700, 15200, 18100, 17500, 19300, 21000, 24780],
backgroundColor: 'rgba(99, 102, 241, 0.1)',
borderColor: 'rgba(99, 102, 241, 1)',
borderWidth: 2,
tension: 0.3,
fill: true
}]
},
options: {
responsive: true,
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true
}
}
}
});
// Category Chart
const categoryCtx = document.getElementById('categoryChart').getContext('2d');
const categoryChart = new Chart(categoryCtx, {
type: 'doughnut',
data: {
labels: ['Electronics', 'Fashion', 'Home & Living', 'Beauty', 'Other'],
datasets: [{
data: [35, 25, 20, 15, 5],
backgroundColor: [
'rgba(99, 102, 241, 0.8)',
'rgba(79, 70, 229, 0.8)',
'rgba(109, 40, 217, 0.8)',
'rgba(139, 92, 246, 0.8)',
'rgba(168, 85, 247, 0.8)'
],
borderWidth: 0
}]
},
options: {
responsive: true,
plugins: {
legend: {
position: 'right'
}
}
}
});
// Traffic Chart
const trafficCtx = document.getElementById('trafficChart').getContext('2d');
const trafficChart = new Chart(trafficCtx, {
type: 'bar',
data: {
labels: ['Direct', 'Organic', 'Social', 'Referral', 'Paid'],
datasets: [{
label: 'Traffic Sources',
data: [35, 40, 15, 7, 3],
backgroundColor: [
'rgba(99, 102, 241, 0.7)',
'rgba(79, 70, 229, 0.7)',
'rgba(109, 40, 217, 0.7)',
'rgba(139, 92, 246, 0.7)',
'rgba(168, 85, 247, 0.7)'
],
borderWidth: 0
}]
},
options: {
responsive: true,
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true
}
}
}
});
// Yearly Chart
const yearlyCtx = document.getElementById('yearlyChart').getContext('2d');
const yearlyChart = new Chart(yearlyCtx, {
type: 'line',
data: {
labels: ['2020', '2021', '2022', '2023'],
datasets: [{
label: 'Yearly Revenue',
data: [85000, 125000, 178000, 220000],
backgroundColor: 'rgba(99, 102, 241, 0.1)',
borderColor: 'rgba(99, 102, 241, 1)',
borderWidth: 2,
tension: 0.3,
fill: true
}]
},
options: {
responsive: true,
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true
}
}
}
});
</script>
</body>
</html>