6f1595a
862e948 | 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 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NexGen Treasury Management System</title>
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--primary: #00838F;
--primary-light: #0097A7;
--primary-dark: #004D73;
--success: #66BB6A;
--warning: #FFA726;
--danger: #EF5350;
--bg-primary: #F5F7FA;
--bg-secondary: #FFFFFF;
--text-primary: #1A237E;
--text-secondary: #546E7A;
--border-color: #E0E6ED;
--shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
--shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: var(--bg-primary);
color: var(--text-primary);
line-height: 1.6;
}
.app-container {
display: flex;
min-height: 100vh;
}
.header {
position: fixed;
top: 0;
left: 0;
right: 0;
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
color: white;
padding: 16px 24px;
box-shadow: var(--shadow-lg);
z-index: 1000;
display: flex;
justify-content: space-between;
align-items: center;
}
.header-left {
display: flex;
align-items: center;
gap: 16px;
}
.logo {
font-size: 24px;
font-weight: bold;
letter-spacing: 1px;
}
.header-right {
display: flex;
align-items: center;
gap: 24px;
font-size: 13px;
}
.sync-status {
display: flex;
align-items: center;
gap: 6px;
}
.sync-indicator {
width: 8px;
height: 8px;
background: var(--success);
border-radius: 50%;
animation: pulse 2s infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
.nav-sidebar {
position: fixed;
left: 0;
top: 70px;
bottom: 0;
width: 280px;
background: var(--bg-secondary);
border-right: 1px solid var(--border-color);
overflow-y: auto;
padding: 24px 0;
box-shadow: var(--shadow);
}
.nav-section {
margin-bottom: 24px;
}
.nav-section-title {
font-size: 12px;
font-weight: bold;
text-transform: uppercase;
color: var(--text-secondary);
padding: 0 24px;
margin-bottom: 12px;
}
.nav-item {
padding: 12px 24px;
cursor: pointer;
color: var(--text-secondary);
border-left: 3px solid transparent;
transition: all 0.3s ease;
display: flex;
align-items: center;
gap: 12px;
font-size: 14px;
}
.nav-item:hover {
background: rgba(0, 131, 143, 0.05);
color: var(--text-primary);
}
.nav-item.active {
background: rgba(0, 131, 143, 0.1);
color: var(--primary);
border-left-color: var(--primary);
font-weight: 600;
}
.main-content {
margin-left: 280px;
margin-top: 70px;
padding: 32px;
flex: 1;
background: var(--bg-primary);
overflow-y: auto;
}
.module-header {
margin-bottom: 32px;
}
.module-title {
font-size: 32px;
font-weight: bold;
color: var(--text-primary);
margin-bottom: 8px;
}
.module-description {
font-size: 14px;
color: var(--text-secondary);
}
.card {
background: var(--bg-secondary);
border-radius: 8px;
padding: 24px;
box-shadow: var(--shadow);
margin-bottom: 24px;
border: 1px solid var(--border-color);
}
.card-title {
font-size: 18px;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 20px;
display: flex;
justify-content: space-between;
align-items: center;
}
.kpi-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 24px;
margin-bottom: 32px;
}
.kpi-card {
background: var(--bg-secondary);
border-radius: 8px;
padding: 24px;
box-shadow: var(--shadow);
border-left: 4px solid var(--primary);
}
.kpi-label {
font-size: 13px;
color: var(--text-secondary);
margin-bottom: 8px;
text-transform: uppercase;
font-weight: 600;
}
.kpi-value {
font-size: 28px;
font-weight: bold;
color: var(--text-primary);
margin-bottom: 8px;
}
.kpi-status {
font-size: 12px;
font-weight: 600;
padding: 4px 12px;
border-radius: 12px;
display: inline-block;
background: rgba(102, 187, 106, 0.1);
color: var(--success);
}
.table-container {
overflow-x: auto;
border-radius: 8px;
border: 1px solid var(--border-color);
background: var(--bg-secondary);
}
table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}
th {
background: var(--bg-primary);
padding: 16px;
text-align: left;
font-weight: 600;
color: var(--text-primary);
border-bottom: 2px solid var(--border-color);
}
td {
padding: 14px 16px;
border-bottom: 1px solid var(--border-color);
color: var(--text-secondary);
}
tr:hover {
background: rgba(0, 131, 143, 0.02);
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 13px;
font-weight: 600;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
gap: 8px;
}
.btn-primary {
background: var(--primary);
color: white;
}
.btn-primary:hover {
background: var(--primary-light);
box-shadow: var(--shadow-lg);
}
.btn-secondary {
background: var(--bg-primary);
color: var(--primary);
border: 1px solid var(--border-color);
}
.btn-sm {
padding: 6px 12px;
font-size: 12px;
}
.badge {
display: inline-block;
padding: 4px 12px;
border-radius: 12px;
font-size: 11px;
font-weight: 600;
background: rgba(102, 187, 106, 0.1);
color: var(--success);
}
.alert {
padding: 16px;
border-radius: 6px;
margin-bottom: 20px;
display: flex;
gap: 12px;
align-items: flex-start;
}
.alert-info {
background: rgba(33, 150, 243, 0.1);
color: #1976D2;
}
.alert-title {
font-weight: 600;
margin-bottom: 4px;
}
.tabs {
display: flex;
gap: 0;
border-bottom: 2px solid var(--border-color);
margin-bottom: 24px;
background: var(--bg-secondary);
border-radius: 8px 8px 0 0;
padding: 0;
}
.tab {
padding: 12px 24px;
background: none;
border: none;
cursor: pointer;
font-size: 14px;
font-weight: 600;
color: var(--text-secondary);
border-bottom: 2px solid transparent;
margin-bottom: 0;
transition: all 0.3s ease;
}
.tab.active {
color: var(--primary);
border-bottom-color: var(--primary);
}
.chart-container {
height: 300px;
background: var(--bg-primary);
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
color: var(--text-secondary);
margin: 20px 0;
border: 1px dashed var(--border-color);
}
.grid-2 {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 24px;
}
.grid-3 {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 24px;
}
.audit-log {
background: var(--bg-primary);
border-left: 3px solid var(--primary);
padding: 16px;
border-radius: 4px;
margin-bottom: 12px;
font-size: 13px;
}
.audit-log-time {
font-weight: 600;
color: var(--text-primary);
margin-bottom: 4px;
}
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
background: var(--border-color);
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--text-secondary);
}
</style>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
// ============================================
// MASTER DATA
// ============================================
const MASTER_DATA = {
company: {
id: "NEXGEN-HQ",
name: "NexGen Financial Solutions",
city: "Dubai"
},
entities: [
{ id: "NEXGEN-HQ", name: "NexGen (Parent - Dubai)", currency: "USD" },
{ id: "NEXGEN-AE", name: "NexGen Arabia (UAE)", currency: "AED" },
{ id: "NEXGEN-UK", name: "NexGen UK (London)", currency: "GBP" },
{ id: "NEXGEN-IN", name: "NexGen India (Bangalore)", currency: "INR" },
{ id: "NEXGEN-SING", name: "NexGen Singapore", currency: "SGD" }
],
covenants: [
{ id: "COV-001", name: "Min Cash Balance", threshold: 100, current: 312.5, unit: "USD M" },
{ id: "COV-002", name: "Debt-to-EBITDA", threshold: 2.5, current: 2.3, unit: "ratio" },
{ id: "COV-003", name: "Interest Coverage", threshold: 3.0, current: 4.2, unit: "ratio" },
{ id: "COV-004", name: "Max Leverage", threshold: 0.65, current: 0.58, unit: "ratio" }
],
users: [
{ id: "U1", name: "Sarah Mitchell", role: "Treasurer" },
{ id: "U2", name: "Ahmed Al-Mansouri", role: "CFO" }
]
};
// ============================================
// INITIAL STATE GENERATORS
// ============================================
const generateBankAccounts = () => [
{ id: "BA-1", entity: "NEXGEN-AE", bank: "Emirates NBD", currency: "AED", balance: 245.3, minBalance: 50 },
{ id: "BA-2", entity: "NEXGEN-AE", bank: "Mashreq Bank", currency: "AED", balance: 78.9, minBalance: 20 },
{ id: "BA-3", entity: "NEXGEN-UK", bank: "HSBC", currency: "GBP", balance: 65.4, minBalance: 15 },
{ id: "BA-4", entity: "NEXGEN-UK", bank: "BNP Paribas", currency: "EUR", balance: 82.3, minBalance: 20 },
{ id: "BA-5", entity: "NEXGEN-IN", bank: "Axis Bank", currency: "INR", balance: 1850, minBalance: 300 },
{ id: "BA-6", entity: "NEXGEN-SING", bank: "DBS", currency: "SGD", balance: 95.6, minBalance: 25 }
];
const generateInvestments = () => [
{ id: "INV-1", type: "FixedDeposit", issuer: "ADIB", amount: 28.1, yield: 4.5, maturity: "2025-03-15", rating: "AA" },
{ id: "INV-2", type: "GovernmentBond", issuer: "UAE Govt", amount: 45.0, yield: 4.2, maturity: "2027-06-30", rating: "AAA" },
{ id: "INV-3", type: "CommercialPaper", issuer: "Global Corp", amount: 35.0, yield: 5.1, maturity: "2025-12-31", rating: "A+" },
{ id: "INV-4", type: "CorporateBond", issuer: "Infra Corp", amount: 22.5, yield: 6.8, maturity: "2026-12-15", rating: "BBB+" },
{ id: "INV-5", type: "Sukuk", issuer: "Islamic Dev Bank", amount: 55.0, yield: 4.8, maturity: "2028-03-20", rating: "AA-" },
{ id: "INV-6", type: "MutualFund", issuer: "Global AM", amount: 18.5, yield: 5.2, maturity: null, rating: "A" }
];
const FX_RATES = { 'AED': 0.2722, 'GBP': 1.2670, 'EUR': 1.1050, 'INR': 0.0120, 'SGD': 0.7450, 'USD': 1.0 };
const calculateLiquidityMetrics = (accounts) => {
let totalUSD = 0;
accounts.forEach(acc => {
totalUSD += acc.balance * (FX_RATES[acc.currency] || 1);
});
return { totalLiquidity: totalUSD, deployed: 204.1, available: Math.max(totalUSD - 100, 0) };
};
// ============================================
// REACT COMPONENTS
// ============================================
function Header({ currentUser }) {
return (
<div className="header">
<div className="header-left">
<div className="logo">π° TMS</div>
<div style={{ fontSize: '14px' }}>NexGen Treasury System</div>
</div>
<div className="header-right">
<div className="sync-status">
<div className="sync-indicator"></div>
<div>Live Sync Active</div>
</div>
<div>{new Date().toLocaleTimeString()}</div>
<div>{currentUser.name} β’ {currentUser.role}</div>
</div>
</div>
);
}
function Navigation({ currentModule, onModuleChange }) {
const modules = [
{ id: 'dashboard', name: 'Dashboard', icon: 'π' },
{ id: 'liquidity', name: 'Liquidity Intelligence', icon: 'π§' },
{ id: 'investment', name: 'Investment Portfolio', icon: 'π' },
{ id: 'forecast', name: 'Forecasting & Risk', icon: 'π―' }
];
return (
<div className="nav-sidebar">
<div className="nav-section">
<div className="nav-section-title">Modules</div>
{modules.map(mod => (
<div
key={mod.id}
className={`nav-item ${currentModule === mod.id ? 'active' : ''}`}
onClick={() => onModuleChange(mod.id)}
>
<span>{mod.icon}</span>
{mod.name}
</div>
))}
</div>
<div className="nav-section">
<div className="nav-section-title">Governance</div>
<div className="nav-item">β
Covenant Tracking</div>
<div className="nav-item">π Audit Trail</div>
<div className="nav-item">π Approvals</div>
</div>
<div className="nav-section">
<div className="nav-section-title">System Status</div>
<div style={{ padding: '0 24px', fontSize: '12px', color: 'var(--text-secondary)', lineHeight: '1.8' }}>
<strong>Demo v1.0</strong><br/>
β
6 Bank Feeds<br/>
β
ERP Connected<br/>
β
Live Simulation<br/>
β
5s Updates<br/>
β
Production Ready<br/>
</div>
</div>
</div>
);
}
function KPICard({ label, value, status = 'compliant' }) {
return (
<div className="kpi-card">
<div className="kpi-label">{label}</div>
<div className="kpi-value">{typeof value === 'number' ? `$${value.toFixed(1)}M` : value}</div>
<div className="kpi-status">β
{status.toUpperCase()}</div>
</div>
);
}
function DashboardModule() {
const [accounts] = React.useState(generateBankAccounts());
const [investments] = React.useState(generateInvestments());
const metrics = calculateLiquidityMetrics(accounts);
const totalInvested = investments.reduce((sum, inv) => sum + inv.amount, 0);
const blendedYield = investments.reduce((sum, inv) => sum + (inv.amount * inv.yield), 0) / totalInvested;
return (
<div className="main-content">
<div className="module-header">
<div className="module-title">Treasury Dashboard</div>
<div className="module-description">Real-time overview of liquidity, investments, and covenant compliance</div>
</div>
<div className="alert alert-info">
<div>βΉοΈ <strong>Connected Systems Active</strong><br/>All integrations syncing: 6 global banks, ERP systems, market data feeds with live simulation running every 5 seconds.</div>
</div>
<div className="kpi-grid">
<KPICard label="Total Liquidity" value={metrics.totalLiquidity} />
<KPICard label="Available for Deployment" value={metrics.available} />
<KPICard label="Deployed Capital" value={metrics.deployed} />
<KPICard label="Covenant Status" value="4 of 4" />
</div>
<div className="card">
<div className="card-title">System Capabilities</div>
<div className="grid-3">
<div>
<strong style={{ fontSize: '14px', color: 'var(--primary)' }}>π Data Integrations</strong>
<ul style={{ fontSize: '12px', color: 'var(--text-secondary)', lineHeight: '2', marginTop: '12px', listStyle: 'none' }}>
<li>β Emirates NBD Feed</li>
<li>β Mashreq Bank Feed</li>
<li>β HSBC London</li>
<li>β BNP Paribas</li>
<li>β Axis Bank India</li>
<li>β DBS Singapore</li>
</ul>
</div>
<div>
<strong style={{ fontSize: '14px', color: 'var(--primary)' }}>π Features</strong>
<ul style={{ fontSize: '12px', color: 'var(--text-secondary)', lineHeight: '2', marginTop: '12px', listStyle: 'none' }}>
<li>β Live Updates (5s)</li>
<li>β Driver Analysis</li>
<li>β FX Conversion</li>
<li>β Covenant Tracking</li>
<li>β Approval Workflows</li>
<li>β Audit Trail</li>
</ul>
</div>
<div>
<strong style={{ fontSize: '14px', color: 'var(--primary)' }}>π Get Started</strong>
<ul style={{ fontSize: '12px', color: 'var(--text-secondary)', lineHeight: '2', marginTop: '12px', listStyle: 'none' }}>
<li>β Liquidity Module</li>
<li>β View Investments</li>
<li>β Run Scenarios</li>
<li>β Execute Sweeps</li>
<li>β Review Audit</li>
<li>β Approve Workflows</li>
</ul>
</div>
</div>
</div>
<div className="card">
<div className="card-title">Data Model Overview</div>
<div className="grid-2">
<div>
<strong>Bank Accounts (6)</strong>
<div style={{ fontSize: '12px', color: 'var(--text-secondary)', lineHeight: '2', marginTop: '12px' }}>
<div>π° Emirates NBD: AED 245.3M</div>
<div>π° Mashreq: AED 78.9M</div>
<div>π° HSBC London: GBP 65.4M</div>
<div>π° BNP Paris: EUR 82.3M</div>
<div>π° Axis Bank: INR 1,850M</div>
<div>π° DBS Singapore: SGD 95.6M</div>
</div>
</div>
<div>
<strong>Investment Portfolio (6)</strong>
<div style={{ fontSize: '12px', color: 'var(--text-secondary)', lineHeight: '2', marginTop: '12px' }}>
<div>π Total Deployed: ${metrics.deployed.toFixed(1)}M</div>
<div>π Blended Yield: {blendedYield.toFixed(2)}%</div>
<div>β° Avg Maturity: 2.1 years</div>
<div>π
Weighted Rating: AA</div>
<div>β
Status: All Active</div>
</div>
</div>
</div>
</div>
</div>
);
}
function LiquidityModule() {
const [accounts, setAccounts] = React.useState(generateBankAccounts());
const [selectedTab, setSelectedTab] = React.useState('overview');
const metrics = calculateLiquidityMetrics(accounts);
React.useEffect(() => {
const interval = setInterval(() => {
setAccounts(prev => prev.map(acc => ({
...acc,
balance: Math.max(acc.balance + (Math.random() - 0.5) * 2, acc.minBalance * 0.8)
})));
}, 5000);
return () => clearInterval(interval);
}, []);
return (
<div className="main-content">
<div className="module-header">
<div className="module-title">Liquidity Intelligence</div>
<div className="module-description">Real-time cash visibility with driver analysis and transaction management</div>
</div>
<div className="tabs">
<button className={`tab ${selectedTab === 'overview' ? 'active' : ''}`} onClick={() => setSelectedTab('overview')}>Overview</button>
<button className={`tab ${selectedTab === 'entities' ? 'active' : ''}`} onClick={() => setSelectedTab('entities')}>By Entity</button>
<button className={`tab ${selectedTab === 'drivers' ? 'active' : ''}`} onClick={() => setSelectedTab('drivers')}>Driver Analysis</button>
<button className={`tab ${selectedTab === 'covenants' ? 'active' : ''}`} onClick={() => setSelectedTab('covenants')}>Covenants</button>
<button className={`tab ${selectedTab === 'audit' ? 'active' : ''}`} onClick={() => setSelectedTab('audit')}>Audit Trail</button>
</div>
{selectedTab === 'overview' && (
<>
<div className="kpi-grid">
<KPICard label="Total Liquidity" value={metrics.totalLiquidity} />
<KPICard label="Min Required" value={100} />
<KPICard label="Cushion" value={metrics.totalLiquidity - 100} />
<KPICard label="Status" value="Live" />
</div>
<div className="card">
<div className="card-title">Bank Account Reconciliation
<button className="btn btn-primary btn-sm">β Sweep Liquidity</button>
</div>
<div className="table-container">
<table>
<thead>
<tr>
<th>Entity</th>
<th>Bank</th>
<th>Currency</th>
<th style={{ textAlign: 'right' }}>Balance</th>
<th style={{ textAlign: 'right' }}>Min Balance</th>
<th style={{ textAlign: 'right' }}>Available</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{accounts.map(acc => (
<tr key={acc.id}>
<td>{acc.entity}</td>
<td>{acc.bank}</td>
<td><strong>{acc.currency}</strong></td>
<td style={{ textAlign: 'right' }}>{acc.balance.toFixed(1)}M</td>
<td style={{ textAlign: 'right' }}>{acc.minBalance.toFixed(1)}M</td>
<td style={{ textAlign: 'right', color: 'var(--primary)', fontWeight: 600 }}>{Math.max(acc.balance - acc.minBalance, 0).toFixed(1)}M</td>
<td><span className="badge">Healthy</span></td>
</tr>
))}
</tbody>
</table>
</div>
</div>
<div className="card">
<div className="card-title">Cash Position Trend (30-Day Historical)</div>
<div className="chart-container">
π Live Chart Area (Updates every 5 seconds with Recharts)
</div>
</div>
</>
)}
{selectedTab === 'entities' && (
<div className="card">
<div className="card-title">Liquidity by Entity & Currency</div>
<div className="grid-2">
<div>
<strong>By Entity (USD Equivalent)</strong>
<div className="table-container" style={{ marginTop: '12px' }}>
<table>
<thead><tr><th>Entity</th><th style={{ textAlign: 'right' }}>Liquidity</th></tr></thead>
<tbody>
<tr><td>NEXGEN-AE</td><td style={{ textAlign: 'right' }}>$89.2M</td></tr>
<tr><td>NEXGEN-UK</td><td style={{ textAlign: 'right' }}>$187.3M</td></tr>
<tr><td>NEXGEN-IN</td><td style={{ textAlign: 'right' }}>$22.2M</td></tr>
<tr><td>NEXGEN-SING</td><td style={{ textAlign: 'right' }}>$71.3M</td></tr>
</tbody>
</table>
</div>
</div>
<div>
<strong>By Currency (Local)</strong>
<div className="table-container" style={{ marginTop: '12px' }}>
<table>
<thead><tr><th>Currency</th><th style={{ textAlign: 'right' }}>Amount</th></tr></thead>
<tbody>
<tr><td><strong>AED</strong></td><td style={{ textAlign: 'right' }}>324.2M</td></tr>
<tr><td><strong>GBP</strong></td><td style={{ textAlign: 'right' }}>147.8M</td></tr>
<tr><td><strong>EUR</strong></td><td style={{ textAlign: 'right' }}>82.3M</td></tr>
<tr><td><strong>INR</strong></td><td style={{ textAlign: 'right' }}>1,850M</td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
)}
{selectedTab === 'drivers' && (
<div className="card">
<div className="card-title">Daily Liquidity Driver Analysis</div>
<div className="grid-2">
<div>
<strong>Driver Impact (Today)</strong>
<div style={{ fontSize: '13px', lineHeight: '2.2', marginTop: '12px' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', paddingBottom: '8px', borderBottom: '1px solid var(--border-color)' }}>
<span>Sales Inflows</span>
<span style={{ color: 'var(--success)', fontWeight: 600 }}>+$18.2M</span>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', paddingBottom: '8px', borderBottom: '1px solid var(--border-color)' }}>
<span>Operating Outflows</span>
<span style={{ color: 'var(--danger)', fontWeight: 600 }}>-$12.5M</span>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', paddingBottom: '8px', borderBottom: '1px solid var(--border-color)' }}>
<span>FX Impact</span>
<span style={{ color: 'var(--warning)', fontWeight: 600 }}>-$2.1M</span>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', paddingBottom: '8px', borderBottom: '1px solid var(--border-color)' }}>
<span>Investment Maturity</span>
<span style={{ color: 'var(--success)', fontWeight: 600 }}>+$0M</span>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', paddingTop: '12px', fontWeight: 'bold', fontSize: '14px', color: 'var(--primary)' }}>
<span>Net Daily Change</span>
<span>+$3.6M</span>
</div>
</div>
</div>
<div>
<strong>Key Insights</strong>
<div className="alert alert-info" style={{ marginTop: '12px', border: 'none' }}>
<div><strong>Sales Performance Strong</strong><br/>Collections of $18.2M show continued momentum across regions.</div>
</div>
<div className="alert alert-info" style={{ border: 'none' }}>
<div><strong>FX Volatility</strong><br/>Minor headwinds from emerging market currencies. Review hedge coverage.</div>
</div>
</div>
</div>
</div>
)}
{selectedTab === 'covenants' && (
<div className="card">
<div className="card-title">Covenant Compliance Dashboard</div>
<div className="grid-2">
{MASTER_DATA.covenants.map(cov => (
<div key={cov.id} style={{ padding: '16px', background: 'var(--bg-primary)', borderRadius: '6px' }}>
<div style={{ fontSize: '13px', fontWeight: 600, marginBottom: '8px' }}>{cov.name}</div>
<div style={{ fontSize: '22px', fontWeight: 'bold', color: 'var(--primary)', marginBottom: '4px' }}>
{cov.current.toFixed(2)}
</div>
<div style={{ fontSize: '12px', color: 'var(--text-secondary)', marginBottom: '8px' }}>
Threshold: {cov.threshold}
</div>
<div className="badge">β
COMPLIANT</div>
</div>
))}
</div>
</div>
)}
{selectedTab === 'audit' && (
<div className="card">
<div className="card-title">Transaction & Approval Audit Trail</div>
<div>
<div className="audit-log">
<div className="audit-log-time">2025-12-10 12:45:00</div>
<div><strong>Bank sync completed</strong> - Emirates NBD feed processed</div>
<div style={{ fontSize: '11px', color: 'var(--text-secondary)', marginTop: '4px' }}>β Completed by System</div>
</div>
<div className="audit-log">
<div className="audit-log-time">2025-12-10 12:30:00</div>
<div><strong>Forecast updated</strong> - 13-week rolling forecast recalculated</div>
<div style={{ fontSize: '11px', color: 'var(--text-secondary)', marginTop: '4px' }}>β Completed by System</div>
</div>
<div className="audit-log">
<div className="audit-log-time">2025-12-10 12:15:00</div>
<div><strong>Sweep initiated</strong> - AED 25M from Mashreq to parent</div>
<div style={{ fontSize: '11px', color: 'var(--text-secondary)', marginTop: '4px' }}>β³ Pending CFO approval</div>
</div>
</div>
</div>
)}
</div>
);
}
function InvestmentModule() {
const [investments] = React.useState(generateInvestments());
const totalDeployed = investments.reduce((sum, inv) => sum + inv.amount, 0);
const blendedYield = investments.reduce((sum, inv) => sum + (inv.amount * inv.yield), 0) / totalDeployed;
return (
<div className="main-content">
<div className="module-header">
<div className="module-title">Investment Portfolio</div>
<div className="module-description">Manage investment positions and portfolio optimization</div>
</div>
<div className="kpi-grid">
<KPICard label="Deployed Capital" value={totalDeployed} />
<KPICard label="Blended Yield" value={`${blendedYield.toFixed(2)}%`} />
<KPICard label="Active Positions" value={investments.length} />
<KPICard label="Avg Rating" value="AA" />
</div>
<div className="card">
<div className="card-title">Current Investment Positions</div>
<div className="table-container">
<table>
<thead>
<tr>
<th>Type</th>
<th>Issuer</th>
<th style={{ textAlign: 'right' }}>Amount</th>
<th style={{ textAlign: 'right' }}>Yield</th>
<th>Rating</th>
<th>Maturity</th>
</tr>
</thead>
<tbody>
{investments.map(inv => (
<tr key={inv.id}>
<td><strong>{inv.type}</strong></td>
<td>{inv.issuer}</td>
<td style={{ textAlign: 'right' }}>${inv.amount.toFixed(1)}M</td>
<td style={{ textAlign: 'right', color: 'var(--success)', fontWeight: 600 }}>{inv.yield.toFixed(2)}%</td>
<td><span className="badge">{inv.rating}</span></td>
<td>{inv.maturity || 'N/A'}</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
<div className="card">
<div className="card-title">Upcoming Maturities & Reinvestment Alerts</div>
<div className="table-container">
<table>
<thead>
<tr><th>Position</th><th style={{ textAlign: 'right' }}>Amount</th><th>Matures</th><th>Days Left</th></tr>
</thead>
<tbody>
<tr>
<td>CommercialPaper - Global Corp</td>
<td style={{ textAlign: 'right' }}>$35.0M</td>
<td>2025-12-31</td>
<td style={{ color: 'var(--danger)', fontWeight: 600 }}>21 days</td>
</tr>
<tr>
<td>FixedDeposit - ADIB</td>
<td style={{ textAlign: 'right' }}>$28.1M</td>
<td>2025-03-15</td>
<td style={{ color: 'var(--primary)', fontWeight: 600 }}>95 days</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
);
}
function ForecastModule() {
return (
<div className="main-content">
<div className="module-header">
<div className="module-title">Forecasting & Scenario Analysis</div>
<div className="module-description">13-week rolling forecast with stress testing and impact analysis</div>
</div>
<div className="card">
<div className="card-title">Forecast Scenarios</div>
<div style={{ display: 'flex', gap: '16px', marginBottom: '24px' }}>
<div style={{ padding: '16px', border: '2px solid var(--primary)', borderRadius: '6px', flex: 1, background: 'rgba(0, 131, 143, 0.05)' }}>
<div style={{ color: 'var(--primary)', fontWeight: 600, marginBottom: '4px' }}>π Base Case</div>
<div style={{ fontSize: '12px', color: 'var(--text-secondary)' }}>Expected outcome with current trajectory</div>
</div>
<div style={{ padding: '16px', border: '2px solid var(--success)', borderRadius: '6px', flex: 1 }}>
<div style={{ color: 'var(--success)', fontWeight: 600, marginBottom: '4px' }}>π Bull Case</div>
<div style={{ fontSize: '12px', color: 'var(--text-secondary)' }}>Sales +15%, FX favorable</div>
</div>
<div style={{ padding: '16px', border: '2px solid var(--danger)', borderRadius: '6px', flex: 1 }}>
<div style={{ color: 'var(--danger)', fontWeight: 600, marginBottom: '4px' }}>π Bear Case</div>
<div style={{ fontSize: '12px', color: 'var(--text-secondary)' }}>Sales -20%, FX headwinds</div>
</div>
</div>
<div className="chart-container">
π 13-Week Forecast Chart (Real-time Recharts Visualization)
</div>
<div className="grid-3" style={{ marginTop: '24px' }}>
<div style={{ padding: '16px', background: 'var(--bg-primary)', borderRadius: '6px' }}>
<div style={{ fontSize: '12px', fontWeight: 600, marginBottom: '8px' }}>Opening (Week 1)</div>
<div style={{ fontSize: '22px', fontWeight: 'bold', color: 'var(--primary)' }}>$310M</div>
</div>
<div style={{ padding: '16px', background: 'var(--bg-primary)', borderRadius: '6px' }}>
<div style={{ fontSize: '12px', fontWeight: 600, marginBottom: '8px' }}>Closing (Week 13)</div>
<div style={{ fontSize: '22px', fontWeight: 'bold', color: 'var(--primary)' }}>$277M</div>
</div>
<div style={{ padding: '16px', background: 'var(--bg-primary)', borderRadius: '6px' }}>
<div style={{ fontSize: '12px', fontWeight: 600, marginBottom: '8px' }}>Min Balance Trigger</div>
<div style={{ fontSize: '22px', fontWeight: 'bold', color: 'var(--primary)' }}>Week 6</div>
</div>
</div>
</div>
<div className="card">
<div className="card-title">Scenario Impact Analysis</div>
<div className="table-container">
<table>
<thead>
<tr>
<th>Factor</th>
<th>Base Case</th>
<th>Bull Case</th>
<th>Bear Case</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Sales Growth</strong></td>
<td>+5% YoY</td>
<td style={{ color: 'var(--success)', fontWeight: 600 }}>+15% YoY</td>
<td style={{ color: 'var(--danger)', fontWeight: 600 }}>-20% YoY</td>
</tr>
<tr>
<td><strong>FX Movement</strong></td>
<td>Neutral</td>
<td style={{ color: 'var(--success)', fontWeight: 600 }}>+2% favorable</td>
<td style={{ color: 'var(--danger)', fontWeight: 600 }}>-5% unfavorable</td>
</tr>
<tr>
<td><strong>Covenant Risk</strong></td>
<td><span className="badge">β
Safe</span></td>
<td><span className="badge">β
Very Safe</span></td>
<td style={{ color: 'var(--danger)', fontWeight: 600 }}>β οΈ At Risk</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
);
}
function TreasuryApp() {
const [currentModule, setCurrentModule] = React.useState('dashboard');
const currentUser = MASTER_DATA.users[0];
return (
<div className="app-container">
<Header currentUser={currentUser} />
<Navigation currentModule={currentModule} onModuleChange={setCurrentModule} />
{currentModule === 'dashboard' && <DashboardModule />}
{currentModule === 'liquidity' && <LiquidityModule />}
{currentModule === 'investment' && <InvestmentModule />}
{currentModule === 'forecast' && <ForecastModule />}
</div>
);
}
ReactDOM.createRoot(document.getElementById('root')).render(<TreasuryApp />);
</script>
</body>
</html>
|