Spaces:
Running
Running
sync data from https://192.168.1.241/ap and create for me a funstion dashboard - Initial Deployment
Browse files- README.md +7 -5
- index.html +771 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: ap-analytics
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: green
|
| 5 |
+
colorTo: pink
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,771 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>AP Analytics - SYSPRO ERP Dashboard Extension</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
| 10 |
+
<style>
|
| 11 |
+
.sidebar {
|
| 12 |
+
transition: all 0.3s ease;
|
| 13 |
+
}
|
| 14 |
+
.sidebar.collapsed {
|
| 15 |
+
width: 70px;
|
| 16 |
+
}
|
| 17 |
+
.sidebar.collapsed .sidebar-text {
|
| 18 |
+
display: none;
|
| 19 |
+
}
|
| 20 |
+
.main-content {
|
| 21 |
+
transition: all 0.3s ease;
|
| 22 |
+
}
|
| 23 |
+
.sidebar.collapsed + .main-content {
|
| 24 |
+
margin-left: 70px;
|
| 25 |
+
}
|
| 26 |
+
.glow {
|
| 27 |
+
box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
|
| 28 |
+
}
|
| 29 |
+
.pulse {
|
| 30 |
+
animation: pulse 2s infinite;
|
| 31 |
+
}
|
| 32 |
+
@keyframes pulse {
|
| 33 |
+
0% { transform: scale(1); }
|
| 34 |
+
50% { transform: scale(1.05); }
|
| 35 |
+
100% { transform: scale(1); }
|
| 36 |
+
}
|
| 37 |
+
.data-card:hover {
|
| 38 |
+
transform: translateY(-5px);
|
| 39 |
+
transition: all 0.3s ease;
|
| 40 |
+
}
|
| 41 |
+
</style>
|
| 42 |
+
</head>
|
| 43 |
+
<body class="bg-gray-50">
|
| 44 |
+
<div class="flex h-screen overflow-hidden">
|
| 45 |
+
<!-- Sidebar -->
|
| 46 |
+
<div class="sidebar bg-blue-800 text-white w-64 flex flex-col">
|
| 47 |
+
<div class="p-4 flex items-center justify-between border-b border-blue-700">
|
| 48 |
+
<div class="flex items-center">
|
| 49 |
+
<i class="fas fa-calculator text-2xl mr-3"></i>
|
| 50 |
+
<span class="sidebar-text font-bold text-xl">AP Analytics</span>
|
| 51 |
+
</div>
|
| 52 |
+
<button id="toggleSidebar" class="text-white focus:outline-none">
|
| 53 |
+
<i class="fas fa-bars"></i>
|
| 54 |
+
</button>
|
| 55 |
+
</div>
|
| 56 |
+
<div class="p-4 border-b border-blue-700">
|
| 57 |
+
<div class="flex items-center mb-4">
|
| 58 |
+
<div class="w-10 h-10 rounded-full bg-blue-600 flex items-center justify-center mr-3">
|
| 59 |
+
<i class="fas fa-user"></i>
|
| 60 |
+
</div>
|
| 61 |
+
<div class="sidebar-text">
|
| 62 |
+
<div class="font-medium">Accounts Payable</div>
|
| 63 |
+
<div class="text-xs text-blue-200">Admin Access</div>
|
| 64 |
+
</div>
|
| 65 |
+
</div>
|
| 66 |
+
</div>
|
| 67 |
+
<nav class="flex-1 overflow-y-auto">
|
| 68 |
+
<div class="p-2">
|
| 69 |
+
<div class="sidebar-text text-xs uppercase text-blue-400 mb-2 px-2">Main</div>
|
| 70 |
+
<a href="#" class="flex items-center p-2 rounded hover:bg-blue-700 mb-1">
|
| 71 |
+
<i class="fas fa-tachometer-alt mr-3"></i>
|
| 72 |
+
<span class="sidebar-text">Dashboard</span>
|
| 73 |
+
</a>
|
| 74 |
+
<a href="#" class="flex items-center p-2 rounded hover:bg-blue-700 mb-1">
|
| 75 |
+
<i class="fas fa-file-invoice-dollar mr-3"></i>
|
| 76 |
+
<span class="sidebar-text">Invoices</span>
|
| 77 |
+
</a>
|
| 78 |
+
<a href="#" class="flex items-center p-2 rounded hover:bg-blue-700 mb-1">
|
| 79 |
+
<i class="fas fa-hand-holding-usd mr-3"></i>
|
| 80 |
+
<span class="sidebar-text">Payments</span>
|
| 81 |
+
</a>
|
| 82 |
+
<a href="#" class="flex items-center p-2 rounded hover:bg-blue-700 mb-1">
|
| 83 |
+
<i class="fas fa-exchange-alt mr-3"></i>
|
| 84 |
+
<span class="sidebar-text">Transactions</span>
|
| 85 |
+
</a>
|
| 86 |
+
</div>
|
| 87 |
+
<div class="p-2">
|
| 88 |
+
<div class="sidebar-text text-xs uppercase text-blue-400 mb-2 px-2">Analysis</div>
|
| 89 |
+
<a href="#" class="flex items-center p-2 rounded hover:bg-blue-700 mb-1">
|
| 90 |
+
<i class="fas fa-chart-line mr-3"></i>
|
| 91 |
+
<span class="sidebar-text">Trends</span>
|
| 92 |
+
</a>
|
| 93 |
+
<a href="#" class="flex items-center p-2 rounded hover:bg-blue-700 mb-1">
|
| 94 |
+
<i class="fas fa-exclamation-triangle mr-3"></i>
|
| 95 |
+
<span class="sidebar-text">Anomalies</span>
|
| 96 |
+
</a>
|
| 97 |
+
<a href="#" class="flex items-center p-2 rounded hover:bg-blue-700 mb-1">
|
| 98 |
+
<i class="fas fa-calendar-check mr-3"></i>
|
| 99 |
+
<span class="sidebar-text">Due Dates</span>
|
| 100 |
+
</a>
|
| 101 |
+
</div>
|
| 102 |
+
<div class="p-2">
|
| 103 |
+
<div class="sidebar-text text-xs uppercase text-blue-400 mb-2 px-2">Settings</div>
|
| 104 |
+
<a href="#" class="flex items-center p-2 rounded hover:bg-blue-700 mb-1">
|
| 105 |
+
<i class="fas fa-cog mr-3"></i>
|
| 106 |
+
<span class="sidebar-text">Preferences</span>
|
| 107 |
+
</a>
|
| 108 |
+
<a href="#" class="flex items-center p-2 rounded hover:bg-blue-700 mb-1">
|
| 109 |
+
<i class="fas fa-plug mr-3"></i>
|
| 110 |
+
<span class="sidebar-text">SYSPRO Connection</span>
|
| 111 |
+
</a>
|
| 112 |
+
</div>
|
| 113 |
+
</nav>
|
| 114 |
+
<div class="p-4 border-t border-blue-700">
|
| 115 |
+
<button class="w-full bg-blue-700 hover:bg-blue-600 text-white py-2 px-4 rounded flex items-center justify-center">
|
| 116 |
+
<i class="fas fa-sync-alt mr-2"></i>
|
| 117 |
+
<span class="sidebar-text">Refresh Data</span>
|
| 118 |
+
</button>
|
| 119 |
+
</div>
|
| 120 |
+
</div>
|
| 121 |
+
|
| 122 |
+
<!-- Main Content -->
|
| 123 |
+
<div class="main-content flex-1 overflow-y-auto">
|
| 124 |
+
<!-- Header -->
|
| 125 |
+
<header class="bg-white shadow-sm">
|
| 126 |
+
<div class="px-6 py-4 flex items-center justify-between">
|
| 127 |
+
<h1 class="text-2xl font-semibold text-gray-800">Accounts Payable Dashboard</h1>
|
| 128 |
+
<div class="flex items-center space-x-4">
|
| 129 |
+
<div class="relative">
|
| 130 |
+
<input type="text" placeholder="Search..." class="pl-10 pr-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
|
| 131 |
+
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
|
| 132 |
+
</div>
|
| 133 |
+
<button class="p-2 rounded-full bg-gray-100 text-gray-600 hover:bg-gray-200">
|
| 134 |
+
<i class="fas fa-bell"></i>
|
| 135 |
+
<span class="absolute top-0 right-0 h-2 w-2 rounded-full bg-red-500"></span>
|
| 136 |
+
</button>
|
| 137 |
+
</div>
|
| 138 |
+
</div>
|
| 139 |
+
</header>
|
| 140 |
+
|
| 141 |
+
<!-- Dashboard Content -->
|
| 142 |
+
<main class="p-6">
|
| 143 |
+
<!-- Connection Status -->
|
| 144 |
+
<div class="mb-6 bg-white rounded-lg shadow p-4 flex items-center justify-between">
|
| 145 |
+
<div class="flex items-center">
|
| 146 |
+
<div class="p-3 rounded-full bg-green-100 text-green-600 mr-4">
|
| 147 |
+
<i class="fas fa-plug text-xl"></i>
|
| 148 |
+
</div>
|
| 149 |
+
<div>
|
| 150 |
+
<h3 class="font-semibold">Connected to SYSPRO ERP</h3>
|
| 151 |
+
<p class="text-sm text-gray-500">Last sync: 2 minutes ago</p>
|
| 152 |
+
</div>
|
| 153 |
+
</div>
|
| 154 |
+
<div class="flex space-x-3">
|
| 155 |
+
<button class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 flex items-center">
|
| 156 |
+
<i class="fas fa-sync-alt mr-2"></i> Sync Now
|
| 157 |
+
</button>
|
| 158 |
+
<button class="px-4 py-2 border border-gray-300 rounded-lg hover:bg-gray-50 flex items-center">
|
| 159 |
+
<i class="fas fa-cog mr-2"></i> Settings
|
| 160 |
+
</button>
|
| 161 |
+
</div>
|
| 162 |
+
</div>
|
| 163 |
+
|
| 164 |
+
<!-- Summary Cards -->
|
| 165 |
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-6">
|
| 166 |
+
<div class="data-card bg-white rounded-lg shadow p-6 hover:shadow-md">
|
| 167 |
+
<div class="flex items-center justify-between">
|
| 168 |
+
<div>
|
| 169 |
+
<p class="text-sm font-medium text-gray-500">Pending Invoices</p>
|
| 170 |
+
<h3 class="text-2xl font-bold text-gray-800 mt-1">142</h3>
|
| 171 |
+
<p class="text-sm text-red-500 mt-1">
|
| 172 |
+
<i class="fas fa-arrow-up mr-1"></i> 12% from last month
|
| 173 |
+
</p>
|
| 174 |
+
</div>
|
| 175 |
+
<div class="p-3 rounded-full bg-red-100 text-red-600">
|
| 176 |
+
<i class="fas fa-file-invoice text-xl"></i>
|
| 177 |
+
</div>
|
| 178 |
+
</div>
|
| 179 |
+
</div>
|
| 180 |
+
<div class="data-card bg-white rounded-lg shadow p-6 hover:shadow-md">
|
| 181 |
+
<div class="flex items-center justify-between">
|
| 182 |
+
<div>
|
| 183 |
+
<p class="text-sm font-medium text-gray-500">Overdue Payments</p>
|
| 184 |
+
<h3 class="text-2xl font-bold text-gray-800 mt-1">23</h3>
|
| 185 |
+
<p class="text-sm text-green-500 mt-1">
|
| 186 |
+
<i class="fas fa-arrow-down mr-1"></i> 8% from last month
|
| 187 |
+
</p>
|
| 188 |
+
</div>
|
| 189 |
+
<div class="p-3 rounded-full bg-yellow-100 text-yellow-600">
|
| 190 |
+
<i class="fas fa-exclamation-triangle text-xl"></i>
|
| 191 |
+
</div>
|
| 192 |
+
</div>
|
| 193 |
+
</div>
|
| 194 |
+
<div class="data-card bg-white rounded-lg shadow p-6 hover:shadow-md">
|
| 195 |
+
<div class="flex items-center justify-between">
|
| 196 |
+
<div>
|
| 197 |
+
<p class="text-sm font-medium text-gray-500">Total Payable</p>
|
| 198 |
+
<h3 class="text-2xl font-bold text-gray-800 mt-1">$245,789</h3>
|
| 199 |
+
<p class="text-sm text-red-500 mt-1">
|
| 200 |
+
<i class="fas fa-arrow-up mr-1"></i> 15% from last month
|
| 201 |
+
</p>
|
| 202 |
+
</div>
|
| 203 |
+
<div class="p-3 rounded-full bg-blue-100 text-blue-600">
|
| 204 |
+
<i class="fas fa-dollar-sign text-xl"></i>
|
| 205 |
+
</div>
|
| 206 |
+
</div>
|
| 207 |
+
</div>
|
| 208 |
+
<div class="data-card bg-white rounded-lg shadow p-6 hover:shadow-md">
|
| 209 |
+
<div class="flex items-center justify-between">
|
| 210 |
+
<div>
|
| 211 |
+
<p class="text-sm font-medium text-gray-500">Early Payment Discounts</p>
|
| 212 |
+
<h3 class="text-2xl font-bold text-gray-800 mt-1">$12,450</h3>
|
| 213 |
+
<p class="text-sm text-green-500 mt-1">
|
| 214 |
+
<i class="fas fa-arrow-up mr-1"></i> Potential savings
|
| 215 |
+
</p>
|
| 216 |
+
</div>
|
| 217 |
+
<div class="p-3 rounded-full bg-green-100 text-green-600">
|
| 218 |
+
<i class="fas fa-percentage text-xl"></i>
|
| 219 |
+
</div>
|
| 220 |
+
</div>
|
| 221 |
+
</div>
|
| 222 |
+
</div>
|
| 223 |
+
|
| 224 |
+
<!-- Charts Section -->
|
| 225 |
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6">
|
| 226 |
+
<!-- Invoice Status Chart -->
|
| 227 |
+
<div class="bg-white rounded-lg shadow p-6">
|
| 228 |
+
<div class="flex items-center justify-between mb-4">
|
| 229 |
+
<h3 class="font-semibold text-lg">Invoice Status</h3>
|
| 230 |
+
<div class="flex space-x-2">
|
| 231 |
+
<button class="px-3 py-1 text-sm bg-blue-100 text-blue-600 rounded">Month</button>
|
| 232 |
+
<button class="px-3 py-1 text-sm bg-gray-100 text-gray-600 rounded">Quarter</button>
|
| 233 |
+
<button class="px-3 py-1 text-sm bg-gray-100 text-gray-600 rounded">Year</button>
|
| 234 |
+
</div>
|
| 235 |
+
</div>
|
| 236 |
+
<canvas id="invoiceStatusChart" height="250"></canvas>
|
| 237 |
+
</div>
|
| 238 |
+
|
| 239 |
+
<!-- Payment Trend Chart -->
|
| 240 |
+
<div class="bg-white rounded-lg shadow p-6">
|
| 241 |
+
<div class="flex items-center justify-between mb-4">
|
| 242 |
+
<h3 class="font-semibold text-lg">Payment Trends</h3>
|
| 243 |
+
<div class="flex space-x-2">
|
| 244 |
+
<button class="px-3 py-1 text-sm bg-blue-100 text-blue-600 rounded">Month</button>
|
| 245 |
+
<button class="px-3 py-1 text-sm bg-gray-100 text-gray-600 rounded">Quarter</button>
|
| 246 |
+
<button class="px-3 py-1 text-sm bg-gray-100 text-gray-600 rounded">Year</button>
|
| 247 |
+
</div>
|
| 248 |
+
</div>
|
| 249 |
+
<canvas id="paymentTrendChart" height="250"></canvas>
|
| 250 |
+
</div>
|
| 251 |
+
</div>
|
| 252 |
+
|
| 253 |
+
<!-- Vendor Analysis and Alerts -->
|
| 254 |
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6">
|
| 255 |
+
<!-- Top Vendors -->
|
| 256 |
+
<div class="bg-white rounded-lg shadow p-6">
|
| 257 |
+
<h3 class="font-semibold text-lg mb-4">Top Vendors by Payable Amount</h3>
|
| 258 |
+
<div class="space-y-4">
|
| 259 |
+
<div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
|
| 260 |
+
<div class="flex items-center">
|
| 261 |
+
<div class="w-10 h-10 rounded-full bg-blue-100 text-blue-600 flex items-center justify-center mr-3">
|
| 262 |
+
<i class="fas fa-building"></i>
|
| 263 |
+
</div>
|
| 264 |
+
<div>
|
| 265 |
+
<p class="font-medium">ABC Suppliers Inc.</p>
|
| 266 |
+
<p class="text-sm text-gray-500">3 invoices pending</p>
|
| 267 |
+
</div>
|
| 268 |
+
</div>
|
| 269 |
+
<div class="text-right">
|
| 270 |
+
<p class="font-semibold">$45,670</p>
|
| 271 |
+
<p class="text-sm text-red-500">Due in 5 days</p>
|
| 272 |
+
</div>
|
| 273 |
+
</div>
|
| 274 |
+
<div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
|
| 275 |
+
<div class="flex items-center">
|
| 276 |
+
<div class="w-10 h-10 rounded-full bg-green-100 text-green-600 flex items-center justify-center mr-3">
|
| 277 |
+
<i class="fas fa-warehouse"></i>
|
| 278 |
+
</div>
|
| 279 |
+
<div>
|
| 280 |
+
<p class="font-medium">XYZ Manufacturing</p>
|
| 281 |
+
<p class="text-sm text-gray-500">2 invoices pending</p>
|
| 282 |
+
</div>
|
| 283 |
+
</div>
|
| 284 |
+
<div class="text-right">
|
| 285 |
+
<p class="font-semibold">$32,450</p>
|
| 286 |
+
<p class="text-sm text-yellow-500">Due in 10 days</p>
|
| 287 |
+
</div>
|
| 288 |
+
</div>
|
| 289 |
+
<div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
|
| 290 |
+
<div class="flex items-center">
|
| 291 |
+
<div class="w-10 h-10 rounded-full bg-purple-100 text-purple-600 flex items-center justify-center mr-3">
|
| 292 |
+
<i class="fas fa-truck"></i>
|
| 293 |
+
</div>
|
| 294 |
+
<div>
|
| 295 |
+
<p class="font-medium">Global Logistics</p>
|
| 296 |
+
<p class="text-sm text-gray-500">1 invoice pending</p>
|
| 297 |
+
</div>
|
| 298 |
+
</div>
|
| 299 |
+
<div class="text-right">
|
| 300 |
+
<p class="font-semibold">$28,900</p>
|
| 301 |
+
<p class="text-sm text-green-500">Due in 15 days</p>
|
| 302 |
+
</div>
|
| 303 |
+
</div>
|
| 304 |
+
</div>
|
| 305 |
+
<button class="mt-4 text-blue-600 hover:text-blue-800 text-sm font-medium flex items-center">
|
| 306 |
+
View all vendors <i class="fas fa-chevron-right ml-1"></i>
|
| 307 |
+
</button>
|
| 308 |
+
</div>
|
| 309 |
+
|
| 310 |
+
<!-- Critical Alerts -->
|
| 311 |
+
<div class="bg-white rounded-lg shadow p-6">
|
| 312 |
+
<h3 class="font-semibold text-lg mb-4">Critical Alerts</h3>
|
| 313 |
+
<div class="space-y-3">
|
| 314 |
+
<div class="p-3 bg-red-50 border-l-4 border-red-500 rounded-r-lg flex items-start">
|
| 315 |
+
<div class="mr-3 text-red-500">
|
| 316 |
+
<i class="fas fa-exclamation-circle"></i>
|
| 317 |
+
</div>
|
| 318 |
+
<div>
|
| 319 |
+
<p class="font-medium">Overdue payment to Tech Solutions Ltd.</p>
|
| 320 |
+
<p class="text-sm text-gray-600">Invoice #INV-2023-0456 is 7 days overdue. Late fee may apply.</p>
|
| 321 |
+
<button class="mt-2 text-sm text-red-600 hover:text-red-800 font-medium">Take action</button>
|
| 322 |
+
</div>
|
| 323 |
+
</div>
|
| 324 |
+
<div class="p-3 bg-yellow-50 border-l-4 border-yellow-500 rounded-r-lg flex items-start">
|
| 325 |
+
<div class="mr-3 text-yellow-500">
|
| 326 |
+
<i class="fas fa-clock"></i>
|
| 327 |
+
</div>
|
| 328 |
+
<div>
|
| 329 |
+
<p class="font-medium">Early payment discount available</p>
|
| 330 |
+
<p class="text-sm text-gray-600">Pay Office Supplies Co. within 2 days to save $450.</p>
|
| 331 |
+
<button class="mt-2 text-sm text-yellow-600 hover:text-yellow-800 font-medium">Schedule payment</button>
|
| 332 |
+
</div>
|
| 333 |
+
</div>
|
| 334 |
+
<div class="p-3 bg-blue-50 border-l-4 border-blue-500 rounded-r-lg flex items-start">
|
| 335 |
+
<div class="mr-3 text-blue-500">
|
| 336 |
+
<i class="fas fa-percentage"></i>
|
| 337 |
+
</div>
|
| 338 |
+
<div>
|
| 339 |
+
<p class="font-medium">Duplicate invoice detected</p>
|
| 340 |
+
<p class="text-sm text-gray-600">Invoice #INV-2023-0512 from Print Masters matches previous payment.</p>
|
| 341 |
+
<button class="mt-2 text-sm text-blue-600 hover:text-blue-800 font-medium">Review</button>
|
| 342 |
+
</div>
|
| 343 |
+
</div>
|
| 344 |
+
</div>
|
| 345 |
+
<button class="mt-4 text-blue-600 hover:text-blue-800 text-sm font-medium flex items-center">
|
| 346 |
+
View all alerts <i class="fas fa-chevron-right ml-1"></i>
|
| 347 |
+
</button>
|
| 348 |
+
</div>
|
| 349 |
+
</div>
|
| 350 |
+
|
| 351 |
+
<!-- Recent Activity -->
|
| 352 |
+
<div class="bg-white rounded-lg shadow p-6 mb-6">
|
| 353 |
+
<h3 class="font-semibold text-lg mb-4">Recent Payment Activity</h3>
|
| 354 |
+
<div class="overflow-x-auto">
|
| 355 |
+
<table class="min-w-full divide-y divide-gray-200">
|
| 356 |
+
<thead class="bg-gray-50">
|
| 357 |
+
<tr>
|
| 358 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Vendor</th>
|
| 359 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Invoice #</th>
|
| 360 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Amount</th>
|
| 361 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Due Date</th>
|
| 362 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
|
| 363 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Action</th>
|
| 364 |
+
</tr>
|
| 365 |
+
</thead>
|
| 366 |
+
<tbody class="bg-white divide-y divide-gray-200">
|
| 367 |
+
<tr>
|
| 368 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 369 |
+
<div class="flex items-center">
|
| 370 |
+
<div class="flex-shrink-0 h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-600">
|
| 371 |
+
<i class="fas fa-building"></i>
|
| 372 |
+
</div>
|
| 373 |
+
<div class="ml-4">
|
| 374 |
+
<div class="text-sm font-medium text-gray-900">Office Supplies Co.</div>
|
| 375 |
+
<div class="text-sm text-gray-500">PO #45678</div>
|
| 376 |
+
</div>
|
| 377 |
+
</div>
|
| 378 |
+
</td>
|
| 379 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">INV-2023-0512</td>
|
| 380 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">$2,450.00</td>
|
| 381 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">May 15, 2023</td>
|
| 382 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 383 |
+
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Approved</span>
|
| 384 |
+
</td>
|
| 385 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
|
| 386 |
+
<button class="text-blue-600 hover:text-blue-900">Process</button>
|
| 387 |
+
</td>
|
| 388 |
+
</tr>
|
| 389 |
+
<tr>
|
| 390 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 391 |
+
<div class="flex items-center">
|
| 392 |
+
<div class="flex-shrink-0 h-10 w-10 rounded-full bg-green-100 flex items-center justify-center text-green-600">
|
| 393 |
+
<i class="fas fa-warehouse"></i>
|
| 394 |
+
</div>
|
| 395 |
+
<div class="ml-4">
|
| 396 |
+
<div class="text-sm font-medium text-gray-900">Tech Solutions Ltd.</div>
|
| 397 |
+
<div class="text-sm text-gray-500">PO #45679</div>
|
| 398 |
+
</div>
|
| 399 |
+
</div>
|
| 400 |
+
</td>
|
| 401 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">INV-2023-0456</td>
|
| 402 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">$8,750.00</td>
|
| 403 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">May 5, 2023</td>
|
| 404 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 405 |
+
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">Overdue</span>
|
| 406 |
+
</td>
|
| 407 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
|
| 408 |
+
<button class="text-blue-600 hover:text-blue-900">Process</button>
|
| 409 |
+
</td>
|
| 410 |
+
</tr>
|
| 411 |
+
<tr>
|
| 412 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 413 |
+
<div class="flex items-center">
|
| 414 |
+
<div class="flex-shrink-0 h-10 w-10 rounded-full bg-purple-100 flex items-center justify-center text-purple-600">
|
| 415 |
+
<i class="fas fa-truck"></i>
|
| 416 |
+
</div>
|
| 417 |
+
<div class="ml-4">
|
| 418 |
+
<div class="text-sm font-medium text-gray-900">Print Masters</div>
|
| 419 |
+
<div class="text-sm text-gray-500">PO #45680</div>
|
| 420 |
+
</div>
|
| 421 |
+
</div>
|
| 422 |
+
</td>
|
| 423 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">INV-2023-0515</td>
|
| 424 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">$1,245.50</td>
|
| 425 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">May 20, 2023</td>
|
| 426 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 427 |
+
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">Pending Approval</span>
|
| 428 |
+
</td>
|
| 429 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
|
| 430 |
+
<button class="text-blue-600 hover:text-blue-900">Review</button>
|
| 431 |
+
</td>
|
| 432 |
+
</tr>
|
| 433 |
+
</tbody>
|
| 434 |
+
</table>
|
| 435 |
+
</div>
|
| 436 |
+
<button class="mt-4 text-blue-600 hover:text-blue-800 text-sm font-medium flex items-center">
|
| 437 |
+
View all transactions <i class="fas fa-chevron-right ml-1"></i>
|
| 438 |
+
</button>
|
| 439 |
+
</div>
|
| 440 |
+
|
| 441 |
+
<!-- Data Interpretation -->
|
| 442 |
+
<div class="bg-white rounded-lg shadow p-6">
|
| 443 |
+
<h3 class="font-semibold text-lg mb-4">Data Interpretation</h3>
|
| 444 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
| 445 |
+
<div class="bg-blue-50 rounded-lg p-4">
|
| 446 |
+
<div class="flex items-start">
|
| 447 |
+
<div class="mr-3 text-blue-500">
|
| 448 |
+
<i class="fas fa-lightbulb text-xl"></i>
|
| 449 |
+
</div>
|
| 450 |
+
<div>
|
| 451 |
+
<h4 class="font-medium text-blue-800 mb-2">Cash Flow Optimization</h4>
|
| 452 |
+
<p class="text-sm text-blue-700">Based on payment terms analysis, you could save approximately $8,200 this month by strategically scheduling payments to take advantage of early payment discounts while maintaining positive cash flow.</p>
|
| 453 |
+
</div>
|
| 454 |
+
</div>
|
| 455 |
+
</div>
|
| 456 |
+
<div class="bg-green-50 rounded-lg p-4">
|
| 457 |
+
<div class="flex items-start">
|
| 458 |
+
<div class="mr-3 text-green-500">
|
| 459 |
+
<i class="fas fa-chart-pie text-xl"></i>
|
| 460 |
+
</div>
|
| 461 |
+
<div>
|
| 462 |
+
<h4 class="font-medium text-green-800 mb-2">Vendor Concentration</h4>
|
| 463 |
+
<p class="text-sm text-green-700">Top 5 vendors account for 62% of total payables. Consider negotiating better terms with these key suppliers to improve working capital.</p>
|
| 464 |
+
</div>
|
| 465 |
+
</div>
|
| 466 |
+
</div>
|
| 467 |
+
<div class="bg-yellow-50 rounded-lg p-4">
|
| 468 |
+
<div class="flex items-start">
|
| 469 |
+
<div class="mr-3 text-yellow-500">
|
| 470 |
+
<i class="fas fa-exclamation-triangle text-xl"></i>
|
| 471 |
+
</div>
|
| 472 |
+
<div>
|
| 473 |
+
<h4 class="font-medium text-yellow-800 mb-2">Anomaly Detected</h4>
|
| 474 |
+
<p class="text-sm text-yellow-700">Invoice amounts from "Office Supplies Co." have increased by 45% compared to last quarter without corresponding PO increases. Recommend review for potential errors or unauthorized purchases.</p>
|
| 475 |
+
</div>
|
| 476 |
+
</div>
|
| 477 |
+
</div>
|
| 478 |
+
<div class="bg-purple-50 rounded-lg p-4">
|
| 479 |
+
<div class="flex items-start">
|
| 480 |
+
<div class="mr-3 text-purple-500">
|
| 481 |
+
<i class="fas fa-calendar-alt text-xl"></i>
|
| 482 |
+
</div>
|
| 483 |
+
<div>
|
| 484 |
+
<h4 class="font-medium text-purple-800 mb-2">Payment Timing</h4>
|
| 485 |
+
<p class="text-sm text-purple-700">72% of payments are processed in the last week of the month, creating processing bottlenecks. Consider spreading payments throughout the month for efficiency.</p>
|
| 486 |
+
</div>
|
| 487 |
+
</div>
|
| 488 |
+
</div>
|
| 489 |
+
</div>
|
| 490 |
+
</div>
|
| 491 |
+
</main>
|
| 492 |
+
</div>
|
| 493 |
+
</div>
|
| 494 |
+
|
| 495 |
+
<script>
|
| 496 |
+
// SYSPRO API Configuration
|
| 497 |
+
const sysproConfig = {
|
| 498 |
+
baseUrl: 'https://192.168.1.241/ap',
|
| 499 |
+
credentials: {
|
| 500 |
+
username: 'YOUR_USERNAME',
|
| 501 |
+
password: 'YOUR_PASSWORD'
|
| 502 |
+
}
|
| 503 |
+
};
|
| 504 |
+
|
| 505 |
+
// Function to fetch AP data from SYSPRO
|
| 506 |
+
async function fetchAPData(endpoint) {
|
| 507 |
+
try {
|
| 508 |
+
const authString = btoa(`${sysproConfig.credentials.username}:${sysproConfig.credentials.password}`);
|
| 509 |
+
const response = await fetch(`${sysproConfig.baseUrl}/${endpoint}`, {
|
| 510 |
+
headers: {
|
| 511 |
+
'Authorization': `Basic ${authString}`,
|
| 512 |
+
'Content-Type': 'application/json'
|
| 513 |
+
}
|
| 514 |
+
});
|
| 515 |
+
|
| 516 |
+
if (!response.ok) {
|
| 517 |
+
throw new Error(`HTTP error! status: ${response.status}`);
|
| 518 |
+
}
|
| 519 |
+
return await response.json();
|
| 520 |
+
} catch (error) {
|
| 521 |
+
console.error('Error fetching data from SYSPRO:', error);
|
| 522 |
+
return null;
|
| 523 |
+
}
|
| 524 |
+
}
|
| 525 |
+
|
| 526 |
+
// Function to update dashboard with real data
|
| 527 |
+
async function updateDashboard() {
|
| 528 |
+
// Fetch all necessary data
|
| 529 |
+
const [invoices, payments, vendors] = await Promise.all([
|
| 530 |
+
fetchAPData('invoices'),
|
| 531 |
+
fetchAPData('payments'),
|
| 532 |
+
fetchAPData('vendors')
|
| 533 |
+
]);
|
| 534 |
+
|
| 535 |
+
if (invoices && payments && vendors) {
|
| 536 |
+
// Update summary cards
|
| 537 |
+
document.querySelectorAll('.data-card h3')[0].textContent = invoices.pendingCount;
|
| 538 |
+
document.querySelectorAll('.data-card h3')[1].textContent = invoices.overdueCount;
|
| 539 |
+
document.querySelectorAll('.data-card h3')[2].textContent = `${invoices.totalPayable.toLocaleString()}`;
|
| 540 |
+
document.querySelectorAll('.data-card h3')[3].textContent = `${payments.potentialSavings.toLocaleString()}`;
|
| 541 |
+
|
| 542 |
+
// Update charts
|
| 543 |
+
updateCharts(invoices, payments);
|
| 544 |
+
|
| 545 |
+
// Update vendor list
|
| 546 |
+
updateVendorList(vendors);
|
| 547 |
+
|
| 548 |
+
// Update recent activity
|
| 549 |
+
updateRecentActivity(invoices.recent);
|
| 550 |
+
|
| 551 |
+
// Update connection status
|
| 552 |
+
document.querySelector('.connection-status p').textContent = `Last sync: ${new Date().toLocaleTimeString()}`;
|
| 553 |
+
}
|
| 554 |
+
}
|
| 555 |
+
|
| 556 |
+
// Toggle sidebar
|
| 557 |
+
document.getElementById('toggleSidebar').addEventListener('click', function() {
|
| 558 |
+
document.querySelector('.sidebar').classList.toggle('collapsed');
|
| 559 |
+
});
|
| 560 |
+
|
| 561 |
+
// Function to update charts with real data
|
| 562 |
+
function updateCharts(invoices, payments) {
|
| 563 |
+
// Invoice Status Chart
|
| 564 |
+
invoiceStatusChart.data.datasets[0].data = [
|
| 565 |
+
invoices.paidCount,
|
| 566 |
+
invoices.pendingApprovalCount,
|
| 567 |
+
invoices.approvedCount,
|
| 568 |
+
invoices.overdueCount,
|
| 569 |
+
invoices.disputedCount
|
| 570 |
+
];
|
| 571 |
+
invoiceStatusChart.update();
|
| 572 |
+
|
| 573 |
+
// Payment Trend Chart
|
| 574 |
+
paymentTrendChart.data.datasets[0].data = payments.totalPayableTrend;
|
| 575 |
+
paymentTrendChart.data.datasets[1].data = payments.earlyPaymentsTrend;
|
| 576 |
+
paymentTrendChart.update();
|
| 577 |
+
}
|
| 578 |
+
|
| 579 |
+
// Function to update vendor list
|
| 580 |
+
function updateVendorList(vendors) {
|
| 581 |
+
const vendorContainer = document.querySelector('.vendor-list-container');
|
| 582 |
+
vendorContainer.innerHTML = vendors.slice(0, 3).map(vendor => `
|
| 583 |
+
<div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg">
|
| 584 |
+
<div class="flex items-center">
|
| 585 |
+
<div class="w-10 h-10 rounded-full bg-blue-100 text-blue-600 flex items-center justify-center mr-3">
|
| 586 |
+
<i class="fas fa-building"></i>
|
| 587 |
+
</div>
|
| 588 |
+
<div>
|
| 589 |
+
<p class="font-medium">${vendor.name}</p>
|
| 590 |
+
<p class="text-sm text-gray-500">${vendor.pendingInvoices} invoices pending</p>
|
| 591 |
+
</div>
|
| 592 |
+
</div>
|
| 593 |
+
<div class="text-right">
|
| 594 |
+
<p class="font-semibold">${vendor.amount.toLocaleString()}</p>
|
| 595 |
+
<p class="text-sm ${getDueDateColor(vendor.dueInDays)}">Due in ${vendor.dueInDays} days</p>
|
| 596 |
+
</div>
|
| 597 |
+
</div>
|
| 598 |
+
`).join('');
|
| 599 |
+
}
|
| 600 |
+
|
| 601 |
+
function getDueDateColor(days) {
|
| 602 |
+
if (days <= 5) return 'text-red-500';
|
| 603 |
+
if (days <= 10) return 'text-yellow-500';
|
| 604 |
+
return 'text-green-500';
|
| 605 |
+
}
|
| 606 |
+
|
| 607 |
+
// Function to update recent activity
|
| 608 |
+
function updateRecentActivity(transactions) {
|
| 609 |
+
const tbody = document.querySelector('tbody');
|
| 610 |
+
tbody.innerHTML = transactions.slice(0, 3).map(transaction => `
|
| 611 |
+
<tr>
|
| 612 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 613 |
+
<div class="flex items-center">
|
| 614 |
+
<div class="flex-shrink-0 h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-600">
|
| 615 |
+
<i class="fas fa-building"></i>
|
| 616 |
+
</div>
|
| 617 |
+
<div class="ml-4">
|
| 618 |
+
<div class="text-sm font-medium text-gray-900">${transaction.vendor}</div>
|
| 619 |
+
<div class="text-sm text-gray-500">PO #${transaction.poNumber}</div>
|
| 620 |
+
</div>
|
| 621 |
+
</div>
|
| 622 |
+
</td>
|
| 623 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${transaction.invoiceNumber}</td>
|
| 624 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${transaction.amount.toLocaleString()}</td>
|
| 625 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${new Date(transaction.dueDate).toLocaleDateString()}</td>
|
| 626 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 627 |
+
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${getStatusClass(transaction.status)}">${transaction.status}</span>
|
| 628 |
+
</td>
|
| 629 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
|
| 630 |
+
<button class="text-blue-600 hover:text-blue-900">${transaction.status === 'Overdue' ? 'Process' : 'Review'}</button>
|
| 631 |
+
</td>
|
| 632 |
+
</tr>
|
| 633 |
+
`).join('');
|
| 634 |
+
}
|
| 635 |
+
|
| 636 |
+
function getStatusClass(status) {
|
| 637 |
+
switch(status) {
|
| 638 |
+
case 'Approved': return 'bg-green-100 text-green-800';
|
| 639 |
+
case 'Overdue': return 'bg-red-100 text-red-800';
|
| 640 |
+
case 'Pending Approval': return 'bg-yellow-100 text-yellow-800';
|
| 641 |
+
default: return 'bg-gray-100 text-gray-800';
|
| 642 |
+
}
|
| 643 |
+
}
|
| 644 |
+
|
| 645 |
+
// Invoice Status Chart
|
| 646 |
+
const invoiceStatusCtx = document.getElementById('invoiceStatusChart').getContext('2d');
|
| 647 |
+
const invoiceStatusChart = new Chart(invoiceStatusCtx, {
|
| 648 |
+
type: 'doughnut',
|
| 649 |
+
data: {
|
| 650 |
+
labels: ['Paid', 'Pending Approval', 'Approved', 'Overdue', 'Disputed'],
|
| 651 |
+
datasets: [{
|
| 652 |
+
data: [320, 142, 85, 23, 12],
|
| 653 |
+
backgroundColor: [
|
| 654 |
+
'#10B981',
|
| 655 |
+
'#3B82F6',
|
| 656 |
+
'#6366F1',
|
| 657 |
+
'#F59E0B',
|
| 658 |
+
'#EF4444'
|
| 659 |
+
],
|
| 660 |
+
borderWidth: 0
|
| 661 |
+
}]
|
| 662 |
+
},
|
| 663 |
+
options: {
|
| 664 |
+
responsive: true,
|
| 665 |
+
maintainAspectRatio: false,
|
| 666 |
+
cutout: '70%',
|
| 667 |
+
plugins: {
|
| 668 |
+
legend: {
|
| 669 |
+
position: 'right',
|
| 670 |
+
},
|
| 671 |
+
tooltip: {
|
| 672 |
+
callbacks: {
|
| 673 |
+
label: function(context) {
|
| 674 |
+
const label = context.label || '';
|
| 675 |
+
const value = context.raw || 0;
|
| 676 |
+
const total = context.dataset.data.reduce((a, b) => a + b, 0);
|
| 677 |
+
const percentage = Math.round((value / total) * 100);
|
| 678 |
+
return `${label}: ${value} (${percentage}%)`;
|
| 679 |
+
}
|
| 680 |
+
}
|
| 681 |
+
}
|
| 682 |
+
}
|
| 683 |
+
}
|
| 684 |
+
});
|
| 685 |
+
|
| 686 |
+
// Payment Trend Chart
|
| 687 |
+
const paymentTrendCtx = document.getElementById('paymentTrendChart').getContext('2d');
|
| 688 |
+
const paymentTrendChart = new Chart(paymentTrendCtx, {
|
| 689 |
+
type: 'line',
|
| 690 |
+
data: {
|
| 691 |
+
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
|
| 692 |
+
datasets: [
|
| 693 |
+
{
|
| 694 |
+
label: 'Total Payable',
|
| 695 |
+
data: [185000, 195000, 210000, 225000, 245000, 235000],
|
| 696 |
+
borderColor: '#3B82F6',
|
| 697 |
+
backgroundColor: 'rgba(59, 130, 246, 0.05)',
|
| 698 |
+
borderWidth: 2,
|
| 699 |
+
fill: true,
|
| 700 |
+
tension: 0.4
|
| 701 |
+
},
|
| 702 |
+
{
|
| 703 |
+
label: 'Early Payments',
|
| 704 |
+
data: [45000, 52000, 48000, 55000, 62000, 58000],
|
| 705 |
+
borderColor: '#10B981',
|
| 706 |
+
backgroundColor: 'rgba(16, 185, 129, 0.05)',
|
| 707 |
+
borderWidth: 2,
|
| 708 |
+
fill: true,
|
| 709 |
+
tension: 0.4
|
| 710 |
+
}
|
| 711 |
+
]
|
| 712 |
+
},
|
| 713 |
+
options: {
|
| 714 |
+
responsive: true,
|
| 715 |
+
maintainAspectRatio: false,
|
| 716 |
+
scales: {
|
| 717 |
+
y: {
|
| 718 |
+
beginAtZero: false,
|
| 719 |
+
grid: {
|
| 720 |
+
drawBorder: false
|
| 721 |
+
},
|
| 722 |
+
ticks: {
|
| 723 |
+
callback: function(value) {
|
| 724 |
+
return '$' + (value / 1000) + 'k';
|
| 725 |
+
}
|
| 726 |
+
}
|
| 727 |
+
},
|
| 728 |
+
x: {
|
| 729 |
+
grid: {
|
| 730 |
+
display: false,
|
| 731 |
+
drawBorder: false
|
| 732 |
+
}
|
| 733 |
+
}
|
| 734 |
+
},
|
| 735 |
+
plugins: {
|
| 736 |
+
tooltip: {
|
| 737 |
+
callbacks: {
|
| 738 |
+
label: function(context) {
|
| 739 |
+
let label = context.dataset.label || '';
|
| 740 |
+
if (label) {
|
| 741 |
+
label += ': ';
|
| 742 |
+
}
|
| 743 |
+
label += '$' + context.raw.toLocaleString();
|
| 744 |
+
return label;
|
| 745 |
+
}
|
| 746 |
+
}
|
| 747 |
+
}
|
| 748 |
+
}
|
| 749 |
+
}
|
| 750 |
+
});
|
| 751 |
+
|
| 752 |
+
// Set up refresh functionality
|
| 753 |
+
document.querySelector('.refresh-btn').addEventListener('click', async () => {
|
| 754 |
+
const cards = document.querySelectorAll('.data-card');
|
| 755 |
+
cards.forEach(card => {
|
| 756 |
+
card.classList.add('pulse');
|
| 757 |
+
setTimeout(() => card.classList.remove('pulse'), 2000);
|
| 758 |
+
});
|
| 759 |
+
await updateDashboard();
|
| 760 |
+
});
|
| 761 |
+
|
| 762 |
+
// Initial data load
|
| 763 |
+
document.addEventListener('DOMContentLoaded', async () => {
|
| 764 |
+
await updateDashboard();
|
| 765 |
+
|
| 766 |
+
// Auto-refresh every 5 minutes
|
| 767 |
+
setInterval(updateDashboard, 300000);
|
| 768 |
+
});
|
| 769 |
+
</script>
|
| 770 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=WritingGuru/ap-analytics" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 771 |
+
</html>
|