Add 2 files
Browse files- index.html +945 -211
- prompts.txt +2 -1
index.html
CHANGED
|
@@ -142,42 +142,45 @@
|
|
| 142 |
<div class="space-y-3">
|
| 143 |
<div>
|
| 144 |
<label class="block text-sm font-medium text-gray-700 mb-1">Profit Range</label>
|
| 145 |
-
<select class="w-full p-2 border border-gray-300 rounded-md text-sm">
|
| 146 |
-
<option>All</option>
|
| 147 |
-
<option>0 - $10k</option>
|
| 148 |
-
<option>$10k - $50k</option>
|
| 149 |
-
<option>$50k - $100k</option>
|
| 150 |
-
<option>$100k+</option>
|
| 151 |
</select>
|
| 152 |
</div>
|
| 153 |
|
| 154 |
<div>
|
| 155 |
<label class="block text-sm font-medium text-gray-700 mb-1">Country</label>
|
| 156 |
-
<select class="w-full p-2 border border-gray-300 rounded-md text-sm">
|
| 157 |
-
<option>All Countries</option>
|
| 158 |
-
<option>United States</option>
|
| 159 |
-
<option>United Kingdom</option>
|
| 160 |
-
<option>Japan</option>
|
| 161 |
-
<option>Germany</option>
|
| 162 |
-
<option>Singapore</option>
|
| 163 |
</select>
|
| 164 |
</div>
|
| 165 |
|
| 166 |
<div>
|
| 167 |
<label class="block text-sm font-medium text-gray-700 mb-1">Asset Class</label>
|
| 168 |
-
<select class="w-full p-2 border border-gray-300 rounded-md text-sm">
|
| 169 |
-
<option>All</option>
|
| 170 |
-
<option>Stocks</option>
|
| 171 |
-
<option>Forex</option>
|
| 172 |
-
<option>Crypto</option>
|
| 173 |
-
<option>Commodities</option>
|
| 174 |
-
<option>Options</option>
|
| 175 |
</select>
|
| 176 |
</div>
|
| 177 |
|
| 178 |
-
<button class="w-full bg-primary text-white py-2 px-4 rounded-md text-sm hover:bg-secondary transition">
|
| 179 |
Apply Filters
|
| 180 |
</button>
|
|
|
|
|
|
|
|
|
|
| 181 |
</div>
|
| 182 |
</div>
|
| 183 |
|
|
@@ -186,15 +189,15 @@
|
|
| 186 |
<div class="space-y-2">
|
| 187 |
<div class="flex justify-between text-sm">
|
| 188 |
<span class="text-gray-600">Total Traders:</span>
|
| 189 |
-
<span class="font-medium">1,248</span>
|
| 190 |
</div>
|
| 191 |
<div class="flex justify-between text-sm">
|
| 192 |
<span class="text-gray-600">Avg. Profit:</span>
|
| 193 |
-
<span class="font-medium text-green-600">$42,780</span>
|
| 194 |
</div>
|
| 195 |
<div class="flex justify-between text-sm">
|
| 196 |
<span class="text-gray-600">Top Country:</span>
|
| 197 |
-
<span class="font-medium">USA (32%)</span>
|
| 198 |
</div>
|
| 199 |
</div>
|
| 200 |
</div>
|
|
@@ -209,10 +212,10 @@
|
|
| 209 |
<h1 class="text-2xl font-bold text-gray-800">Traders Dashboard</h1>
|
| 210 |
<div class="flex items-center space-x-4">
|
| 211 |
<div class="relative">
|
| 212 |
-
<input type="text" placeholder="Search traders..." class="pl-10 pr-4 py-2 border border-gray-300 rounded-md text-sm w-64 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent">
|
| 213 |
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
|
| 214 |
</div>
|
| 215 |
-
<button class="bg-primary text-white py-2 px-4 rounded-md text-sm hover:bg-secondary transition flex items-center">
|
| 216 |
<i class="fas fa-plus mr-2"></i>
|
| 217 |
Add Trader
|
| 218 |
</button>
|
|
@@ -231,52 +234,52 @@
|
|
| 231 |
<div class="flex justify-between items-start">
|
| 232 |
<div>
|
| 233 |
<p class="text-sm text-gray-500">Total Traders</p>
|
| 234 |
-
<h3 class="text-2xl font-bold mt-1">1,248</h3>
|
| 235 |
</div>
|
| 236 |
<div class="bg-blue-100 p-2 rounded-full">
|
| 237 |
<i class="fas fa-users text-blue-600"></i>
|
| 238 |
</div>
|
| 239 |
</div>
|
| 240 |
-
<p class="text-xs text-green-600 mt-2"><i class="fas fa-arrow-up mr-1"></i> 12.5% from last month</p>
|
| 241 |
</div>
|
| 242 |
|
| 243 |
<div class="bg-white p-4 rounded-lg shadow-sm border border-gray-100">
|
| 244 |
<div class="flex justify-between items-start">
|
| 245 |
<div>
|
| 246 |
<p class="text-sm text-gray-500">Avg. Profit</p>
|
| 247 |
-
<h3 class="text-2xl font-bold mt-1">$42.7k</h3>
|
| 248 |
</div>
|
| 249 |
<div class="bg-green-100 p-2 rounded-full">
|
| 250 |
<i class="fas fa-chart-line text-green-600"></i>
|
| 251 |
</div>
|
| 252 |
</div>
|
| 253 |
-
<p class="text-xs text-green-600 mt-2"><i class="fas fa-arrow-up mr-1"></i> 8.3% from last month</p>
|
| 254 |
</div>
|
| 255 |
|
| 256 |
<div class="bg-white p-4 rounded-lg shadow-sm border border-gray-100">
|
| 257 |
<div class="flex justify-between items-start">
|
| 258 |
<div>
|
| 259 |
<p class="text-sm text-gray-500">Top Market</p>
|
| 260 |
-
<h3 class="text-2xl font-bold mt-1">Crypto</h3>
|
| 261 |
</div>
|
| 262 |
<div class="bg-purple-100 p-2 rounded-full">
|
| 263 |
<i class="fas fa-coins text-purple-600"></i>
|
| 264 |
</div>
|
| 265 |
</div>
|
| 266 |
-
<p class="text-xs text-gray-500 mt-2">38% of total trades</p>
|
| 267 |
</div>
|
| 268 |
|
| 269 |
<div class="bg-white p-4 rounded-lg shadow-sm border border-gray-100">
|
| 270 |
<div class="flex justify-between items-start">
|
| 271 |
<div>
|
| 272 |
<p class="text-sm text-gray-500">Risk Score</p>
|
| 273 |
-
<h3 class="text-2xl font-bold mt-1">4.2/10</h3>
|
| 274 |
</div>
|
| 275 |
<div class="bg-yellow-100 p-2 rounded-full">
|
| 276 |
<i class="fas fa-shield-alt text-yellow-600"></i>
|
| 277 |
</div>
|
| 278 |
</div>
|
| 279 |
-
<p class="text-xs text-green-600 mt-2"><i class="fas fa-arrow-down mr-1"></i> 1.2 from last quarter</p>
|
| 280 |
</div>
|
| 281 |
</div>
|
| 282 |
|
|
@@ -285,10 +288,10 @@
|
|
| 285 |
<div class="bg-white p-4 rounded-lg shadow-sm border border-gray-100">
|
| 286 |
<div class="flex justify-between items-center mb-4">
|
| 287 |
<h3 class="font-semibold text-gray-800">Profit Distribution</h3>
|
| 288 |
-
<select class="text-sm border border-gray-300 rounded px-2 py-1">
|
| 289 |
-
<option>Last 30 Days</option>
|
| 290 |
-
<option>Last 90 Days</option>
|
| 291 |
-
<option>This Year</option>
|
| 292 |
</select>
|
| 293 |
</div>
|
| 294 |
<div class="chart-container">
|
|
@@ -299,9 +302,9 @@
|
|
| 299 |
<div class="bg-white p-4 rounded-lg shadow-sm border border-gray-100">
|
| 300 |
<div class="flex justify-between items-center mb-4">
|
| 301 |
<h3 class="font-semibold text-gray-800">Trader Locations</h3>
|
| 302 |
-
<select class="text-sm border border-gray-300 rounded px-2 py-1">
|
| 303 |
-
<option>By Country</option>
|
| 304 |
-
<option>By Region</option>
|
| 305 |
</select>
|
| 306 |
</div>
|
| 307 |
<div class="chart-container">
|
|
@@ -315,10 +318,10 @@
|
|
| 315 |
<div class="p-4 border-b border-gray-200 flex justify-between items-center">
|
| 316 |
<h3 class="font-semibold text-gray-800">Top Performing Traders</h3>
|
| 317 |
<div class="flex space-x-2">
|
| 318 |
-
<button class="text-gray-500 hover:text-gray-700">
|
| 319 |
<i class="fas fa-download"></i>
|
| 320 |
</button>
|
| 321 |
-
<button class="text-gray-500 hover:text-gray-700">
|
| 322 |
<i class="fas fa-filter"></i>
|
| 323 |
</button>
|
| 324 |
</div>
|
|
@@ -345,22 +348,16 @@
|
|
| 345 |
|
| 346 |
<div class="px-6 py-4 border-t border-gray-200 flex items-center justify-between">
|
| 347 |
<div class="text-sm text-gray-500">
|
| 348 |
-
Showing <span class="font-medium">1</span> to <span class="font-medium">10</span> of <span class="font-medium">1248</span> traders
|
| 349 |
</div>
|
| 350 |
<div class="flex space-x-2">
|
| 351 |
-
<button class="px-3 py-1 border border-gray-300 rounded-md text-sm bg-white text-gray-700 hover:bg-gray-50">
|
| 352 |
Previous
|
| 353 |
</button>
|
| 354 |
-
<
|
| 355 |
-
|
| 356 |
-
</
|
| 357 |
-
<button class="px-3 py-1 border border-gray-300 rounded-md text-sm bg-white text-gray-700 hover:bg-gray-50">
|
| 358 |
-
2
|
| 359 |
-
</button>
|
| 360 |
-
<button class="px-3 py-1 border border-gray-300 rounded-md text-sm bg-white text-gray-700 hover:bg-gray-50">
|
| 361 |
-
3
|
| 362 |
-
</button>
|
| 363 |
-
<button class="px-3 py-1 border border-gray-300 rounded-md text-sm bg-white text-gray-700 hover:bg-gray-50">
|
| 364 |
Next
|
| 365 |
</button>
|
| 366 |
</div>
|
|
@@ -390,41 +387,51 @@
|
|
| 390 |
<form id="addTraderForm" class="space-y-4">
|
| 391 |
<div>
|
| 392 |
<label for="name" class="block text-sm font-medium text-gray-700">Full Name</label>
|
| 393 |
-
<input type="text" id="name" name="name" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm">
|
| 394 |
</div>
|
| 395 |
|
| 396 |
<div>
|
| 397 |
<label for="email" class="block text-sm font-medium text-gray-700">Email</label>
|
| 398 |
-
<input type="email" id="email" name="email" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm">
|
| 399 |
</div>
|
| 400 |
|
| 401 |
<div>
|
| 402 |
<label for="country" class="block text-sm font-medium text-gray-700">Country</label>
|
| 403 |
-
<select id="country" name="country" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm">
|
| 404 |
<option value="">Select Country</option>
|
| 405 |
-
<option value="
|
| 406 |
-
<option value="
|
| 407 |
-
<option value="
|
| 408 |
-
<option value="
|
| 409 |
-
<option value="
|
| 410 |
</select>
|
| 411 |
</div>
|
| 412 |
|
| 413 |
<div>
|
| 414 |
<label for="market" class="block text-sm font-medium text-gray-700">Primary Market</label>
|
| 415 |
-
<select id="market" name="market" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm">
|
| 416 |
<option value="">Select Market</option>
|
| 417 |
-
<option value="
|
| 418 |
-
<option value="
|
| 419 |
-
<option value="
|
| 420 |
-
<option value="
|
| 421 |
-
<option value="
|
| 422 |
</select>
|
| 423 |
</div>
|
| 424 |
|
| 425 |
<div>
|
| 426 |
<label for="profit" class="block text-sm font-medium text-gray-700">Annual Profit ($)</label>
|
| 427 |
-
<input type="number" id="profit" name="profit" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 428 |
</div>
|
| 429 |
</form>
|
| 430 |
</div>
|
|
@@ -432,10 +439,164 @@
|
|
| 432 |
</div>
|
| 433 |
</div>
|
| 434 |
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
|
| 435 |
-
<button type="button" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-primary text-base font-medium text-white hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary sm:ml-3 sm:w-auto sm:text-sm">
|
| 436 |
Add Trader
|
| 437 |
</button>
|
| 438 |
-
<button type="button" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 439 |
Cancel
|
| 440 |
</button>
|
| 441 |
</div>
|
|
@@ -445,125 +606,335 @@
|
|
| 445 |
|
| 446 |
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
| 447 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 448 |
// Sample trader data
|
| 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 |
// Populate traders table
|
| 553 |
function populateTradersTable() {
|
| 554 |
const tableBody = document.getElementById('tradersTableBody');
|
| 555 |
tableBody.innerHTML = '';
|
| 556 |
|
| 557 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 558 |
const row = document.createElement('tr');
|
| 559 |
|
| 560 |
// Format profit with commas
|
| 561 |
-
const formattedProfit = trader.profit
|
| 562 |
-
style: 'currency',
|
| 563 |
-
currency: 'USD',
|
| 564 |
-
minimumFractionDigits: 0,
|
| 565 |
-
maximumFractionDigits: 0
|
| 566 |
-
});
|
| 567 |
|
| 568 |
row.innerHTML = `
|
| 569 |
<td class="px-6 py-4 whitespace-nowrap">
|
|
@@ -610,13 +981,13 @@
|
|
| 610 |
</div>
|
| 611 |
</td>
|
| 612 |
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
| 613 |
-
<button class="text-primary hover:text-secondary mr-3">
|
| 614 |
<i class="fas fa-eye"></i>
|
| 615 |
</button>
|
| 616 |
-
<button class="text-blue-500 hover:text-blue-700 mr-3">
|
| 617 |
<i class="fas fa-edit"></i>
|
| 618 |
</button>
|
| 619 |
-
<button class="text-red-500 hover:text-red-700">
|
| 620 |
<i class="fas fa-trash"></i>
|
| 621 |
</button>
|
| 622 |
</td>
|
|
@@ -624,13 +995,124 @@
|
|
| 624 |
|
| 625 |
tableBody.appendChild(row);
|
| 626 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 627 |
}
|
| 628 |
|
| 629 |
// Initialize charts
|
| 630 |
function initCharts() {
|
| 631 |
// Profit Distribution Chart
|
| 632 |
const profitCtx = document.getElementById('profitChart').getContext('2d');
|
| 633 |
-
|
| 634 |
type: 'bar',
|
| 635 |
data: {
|
| 636 |
labels: ['0 - $10k', '$10k - $50k', '$50k - $100k', '$100k - $250k', '$250k+'],
|
|
@@ -672,7 +1154,7 @@
|
|
| 672 |
|
| 673 |
// Location Distribution Chart
|
| 674 |
const locationCtx = document.getElementById('locationChart').getContext('2d');
|
| 675 |
-
|
| 676 |
type: 'doughnut',
|
| 677 |
data: {
|
| 678 |
labels: ['United States', 'United Kingdom', 'Japan', 'Germany', 'Singapore', 'Other'],
|
|
@@ -709,38 +1191,290 @@
|
|
| 709 |
});
|
| 710 |
}
|
| 711 |
|
| 712 |
-
//
|
| 713 |
-
|
| 714 |
-
|
| 715 |
-
|
| 716 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 717 |
|
| 718 |
-
//
|
| 719 |
-
|
| 720 |
-
document.
|
| 721 |
-
|
| 722 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 723 |
|
| 724 |
-
//
|
| 725 |
-
|
| 726 |
-
|
| 727 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 728 |
|
| 729 |
-
//
|
| 730 |
-
|
| 731 |
-
|
| 732 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 733 |
|
| 734 |
-
//
|
| 735 |
-
|
| 736 |
-
|
| 737 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 738 |
|
| 739 |
// Initialize the app
|
| 740 |
document.addEventListener('DOMContentLoaded', function() {
|
| 741 |
-
|
| 742 |
initCharts();
|
| 743 |
-
|
| 744 |
-
|
| 745 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 746 |
</html>
|
|
|
|
| 142 |
<div class="space-y-3">
|
| 143 |
<div>
|
| 144 |
<label class="block text-sm font-medium text-gray-700 mb-1">Profit Range</label>
|
| 145 |
+
<select id="profitRangeFilter" class="w-full p-2 border border-gray-300 rounded-md text-sm">
|
| 146 |
+
<option value="all">All</option>
|
| 147 |
+
<option value="0-10">0 - $10k</option>
|
| 148 |
+
<option value="10-50">$10k - $50k</option>
|
| 149 |
+
<option value="50-100">$50k - $100k</option>
|
| 150 |
+
<option value="100+">$100k+</option>
|
| 151 |
</select>
|
| 152 |
</div>
|
| 153 |
|
| 154 |
<div>
|
| 155 |
<label class="block text-sm font-medium text-gray-700 mb-1">Country</label>
|
| 156 |
+
<select id="countryFilter" class="w-full p-2 border border-gray-300 rounded-md text-sm">
|
| 157 |
+
<option value="all">All Countries</option>
|
| 158 |
+
<option value="United States">United States</option>
|
| 159 |
+
<option value="United Kingdom">United Kingdom</option>
|
| 160 |
+
<option value="Japan">Japan</option>
|
| 161 |
+
<option value="Germany">Germany</option>
|
| 162 |
+
<option value="Singapore">Singapore</option>
|
| 163 |
</select>
|
| 164 |
</div>
|
| 165 |
|
| 166 |
<div>
|
| 167 |
<label class="block text-sm font-medium text-gray-700 mb-1">Asset Class</label>
|
| 168 |
+
<select id="marketFilter" class="w-full p-2 border border-gray-300 rounded-md text-sm">
|
| 169 |
+
<option value="all">All</option>
|
| 170 |
+
<option value="Stocks">Stocks</option>
|
| 171 |
+
<option value="Forex">Forex</option>
|
| 172 |
+
<option value="Crypto">Crypto</option>
|
| 173 |
+
<option value="Commodities">Commodities</option>
|
| 174 |
+
<option value="Options">Options</option>
|
| 175 |
</select>
|
| 176 |
</div>
|
| 177 |
|
| 178 |
+
<button id="applyFiltersBtn" class="w-full bg-primary text-white py-2 px-4 rounded-md text-sm hover:bg-secondary transition">
|
| 179 |
Apply Filters
|
| 180 |
</button>
|
| 181 |
+
<button id="resetFiltersBtn" class="w-full bg-gray-200 text-gray-800 py-2 px-4 rounded-md text-sm hover:bg-gray-300 transition">
|
| 182 |
+
Reset Filters
|
| 183 |
+
</button>
|
| 184 |
</div>
|
| 185 |
</div>
|
| 186 |
|
|
|
|
| 189 |
<div class="space-y-2">
|
| 190 |
<div class="flex justify-between text-sm">
|
| 191 |
<span class="text-gray-600">Total Traders:</span>
|
| 192 |
+
<span id="totalTradersStat" class="font-medium">1,248</span>
|
| 193 |
</div>
|
| 194 |
<div class="flex justify-between text-sm">
|
| 195 |
<span class="text-gray-600">Avg. Profit:</span>
|
| 196 |
+
<span id="avgProfitStat" class="font-medium text-green-600">$42,780</span>
|
| 197 |
</div>
|
| 198 |
<div class="flex justify-between text-sm">
|
| 199 |
<span class="text-gray-600">Top Country:</span>
|
| 200 |
+
<span id="topCountryStat" class="font-medium">USA (32%)</span>
|
| 201 |
</div>
|
| 202 |
</div>
|
| 203 |
</div>
|
|
|
|
| 212 |
<h1 class="text-2xl font-bold text-gray-800">Traders Dashboard</h1>
|
| 213 |
<div class="flex items-center space-x-4">
|
| 214 |
<div class="relative">
|
| 215 |
+
<input type="text" id="searchInput" placeholder="Search traders..." class="pl-10 pr-4 py-2 border border-gray-300 rounded-md text-sm w-64 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent">
|
| 216 |
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
|
| 217 |
</div>
|
| 218 |
+
<button id="openAddTraderModal" class="bg-primary text-white py-2 px-4 rounded-md text-sm hover:bg-secondary transition flex items-center">
|
| 219 |
<i class="fas fa-plus mr-2"></i>
|
| 220 |
Add Trader
|
| 221 |
</button>
|
|
|
|
| 234 |
<div class="flex justify-between items-start">
|
| 235 |
<div>
|
| 236 |
<p class="text-sm text-gray-500">Total Traders</p>
|
| 237 |
+
<h3 id="totalTradersCard" class="text-2xl font-bold mt-1">1,248</h3>
|
| 238 |
</div>
|
| 239 |
<div class="bg-blue-100 p-2 rounded-full">
|
| 240 |
<i class="fas fa-users text-blue-600"></i>
|
| 241 |
</div>
|
| 242 |
</div>
|
| 243 |
+
<p id="totalTradersChange" class="text-xs text-green-600 mt-2"><i class="fas fa-arrow-up mr-1"></i> 12.5% from last month</p>
|
| 244 |
</div>
|
| 245 |
|
| 246 |
<div class="bg-white p-4 rounded-lg shadow-sm border border-gray-100">
|
| 247 |
<div class="flex justify-between items-start">
|
| 248 |
<div>
|
| 249 |
<p class="text-sm text-gray-500">Avg. Profit</p>
|
| 250 |
+
<h3 id="avgProfitCard" class="text-2xl font-bold mt-1">$42.7k</h3>
|
| 251 |
</div>
|
| 252 |
<div class="bg-green-100 p-2 rounded-full">
|
| 253 |
<i class="fas fa-chart-line text-green-600"></i>
|
| 254 |
</div>
|
| 255 |
</div>
|
| 256 |
+
<p id="avgProfitChange" class="text-xs text-green-600 mt-2"><i class="fas fa-arrow-up mr-1"></i> 8.3% from last month</p>
|
| 257 |
</div>
|
| 258 |
|
| 259 |
<div class="bg-white p-4 rounded-lg shadow-sm border border-gray-100">
|
| 260 |
<div class="flex justify-between items-start">
|
| 261 |
<div>
|
| 262 |
<p class="text-sm text-gray-500">Top Market</p>
|
| 263 |
+
<h3 id="topMarketCard" class="text-2xl font-bold mt-1">Crypto</h3>
|
| 264 |
</div>
|
| 265 |
<div class="bg-purple-100 p-2 rounded-full">
|
| 266 |
<i class="fas fa-coins text-purple-600"></i>
|
| 267 |
</div>
|
| 268 |
</div>
|
| 269 |
+
<p id="topMarketPercent" class="text-xs text-gray-500 mt-2">38% of total trades</p>
|
| 270 |
</div>
|
| 271 |
|
| 272 |
<div class="bg-white p-4 rounded-lg shadow-sm border border-gray-100">
|
| 273 |
<div class="flex justify-between items-start">
|
| 274 |
<div>
|
| 275 |
<p class="text-sm text-gray-500">Risk Score</p>
|
| 276 |
+
<h3 id="riskScoreCard" class="text-2xl font-bold mt-1">4.2/10</h3>
|
| 277 |
</div>
|
| 278 |
<div class="bg-yellow-100 p-2 rounded-full">
|
| 279 |
<i class="fas fa-shield-alt text-yellow-600"></i>
|
| 280 |
</div>
|
| 281 |
</div>
|
| 282 |
+
<p id="riskScoreChange" class="text-xs text-green-600 mt-2"><i class="fas fa-arrow-down mr-1"></i> 1.2 from last quarter</p>
|
| 283 |
</div>
|
| 284 |
</div>
|
| 285 |
|
|
|
|
| 288 |
<div class="bg-white p-4 rounded-lg shadow-sm border border-gray-100">
|
| 289 |
<div class="flex justify-between items-center mb-4">
|
| 290 |
<h3 class="font-semibold text-gray-800">Profit Distribution</h3>
|
| 291 |
+
<select id="profitTimeRange" class="text-sm border border-gray-300 rounded px-2 py-1">
|
| 292 |
+
<option value="30">Last 30 Days</option>
|
| 293 |
+
<option value="90">Last 90 Days</option>
|
| 294 |
+
<option value="365">This Year</option>
|
| 295 |
</select>
|
| 296 |
</div>
|
| 297 |
<div class="chart-container">
|
|
|
|
| 302 |
<div class="bg-white p-4 rounded-lg shadow-sm border border-gray-100">
|
| 303 |
<div class="flex justify-between items-center mb-4">
|
| 304 |
<h3 class="font-semibold text-gray-800">Trader Locations</h3>
|
| 305 |
+
<select id="locationViewType" class="text-sm border border-gray-300 rounded px-2 py-1">
|
| 306 |
+
<option value="country">By Country</option>
|
| 307 |
+
<option value="region">By Region</option>
|
| 308 |
</select>
|
| 309 |
</div>
|
| 310 |
<div class="chart-container">
|
|
|
|
| 318 |
<div class="p-4 border-b border-gray-200 flex justify-between items-center">
|
| 319 |
<h3 class="font-semibold text-gray-800">Top Performing Traders</h3>
|
| 320 |
<div class="flex space-x-2">
|
| 321 |
+
<button id="exportDataBtn" class="text-gray-500 hover:text-gray-700">
|
| 322 |
<i class="fas fa-download"></i>
|
| 323 |
</button>
|
| 324 |
+
<button id="showFiltersBtn" class="text-gray-500 hover:text-gray-700">
|
| 325 |
<i class="fas fa-filter"></i>
|
| 326 |
</button>
|
| 327 |
</div>
|
|
|
|
| 348 |
|
| 349 |
<div class="px-6 py-4 border-t border-gray-200 flex items-center justify-between">
|
| 350 |
<div class="text-sm text-gray-500">
|
| 351 |
+
Showing <span id="showingFrom" class="font-medium">1</span> to <span id="showingTo" class="font-medium">10</span> of <span id="totalTradersCount" class="font-medium">1248</span> traders
|
| 352 |
</div>
|
| 353 |
<div class="flex space-x-2">
|
| 354 |
+
<button id="prevPageBtn" class="px-3 py-1 border border-gray-300 rounded-md text-sm bg-white text-gray-700 hover:bg-gray-50">
|
| 355 |
Previous
|
| 356 |
</button>
|
| 357 |
+
<div id="pageNumbers" class="flex space-x-2">
|
| 358 |
+
<!-- Page numbers will be inserted here -->
|
| 359 |
+
</div>
|
| 360 |
+
<button id="nextPageBtn" class="px-3 py-1 border border-gray-300 rounded-md text-sm bg-white text-gray-700 hover:bg-gray-50">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 361 |
Next
|
| 362 |
</button>
|
| 363 |
</div>
|
|
|
|
| 387 |
<form id="addTraderForm" class="space-y-4">
|
| 388 |
<div>
|
| 389 |
<label for="name" class="block text-sm font-medium text-gray-700">Full Name</label>
|
| 390 |
+
<input type="text" id="name" name="name" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm" required>
|
| 391 |
</div>
|
| 392 |
|
| 393 |
<div>
|
| 394 |
<label for="email" class="block text-sm font-medium text-gray-700">Email</label>
|
| 395 |
+
<input type="email" id="email" name="email" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm" required>
|
| 396 |
</div>
|
| 397 |
|
| 398 |
<div>
|
| 399 |
<label for="country" class="block text-sm font-medium text-gray-700">Country</label>
|
| 400 |
+
<select id="country" name="country" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm" required>
|
| 401 |
<option value="">Select Country</option>
|
| 402 |
+
<option value="United States">United States</option>
|
| 403 |
+
<option value="United Kingdom">United Kingdom</option>
|
| 404 |
+
<option value="Japan">Japan</option>
|
| 405 |
+
<option value="Germany">Germany</option>
|
| 406 |
+
<option value="Singapore">Singapore</option>
|
| 407 |
</select>
|
| 408 |
</div>
|
| 409 |
|
| 410 |
<div>
|
| 411 |
<label for="market" class="block text-sm font-medium text-gray-700">Primary Market</label>
|
| 412 |
+
<select id="market" name="market" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm" required>
|
| 413 |
<option value="">Select Market</option>
|
| 414 |
+
<option value="Stocks">Stocks</option>
|
| 415 |
+
<option value="Forex">Forex</option>
|
| 416 |
+
<option value="Crypto">Cryptocurrency</option>
|
| 417 |
+
<option value="Commodities">Commodities</option>
|
| 418 |
+
<option value="Options">Options</option>
|
| 419 |
</select>
|
| 420 |
</div>
|
| 421 |
|
| 422 |
<div>
|
| 423 |
<label for="profit" class="block text-sm font-medium text-gray-700">Annual Profit ($)</label>
|
| 424 |
+
<input type="number" id="profit" name="profit" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm" required>
|
| 425 |
+
</div>
|
| 426 |
+
|
| 427 |
+
<div>
|
| 428 |
+
<label for="winRate" class="block text-sm font-medium text-gray-700">Win Rate (%)</label>
|
| 429 |
+
<input type="number" id="winRate" name="winRate" min="0" max="100" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm" required>
|
| 430 |
+
</div>
|
| 431 |
+
|
| 432 |
+
<div>
|
| 433 |
+
<label for="riskScore" class="block text-sm font-medium text-gray-700">Risk Score (1-10)</label>
|
| 434 |
+
<input type="number" id="riskScore" name="riskScore" min="1" max="10" step="0.1" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm" required>
|
| 435 |
</div>
|
| 436 |
</form>
|
| 437 |
</div>
|
|
|
|
| 439 |
</div>
|
| 440 |
</div>
|
| 441 |
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
|
| 442 |
+
<button type="button" id="submitAddTrader" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-primary text-base font-medium text-white hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary sm:ml-3 sm:w-auto sm:text-sm">
|
| 443 |
Add Trader
|
| 444 |
</button>
|
| 445 |
+
<button type="button" id="cancelAddTrader" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
|
| 446 |
+
Cancel
|
| 447 |
+
</button>
|
| 448 |
+
</div>
|
| 449 |
+
</div>
|
| 450 |
+
</div>
|
| 451 |
+
</div>
|
| 452 |
+
|
| 453 |
+
<!-- View Trader Modal -->
|
| 454 |
+
<div id="viewTraderModal" class="fixed inset-0 z-50 hidden overflow-y-auto">
|
| 455 |
+
<div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
|
| 456 |
+
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
|
| 457 |
+
<div class="absolute inset-0 bg-gray-500 opacity-75"></div>
|
| 458 |
+
</div>
|
| 459 |
+
|
| 460 |
+
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">​</span>
|
| 461 |
+
|
| 462 |
+
<div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">
|
| 463 |
+
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
| 464 |
+
<div class="sm:flex sm:items-start">
|
| 465 |
+
<div class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10">
|
| 466 |
+
<i class="fas fa-user text-blue-600"></i>
|
| 467 |
+
</div>
|
| 468 |
+
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
|
| 469 |
+
<h3 class="text-lg leading-6 font-medium text-gray-900" id="viewTraderName">Trader Details</h3>
|
| 470 |
+
<div class="mt-2">
|
| 471 |
+
<div id="traderDetails" class="space-y-2">
|
| 472 |
+
<!-- Trader details will be inserted here -->
|
| 473 |
+
</div>
|
| 474 |
+
</div>
|
| 475 |
+
</div>
|
| 476 |
+
</div>
|
| 477 |
+
</div>
|
| 478 |
+
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
|
| 479 |
+
<button type="button" id="closeViewTraderModal" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-primary text-base font-medium text-white hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary sm:ml-3 sm:w-auto sm:text-sm">
|
| 480 |
+
Close
|
| 481 |
+
</button>
|
| 482 |
+
</div>
|
| 483 |
+
</div>
|
| 484 |
+
</div>
|
| 485 |
+
</div>
|
| 486 |
+
|
| 487 |
+
<!-- Edit Trader Modal -->
|
| 488 |
+
<div id="editTraderModal" class="fixed inset-0 z-50 hidden overflow-y-auto">
|
| 489 |
+
<div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
|
| 490 |
+
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
|
| 491 |
+
<div class="absolute inset-0 bg-gray-500 opacity-75"></div>
|
| 492 |
+
</div>
|
| 493 |
+
|
| 494 |
+
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">​</span>
|
| 495 |
+
|
| 496 |
+
<div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">
|
| 497 |
+
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
| 498 |
+
<div class="sm:flex sm:items-start">
|
| 499 |
+
<div class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10">
|
| 500 |
+
<i class="fas fa-edit text-blue-600"></i>
|
| 501 |
+
</div>
|
| 502 |
+
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
|
| 503 |
+
<h3 class="text-lg leading-6 font-medium text-gray-900">Edit Trader</h3>
|
| 504 |
+
<div class="mt-2">
|
| 505 |
+
<form id="editTraderForm" class="space-y-4">
|
| 506 |
+
<input type="hidden" id="editTraderId">
|
| 507 |
+
<div>
|
| 508 |
+
<label for="editName" class="block text-sm font-medium text-gray-700">Full Name</label>
|
| 509 |
+
<input type="text" id="editName" name="editName" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm" required>
|
| 510 |
+
</div>
|
| 511 |
+
|
| 512 |
+
<div>
|
| 513 |
+
<label for="editEmail" class="block text-sm font-medium text-gray-700">Email</label>
|
| 514 |
+
<input type="email" id="editEmail" name="editEmail" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm" required>
|
| 515 |
+
</div>
|
| 516 |
+
|
| 517 |
+
<div>
|
| 518 |
+
<label for="editCountry" class="block text-sm font-medium text-gray-700">Country</label>
|
| 519 |
+
<select id="editCountry" name="editCountry" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm" required>
|
| 520 |
+
<option value="">Select Country</option>
|
| 521 |
+
<option value="United States">United States</option>
|
| 522 |
+
<option value="United Kingdom">United Kingdom</option>
|
| 523 |
+
<option value="Japan">Japan</option>
|
| 524 |
+
<option value="Germany">Germany</option>
|
| 525 |
+
<option value="Singapore">Singapore</option>
|
| 526 |
+
</select>
|
| 527 |
+
</div>
|
| 528 |
+
|
| 529 |
+
<div>
|
| 530 |
+
<label for="editMarket" class="block text-sm font-medium text-gray-700">Primary Market</label>
|
| 531 |
+
<select id="editMarket" name="editMarket" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm" required>
|
| 532 |
+
<option value="">Select Market</option>
|
| 533 |
+
<option value="Stocks">Stocks</option>
|
| 534 |
+
<option value="Forex">Forex</option>
|
| 535 |
+
<option value="Crypto">Cryptocurrency</option>
|
| 536 |
+
<option value="Commodities">Commodities</option>
|
| 537 |
+
<option value="Options">Options</option>
|
| 538 |
+
</select>
|
| 539 |
+
</div>
|
| 540 |
+
|
| 541 |
+
<div>
|
| 542 |
+
<label for="editProfit" class="block text-sm font-medium text-gray-700">Annual Profit ($)</label>
|
| 543 |
+
<input type="number" id="editProfit" name="editProfit" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm" required>
|
| 544 |
+
</div>
|
| 545 |
+
|
| 546 |
+
<div>
|
| 547 |
+
<label for="editWinRate" class="block text-sm font-medium text-gray-700">Win Rate (%)</label>
|
| 548 |
+
<input type="number" id="editWinRate" name="editWinRate" min="0" max="100" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm" required>
|
| 549 |
+
</div>
|
| 550 |
+
|
| 551 |
+
<div>
|
| 552 |
+
<label for="editRiskScore" class="block text-sm font-medium text-gray-700">Risk Score (1-10)</label>
|
| 553 |
+
<input type="number" id="editRiskScore" name="editRiskScore" min="1" max="10" step="0.1" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-primary focus:border-primary sm:text-sm" required>
|
| 554 |
+
</div>
|
| 555 |
+
</form>
|
| 556 |
+
</div>
|
| 557 |
+
</div>
|
| 558 |
+
</div>
|
| 559 |
+
</div>
|
| 560 |
+
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
|
| 561 |
+
<button type="button" id="submitEditTrader" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-primary text-base font-medium text-white hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary sm:ml-3 sm:w-auto sm:text-sm">
|
| 562 |
+
Save Changes
|
| 563 |
+
</button>
|
| 564 |
+
<button type="button" id="cancelEditTrader" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
|
| 565 |
+
Cancel
|
| 566 |
+
</button>
|
| 567 |
+
</div>
|
| 568 |
+
</div>
|
| 569 |
+
</div>
|
| 570 |
+
</div>
|
| 571 |
+
|
| 572 |
+
<!-- Delete Confirmation Modal -->
|
| 573 |
+
<div id="deleteConfirmationModal" class="fixed inset-0 z-50 hidden overflow-y-auto">
|
| 574 |
+
<div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
|
| 575 |
+
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
|
| 576 |
+
<div class="absolute inset-0 bg-gray-500 opacity-75"></div>
|
| 577 |
+
</div>
|
| 578 |
+
|
| 579 |
+
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">​</span>
|
| 580 |
+
|
| 581 |
+
<div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">
|
| 582 |
+
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
| 583 |
+
<div class="sm:flex sm:items-start">
|
| 584 |
+
<div class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10">
|
| 585 |
+
<i class="fas fa-exclamation-triangle text-red-600"></i>
|
| 586 |
+
</div>
|
| 587 |
+
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
|
| 588 |
+
<h3 class="text-lg leading-6 font-medium text-gray-900">Delete Trader</h3>
|
| 589 |
+
<div class="mt-2">
|
| 590 |
+
<p class="text-sm text-gray-500">Are you sure you want to delete this trader? This action cannot be undone.</p>
|
| 591 |
+
</div>
|
| 592 |
+
</div>
|
| 593 |
+
</div>
|
| 594 |
+
</div>
|
| 595 |
+
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
|
| 596 |
+
<button type="button" id="confirmDeleteBtn" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm">
|
| 597 |
+
Delete
|
| 598 |
+
</button>
|
| 599 |
+
<button type="button" id="cancelDeleteBtn" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
|
| 600 |
Cancel
|
| 601 |
</button>
|
| 602 |
</div>
|
|
|
|
| 606 |
|
| 607 |
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
| 608 |
<script>
|
| 609 |
+
// Global variables
|
| 610 |
+
let traders = [];
|
| 611 |
+
let filteredTraders = [];
|
| 612 |
+
let currentPage = 1;
|
| 613 |
+
const tradersPerPage = 10;
|
| 614 |
+
let profitChart, locationChart;
|
| 615 |
+
let traderToDelete = null;
|
| 616 |
+
|
| 617 |
// Sample trader data
|
| 618 |
+
function initializeTraders() {
|
| 619 |
+
traders = [
|
| 620 |
+
{
|
| 621 |
+
id: 1,
|
| 622 |
+
name: "John Smith",
|
| 623 |
+
email: "[email protected]",
|
| 624 |
+
country: "United States",
|
| 625 |
+
market: "Stocks",
|
| 626 |
+
profit: 125000,
|
| 627 |
+
winRate: 78,
|
| 628 |
+
riskScore: 3.2,
|
| 629 |
+
avatar: "JS"
|
| 630 |
+
},
|
| 631 |
+
{
|
| 632 |
+
id: 2,
|
| 633 |
+
name: "Emma Johnson",
|
| 634 |
+
email: "[email protected]",
|
| 635 |
+
country: "United Kingdom",
|
| 636 |
+
market: "Forex",
|
| 637 |
+
profit: 89000,
|
| 638 |
+
winRate: 82,
|
| 639 |
+
riskScore: 2.8,
|
| 640 |
+
avatar: "EJ"
|
| 641 |
+
},
|
| 642 |
+
{
|
| 643 |
+
id: 3,
|
| 644 |
+
name: "Hiroshi Tanaka",
|
| 645 |
+
email: "[email protected]",
|
| 646 |
+
country: "Japan",
|
| 647 |
+
market: "Crypto",
|
| 648 |
+
profit: 215000,
|
| 649 |
+
winRate: 65,
|
| 650 |
+
riskScore: 5.1,
|
| 651 |
+
avatar: "HT"
|
| 652 |
+
},
|
| 653 |
+
{
|
| 654 |
+
id: 4,
|
| 655 |
+
name: "Sophie Müller",
|
| 656 |
+
email: "sophie.[email protected]",
|
| 657 |
+
country: "Germany",
|
| 658 |
+
market: "Commodities",
|
| 659 |
+
profit: 76000,
|
| 660 |
+
winRate: 71,
|
| 661 |
+
riskScore: 4.3,
|
| 662 |
+
avatar: "SM"
|
| 663 |
+
},
|
| 664 |
+
{
|
| 665 |
+
id: 5,
|
| 666 |
+
name: "Wei Chen",
|
| 667 |
+
email: "[email protected]",
|
| 668 |
+
country: "Singapore",
|
| 669 |
+
market: "Options",
|
| 670 |
+
profit: 182000,
|
| 671 |
+
winRate: 75,
|
| 672 |
+
riskScore: 3.9,
|
| 673 |
+
avatar: "WC"
|
| 674 |
+
},
|
| 675 |
+
{
|
| 676 |
+
id: 6,
|
| 677 |
+
name: "Raj Patel",
|
| 678 |
+
email: "[email protected]",
|
| 679 |
+
country: "India",
|
| 680 |
+
market: "Crypto",
|
| 681 |
+
profit: 143000,
|
| 682 |
+
winRate: 68,
|
| 683 |
+
riskScore: 4.7,
|
| 684 |
+
avatar: "RP"
|
| 685 |
+
},
|
| 686 |
+
{
|
| 687 |
+
id: 7,
|
| 688 |
+
name: "Maria Garcia",
|
| 689 |
+
email: "[email protected]",
|
| 690 |
+
country: "Spain",
|
| 691 |
+
market: "Forex",
|
| 692 |
+
profit: 92000,
|
| 693 |
+
winRate: 79,
|
| 694 |
+
riskScore: 3.5,
|
| 695 |
+
avatar: "MG"
|
| 696 |
+
},
|
| 697 |
+
{
|
| 698 |
+
id: 8,
|
| 699 |
+
name: "David Kim",
|
| 700 |
+
email: "[email protected]",
|
| 701 |
+
country: "South Korea",
|
| 702 |
+
market: "Stocks",
|
| 703 |
+
profit: 112000,
|
| 704 |
+
winRate: 74,
|
| 705 |
+
riskScore: 3.8,
|
| 706 |
+
avatar: "DK"
|
| 707 |
+
},
|
| 708 |
+
{
|
| 709 |
+
id: 9,
|
| 710 |
+
name: "Olivia Brown",
|
| 711 |
+
email: "[email protected]",
|
| 712 |
+
country: "Canada",
|
| 713 |
+
market: "Options",
|
| 714 |
+
profit: 155000,
|
| 715 |
+
winRate: 81,
|
| 716 |
+
riskScore: 3.1,
|
| 717 |
+
avatar: "OB"
|
| 718 |
+
},
|
| 719 |
+
{
|
| 720 |
+
id: 10,
|
| 721 |
+
name: "Luca Rossi",
|
| 722 |
+
email: "[email protected]",
|
| 723 |
+
country: "Italy",
|
| 724 |
+
market: "Commodities",
|
| 725 |
+
profit: 68000,
|
| 726 |
+
winRate: 69,
|
| 727 |
+
riskScore: 4.5,
|
| 728 |
+
avatar: "LR"
|
| 729 |
+
},
|
| 730 |
+
{
|
| 731 |
+
id: 11,
|
| 732 |
+
name: "Michael Wilson",
|
| 733 |
+
email: "[email protected]",
|
| 734 |
+
country: "United States",
|
| 735 |
+
market: "Stocks",
|
| 736 |
+
profit: 198000,
|
| 737 |
+
winRate: 77,
|
| 738 |
+
riskScore: 3.7,
|
| 739 |
+
avatar: "MW"
|
| 740 |
+
},
|
| 741 |
+
{
|
| 742 |
+
id: 12,
|
| 743 |
+
name: "Sarah Lee",
|
| 744 |
+
email: "[email protected]",
|
| 745 |
+
country: "Australia",
|
| 746 |
+
market: "Forex",
|
| 747 |
+
profit: 107000,
|
| 748 |
+
winRate: 83,
|
| 749 |
+
riskScore: 2.9,
|
| 750 |
+
avatar: "SL"
|
| 751 |
+
},
|
| 752 |
+
{
|
| 753 |
+
id: 13,
|
| 754 |
+
name: "Carlos Hernandez",
|
| 755 |
+
email: "[email protected]",
|
| 756 |
+
country: "Mexico",
|
| 757 |
+
market: "Crypto",
|
| 758 |
+
profit: 231000,
|
| 759 |
+
winRate: 67,
|
| 760 |
+
riskScore: 5.3,
|
| 761 |
+
avatar: "CH"
|
| 762 |
+
},
|
| 763 |
+
{
|
| 764 |
+
id: 14,
|
| 765 |
+
name: "Anna Kowalski",
|
| 766 |
+
email: "[email protected]",
|
| 767 |
+
country: "Poland",
|
| 768 |
+
market: "Commodities",
|
| 769 |
+
profit: 89000,
|
| 770 |
+
winRate: 72,
|
| 771 |
+
riskScore: 4.1,
|
| 772 |
+
avatar: "AK"
|
| 773 |
+
},
|
| 774 |
+
{
|
| 775 |
+
id: 15,
|
| 776 |
+
name: "Thomas Müller",
|
| 777 |
+
email: "[email protected]",
|
| 778 |
+
country: "Germany",
|
| 779 |
+
market: "Options",
|
| 780 |
+
profit: 175000,
|
| 781 |
+
winRate: 76,
|
| 782 |
+
riskScore: 3.6,
|
| 783 |
+
avatar: "TM"
|
| 784 |
+
}
|
| 785 |
+
];
|
| 786 |
+
|
| 787 |
+
// Generate more traders to reach 1248
|
| 788 |
+
const countries = ["United States", "United Kingdom", "Japan", "Germany", "Singapore", "India", "Canada", "Australia", "France", "Brazil"];
|
| 789 |
+
const markets = ["Stocks", "Forex", "Crypto", "Commodities", "Options"];
|
| 790 |
+
|
| 791 |
+
for (let i = 16; i <= 1248; i++) {
|
| 792 |
+
const country = countries[Math.floor(Math.random() * countries.length)];
|
| 793 |
+
const market = markets[Math.floor(Math.random() * markets.length)];
|
| 794 |
+
const firstName = ["James", "Robert", "John", "Michael", "David", "William", "Richard", "Joseph", "Thomas", "Charles"][Math.floor(Math.random() * 10)];
|
| 795 |
+
const lastName = ["Smith", "Johnson", "Williams", "Brown", "Jones", "Garcia", "Miller", "Davis", "Rodriguez", "Martinez"][Math.floor(Math.random() * 10)];
|
| 796 |
+
|
| 797 |
+
traders.push({
|
| 798 |
+
id: i,
|
| 799 |
+
name: `${firstName} ${lastName}`,
|
| 800 |
+
email: `${firstName.toLowerCase()}.${lastName.toLowerCase()}@example.com`,
|
| 801 |
+
country: country,
|
| 802 |
+
market: market,
|
| 803 |
+
profit: Math.floor(Math.random() * 300000) + 10000,
|
| 804 |
+
winRate: Math.floor(Math.random() * 30) + 60,
|
| 805 |
+
riskScore: (Math.random() * 7 + 2).toFixed(1),
|
| 806 |
+
avatar: firstName.charAt(0) + lastName.charAt(0)
|
| 807 |
+
});
|
| 808 |
}
|
| 809 |
+
|
| 810 |
+
filteredTraders = [...traders];
|
| 811 |
+
}
|
| 812 |
+
|
| 813 |
+
// Format currency
|
| 814 |
+
function formatCurrency(amount) {
|
| 815 |
+
return new Intl.NumberFormat('en-US', {
|
| 816 |
+
style: 'currency',
|
| 817 |
+
currency: 'USD',
|
| 818 |
+
minimumFractionDigits: 0,
|
| 819 |
+
maximumFractionDigits: 0
|
| 820 |
+
}).format(amount);
|
| 821 |
+
}
|
| 822 |
+
|
| 823 |
+
// Calculate statistics
|
| 824 |
+
function calculateStatistics() {
|
| 825 |
+
const totalTraders = filteredTraders.length;
|
| 826 |
+
const avgProfit = filteredTraders.reduce((sum, trader) => sum + trader.profit, 0) / totalTraders;
|
| 827 |
+
|
| 828 |
+
// Count traders by country
|
| 829 |
+
const countryCounts = {};
|
| 830 |
+
filteredTraders.forEach(trader => {
|
| 831 |
+
countryCounts[trader.country] = (countryCounts[trader.country] || 0) + 1;
|
| 832 |
+
});
|
| 833 |
+
|
| 834 |
+
// Find top country
|
| 835 |
+
let topCountry = "";
|
| 836 |
+
let topCount = 0;
|
| 837 |
+
for (const country in countryCounts) {
|
| 838 |
+
if (countryCounts[country] > topCount) {
|
| 839 |
+
topCountry = country;
|
| 840 |
+
topCount = countryCounts[country];
|
| 841 |
+
}
|
| 842 |
+
}
|
| 843 |
+
|
| 844 |
+
// Count traders by market
|
| 845 |
+
const marketCounts = {};
|
| 846 |
+
filteredTraders.forEach(trader => {
|
| 847 |
+
marketCounts[trader.market] = (marketCounts[trader.market] || 0) + 1;
|
| 848 |
+
});
|
| 849 |
+
|
| 850 |
+
// Find top market
|
| 851 |
+
let topMarket = "";
|
| 852 |
+
let topMarketCount = 0;
|
| 853 |
+
for (const market in marketCounts) {
|
| 854 |
+
if (marketCounts[market] > topMarketCount) {
|
| 855 |
+
topMarket = market;
|
| 856 |
+
topMarketCount = marketCounts[market];
|
| 857 |
+
}
|
| 858 |
+
}
|
| 859 |
+
|
| 860 |
+
// Calculate average risk score
|
| 861 |
+
const avgRiskScore = filteredTraders.reduce((sum, trader) => sum + parseFloat(trader.riskScore), 0) / totalTraders;
|
| 862 |
+
|
| 863 |
+
// Update stats
|
| 864 |
+
document.getElementById('totalTradersStat').textContent = totalTraders.toLocaleString();
|
| 865 |
+
document.getElementById('avgProfitStat').textContent = formatCurrency(avgProfit);
|
| 866 |
+
document.getElementById('topCountryStat').textContent = `${topCountry} (${Math.round((topCount / totalTraders) * 100)}%)`;
|
| 867 |
+
|
| 868 |
+
document.getElementById('totalTradersCard').textContent = totalTraders.toLocaleString();
|
| 869 |
+
document.getElementById('avgProfitCard').textContent = formatCurrency(avgProfit);
|
| 870 |
+
document.getElementById('topMarketCard').textContent = topMarket;
|
| 871 |
+
document.getElementById('topMarketPercent').textContent = `${Math.round((topMarketCount / totalTraders) * 100)}% of total trades`;
|
| 872 |
+
document.getElementById('riskScoreCard').textContent = `${avgRiskScore.toFixed(1)}/10`;
|
| 873 |
+
|
| 874 |
+
// Update charts
|
| 875 |
+
updateCharts();
|
| 876 |
+
}
|
| 877 |
+
|
| 878 |
+
// Update charts
|
| 879 |
+
function updateCharts() {
|
| 880 |
+
// Profit distribution
|
| 881 |
+
const profitRanges = [
|
| 882 |
+
{ min: 0, max: 10000, label: '0 - $10k', count: 0 },
|
| 883 |
+
{ min: 10000, max: 50000, label: '$10k - $50k', count: 0 },
|
| 884 |
+
{ min: 50000, max: 100000, label: '$50k - $100k', count: 0 },
|
| 885 |
+
{ min: 100000, max: 250000, label: '$100k - $250k', count: 0 },
|
| 886 |
+
{ min: 250000, max: Infinity, label: '$250k+', count: 0 }
|
| 887 |
+
];
|
| 888 |
+
|
| 889 |
+
filteredTraders.forEach(trader => {
|
| 890 |
+
for (const range of profitRanges) {
|
| 891 |
+
if (trader.profit >= range.min && trader.profit < range.max) {
|
| 892 |
+
range.count++;
|
| 893 |
+
break;
|
| 894 |
+
}
|
| 895 |
+
}
|
| 896 |
+
});
|
| 897 |
+
|
| 898 |
+
profitChart.data.datasets[0].data = profitRanges.map(range => range.count);
|
| 899 |
+
profitChart.update();
|
| 900 |
+
|
| 901 |
+
// Location distribution
|
| 902 |
+
const countryCounts = {};
|
| 903 |
+
filteredTraders.forEach(trader => {
|
| 904 |
+
countryCounts[trader.country] = (countryCounts[trader.country] || 0) + 1;
|
| 905 |
+
});
|
| 906 |
+
|
| 907 |
+
const countries = Object.keys(countryCounts);
|
| 908 |
+
const counts = Object.values(countryCounts);
|
| 909 |
+
|
| 910 |
+
// Sort by count and take top 5
|
| 911 |
+
const sortedIndices = [...Array(countries.length).keys()]
|
| 912 |
+
.sort((a, b) => counts[b] - counts[a])
|
| 913 |
+
.slice(0, 5);
|
| 914 |
+
|
| 915 |
+
const topCountries = sortedIndices.map(i => countries[i]);
|
| 916 |
+
const topCounts = sortedIndices.map(i => counts[i]);
|
| 917 |
+
const otherCount = filteredTraders.length - topCounts.reduce((a, b) => a + b, 0);
|
| 918 |
+
|
| 919 |
+
locationChart.data.labels = [...topCountries, 'Other'];
|
| 920 |
+
locationChart.data.datasets[0].data = [...topCounts, otherCount];
|
| 921 |
+
locationChart.update();
|
| 922 |
+
}
|
| 923 |
|
| 924 |
// Populate traders table
|
| 925 |
function populateTradersTable() {
|
| 926 |
const tableBody = document.getElementById('tradersTableBody');
|
| 927 |
tableBody.innerHTML = '';
|
| 928 |
|
| 929 |
+
const startIndex = (currentPage - 1) * tradersPerPage;
|
| 930 |
+
const endIndex = Math.min(startIndex + tradersPerPage, filteredTraders.length);
|
| 931 |
+
const paginatedTraders = filteredTraders.slice(startIndex, endIndex);
|
| 932 |
+
|
| 933 |
+
paginatedTraders.forEach(trader => {
|
| 934 |
const row = document.createElement('tr');
|
| 935 |
|
| 936 |
// Format profit with commas
|
| 937 |
+
const formattedProfit = formatCurrency(trader.profit);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 938 |
|
| 939 |
row.innerHTML = `
|
| 940 |
<td class="px-6 py-4 whitespace-nowrap">
|
|
|
|
| 981 |
</div>
|
| 982 |
</td>
|
| 983 |
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
| 984 |
+
<button class="view-trader-btn text-primary hover:text-secondary mr-3" data-id="${trader.id}">
|
| 985 |
<i class="fas fa-eye"></i>
|
| 986 |
</button>
|
| 987 |
+
<button class="edit-trader-btn text-blue-500 hover:text-blue-700 mr-3" data-id="${trader.id}">
|
| 988 |
<i class="fas fa-edit"></i>
|
| 989 |
</button>
|
| 990 |
+
<button class="delete-trader-btn text-red-500 hover:text-red-700" data-id="${trader.id}">
|
| 991 |
<i class="fas fa-trash"></i>
|
| 992 |
</button>
|
| 993 |
</td>
|
|
|
|
| 995 |
|
| 996 |
tableBody.appendChild(row);
|
| 997 |
});
|
| 998 |
+
|
| 999 |
+
// Update pagination info
|
| 1000 |
+
document.getElementById('showingFrom').textContent = startIndex + 1;
|
| 1001 |
+
document.getElementById('showingTo').textContent = endIndex;
|
| 1002 |
+
document.getElementById('totalTradersCount').textContent = filteredTraders.length;
|
| 1003 |
+
|
| 1004 |
+
// Update pagination buttons
|
| 1005 |
+
updatePaginationButtons();
|
| 1006 |
+
}
|
| 1007 |
+
|
| 1008 |
+
// Update pagination buttons
|
| 1009 |
+
function updatePaginationButtons() {
|
| 1010 |
+
const totalPages = Math.ceil(filteredTraders.length / tradersPerPage);
|
| 1011 |
+
const pageNumbersContainer = document.getElementById('pageNumbers');
|
| 1012 |
+
pageNumbersContainer.innerHTML = '';
|
| 1013 |
+
|
| 1014 |
+
// Always show first page
|
| 1015 |
+
if (currentPage > 3) {
|
| 1016 |
+
const firstPageBtn = document.createElement('button');
|
| 1017 |
+
firstPageBtn.className = 'px-3 py-1 border border-gray-300 rounded-md text-sm bg-white text-gray-700 hover:bg-gray-50';
|
| 1018 |
+
firstPageBtn.textContent = '1';
|
| 1019 |
+
firstPageBtn.addEventListener('click', () => {
|
| 1020 |
+
currentPage = 1;
|
| 1021 |
+
populateTradersTable();
|
| 1022 |
+
});
|
| 1023 |
+
pageNumbersContainer.appendChild(firstPageBtn);
|
| 1024 |
+
|
| 1025 |
+
if (currentPage > 4) {
|
| 1026 |
+
const ellipsis = document.createElement('span');
|
| 1027 |
+
ellipsis.className = 'px-3 py-1';
|
| 1028 |
+
ellipsis.textContent = '...';
|
| 1029 |
+
pageNumbersContainer.appendChild(ellipsis);
|
| 1030 |
+
}
|
| 1031 |
+
}
|
| 1032 |
+
|
| 1033 |
+
// Show pages around current page
|
| 1034 |
+
const startPage = Math.max(1, currentPage - 2);
|
| 1035 |
+
const endPage = Math.min(totalPages, currentPage + 2);
|
| 1036 |
+
|
| 1037 |
+
for (let i = startPage; i <= endPage; i++) {
|
| 1038 |
+
const pageBtn = document.createElement('button');
|
| 1039 |
+
pageBtn.className = `px-3 py-1 border rounded-md text-sm ${i === currentPage ? 'bg-primary text-white border-primary' : 'bg-white text-gray-700 border-gray-300 hover:bg-gray-50'}`;
|
| 1040 |
+
pageBtn.textContent = i;
|
| 1041 |
+
pageBtn.addEventListener('click', () => {
|
| 1042 |
+
currentPage = i;
|
| 1043 |
+
populateTradersTable();
|
| 1044 |
+
});
|
| 1045 |
+
pageNumbersContainer.appendChild(pageBtn);
|
| 1046 |
+
}
|
| 1047 |
+
|
| 1048 |
+
// Always show last page
|
| 1049 |
+
if (currentPage < totalPages - 2) {
|
| 1050 |
+
if (currentPage < totalPages - 3) {
|
| 1051 |
+
const ellipsis = document.createElement('span');
|
| 1052 |
+
ellipsis.className = 'px-3 py-1';
|
| 1053 |
+
ellipsis.textContent = '...';
|
| 1054 |
+
pageNumbersContainer.appendChild(ellipsis);
|
| 1055 |
+
}
|
| 1056 |
+
|
| 1057 |
+
const lastPageBtn = document.createElement('button');
|
| 1058 |
+
lastPageBtn.className = 'px-3 py-1 border border-gray-300 rounded-md text-sm bg-white text-gray-700 hover:bg-gray-50';
|
| 1059 |
+
lastPageBtn.textContent = totalPages;
|
| 1060 |
+
lastPageBtn.addEventListener('click', () => {
|
| 1061 |
+
currentPage = totalPages;
|
| 1062 |
+
populateTradersTable();
|
| 1063 |
+
});
|
| 1064 |
+
pageNumbersContainer.appendChild(lastPageBtn);
|
| 1065 |
+
}
|
| 1066 |
+
|
| 1067 |
+
// Enable/disable previous and next buttons
|
| 1068 |
+
document.getElementById('prevPageBtn').disabled = currentPage === 1;
|
| 1069 |
+
document.getElementById('nextPageBtn').disabled = currentPage === totalPages;
|
| 1070 |
+
}
|
| 1071 |
+
|
| 1072 |
+
// Filter traders based on filters
|
| 1073 |
+
function filterTraders() {
|
| 1074 |
+
const profitRange = document.getElementById('profitRangeFilter').value;
|
| 1075 |
+
const country = document.getElementById('countryFilter').value;
|
| 1076 |
+
const market = document.getElementById('marketFilter').value;
|
| 1077 |
+
const searchTerm = document.getElementById('searchInput').value.toLowerCase();
|
| 1078 |
+
|
| 1079 |
+
filteredTraders = traders.filter(trader => {
|
| 1080 |
+
// Filter by profit range
|
| 1081 |
+
if (profitRange !== 'all') {
|
| 1082 |
+
if (profitRange === '0-10' && trader.profit >= 10000) return false;
|
| 1083 |
+
if (profitRange === '10-50' && (trader.profit < 10000 || trader.profit >= 50000)) return false;
|
| 1084 |
+
if (profitRange === '50-100' && (trader.profit < 50000 || trader.profit >= 100000)) return false;
|
| 1085 |
+
if (profitRange === '100+' && trader.profit < 100000) return false;
|
| 1086 |
+
}
|
| 1087 |
+
|
| 1088 |
+
// Filter by country
|
| 1089 |
+
if (country !== 'all' && trader.country !== country) return false;
|
| 1090 |
+
|
| 1091 |
+
// Filter by market
|
| 1092 |
+
if (market !== 'all' && trader.market !== market) return false;
|
| 1093 |
+
|
| 1094 |
+
// Filter by search term
|
| 1095 |
+
if (searchTerm && !(
|
| 1096 |
+
trader.name.toLowerCase().includes(searchTerm) ||
|
| 1097 |
+
trader.email.toLowerCase().includes(searchTerm) ||
|
| 1098 |
+
trader.country.toLowerCase().includes(searchTerm) ||
|
| 1099 |
+
trader.market.toLowerCase().includes(searchTerm) ||
|
| 1100 |
+
trader.id.toString().includes(searchTerm)
|
| 1101 |
+
)) return false;
|
| 1102 |
+
|
| 1103 |
+
return true;
|
| 1104 |
+
});
|
| 1105 |
+
|
| 1106 |
+
currentPage = 1;
|
| 1107 |
+
populateTradersTable();
|
| 1108 |
+
calculateStatistics();
|
| 1109 |
}
|
| 1110 |
|
| 1111 |
// Initialize charts
|
| 1112 |
function initCharts() {
|
| 1113 |
// Profit Distribution Chart
|
| 1114 |
const profitCtx = document.getElementById('profitChart').getContext('2d');
|
| 1115 |
+
profitChart = new Chart(profitCtx, {
|
| 1116 |
type: 'bar',
|
| 1117 |
data: {
|
| 1118 |
labels: ['0 - $10k', '$10k - $50k', '$50k - $100k', '$100k - $250k', '$250k+'],
|
|
|
|
| 1154 |
|
| 1155 |
// Location Distribution Chart
|
| 1156 |
const locationCtx = document.getElementById('locationChart').getContext('2d');
|
| 1157 |
+
locationChart = new Chart(locationCtx, {
|
| 1158 |
type: 'doughnut',
|
| 1159 |
data: {
|
| 1160 |
labels: ['United States', 'United Kingdom', 'Japan', 'Germany', 'Singapore', 'Other'],
|
|
|
|
| 1191 |
});
|
| 1192 |
}
|
| 1193 |
|
| 1194 |
+
// View trader details
|
| 1195 |
+
function viewTraderDetails(traderId) {
|
| 1196 |
+
const trader = traders.find(t => t.id === traderId);
|
| 1197 |
+
if (!trader) return;
|
| 1198 |
+
|
| 1199 |
+
document.getElementById('viewTraderName').textContent = trader.name;
|
| 1200 |
+
|
| 1201 |
+
const detailsContainer = document.getElementById('traderDetails');
|
| 1202 |
+
detailsContainer.innerHTML = `
|
| 1203 |
+
<div class="flex justify-between">
|
| 1204 |
+
<span class="text-gray-600">ID:</span>
|
| 1205 |
+
<span class="font-medium">${trader.id}</span>
|
| 1206 |
+
</div>
|
| 1207 |
+
<div class="flex justify-between">
|
| 1208 |
+
<span class="text-gray-600">Email:</span>
|
| 1209 |
+
<span class="font-medium">${trader.email}</span>
|
| 1210 |
+
</div>
|
| 1211 |
+
<div class="flex justify-between">
|
| 1212 |
+
<span class="text-gray-600">Country:</span>
|
| 1213 |
+
<span class="font-medium">${trader.country}</span>
|
| 1214 |
+
</div>
|
| 1215 |
+
<div class="flex justify-between">
|
| 1216 |
+
<span class="text-gray-600">Market:</span>
|
| 1217 |
+
<span class="font-medium">${trader.market}</span>
|
| 1218 |
+
</div>
|
| 1219 |
+
<div class="flex justify-between">
|
| 1220 |
+
<span class="text-gray-600">Annual Profit:</span>
|
| 1221 |
+
<span class="font-medium">${formatCurrency(trader.profit)}</span>
|
| 1222 |
+
</div>
|
| 1223 |
+
<div class="flex justify-between">
|
| 1224 |
+
<span class="text-gray-600">Win Rate:</span>
|
| 1225 |
+
<span class="font-medium">${trader.winRate}%</span>
|
| 1226 |
+
</div>
|
| 1227 |
+
<div class="flex justify-between">
|
| 1228 |
+
<span class="text-gray-600">Risk Score:</span>
|
| 1229 |
+
<span class="font-medium">${trader.riskScore}/10</span>
|
| 1230 |
+
</div>
|
| 1231 |
+
<div class="pt-4">
|
| 1232 |
+
<h4 class="text-sm font-medium text-gray-700 mb-2">Performance Summary</h4>
|
| 1233 |
+
<p class="text-sm text-gray-600">${trader.name} has been trading ${trader.market} from ${trader.country} with a ${trader.winRate}% win rate and ${formatCurrency(trader.profit)} in annual profits. Their risk score of ${trader.riskScore}/10 indicates ${trader.riskScore < 4 ? 'a conservative' : trader.riskScore < 7 ? 'a moderate' : 'an aggressive'} trading style.</p>
|
| 1234 |
+
</div>
|
| 1235 |
+
`;
|
| 1236 |
+
|
| 1237 |
+
document.getElementById('viewTraderModal').classList.remove('hidden');
|
| 1238 |
+
}
|
| 1239 |
+
|
| 1240 |
+
// Edit trader
|
| 1241 |
+
function editTrader(traderId) {
|
| 1242 |
+
const trader = traders.find(t => t.id === traderId);
|
| 1243 |
+
if (!trader) return;
|
| 1244 |
+
|
| 1245 |
+
document.getElementById('editTraderId').value = trader.id;
|
| 1246 |
+
document.getElementById('editName').value = trader.name;
|
| 1247 |
+
document.getElementById('editEmail').value = trader.email;
|
| 1248 |
+
document.getElementById('editCountry').value = trader.country;
|
| 1249 |
+
document.getElementById('editMarket').value = trader.market;
|
| 1250 |
+
document.getElementById('editProfit').value = trader.profit;
|
| 1251 |
+
document.getElementById('editWinRate').value = trader.winRate;
|
| 1252 |
+
document.getElementById('editRiskScore').value = trader.riskScore;
|
| 1253 |
+
|
| 1254 |
+
document.getElementById('editTraderModal').classList.remove('hidden');
|
| 1255 |
+
}
|
| 1256 |
|
| 1257 |
+
// Save edited trader
|
| 1258 |
+
function saveEditedTrader() {
|
| 1259 |
+
const traderId = parseInt(document.getElementById('editTraderId').value);
|
| 1260 |
+
const traderIndex = traders.findIndex(t => t.id === traderId);
|
| 1261 |
+
|
| 1262 |
+
if (traderIndex === -1) return;
|
| 1263 |
+
|
| 1264 |
+
traders[traderIndex] = {
|
| 1265 |
+
id: traderId,
|
| 1266 |
+
name: document.getElementById('editName').value,
|
| 1267 |
+
email: document.getElementById('editEmail').value,
|
| 1268 |
+
country: document.getElementById('editCountry').value,
|
| 1269 |
+
market: document.getElementById('editMarket').value,
|
| 1270 |
+
profit: parseFloat(document.getElementById('editProfit').value),
|
| 1271 |
+
winRate: parseFloat(document.getElementById('editWinRate').value),
|
| 1272 |
+
riskScore: parseFloat(document.getElementById('editRiskScore').value),
|
| 1273 |
+
avatar: document.getElementById('editName').value.split(' ').map(n => n[0]).join('')
|
| 1274 |
+
};
|
| 1275 |
+
|
| 1276 |
+
document.getElementById('editTraderModal').classList.add('hidden');
|
| 1277 |
+
filterTraders();
|
| 1278 |
+
|
| 1279 |
+
// Show success message
|
| 1280 |
+
showToast('Trader updated successfully!', 'success');
|
| 1281 |
+
}
|
| 1282 |
|
| 1283 |
+
// Delete trader
|
| 1284 |
+
function deleteTrader(traderId) {
|
| 1285 |
+
traders = traders.filter(t => t.id !== traderId);
|
| 1286 |
+
document.getElementById('deleteConfirmationModal').classList.add('hidden');
|
| 1287 |
+
filterTraders();
|
| 1288 |
+
|
| 1289 |
+
// Show success message
|
| 1290 |
+
showToast('Trader deleted successfully!', 'success');
|
| 1291 |
+
}
|
| 1292 |
|
| 1293 |
+
// Add new trader
|
| 1294 |
+
function addNewTrader() {
|
| 1295 |
+
const newId = Math.max(...traders.map(t => t.id)) + 1;
|
| 1296 |
+
|
| 1297 |
+
traders.push({
|
| 1298 |
+
id: newId,
|
| 1299 |
+
name: document.getElementById('name').value,
|
| 1300 |
+
email: document.getElementById('email').value,
|
| 1301 |
+
country: document.getElementById('country').value,
|
| 1302 |
+
market: document.getElementById('market').value,
|
| 1303 |
+
profit: parseFloat(document.getElementById('profit').value),
|
| 1304 |
+
winRate: parseFloat(document.getElementById('winRate').value),
|
| 1305 |
+
riskScore: parseFloat(document.getElementById('riskScore').value),
|
| 1306 |
+
avatar: document.getElementById('name').value.split(' ').map(n => n[0]).join('')
|
| 1307 |
+
});
|
| 1308 |
+
|
| 1309 |
+
document.getElementById('addTraderModal').classList.add('hidden');
|
| 1310 |
+
document.getElementById('addTraderForm').reset();
|
| 1311 |
+
filterTraders();
|
| 1312 |
+
|
| 1313 |
+
// Show success message
|
| 1314 |
+
showToast('New trader added successfully!', 'success');
|
| 1315 |
+
}
|
| 1316 |
+
|
| 1317 |
+
// Show toast notification
|
| 1318 |
+
function showToast(message, type) {
|
| 1319 |
+
const toast = document.createElement('div');
|
| 1320 |
+
toast.className = `fixed bottom-4 right-4 px-4 py-2 rounded-md shadow-md text-white ${
|
| 1321 |
+
type === 'success' ? 'bg-green-500' :
|
| 1322 |
+
type === 'error' ? 'bg-red-500' :
|
| 1323 |
+
'bg-blue-500'
|
| 1324 |
+
}`;
|
| 1325 |
+
toast.textContent = message;
|
| 1326 |
+
|
| 1327 |
+
document.body.appendChild(toast);
|
| 1328 |
+
|
| 1329 |
+
setTimeout(() => {
|
| 1330 |
+
toast.classList.add('opacity-0', 'transition-opacity', 'duration-300');
|
| 1331 |
+
setTimeout(() => toast.remove(), 300);
|
| 1332 |
+
}, 3000);
|
| 1333 |
+
}
|
| 1334 |
|
| 1335 |
+
// Export data
|
| 1336 |
+
function exportData() {
|
| 1337 |
+
const data = filteredTraders.map(trader => ({
|
| 1338 |
+
ID: trader.id,
|
| 1339 |
+
Name: trader.name,
|
| 1340 |
+
Email: trader.email,
|
| 1341 |
+
Country: trader.country,
|
| 1342 |
+
Market: trader.market,
|
| 1343 |
+
Profit: trader.profit,
|
| 1344 |
+
'Win Rate': trader.winRate,
|
| 1345 |
+
'Risk Score': trader.riskScore
|
| 1346 |
+
}));
|
| 1347 |
+
|
| 1348 |
+
// Convert to CSV
|
| 1349 |
+
const headers = Object.keys(data[0]);
|
| 1350 |
+
const csv = [
|
| 1351 |
+
headers.join(','),
|
| 1352 |
+
...data.map(row => headers.map(header => JSON.stringify(row[header])).join(','))
|
| 1353 |
+
].join('\n');
|
| 1354 |
+
|
| 1355 |
+
// Create download link
|
| 1356 |
+
const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
|
| 1357 |
+
const url = URL.createObjectURL(blob);
|
| 1358 |
+
const link = document.createElement('a');
|
| 1359 |
+
link.href = url;
|
| 1360 |
+
link.setAttribute('download', 'traders_export.csv');
|
| 1361 |
+
document.body.appendChild(link);
|
| 1362 |
+
link.click();
|
| 1363 |
+
document.body.removeChild(link);
|
| 1364 |
+
|
| 1365 |
+
// Show success message
|
| 1366 |
+
showToast('Data exported successfully!', 'success');
|
| 1367 |
+
}
|
| 1368 |
|
| 1369 |
// Initialize the app
|
| 1370 |
document.addEventListener('DOMContentLoaded', function() {
|
| 1371 |
+
initializeTraders();
|
| 1372 |
initCharts();
|
| 1373 |
+
filterTraders();
|
| 1374 |
+
|
| 1375 |
+
// Mobile menu toggle
|
| 1376 |
+
document.getElementById('menuToggle').addEventListener('click', function() {
|
| 1377 |
+
document.querySelector('.sidebar').classList.toggle('active');
|
| 1378 |
+
document.querySelector('.overlay').classList.toggle('active');
|
| 1379 |
+
});
|
| 1380 |
+
|
| 1381 |
+
// Close mobile menu when clicking overlay
|
| 1382 |
+
document.querySelector('.overlay').addEventListener('click', function() {
|
| 1383 |
+
document.querySelector('.sidebar').classList.remove('active');
|
| 1384 |
+
this.classList.remove('active');
|
| 1385 |
+
});
|
| 1386 |
+
|
| 1387 |
+
// Apply filters button
|
| 1388 |
+
document.getElementById('applyFiltersBtn').addEventListener('click', filterTraders);
|
| 1389 |
+
|
| 1390 |
+
// Reset filters button
|
| 1391 |
+
document.getElementById('resetFiltersBtn').addEventListener('click', function() {
|
| 1392 |
+
document.getElementById('profitRangeFilter').value = 'all';
|
| 1393 |
+
document.getElementById('countryFilter').value = 'all';
|
| 1394 |
+
document.getElementById('marketFilter').value = 'all';
|
| 1395 |
+
document.getElementById('searchInput').value = '';
|
| 1396 |
+
filterTraders();
|
| 1397 |
+
});
|
| 1398 |
+
|
| 1399 |
+
// Search input
|
| 1400 |
+
document.getElementById('searchInput').addEventListener('input', filterTraders);
|
| 1401 |
+
|
| 1402 |
+
// Pagination buttons
|
| 1403 |
+
document.getElementById('prevPageBtn').addEventListener('click', function() {
|
| 1404 |
+
if (currentPage > 1) {
|
| 1405 |
+
currentPage--;
|
| 1406 |
+
populateTradersTable();
|
| 1407 |
+
}
|
| 1408 |
+
});
|
| 1409 |
+
|
| 1410 |
+
document.getElementById('nextPageBtn').addEventListener('click', function() {
|
| 1411 |
+
const totalPages = Math.ceil(filteredTraders.length / tradersPerPage);
|
| 1412 |
+
if (currentPage < totalPages) {
|
| 1413 |
+
currentPage++;
|
| 1414 |
+
populateTradersTable();
|
| 1415 |
+
}
|
| 1416 |
+
});
|
| 1417 |
+
|
| 1418 |
+
// Add trader modal
|
| 1419 |
+
document.getElementById('openAddTraderModal').addEventListener('click', function() {
|
| 1420 |
+
document.getElementById('addTraderModal').classList.remove('hidden');
|
| 1421 |
+
});
|
| 1422 |
+
|
| 1423 |
+
document.getElementById('cancelAddTrader').addEventListener('click', function() {
|
| 1424 |
+
document.getElementById('addTraderModal').classList.add('hidden');
|
| 1425 |
+
document.getElementById('addTraderForm').reset();
|
| 1426 |
+
});
|
| 1427 |
+
|
| 1428 |
+
document.getElementById('submitAddTrader').addEventListener('click', function() {
|
| 1429 |
+
if (document.getElementById('addTraderForm').reportValidity()) {
|
| 1430 |
+
addNewTrader();
|
| 1431 |
+
}
|
| 1432 |
+
});
|
| 1433 |
+
|
| 1434 |
+
// View trader modal
|
| 1435 |
+
document.addEventListener('click', function(e) {
|
| 1436 |
+
if (e.target.classList.contains('view-trader-btn') || e.target.closest('.view-trader-btn')) {
|
| 1437 |
+
const btn = e.target.classList.contains('view-trader-btn') ? e.target : e.target.closest('.view-trader-btn');
|
| 1438 |
+
viewTraderDetails(parseInt(btn.dataset.id));
|
| 1439 |
+
}
|
| 1440 |
+
});
|
| 1441 |
+
|
| 1442 |
+
document.getElementById('closeViewTraderModal').addEventListener('click', function() {
|
| 1443 |
+
document.getElementById('viewTraderModal').classList.add('hidden');
|
| 1444 |
+
});
|
| 1445 |
+
|
| 1446 |
+
// Edit trader modal
|
| 1447 |
+
document.addEventListener('click', function(e) {
|
| 1448 |
+
if (e.target.classList.contains('edit-trader-btn') || e.target.closest('.edit-trader-btn')) {
|
| 1449 |
+
const btn = e.target.classList.contains('edit-trader-btn') ? e.target : e.target.closest('.edit-trader-btn');
|
| 1450 |
+
editTrader(parseInt(btn.dataset.id));
|
| 1451 |
+
}
|
| 1452 |
+
});
|
| 1453 |
+
|
| 1454 |
+
document.getElementById('cancelEditTrader').addEventListener('click', function() {
|
| 1455 |
+
document.getElementById('editTraderModal').classList.add('hidden');
|
| 1456 |
+
});
|
| 1457 |
+
|
| 1458 |
+
document.getElementById('submitEditTrader').addEventListener('click', function() {
|
| 1459 |
+
if (document.getElementById('editTraderForm').reportValidity()) {
|
| 1460 |
+
saveEditedTrader();
|
| 1461 |
+
}
|
| 1462 |
+
});
|
| 1463 |
+
|
| 1464 |
+
// Delete trader
|
| 1465 |
+
document.addEventListener('click', function(e) {
|
| 1466 |
+
if (e.target.classList.contains('delete-trader-btn') || e.target.closest('.delete-trader-btn')) {
|
| 1467 |
+
const btn = e.target.classList.contains('delete-trader-btn') ? e.target : e.target.closest('.delete-trader-btn');
|
| 1468 |
+
traderToDelete = parseInt(btn.dataset.id);
|
| 1469 |
+
document.getElementById('deleteConfirmationModal').classList.remove('hidden');
|
| 1470 |
+
}
|
| 1471 |
+
});
|
| 1472 |
+
|
| 1473 |
+
document.getElementById('confirmDeleteBtn').addEventListener('click', function() {
|
| 1474 |
+
deleteTrader(traderToDelete);
|
| 1475 |
+
});
|
| 1476 |
+
|
| 1477 |
+
document.getElementById('cancelDeleteBtn').addEventListener('click', function() {
|
| 1478 |
+
document.getElementById('deleteConfirmationModal').classList.add('hidden');
|
| 1479 |
+
|
| 1480 |
</html>
|
prompts.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
-
Build me full database management application for gathering profitable traders database in the world
|
|
|
|
|
|
| 1 |
+
Build me full database management application for gathering profitable traders database in the world
|
| 2 |
+
Plug JavaScript in the app in order to bring it live
|