File size: 38,032 Bytes
3c4a591 fd6bf1b 3c4a591 fd6bf1b 3c4a591 fd6bf1b 3c4a591 fd6bf1b 3c4a591 fd6bf1b 3c4a591 fd6bf1b 3c4a591 fd6bf1b 3c4a591 fd6bf1b 3c4a591 fd6bf1b 3c4a591 fd6bf1b 3c4a591 fd6bf1b 3c4a591 fd6bf1b 3c4a591 | 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 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Expense & Invoice Manager | Small Business</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
:root {
--primary: #4f46e5;
--primary-light: #6366f1;
--secondary: #10b981;
--danger: #ef4444;
--warning: #f59e0b;
}
.sidebar {
transition: all 0.3s ease;
}
@media (max-width: 768px) {
.sidebar {
transform: translateX(-100%);
position: absolute;
z-index: 50;
height: 100vh;
}
.sidebar.active {
transform: translateX(0);
}
}
.receipt-preview {
max-height: 150px;
object-fit: contain;
}
.invoice-line-item:last-child {
border-bottom: none;
}
.currency-toggle.active {
background-color: var(--primary);
color: white;
}
</style>
</head>
<body class="bg-gray-50">
<!-- Mobile Menu Button -->
<button id="mobileMenuButton" class="md:hidden fixed top-4 left-4 z-50 bg-indigo-600 text-white p-2 rounded-lg shadow-lg">
<i class="fas fa-bars"></i>
</button>
<!-- Sidebar -->
<div id="sidebar" class="sidebar w-64 bg-white shadow-lg h-screen fixed">
<div class="p-4 border-b border-gray-200">
<div class="flex items-center space-x-3">
<div class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center">
<i class="fas fa-coins text-indigo-600"></i>
</div>
<h1 class="text-xl font-bold text-gray-800">BizTracker</h1>
</div>
</div>
<div class="p-4">
<div class="flex items-center space-x-3 mb-6">
<div class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center">
<span class="text-indigo-600 font-semibold">JD</span>
</div>
<div>
<p class="font-medium text-gray-800">John Doe</p>
<p class="text-xs text-gray-500">Admin</p>
</div>
</div>
<nav>
<ul class="space-y-1">
<li>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg bg-indigo-50 text-indigo-700">
<i class="fas fa-tachometer-alt w-5 text-center"></i>
<span>Dashboard</span>
</a>
</li>
<li>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg hover:bg-gray-100 text-gray-700">
<i class="fas fa-receipt w-5 text-center"></i>
<span>Expenses</span>
</a>
</li>
<li>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg hover:bg-gray-100 text-gray-700">
<i class="fas fa-file-invoice-dollar w-5 text-center"></i>
<span>Invoices</span>
</a>
</li>
<li>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg hover:bg-gray-100 text-gray-700">
<i class="fas fa-chart-pie w-5 text-center"></i>
<span>Reports</span>
</a>
</li>
<li>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg hover:bg-gray-100 text-gray-700">
<i class="fas fa-users w-5 text-center"></i>
<span>Clients</span>
</a>
</li>
<li>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg hover:bg-gray-100 text-gray-700">
<i class="fas fa-cog w-5 text-center"></i>
<span>Settings</span>
</a>
</li>
</ul>
</nav>
</div>
<div class="absolute bottom-0 w-full p-4 border-t border-gray-200">
<button class="flex items-center space-x-3 p-2 rounded-lg hover:bg-gray-100 text-gray-700 w-full">
<i class="fas fa-sign-out-alt w-5 text-center"></i>
<span>Logout</span>
</button>
</div>
</div>
<!-- Main Content -->
<div class="ml-0 md:ml-64 transition-all duration-300">
<!-- Header -->
<header class="bg-white shadow-sm p-4">
<div class="flex justify-between items-center">
<h1 class="text-2xl font-bold text-gray-800">Dashboard</h1>
<div class="flex items-center space-x-4">
<div class="flex bg-gray-100 rounded-lg p-1">
<button id="usdToggle" class="currency-toggle px-3 py-1 rounded-md active">USD</button>
<button id="tshToggle" class="currency-toggle px-3 py-1 rounded-md">TSh</button>
</div>
<div class="relative">
<button id="notificationsButton" class="relative p-2 rounded-full hover:bg-gray-100">
<i class="fas fa-bell text-gray-600"></i>
<span class="absolute top-0 right-0 w-2 h-2 bg-red-500 rounded-full"></span>
</button>
<div id="notificationsDropdown" class="hidden absolute right-0 mt-2 w-72 bg-white rounded-lg shadow-lg z-10 border border-gray-200">
<div class="p-3 border-b border-gray-200">
<h3 class="font-medium">Notifications</h3>
</div>
<div class="max-h-60 overflow-y-auto">
<a href="#" class="block p-3 hover:bg-gray-50 border-b border-gray-100">
<div class="flex items-start">
<div class="w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center mr-3">
<i class="fas fa-file-invoice-dollar text-blue-500"></i>
</div>
<div>
<p class="text-sm">Invoice #1023 is due in 2 days</p>
<p class="text-xs text-gray-500">Client: ABC Corp</p>
</div>
</div>
</a>
<a href="#" class="block p-3 hover:bg-gray-50 border-b border-gray-100">
<div class="flex items-start">
<div class="w-8 h-8 rounded-full bg-green-100 flex items-center justify-center mr-3">
<i class="fas fa-check-circle text-green-500"></i>
</div>
<div>
<p class="text-sm">Expense approved</p>
<p class="text-xs text-gray-500">Office supplies - $45.00</p>
</div>
</div>
</a>
<a href="#" class="block p-3 hover:bg-gray-50">
<div class="flex items-start">
<div class="w-8 h-8 rounded-full bg-yellow-100 flex items-center justify-center mr-3">
<i class="fas fa-exclamation-triangle text-yellow-500"></i>
</div>
<div>
<p class="text-sm">Invoice #1018 is overdue</p>
<p class="text-xs text-gray-500">Client: XYZ Ltd</p>
</div>
</div>
</a>
</div>
<div class="p-3 border-t border-gray-200 text-center">
<a href="#" class="text-sm text-indigo-600 hover:underline">View all notifications</a>
</div>
</div>
</div>
</div>
</div>
</header>
<!-- Dashboard Content -->
<main class="p-4">
<!-- Summary Cards -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
<div class="bg-white rounded-lg shadow p-4">
<div class="flex justify-between items-start">
<div>
<p class="text-sm text-gray-500">Total Expenses</p>
<h3 class="text-2xl font-bold" id="totalExpenses">$2,450.00</h3>
</div>
<div class="p-2 rounded-lg bg-indigo-100 text-indigo-600">
<i class="fas fa-receipt"></i>
</div>
</div>
<p class="text-xs text-gray-500 mt-2">+12% from last month</p>
</div>
<div class="bg-white rounded-lg shadow p-4">
<div class="flex justify-between items-start">
<div>
<p class="text-sm text-gray-500">Total Invoices</p>
<h3 class="text-2xl font-bold" id="totalInvoices">$5,780.00</h3>
</div>
<div class="p-2 rounded-lg bg-green-100 text-green-600">
<i class="fas fa-file-invoice-dollar"></i>
</div>
</div>
<p class="text-xs text-gray-500 mt-2">3 unpaid invoices</p>
</div>
<div class="bg-white rounded-lg shadow p-4">
<div class="flex justify-between items-start">
<div>
<p class="text-sm text-gray-500">USD Balance</p>
<h3 class="text-2xl font-bold">$3,330.00</h3>
</div>
<div class="p-2 rounded-lg bg-blue-100 text-blue-600">
<i class="fas fa-dollar-sign"></i>
</div>
</div>
<p class="text-xs text-gray-500 mt-2">Equivalent to TSh 7,728,000</p>
</div>
<div class="bg-white rounded-lg shadow p-4">
<div class="flex justify-between items-start">
<div>
<p class="text-sm text-gray-500">TSh Balance</p>
<h3 class="text-2xl font-bold">TSh 1,250,000</h3>
</div>
<div class="p-2 rounded-lg bg-yellow-100 text-yellow-600">
<i class="fas fa-money-bill-wave"></i>
</div>
</div>
<p class="text-xs text-gray-500 mt-2">Equivalent to $540.00</p>
</div>
</div>
<!-- Charts Section -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6">
<!-- Expense by Category -->
<div class="bg-white rounded-lg shadow p-4">
<div class="flex justify-between items-center mb-4">
<h2 class="font-medium">Expenses by Category</h2>
<select class="text-sm border border-gray-200 rounded px-2 py-1">
<option>This Month</option>
<option>Last Month</option>
<option>This Quarter</option>
<option>This Year</option>
</select>
</div>
<div class="h-64">
<canvas id="expenseChart"></canvas>
</div>
</div>
<!-- Invoice Status -->
<div class="bg-white rounded-lg shadow p-4">
<div class="flex justify-between items-center mb-4">
<h2 class="font-medium">Invoice Status</h2>
<select class="text-sm border border-gray-200 rounded px-2 py-1">
<option>All Time</option>
<option>This Year</option>
<option>This Quarter</option>
</select>
</div>
<div class="h-64">
<canvas id="invoiceChart"></canvas>
</div>
</div>
</div>
<!-- Recent Activity Section -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<!-- Recent Expenses -->
<div class="bg-white rounded-lg shadow p-4">
<div class="flex justify-between items-center mb-4">
<h2 class="font-medium">Recent Expenses</h2>
<button class="text-sm text-indigo-600 hover:underline">View All</button>
</div>
<div class="space-y-4">
<div class="flex items-start">
<div class="w-10 h-10 rounded-full bg-purple-100 flex items-center justify-center mr-3">
<i class="fas fa-plane text-purple-500"></i>
</div>
<div class="flex-1">
<div class="flex justify-between">
<h3 class="font-medium">Business Travel</h3>
<span class="font-medium">$450.00</span>
</div>
<p class="text-sm text-gray-500">Delta Airlines • 12 Jun 2023</p>
</div>
</div>
<div class="flex items-start">
<div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center mr-3">
<i class="fas fa-laptop text-blue-500"></i>
</div>
<div class="flex-1">
<div class="flex justify-between">
<h3 class="font-medium">Office Equipment</h3>
<span class="font-medium">$1,200.00</span>
</div>
<p class="text-sm text-gray-500">Tech Solutions • 10 Jun 2023</p>
</div>
</div>
<div class="flex items-start">
<div class="w-10 h-10 rounded-full bg-green-100 flex items-center justify-center mr-3">
<i class="fas fa-utensils text-green-500"></i>
</div>
<div class="flex-1">
<div class="flex justify-between">
<h3 class="font-medium">Client Meeting</h3>
<span class="font-medium">TSh 120,000</span>
</div>
<p class="text-sm text-gray-500">Serengeti Restaurant • 8 Jun 2023</p>
</div>
</div>
</div>
<button class="mt-4 w-full py-2 border border-dashed border-gray-300 rounded-lg text-sm text-gray-500 hover:bg-gray-50">
<i class="fas fa-plus mr-1"></i> Add Expense
</button>
</div>
<!-- Recent Invoices -->
<div class="bg-white rounded-lg shadow p-4">
<div class="flex justify-between items-center mb-4">
<h2 class="font-medium">Recent Invoices</h2>
<button class="text-sm text-indigo-600 hover:underline">View All</button>
</div>
<div class="space-y-4">
<div class="border-b border-gray-100 pb-4">
<div class="flex justify-between items-start">
<div>
<h3 class="font-medium">#1023 - ABC Corp</h3>
<p class="text-sm text-gray-500">Due 15 Jun 2023</p>
</div>
<span class="font-medium">$1,800.00</span>
</div>
<div class="mt-2 flex justify-between items-center">
<span class="px-2 py-1 bg-blue-100 text-blue-800 text-xs rounded-full">Sent</span>
<button class="text-xs text-indigo-600 hover:underline">View</button>
</div>
</div>
<div class="border-b border-gray-100 pb-4">
<div class="flex justify-between items-start">
<div>
<h3 class="font-medium">#1022 - XYZ Ltd</h3>
<p class="text-sm text-gray-500">Due 5 Jun 2023</p>
</div>
<span class="font-medium">TSh 2,500,000</span>
</div>
<div class="mt-2 flex justify-between items-center">
<span class="px-2 py-1 bg-yellow-100 text-yellow-800 text-xs rounded-full">Overdue</span>
<button class="text-xs text-indigo-600 hover:underline">View</button>
</div>
</div>
<div class="pb-2">
<div class="flex justify-between items-start">
<div>
<h3 class="font-medium">#1021 - Global Tech</h3>
<p class="text-sm text-gray-500">Paid 1 Jun 2023</p>
</div>
<span class="font-medium">$2,480.00</span>
</div>
<div class="mt-2 flex justify-between items-center">
<span class="px-2 py-1 bg-green-100 text-green-800 text-xs rounded-full">Paid</span>
<button class="text-xs text-indigo-600 hover:underline">View</button>
</div>
</div>
</div>
<button class="mt-4 w-full py-2 border border-dashed border-gray-300 rounded-lg text-sm text-gray-500 hover:bg-gray-50">
<i class="fas fa-plus mr-1"></i> Create Invoice
</button>
</div>
<!-- Quick Actions -->
<div class="bg-white rounded-lg shadow p-4">
<h2 class="font-medium mb-4">Quick Actions</h2>
<div class="grid grid-cols-2 gap-3">
<button class="flex flex-col items-center justify-center p-4 border border-gray-200 rounded-lg hover:bg-gray-50">
<div class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center mb-2 text-indigo-600">
<i class="fas fa-receipt"></i>
</div>
<span class="text-sm">Add Expense</span>
</button>
<button class="flex flex-col items-center justify-center p-4 border border-gray-200 rounded-lg hover:bg-gray-50">
<div class="w-10 h-10 rounded-full bg-green-100 flex items-center justify-center mb-2 text-green-600">
<i class="fas fa-file-invoice-dollar"></i>
</div>
<span class="text-sm">Create Invoice</span>
</button>
<button class="flex flex-col items-center justify-center p-4 border border-gray-200 rounded-lg hover:bg-gray-50">
<div class="w-10 h-10 rounded-full bg-blue-100 flex items-center justify-center mb-2 text-blue-600">
<i class="fas fa-user-plus"></i>
</div>
<span class="text-sm">Add Client</span>
</button>
<button class="flex flex-col items-center justify-center p-4 border border-gray-200 rounded-lg hover:bg-gray-50">
<div class="w-10 h-10 rounded-full bg-purple-100 flex items-center justify-center mb-2 text-purple-600">
<i class="fas fa-file-export"></i>
</div>
<span class="text-sm">Export Data</span>
</button>
<button class="flex flex-col items-center justify-center p-4 border border-gray-200 rounded-lg hover:bg-gray-50">
<div class="w-10 h-10 rounded-full bg-yellow-100 flex items-center justify-center mb-2 text-yellow-600">
<i class="fas fa-exchange-alt"></i>
</div>
<span class="text-sm">Currency Exchange</span>
</button>
<button class="flex flex-col items-center justify-center p-4 border border-gray-200 rounded-lg hover:bg-gray-50">
<div class="w-10 h-10 rounded-full bg-red-100 flex items-center justify-center mb-2 text-red-600">
<i class="fas fa-envelope"></i>
</div>
<span class="text-sm">Send Reminders</span>
</button>
</div>
</div>
</div>
<!-- Expense Modal -->
<div id="expenseModal" class="hidden fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4">
<div class="bg-white rounded-lg shadow-xl w-full max-w-2xl max-h-[90vh] overflow-y-auto">
<div class="p-4 border-b border-gray-200 flex justify-between items-center">
<h3 class="text-lg font-medium">Add New Expense</h3>
<button id="closeExpenseModal" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="p-4">
<form>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Date</label>
<input type="date" class="w-full border border-gray-300 rounded-md px-3 py-2">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Vendor</label>
<input type="text" placeholder="Vendor name" class="w-full border border-gray-300 rounded-md px-3 py-2">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Category</label>
<select class="w-full border border-gray-300 rounded-md px-3 py-2">
<option value="">Select category</option>
<option>Travel</option>
<option>Office Supplies</option>
<option>Meals</option>
<option>Equipment</option>
<option>Utilities</option>
<option>Other</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Project/Tag</label>
<input type="text" placeholder="Optional project or tag" class="w-full border border-gray-300 rounded-md px-3 py-2">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Amount</label>
<div class="flex">
<select class="border border-gray-300 rounded-l-md px-3 py-2 bg-gray-100">
<option>USD</option>
<option>TSh</option>
</select>
<input type="number" placeholder="0.00" class="flex-1 border border-gray-300 rounded-r-md px-3 py-2 border-l-0">
</div>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Payment Method</label>
<select class="w-full border border-gray-300 rounded-md px-3 py-2">
<option>Cash</option>
<option>Credit Card</option>
<option>Bank Transfer</option>
<option>Mobile Payment</option>
</select>
</div>
</div>
<div class="mb-4">
<label class="block text-sm font-medium text-gray-700 mb-1">Description</label>
<textarea rows="3" placeholder="Add any details about this expense" class="w-full border border-gray-300 rounded-md px-3 py-2"></textarea>
</div>
<div class="mb-6">
<label class="block text-sm font-medium text-gray-700 mb-1">Receipt</label>
<div class="flex items-center justify-center w-full">
<label for="receiptUpload" class="flex flex-col items-center justify-center w-full h-32 border-2 border-gray-300 border-dashed rounded-lg cursor-pointer bg-gray-50 hover:bg-gray-100">
<div class="flex flex-col items-center justify-center pt-5 pb-6">
<i class="fas fa-cloud-upload-alt text-gray-400 mb-2 text-2xl"></i>
<p class="mb-2 text-sm text-gray-500">Click to upload or drag and drop</p>
<p class="text-xs text-gray-500">PNG, JPG, PDF (MAX. 5MB)</p>
</div>
<input id="receiptUpload" type="file" class="hidden" />
</label>
</div>
<div id="receiptPreview" class="mt-2 hidden">
<img id="previewImage" src="#" alt="Receipt preview" class="receipt-preview mx-auto">
<button id="removeReceipt" class="mt-2 text-sm text-red-600 hover:underline">Remove receipt</button>
</div>
</div>
<div class="flex justify-end space-x-3">
<button type="button" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50">Cancel</button>
<button type="submit" class="px-4 py-2 bg-indigo-600 rounded-md text-sm font-medium text-white hover:bg-indigo-700">Save Expense</button>
</div>
</form>
</div>
</div>
</div>
</main>
</div>
<script>
// Mobile menu toggle
document.getElementById('mobileMenuButton').addEventListener('click', function() {
document.getElementById('sidebar').classList.toggle('active');
});
// Notifications dropdown
document.getElementById('notificationsButton').addEventListener('click', function(e) {
e.stopPropagation();
document.getElementById('notificationsDropdown').classList.toggle('hidden');
});
// Close dropdown when clicking outside
document.addEventListener('click', function() {
document.getElementById('notificationsDropdown').classList.add('hidden');
});
// Currency toggle
document.getElementById('usdToggle').addEventListener('click', function() {
document.getElementById('usdToggle').classList.add('active');
document.getElementById('tshToggle').classList.remove('active');
document.getElementById('totalExpenses').textContent = '$2,450.00';
document.getElementById('totalInvoices').textContent = '$5,780.00';
});
document.getElementById('tshToggle').addEventListener('click', function() {
document.getElementById('tshToggle').classList.add('active');
document.getElementById('usdToggle').classList.remove('active');
document.getElementById('totalExpenses').textContent = 'TSh 5,684,000';
document.getElementById('totalInvoices').textContent = 'TSh 13,410,400';
});
// Receipt upload preview
document.getElementById('receiptUpload').addEventListener('change', function(e) {
const file = e.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(event) {
document.getElementById('previewImage').src = event.target.result;
document.getElementById('receiptPreview').classList.remove('hidden');
};
reader.readAsDataURL(file);
}
});
document.getElementById('removeReceipt').addEventListener('click', function() {
document.getElementById('receiptUpload').value = '';
document.getElementById('receiptPreview').classList.add('hidden');
});
// Expense modal
document.querySelectorAll('button').forEach(button => {
if (button.textContent.includes('Add Expense')) {
button.addEventListener('click', function() {
document.getElementById('expenseModal').classList.remove('hidden');
});
}
});
document.getElementById('closeExpenseModal').addEventListener('click', function() {
document.getElementById('expenseModal').classList.add('hidden');
});
// Close modal when clicking outside
document.getElementById('expenseModal').addEventListener('click', function(e) {
if (e.target === this) {
this.classList.add('hidden');
}
});
// Charts
document.addEventListener('DOMContentLoaded', function() {
// Expense by Category Chart
const expenseCtx = document.getElementById('expenseChart').getContext('2d');
const expenseChart = new Chart(expenseCtx, {
type: 'doughnut',
data: {
labels: ['Travel', 'Office Supplies', 'Meals', 'Equipment', 'Utilities'],
datasets: [{
data: [650, 1200, 350, 1800, 250],
backgroundColor: [
'#6366f1',
'#10b981',
'#f59e0b',
'#8b5cf6',
'#3b82f6'
],
borderWidth: 0
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'right'
}
}
}
});
// Invoice Status Chart
const invoiceCtx = document.getElementById('invoiceChart').getContext('2d');
const invoiceChart = new Chart(invoiceCtx, {
type: 'bar',
data: {
labels: ['Draft', 'Sent', 'Paid', 'Overdue'],
datasets: [{
label: 'USD',
data: [1200, 2800, 4500, 800],
backgroundColor: '#4f46e5'
}, {
label: 'TSh',
data: [0, 2500000, 3800000, 1200000],
backgroundColor: '#10b981'
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
x: {
stacked: false
},
y: {
stacked: false,
ticks: {
callback: function(value) {
if (value >= 1000000) {
return 'TSh ' + (value / 1000000) + 'M';
} else if (value >= 1000) {
return '$' + (value / 1000) + 'K';
}
return value;
}
}
}
},
plugins: {
tooltip: {
callbacks: {
label: function(context) {
let label = context.dataset.label || '';
if (label) {
label += ': ';
}
if (context.dataset.label === 'USD') {
label += '$' + context.raw.toLocaleString();
} else {
label += 'TSh ' + context.raw.toLocaleString();
}
return label;
}
}
}
}
}
});
});
</script>
<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=damani14/expense" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |