Spaces:
Running
Running
File size: 18,257 Bytes
7eeea54 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Dashboard | CropSync Nexus</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
<style>
.sidebar {
transition: all 0.3s ease;
}
.dashboard-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body class="bg-gray-100">
<div class="flex h-screen overflow-hidden">
<!-- Sidebar -->
<div class="sidebar bg-primary-800 text-white w-64 flex-shrink-0">
<div class="p-4 flex items-center border-b border-primary-700">
<i data-feather="sun" class="h-6 w-6"></i>
<span class="ml-2 text-xl font-bold">CropSync Nexus</span>
</div>
<nav class="p-4">
<div class="mb-8">
<p class="text-xs uppercase text-primary-300 mb-2">Admin Panel</p>
<a href="/admin-dashboard" class="flex items-center py-2 px-3 bg-primary-700 rounded-md text-white">
<i data-feather="home" class="h-4 w-4 mr-2"></i> Dashboard
</a>
<a href="/admin/users" class="flex items-center py-2 px-3 hover:bg-primary-700 rounded-md mt-1">
<i data-feather="users" class="h-4 w-4 mr-2"></i> User Management
</a>
<a href="/admin/enterprises" class="flex items-center py-2 px-3 hover:bg-primary-700 rounded-md mt-1">
<i data-feather="map" class="h-4 w-4 mr-2"></i> Farm Enterprises
</a>
<a href="/admin/reports" class="flex items-center py-2 px-3 hover:bg-primary-700 rounded-md mt-1">
<i data-feather="bar-chart-2" class="h-4 w-4 mr-2"></i> Reports
</a>
<a href="/admin/settings" class="flex items-center py-2 px-3 hover:bg-primary-700 rounded-md mt-1">
<i data-feather="settings" class="h-4 w-4 mr-2"></i> System Settings
</a>
</div>
<div>
<p class="text-xs uppercase text-primary-300 mb-2">Quick Actions</p>
<a href="/admin/tasks" class="flex items-center py-2 px-3 hover:bg-primary-700 rounded-md">
<i data-feather="check-circle" class="h-4 w-4 mr-2"></i> Task Management
</a>
<a href="/admin/inventory" class="flex items-center py-2 px-3 hover:bg-primary-700 rounded-md mt-1">
<i data-feather="package" class="h-4 w-4 mr-2"></i> Inventory
</a>
<a href="/admin/finance" class="flex items-center py-2 px-3 hover:bg-primary-700 rounded-md mt-1">
<i data-feather="dollar-sign" class="h-4 w-4 mr-2"></i> Financials
</a>
</div>
</nav>
</div>
<!-- Main Content -->
<div class="flex-1 overflow-auto">
<!-- Top Navigation -->
<header class="bg-white shadow-sm">
<div class="flex justify-between items-center px-6 py-4">
<div class="flex items-center">
<button id="sidebarToggle" class="mr-4 text-gray-500 hover:text-gray-700">
<i data-feather="menu"></i>
</button>
<h1 class="text-xl font-semibold text-gray-800">Admin Dashboard</h1>
</div>
<div class="flex items-center space-x-4">
<div class="relative">
<button id="notificationsBtn" class="p-1 text-gray-500 hover:text-gray-700">
<i data-feather="bell"></i>
<span class="absolute top-0 right-0 h-2 w-2 rounded-full bg-red-500"></span>
</button>
</div>
<div class="relative">
<button id="messagesBtn" class="p-1 text-gray-500 hover:text-gray-700">
<i data-feather="mail"></i>
</button>
</div>
<div class="relative">
<button id="userMenuBtn" class="flex items-center text-sm focus:outline-none">
<img class="h-8 w-8 rounded-full" src="http://static.photos/people/200x200/1" alt="User profile">
<span class="ml-2 text-gray-700">Admin User</span>
<i data-feather="chevron-down" class="ml-1 h-4 w-4 text-gray-500"></i>
</button>
</div>
</div>
</div>
</header>
<!-- Dashboard Content -->
<main class="p-6">
<!-- Stats Cards -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-6">
<div class="dashboard-card bg-white p-6 rounded-lg shadow-sm transition-all duration-300">
<div class="flex justify-between items-start">
<div>
<p class="text-sm font-medium text-gray-500">Total Users</p>
<h3 class="text-2xl font-bold mt-1">142</h3>
</div>
<div class="p-2 bg-primary-100 rounded-md">
<i data-feather="users" class="text-primary-600 h-5 w-5"></i>
</div>
</div>
<p class="text-xs text-gray-500 mt-2"><span class="text-green-500">+5.2%</span> from last month</p>
</div>
<div class="dashboard-card bg-white p-6 rounded-lg shadow-sm transition-all duration-300">
<div class="flex justify-between items-start">
<div>
<p class="text-sm font-medium text-gray-500">Active Farms</p>
<h3 class="text-2xl font-bold mt-1">24</h3>
</div>
<div class="p-2 bg-green-100 rounded-md">
<i data-feather="map-pin" class="text-green-600 h-5 w-5"></i>
</div>
</div>
<p class="text-xs text-gray-500 mt-2"><span class="text-green-500">+2 new</span> this week</p>
</div>
<div class="dashboard-card bg-white p-6 rounded-lg shadow-sm transition-all duration-300">
<div class="flex justify-between items-start">
<div>
<p class="text-sm font-medium text-gray-500">Tasks Completed</p>
<h3 class="text-2xl font-bold mt-1">87%</h3>
</div>
<div class="p-2 bg-blue-100 rounded-md">
<i data-feather="check-circle" class="text-blue-600 h-5 w-5"></i>
</div>
</div>
<p class="text-xs text-gray-500 mt-2"><span class="text-green-500">+12%</span> efficiency</p>
</div>
<div class="dashboard-card bg-white p-6 rounded-lg shadow-sm transition-all duration-300">
<div class="flex justify-between items-start">
<div>
<p class="text-sm font-medium text-gray-500">Monthly Revenue</p>
<h3 class="text-2xl font-bold mt-1">$28,450</h3>
</div>
<div class="p-2 bg-yellow-100 rounded-md">
<i data-feather="dollar-sign" class="text-yellow-600 h-5 w-5"></i>
</div>
</div>
<p class="text-xs text-gray-500 mt-2"><span class="text-green-500">+8.3%</span> from last month</p>
</div>
</div>
<!-- Charts Row -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6">
<div class="bg-white p-6 rounded-lg shadow-sm">
<div class="flex justify-between items-center mb-4">
<h2 class="text-lg font-semibold text-gray-800">Farm Productivity</h2>
<select class="text-sm border border-gray-300 rounded-md px-2 py-1 focus:outline-none focus:ring-1 focus:ring-primary-500">
<option>Last 7 Days</option>
<option>Last 30 Days</option>
<option selected>This Year</option>
</select>
</div>
<canvas id="productivityChart" height="250"></canvas>
</div>
<div class="bg-white p-6 rounded-lg shadow-sm">
<div class="flex justify-between items-center mb-4">
<h2 class="text-lg font-semibold text-gray-800">Enterprise Distribution</h2>
<div class="text-sm text-gray-500">Total: 24 Farms</div>
</div>
<div id="enterpriseChart" class="h-64"></div>
</div>
</div>
<!-- Recent Activity & Quick Actions -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<div class="lg:col-span-2 bg-white p-6 rounded-lg shadow-sm">
<div class="flex justify-between items-center mb-4">
<h2 class="text-lg font-semibold text-gray-800">Recent Activity</h2>
<a href="#" class="text-sm text-primary-600 hover:text-primary-700">View All</a>
</div>
<div class="space-y-4">
<div class="flex items-start">
<div class="flex-shrink-0 bg-primary-100 rounded-full p-2">
<i data-feather="user-plus" class="text-primary-600 h-4 w-4"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium text-gray-800">New technician added</p>
<p class="text-xs text-gray-500">John Doe was added to Farm #5 by Admin</p>
<p class="text-xs text-gray-400 mt-1">2 hours ago</p>
</div>
</div>
<div class="flex items-start">
<div class="flex-shrink-0 bg-green-100 rounded-full p-2">
<i data-feather="check-circle" class="text-green-600 h-4 w-4"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium text-gray-800">Task completed</p>
<p class="text-xs text-gray-500">Harvesting in Field B-3 marked as complete</p>
<p class="text-xs text-gray-400 mt-1">5 hours ago</p>
</div>
</div>
<div class="flex items-start">
<div class="flex-shrink-0 bg-yellow-100 rounded-full p-2">
<i data-feather="alert-triangle" class="text-yellow-600 h-4 w-4"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium text-gray-800">Disease detected</p>
<p class="text-xs text-gray-500">Powdery mildew reported in Farm #2</p>
<p class="text-xs text-gray-400 mt-1">1 day ago</p>
</div>
</div>
<div class="flex items-start">
<div class="flex-shrink-0 bg-blue-100 rounded-full p-2">
<i data-feather="dollar-sign" class="text-blue-600 h-4 w-4"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium text-gray-800">New transaction</p>
<p class="text-xs text-gray-500">$1,240 revenue from tomato sales</p>
<p class="text-xs text-gray-400 mt-1">2 days ago</p>
</div>
</div>
</div>
</div>
<div class="bg-white p-6 rounded-lg shadow-sm">
<div class="flex justify-between items-center mb-4">
<h2 class="text-lg font-semibold text-gray-800">Quick Actions</h2>
</div>
<div class="space-y-3">
<a href="/admin/users/create" class="flex items-center px-4 py-3 bg-primary-50 rounded-md hover:bg-primary-100">
<i data-feather="user-plus" class="text-primary-600 h-5 w-5"></i>
<span class="ml-3 text-sm font-medium">Add New User</span>
</a>
<a href="/admin/tasks/create" class="flex items-center px-4 py-3 bg-green-50 rounded-md hover:bg-green-100">
<i data-feather="plus-circle" class="text-green-600 h-5 w-5"></i>
<span class="ml-3 text-sm font-medium">Create Task</span>
</a>
<a href="/admin/reports/generate" class="flex items-center px-4 py-3 bg-blue-50 rounded-md hover:bg-blue-100">
<i data-feather="file-text" class="text-blue-600 h-5 w-5"></i>
<span class="ml-3 text-sm font-medium">Generate Report</span>
</a>
<a href="/admin/inventory/add" class="flex items-center px-4 py-3 bg-purple-50 rounded-md hover:bg-purple-100">
<i data-feather="package" class="text-purple-600 h-5 w-5"></i>
<span class="ml-3 text-sm font-medium">Add Inventory</span>
</a>
</div>
</div>
</div>
</main>
</div>
</div>
<script>
feather.replace();
// Initialize productivity chart
const productivityCtx = document.getElementById('productivityChart').getContext('2d');
new Chart(productivityCtx, {
type: 'line',
data: {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
datasets: [
{
label: 'Yield (kg/ha)',
data: [1200, 1400, 1600, 1800, 2100, 2300, 2500, 2400, 2200, 2000, 1800, 1500],
borderColor: '#22c55e',
backgroundColor: 'rgba(34, 197, 94, 0.05)',
fill: true,
tension: 0.4
},
{
label: 'Revenue ($)',
data: [3200, 3800, 4200, 4500, 5200, 5800, 6200, 6000, 5500, 5000, 4500, 4000],
borderColor: '#3b82f6',
backgroundColor: 'rgba(59, 130, 246, 0.05)',
fill: true,
tension: 0.4
}
]
},
options: {
responsive: true,
plugins: {
legend: {
position: 'top',
},
tooltip: {
mode: 'index',
intersect: false,
}
},
scales: {
y: {
beginAtZero: true
}
}
}
});
// Initialize enterprise distribution chart
var enterpriseOptions = {
series: [44, 55, 41, 17, 15],
labels: ['Crops', 'Poultry', 'Horticulture', 'Beekeeping', 'Agro-Food'],
chart: {
type: 'donut',
height: 350
},
colors: ['#22c55e', '#3b82f6', '#f59e0b', '#8b5cf6', '#ec4899'],
responsive: [{
breakpoint: 480,
options: {
chart: {
width: 200
},
legend: {
position: 'bottom'
}
}
}]
};
var enterpriseChart = new ApexCharts(document.querySelector("#enterpriseChart"), enterpriseOptions);
enterpriseChart.render();
// Toggle sidebar
document.getElementById('sidebarToggle').addEventListener('click', function() {
document.querySelector('.sidebar').classList.toggle('hidden');
});
</script>
</body>
</html> |