File size: 69,612 Bytes
cf55431 2eb727c cf55431 2eb727c a4a1e94 f5269df cf55431 2eb727c a4a1e94 2eb727c f5269df 2eb727c f5269df a4a1e94 f5269df a4a1e94 2eb727c cf55431 2eb727c cf55431 2eb727c cf55431 2eb727c cf55431 a4a1e94 cf55431 2eb727c a4a1e94 f5269df cf55431 2eb727c f5269df a4a1e94 f5269df a4a1e94 2eb727c a4a1e94 f5269df a4a1e94 2eb727c cf55431 2eb727c cf55431 2eb727c cf55431 2eb727c cf55431 2eb727c cf55431 2eb727c cf55431 2eb727c cf55431 2eb727c cf55431 | 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 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 | <!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SalesHub - Đăng nhập</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.sidebar {
transition: all 0.3s ease;
}
.dashboard-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}
.platform-icon {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 20px;
}
.chart-container {
position: relative;
height: 300px;
}
.notification-badge {
position: absolute;
top: -5px;
right: -5px;
width: 20px;
height: 20px;
border-radius: 50%;
background-color: #EF4444;
color: white;
display: flex;
align-items: center;
justify-content: center;
font-size: 10px;
}
.product-image {
width: 60px;
height: 60px;
object-fit: cover;
border-radius: 8px;
}
.order-status {
padding: 4px 8px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
}
.login-container {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
backdrop-filter: blur(10px);
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.2);
}
.input-field {
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.2);
}
.input-field:focus {
background: rgba(255, 255, 255, 0.2);
}
.otp-input {
width: 50px;
height: 50px;
text-align: center;
font-size: 18px;
margin: 0 5px;
}
.password-strength {
height: 4px;
transition: all 0.3s ease;
}
</style>
</head>
<body class="bg-gray-100 font-sans">
<!-- Login Screen (shown by default) -->
<div id="loginScreen" class="min-h-screen flex items-center justify-center login-container p-4">
<div class="login-card rounded-2xl shadow-xl overflow-hidden w-full max-w-md p-8">
<div class="text-center mb-8">
<i class="fas fa-store-alt text-5xl text-white mb-4"></i>
<h1 class="text-3xl font-bold text-white">SalesHub</h1>
<p class="text-white opacity-80 mt-2">Hệ thống quản lý bán hàng đa nền tảng</p>
</div>
<form id="loginForm" class="space-y-6">
<div>
<label for="username" class="block text-sm font-medium text-white mb-1">Tên đăng nhập</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-user text-white opacity-70"></i>
</div>
<input type="text" id="username" name="username" required
class="input-field w-full pl-10 pr-3 py-3 rounded-lg text-white placeholder-white opacity-80 focus:outline-none focus:ring-2 focus:ring-white">
</div>
</div>
<div>
<label for="password" class="block text-sm font-medium text-white mb-1">Mật khẩu</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-lock text-white opacity-70"></i>
</div>
<input type="password" id="password" name="password" required
class="input-field w-full pl-10 pr-3 py-3 rounded-lg text-white placeholder-white opacity-80 focus:outline-none focus:ring-2 focus:ring-white">
</div>
</div>
<div class="flex items-center justify-between">
<div class="flex items-center">
<input id="remember-me" name="remember-me" type="checkbox"
class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
<label for="remember-me" class="ml-2 block text-sm text-white opacity-80">
Ghi nhớ đăng nhập
</label>
</div>
<div class="text-sm">
<a href="#" id="forgotPasswordLink" class="font-medium text-white hover:underline">
Quên mật khẩu?
</a>
</div>
</div>
<div>
<button type="submit"
class="w-full flex justify-center py-3 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-indigo-700 bg-white hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-white transition duration-150">
Đăng nhập
</button>
</div>
</form>
<div class="mt-6">
<div class="relative">
<div class="absolute inset-0 flex items-center">
<div class="w-full border-t border-white opacity-30"></div>
</div>
<div class="relative flex justify-center text-sm">
<span class="px-2 bg-transparent text-white opacity-80">
Hoặc đăng nhập bằng
</span>
</div>
</div>
<div class="mt-6 grid grid-cols-3 gap-3">
<div>
<a href="#" class="w-full inline-flex justify-center py-2 px-4 rounded-lg input-field text-white hover:bg-white hover:bg-opacity-10">
<i class="fab fa-facebook-f"></i>
</a>
</div>
<div>
<a href="#" class="w-full inline-flex justify-center py-2 px-4 rounded-lg input-field text-white hover:bg-white hover:bg-opacity-10">
<i class="fab fa-google"></i>
</a>
</div>
<div>
<a href="#" class="w-full inline-flex justify-center py-2 px-4 rounded-lg input-field text-white hover:bg-white hover:bg-opacity-10">
<i class="fab fa-apple"></i>
</a>
</div>
</div>
</div>
<div class="mt-6 text-center">
<p class="text-sm text-white opacity-80">
Chưa có tài khoản?
<a href="#" id="registerLink" class="font-medium text-white hover:underline">
Đăng ký ngay
</a>
</p>
</div>
</div>
</div>
<!-- Register Screen (hidden by default) -->
<div id="registerScreen" class="hidden min-h-screen flex items-center justify-center login-container p-4">
<div class="login-card rounded-2xl shadow-xl overflow-hidden w-full max-w-md p-8">
<div class="text-center mb-8">
<i class="fas fa-user-plus text-5xl text-white mb-4"></i>
<h1 class="text-3xl font-bold text-white">Đăng ký tài khoản</h1>
<p class="text-white opacity-80 mt-2">Tạo tài khoản để bắt đầu sử dụng SalesHub</p>
</div>
<form id="registerForm" class="space-y-4">
<div>
<label for="fullName" class="block text-sm font-medium text-white mb-1">Họ và tên</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-user text-white opacity-70"></i>
</div>
<input type="text" id="fullName" name="fullName" required
class="input-field w-full pl-10 pr-3 py-3 rounded-lg text-white placeholder-white opacity-80 focus:outline-none focus:ring-2 focus:ring-white">
</div>
</div>
<div>
<label for="registerEmail" class="block text-sm font-medium text-white mb-1">Email</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-envelope text-white opacity-70"></i>
</div>
<input type="email" id="registerEmail" name="registerEmail" required
class="input-field w-full pl-10 pr-3 py-3 rounded-lg text-white placeholder-white opacity-80 focus:outline-none focus:ring-2 focus:ring-white">
</div>
</div>
<div>
<label for="registerUsername" class="block text-sm font-medium text-white mb-1">Tên đăng nhập</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-at text-white opacity-70"></i>
</div>
<input type="text" id="registerUsername" name="registerUsername" required
class="input-field w-full pl-10 pr-3 py-3 rounded-lg text-white placeholder-white opacity-80 focus:outline-none focus:ring-2 focus:ring-white">
</div>
</div>
<div>
<label for="registerPassword" class="block text-sm font-medium text-white mb-1">Mật khẩu</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-lock text-white opacity-70"></i>
</div>
<input type="password" id="registerPassword" name="registerPassword" required
class="input-field w-full pl-10 pr-3 py-3 rounded-lg text-white placeholder-white opacity-80 focus:outline-none focus:ring-2 focus:ring-white">
</div>
<div class="mt-2 grid grid-cols-4 gap-1">
<div id="passwordStrength1" class="password-strength bg-gray-300 rounded"></div>
<div id="passwordStrength2" class="password-strength bg-gray-300 rounded"></div>
<div id="passwordStrength3" class="password-strength bg-gray-300 rounded"></div>
<div id="passwordStrength4" class="password-strength bg-gray-300 rounded"></div>
</div>
<p id="passwordStrengthText" class="text-xs text-white opacity-60 mt-1">Mật khẩu phải có ít nhất 8 ký tự</p>
</div>
<div>
<label for="confirmRegisterPassword" class="block text-sm font-medium text-white mb-1">Xác nhận mật khẩu</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-lock text-white opacity-70"></i>
</div>
<input type="password" id="confirmRegisterPassword" name="confirmRegisterPassword" required
class="input-field w-full pl-10 pr-3 py-3 rounded-lg text-white placeholder-white opacity-80 focus:outline-none focus:ring-2 focus:ring-white">
</div>
</div>
<div class="flex items-center">
<input id="showRegisterPassword" name="showRegisterPassword" type="checkbox"
class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
<label for="showRegisterPassword" class="ml-2 block text-sm text-white opacity-80">
Hiển thị mật khẩu
</label>
</div>
<div class="flex items-center">
<input id="agreeTerms" name="agreeTerms" type="checkbox" required
class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
<label for="agreeTerms" class="ml-2 block text-sm text-white opacity-80">
Tôi đồng ý với <a href="#" class="text-white font-medium hover:underline">Điều khoản dịch vụ</a> và <a href="#" class="text-white font-medium hover:underline">Chính sách bảo mật</a>
</label>
</div>
<div class="pt-2">
<button type="submit"
class="w-full flex justify-center py-3 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-indigo-700 bg-white hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-white transition duration-150">
Đăng ký
</button>
</div>
</form>
<div class="mt-6 text-center">
<a href="#" id="backToLoginFromRegister" class="text-sm font-medium text-white hover:underline">
<i class="fas fa-arrow-left mr-1"></i> Đã có tài khoản? Đăng nhập
</a>
</div>
</div>
</div>
<!-- Forgot Password Screen (hidden by default) -->
<div id="forgotPasswordScreen" class="hidden min-h-screen flex items-center justify-center login-container p-4">
<div class="login-card rounded-2xl shadow-xl overflow-hidden w-full max-w-md p-8">
<div class="text-center mb-8">
<i class="fas fa-key text-5xl text-white mb-4"></i>
<h1 class="text-3xl font-bold text-white">Khôi phục mật khẩu</h1>
<p class="text-white opacity-80 mt-2">Nhập email đăng ký để nhận mã xác thực</p>
</div>
<form id="forgotPasswordForm" class="space-y-6">
<div>
<label for="recoveryEmail" class="block text-sm font-medium text-white mb-1">Email đăng ký</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-envelope text-white opacity-70"></i>
</div>
<input type="email" id="recoveryEmail" name="recoveryEmail" required
class="input-field w-full pl-10 pr-3 py-3 rounded-lg text-white placeholder-white opacity-80 focus:outline-none focus:ring-2 focus:ring-white">
</div>
</div>
<div>
<button type="submit"
class="w-full flex justify-center py-3 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-indigo-700 bg-white hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-white transition duration-150">
Gửi mã xác thực
</button>
</div>
</form>
<div class="mt-6 text-center">
<a href="#" id="backToLoginLink" class="text-sm font-medium text-white hover:underline">
<i class="fas fa-arrow-left mr-1"></i> Quay lại đăng nhập
</a>
</div>
</div>
</div>
<!-- OTP Verification Screen (hidden by default) -->
<div id="otpScreen" class="hidden min-h-screen flex items-center justify-center login-container p-4">
<div class="login-card rounded-2xl shadow-xl overflow-hidden w-full max-w-md p-8">
<div class="text-center mb-8">
<i class="fas fa-shield-alt text-5xl text-white mb-4"></i>
<h1 class="text-3xl font-bold text-white">Xác thực OTP</h1>
<p class="text-white opacity-80 mt-2">Mã xác thực đã được gửi đến <span id="emailDisplay" class="font-medium">example@email.com</span></p>
</div>
<form id="otpForm" class="space-y-6">
<div class="flex justify-center">
<input type="text" maxlength="1" class="otp-input rounded-lg input-field text-white text-center" pattern="\d*">
<input type="text" maxlength="1" class="otp-input rounded-lg input-field text-white text-center" pattern="\d*">
<input type="text" maxlength="1" class="otp-input rounded-lg input-field text-white text-center" pattern="\d*">
<input type="text" maxlength="1" class="otp-input rounded-lg input-field text-white text-center" pattern="\d*">
<input type="text" maxlength="1" class="otp-input rounded-lg input-field text-white text-center" pattern="\d*">
<input type="text" maxlength="1" class="otp-input rounded-lg input-field text-white text-center" pattern="\d*">
</div>
<div class="text-center text-sm text-white opacity-80">
<p>Bạn chưa nhận được mã? <a href="#" class="font-medium hover:underline">Gửi lại</a></p>
<p class="mt-1" id="countdown">Mã có hiệu lực trong 03:00</p>
</div>
<div>
<button type="submit"
class="w-full flex justify-center py-3 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-indigo-700 bg-white hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-white transition duration-150">
Xác thực
</button>
</div>
</form>
<div class="mt-6 text-center">
<a href="#" id="backToForgotPasswordLink" class="text-sm font-medium text-white hover:underline">
<i class="fas fa-arrow-left mr-1"></i> Quay lại
</a>
</div>
</div>
</div>
<!-- New Password Screen (hidden by default) -->
<div id="newPasswordScreen" class="hidden min-h-screen flex items-center justify-center login-container p-4">
<div class="login-card rounded-2xl shadow-xl overflow-hidden w-full max-w-md p-8">
<div class="text-center mb-8">
<i class="fas fa-lock-open text-5xl text-white mb-4"></i>
<h1 class="text-3xl font-bold text-white">Đặt lại mật khẩu</h1>
<p class="text-white opacity-80 mt-2">Vui lòng nhập mật khẩu mới cho tài khoản của bạn</p>
</div>
<form id="newPasswordForm" class="space-y-6">
<div>
<label for="newPassword" class="block text-sm font-medium text-white mb-1">Mật khẩu mới</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-lock text-white opacity-70"></i>
</div>
<input type="password" id="newPassword" name="newPassword" required
class="input-field w-full pl-10 pr-3 py-3 rounded-lg text-white placeholder-white opacity-80 focus:outline-none focus:ring-2 focus:ring-white">
</div>
<p class="text-xs text-white opacity-60 mt-1">Mật khẩu phải có ít nhất 8 ký tự</p>
</div>
<div>
<label for="confirmPassword" class="block text-sm font-medium text-white mb-1">Xác nhận mật khẩu</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<i class="fas fa-lock text-white opacity-70"></i>
</div>
<input type="password" id="confirmPassword" name="confirmPassword" required
class="input-field w-full pl-10 pr-3 py-3 rounded-lg text-white placeholder-white opacity-80 focus:outline-none focus:ring-2 focus:ring-white">
</div>
</div>
<div class="flex items-center">
<input id="showPassword" name="showPassword" type="checkbox"
class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
<label for="showPassword" class="ml-2 block text-sm text-white opacity-80">
Hiển thị mật khẩu
</label>
</div>
<div>
<button type="submit"
class="w-full flex justify-center py-3 px-4 border border-transparent rounded-lg shadow-sm text-sm font-medium text-indigo-700 bg-white hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-white transition duration-150">
Cập nhật mật khẩu
</button>
</div>
</form>
<div class="mt-6 text-center">
<a href="#" id="backToOtpLink" class="text-sm font-medium text-white hover:underline">
<i class="fas fa-arrow-left mr-1"></i> Quay lại
</a>
</div>
</div>
</div>
<!-- Success Message Screen (hidden by default) -->
<div id="successScreen" class="hidden min-h-screen flex items-center justify-center login-container p-4">
<div class="login-card rounded-2xl shadow-xl overflow-hidden w-full max-w-md p-8 text-center">
<div class="mb-8">
<div class="w-20 h-20 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4">
<i class="fas fa-check text-4xl text-green-600"></i>
</div>
<h1 class="text-3xl font-bold text-white">Thành công!</h1>
<p class="text-white opacity-80 mt-2" id="successMessage">Mật khẩu của bạn đã được cập nhật thành công</p>
</div>
<a href="#" id="backToLoginFromSuccess"
class="inline-flex justify-center py-3 px-6 border border-transparent rounded-lg shadow-sm text-sm font-medium text-indigo-700 bg-white hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-white transition duration-150">
Đăng nhập ngay
</a>
</div>
</div>
<!-- Dashboard (hidden by default) -->
<div id="dashboard" class="hidden flex h-screen overflow-hidden">
<!-- Sidebar -->
<div class="sidebar bg-indigo-800 text-white w-64 flex-shrink-0 flex flex-col">
<div class="p-4 flex items-center justify-between border-b border-indigo-700">
<div class="flex items-center">
<i class="fas fa-store-alt text-2xl mr-3"></i>
<span class="text-xl font-bold">SalesHub</span>
</div>
<button id="sidebarToggle" class="text-white focus:outline-none lg:hidden">
<i class="fas fa-bars"></i>
</button>
</div>
<div class="p-4 flex items-center space-x-3 bg-indigo-900">
<div class="relative">
<img src="https://randomuser.me/api/portraits/women/44.jpg" alt="User" class="w-10 h-10 rounded-full">
<div class="absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full border-2 border-indigo-900"></div>
</div>
<div>
<div class="font-medium" id="loggedInUsername">Nguyễn Thị Mai</div>
<div class="text-xs text-indigo-300">Admin</div>
</div>
</div>
<nav class="flex-1 overflow-y-auto">
<div class="p-4">
<div class="text-xs uppercase text-indigo-400 font-semibold mb-2">Tổng quan</div>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg bg-indigo-700 text-white">
<i class="fas fa-tachometer-alt"></i>
<span>Bảng điều khiển</span>
</a>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white mt-1">
<i class="fas fa-chart-line"></i>
<span>Phân tích</span>
</a>
</div>
<div class="p-4">
<div class="text-xs uppercase text-indigo-400 font-semibold mb-2">Bán hàng</div>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
<i class="fas fa-shopping-cart"></i>
<span>Đơn hàng</span>
<span class="ml-auto bg-indigo-600 text-xs px-2 py-1 rounded-full">15</span>
</a>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white mt-1">
<i class="fas fa-box-open"></i>
<span>Sản phẩm</span>
</a>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white mt-1">
<i class="fas fa-users"></i>
<span>Khách hàng</span>
</a>
</div>
<div class="p-4">
<div class="text-xs uppercase text-indigo-400 font-semibold mb-2">Đa nền tảng</div>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
<div class="platform-icon bg-blue-500">
<i class="fab fa-facebook-f"></i>
</div>
<span>Facebook</span>
</a>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white mt-1">
<div class="platform-icon bg-red-500">
<i class="fab fa-youtube"></i>
</div>
<span>YouTube</span>
</a>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white mt-1">
<div class="platform-icon bg-purple-600">
<i class="fab fa-shopify"></i>
</div>
<span>Shopee</span>
</a>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white mt-1">
<div class="platform-icon bg-orange-500">
<i class="fab fa-lazada"></i>
</div>
<span>Lazada</span>
</a>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white mt-1">
<div class="platform-icon bg-green-600">
<i class="fab fa-tiktok"></i>
</div>
<span>TikTok Shop</span>
</a>
</div>
<div class="p-4">
<div class="text-xs uppercase text-indigo-400 font-semibold mb-2">Cài đặt</div>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
<i class="fas fa-cog"></i>
<span>Cài đặt chung</span>
</a>
<a href="#" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white mt-1">
<i class="fas fa-user-shield"></i>
<span>Quản lý người dùng</span>
</a>
</div>
</nav>
<div class="p-4 border-t border-indigo-700">
<a href="#" id="logoutBtn" class="flex items-center space-x-3 p-2 rounded-lg text-indigo-200 hover:bg-indigo-700 hover:text-white">
<i class="fas fa-sign-out-alt"></i>
<span>Đăng xuất</span>
</a>
</div>
</div>
<!-- Main Content -->
<div class="flex-1 overflow-auto">
<!-- Header -->
<header class="bg-white shadow-sm">
<div class="flex items-center justify-between p-4">
<div class="flex items-center space-x-4">
<h1 class="text-xl font-semibold text-gray-800">Bảng điều khiển</h1>
<div class="relative">
<input type="text" placeholder="Tìm kiếm..." class="pl-10 pr-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500">
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
</div>
</div>
<div class="flex items-center space-x-4">
<div class="relative">
<button class="p-2 rounded-full hover:bg-gray-100 focus:outline-none">
<i class="fas fa-bell text-gray-600"></i>
<div class="notification-badge">3</div>
</button>
</div>
<div class="relative">
<button class="p-2 rounded-full hover:bg-gray-100 focus:outline-none">
<i class="fas fa-envelope text-gray-600"></i>
<div class="notification-badge">5</div>
</button>
</div>
<div class="flex items-center space-x-2">
<img src="https://randomuser.me/api/portraits/women/44.jpg" alt="User" class="w-8 h-8 rounded-full">
<span class="text-sm font-medium" id="headerUsername">Mai Nguyễn</span>
</div>
</div>
</div>
</header>
<!-- Dashboard Content -->
<main class="p-6">
<!-- Stats Cards -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-6">
<div class="dashboard-card bg-white rounded-xl shadow-sm p-6 transition duration-300">
<div class="flex items-center justify-between">
<div>
<p class="text-sm font-medium text-gray-500">Tổng doanh thu</p>
<p class="text-2xl font-bold mt-1">32,450,000₫</p>
<p class="text-sm text-green-500 mt-1">+12.5% so với tháng trước</p>
</div>
<div class="p-3 rounded-lg bg-green-100 text-green-600">
<i class="fas fa-wallet text-xl"></i>
</div>
</div>
</div>
<div class="dashboard-card bg-white rounded-xl shadow-sm p-6 transition duration-300">
<div class="flex items-center justify-between">
<div>
<p class="text-sm font-medium text-gray-500">Tổng đơn hàng</p>
<p class="text-2xl font-bold mt-1">1,245</p>
<p class="text-sm text-blue-500 mt-1">+8.2% so với tháng trước</p>
</div>
<div class="p-3 rounded-lg bg-blue-100 text-blue-600">
<i class="fas fa-shopping-bag text-xl"></i>
</div>
</div>
</div>
<div class="dashboard-card bg-white rounded-xl shadow-sm p-6 transition duration-300">
<div class="flex items-center justify-between">
<div>
<p class="text-sm font-medium text-gray-500">Khách hàng mới</p>
<p class="text-2xl font-bold mt-1">324</p>
<p class="text-sm text-purple-500 mt-1">+5.7% so với tháng trước</p>
</div>
<div class="p-3 rounded-lg bg-purple-100 text-purple-600">
<i class="fas fa-user-plus text-xl"></i>
</div>
</div>
</div>
<div class="dashboard-card bg-white rounded-xl shadow-sm p-6 transition duration-300">
<div class="flex items-center justify-between">
<div>
<p class="text-sm font-medium text-gray-500">Tỷ lệ hoàn thành</p>
<p class="text-2xl font-bold mt-1">92.5%</p>
<p class="text-sm text-yellow-500 mt-1">-2.3% so với tháng trước</p>
</div>
<div class="p-3 rounded-lg bg-yellow-100 text-yellow-600">
<i class="fas fa-check-circle text-xl"></i>
</div>
</div>
</div>
</div>
<!-- Charts and Platforms -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-6">
<!-- Sales Chart -->
<div class="lg:col-span-2 bg-white rounded-xl shadow-sm p-6">
<div class="flex items-center justify-between mb-4">
<h2 class="text-lg font-semibold">Doanh thu theo tháng</h2>
<div class="flex space-x-2">
<button class="px-3 py-1 text-sm bg-indigo-100 text-indigo-700 rounded-lg">Tháng</button>
<button class="px-3 py-1 text-sm bg-gray-100 text-gray-700 rounded-lg">Năm</button>
</div>
</div>
<div class="chart-container">
<canvas id="salesChart"></canvas>
</div>
</div>
<!-- Platform Distribution -->
<div class="bg-white rounded-xl shadow-sm p-6">
<h2 class="text-lg font-semibold mb-4">Phân bổ theo nền tảng</h2>
<div class="chart-container">
<canvas id="platformChart"></canvas>
</div>
<div class="mt-4 space-y-3">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<div class="platform-icon bg-blue-500">
<i class="fab fa-facebook-f"></i>
</div>
<span>Facebook</span>
</div>
<span class="font-medium">42%</span>
</div>
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<div class="platform-icon bg-purple-600">
<i class="fab fa-shopify"></i>
</div>
<span>Shopee</span>
</div>
<span class="font-medium">28%</span>
</div>
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<div class="platform-icon bg-green-600">
<i class="fab fa-tiktok"></i>
</div>
<span>TikTok Shop</span>
</div>
<span class="font-medium">18%</span>
</div>
<div class="flex items-center justify-between">
<div class="flex items-center space-x-2">
<div class="platform-icon bg-orange-500">
<i class="fab fa-lazada"></i>
</div>
<span>Lazada</span>
</div>
<span class="font-medium">12%</span>
</div>
</div>
</div>
</div>
<!-- Recent Orders and Top Products -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<!-- Recent Orders -->
<div class="bg-white rounded-xl shadow-sm overflow-hidden">
<div class="p-6">
<div class="flex items-center justify-between mb-4">
<h2 class="text-lg font-semibold">Đơn hàng gần đây</h2>
<a href="#" class="text-sm text-indigo-600 hover:underline">Xem tất cả</a>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Mã đơn</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Khách hàng</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Ngày</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Tổng tiền</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Trạng thái</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr class="hover:bg-gray-50">
<td class="px-4 py-4 whitespace-nowrap text-sm font-medium text-indigo-600">#DH-2458</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">Trần Văn An</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">15/06/2023</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">1,250,000₫</td>
<td class="px-4 py-4 whitespace-nowrap">
<span class="order-status bg-green-100 text-green-800">Đã giao</span>
</td>
</tr>
<tr class="hover:bg-gray-50">
<td class="px-4 py-4 whitespace-nowrap text-sm font-medium text-indigo-600">#DH-2457</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">Lê Thị Bình</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">15/06/2023</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">850,000₫</td>
<td class="px-4 py-4 whitespace-nowrap">
<span class="order-status bg-yellow-100 text-yellow-800">Đang giao</span>
</td>
</tr>
<tr class="hover:bg-gray-50">
<td class="px-4 py-4 whitespace-nowrap text-sm font-medium text-indigo-600">#DH-2456</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">Phạм Văn Cường</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">14/06/2023</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">2,150,000₫</td>
<td class="px-4 py-4 whitespace-nowrap">
<span class="order-status bg-blue-100 text-blue-800">Đang xử lý</span>
</td>
</tr>
<tr class="hover:bg-gray-50">
<td class="px-4 py-4 whitespace-nowrap text-sm font-medium text-indigo-600">#DH-2455</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">Nguyễn Thị Dung</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">14/06/2023</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">1,750,000₫</td>
<td class="px-4 py-4 whitespace-nowrap">
<span class="order-status bg-green-100 text-green-800">Đã giao</span>
</td>
</tr>
<tr class="hover:bg-gray-50">
<td class="px-4 py-4 whitespace-nowrap text-sm font-medium text-indigo-600">#DH-2454</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">Hoàng Văn Đức</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">13/06/2023</td>
<td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500">980,000₫</td>
<td class="px-4 py-4 whitespace-nowrap">
<span class="order-status bg-red-100 text-red-800">Đã hủy</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Top Products -->
<div class="bg-white rounded-xl shadow-sm overflow-hidden">
<div class="p-6">
<div class="flex items-center justify-between mb-4">
<h2 class="text-lg font-semibold">Sản phẩm bán chạy</h2>
<a href="#" class="text-sm text-indigo-600 hover:underline">Xem tất cả</a>
</div>
<div class="space-y-4">
<div class="flex items-center p-3 hover:bg-gray-50 rounded-lg">
<img src="https://via.placeholder.com/150" alt="Product" class="product-image">
<div class="ml-4 flex-1">
<h3 class="font-medium">Điện thoại iPhone 13 Pro Max</h3>
<p class="text-sm text-gray-500">Đã bán: 245</p>
</div>
<div class="text-right">
<p class="font-medium">28,990,000₫</p>
<p class="text-sm text-green-500">+15.2%</p>
</div>
</div>
<div class="flex items-center p-3 hover:bg-gray-50 rounded-lg">
<img src="https://via.placeholder.com/150" alt="Product" class="product-image">
<div class="ml-4 flex-1">
<h3 class="font-medium">Laptop Dell XPS 15</h3>
<p class="text-sm text-gray-500">Đã bán: 187</p>
</div>
<div class="text-right">
<p class="font-medium">36,500,000₫</p>
<p class="text-sm text-green-500">+8.7%</p>
</div>
</div>
<div class="flex items-center p-3 hover:bg-gray-50 rounded-lg">
<img src="https://via.placeholder.com/150" alt="Product" class="product-image">
<div class="ml-4 flex-1">
<h3 class="font-medium">Tai nghe AirPods Pro 2</h3>
<p class="text-sm text-gray-500">Đã bán: 156</p>
</div>
<div class="text-right">
<p class="font-medium">5,990,000₫</p>
<p class="text-sm text-green-500">+22.1%</p>
</div>
</div>
<div class="flex items-center p-3 hover:bg-gray-50 rounded-lg">
<img src="https://via.placeholder.com/150" alt="Product" class="product-image">
<div class="ml-4 flex-1">
<h3 class="font-medium">Smartwatch Apple Watch S8</h3>
<p class="text-sm text-gray-500">Đã bán: 132</p>
</div>
<div class="text-right">
<p class="font-medium">12,490,000₫</p>
<p class="text-sm text-green-500">+5.3%</p>
</div>
</div>
<div class="flex items-center p-3 hover:bg-gray-50 rounded-lg">
<img src="https://via.placeholder.com/150" alt="Product" class="product-image">
<div class="ml-4 flex-1">
<h3 class="font-medium">Máy ảnh Sony A7 IV</h3>
<p class="text-sm text-gray-500">Đã bán: 98</p>
</div>
<div class="text-right">
<p class="font-medium">52,500,000₫</p>
<p class="text-sm text-green-500">+3.8%</p>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
// Check if user is already logged in (from localStorage)
document.addEventListener('DOMContentLoaded', function() {
const loggedInUser = localStorage.getItem('loggedInUser');
if (loggedInUser) {
showDashboard(JSON.parse(loggedInUser));
}
// Initialize OTP input fields
initOtpInputs();
// Initialize password strength checker
initPasswordStrengthChecker();
});
// Login Form Submission
document.getElementById('loginForm').addEventListener('submit', function(e) {
e.preventDefault();
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
const rememberMe = document.getElementById('remember-me').checked;
// Simple validation
if (!username || !password) {
alert('Vui lòng nhập tên đăng nhập và mật khẩu');
return;
}
// In a real app, you would send this to a server for authentication
// For demo purposes, we'll just simulate a successful login
const user = {
username: username,
fullName: username === 'admin' ? 'Nguyễn Thị Mai (Admin)' : username.charAt(0).toUpperCase() + username.slice(1) + ' Nguyễn',
role: username === 'admin' ? 'Admin' : 'User'
};
if (rememberMe) {
localStorage.setItem('loggedInUser', JSON.stringify(user));
} else {
sessionStorage.setItem('loggedInUser', JSON.stringify(user));
}
showDashboard(user);
});
// Register Link
document.getElementById('registerLink').addEventListener('click', function(e) {
e.preventDefault();
document.getElementById('loginScreen').classList.add('hidden');
document.getElementById('registerScreen').classList.remove('hidden');
});
// Back to Login from Register
document.getElementById('backToLoginFromRegister').addEventListener('click', function(e) {
e.preventDefault();
document.getElementById('registerScreen').classList.add('hidden');
document.getElementById('loginScreen').classList.remove('hidden');
});
// Register Form Submission
document.getElementById('registerForm').addEventListener('submit', function(e) {
e.preventDefault();
const fullName = document.getElementById('fullName').value;
const email = document.getElementById('registerEmail').value;
const username = document.getElementById('registerUsername').value;
const password = document.getElementById('registerPassword').value;
const confirmPassword = document.getElementById('confirmRegisterPassword').value;
const agreeTerms = document.getElementById('agreeTerms').checked;
// Validation
if (!fullName || !email || !username || !password || !confirmPassword) {
alert('Vui lòng điền đầy đủ thông tin');
return;
}
if (password.length < 8) {
alert('Mật khẩu phải có ít nhất 8 ký tự');
return;
}
if (password !== confirmPassword) {
alert('Mật khẩu xác nhận không khớp');
return;
}
if (!agreeTerms) {
alert('Vui lòng đồng ý với Điều khoản dịch vụ và Chính sách bảo mật');
return;
}
// In a real app, you would send this to a server to create account
// For demo, we'll just show success message
document.getElementById('successMessage').textContent = 'Tài khoản của bạn đã được tạo thành công!';
document.getElementById('registerScreen').classList.add('hidden');
document.getElementById('successScreen').classList.remove('hidden');
});
// Forgot Password Link
document.getElementById('forgotPasswordLink').addEventListener('click', function(e) {
e.preventDefault();
document.getElementById('loginScreen').classList.add('hidden');
document.getElementById('forgotPasswordScreen').classList.remove('hidden');
});
// Back to Login from Forgot Password
document.getElementById('backToLoginLink').addEventListener('click', function(e) {
e.preventDefault();
document.getElementById('forgotPasswordScreen').classList.add('hidden');
document.getElementById('loginScreen').classList.remove('hidden');
});
// Forgot Password Form Submission
document.getElementById('forgotPasswordForm').addEventListener('submit', function(e) {
e.preventDefault();
const email = document.getElementById('recoveryEmail').value;
if (!email) {
alert('Vui lòng nhập email đăng ký');
return;
}
// In a real app, you would send this to a server to send OTP
// For demo, we'll just simulate it
document.getElementById('emailDisplay').textContent = email;
document.getElementById('forgotPasswordScreen').classList.add('hidden');
document.getElementById('otpScreen').classList.remove('hidden');
// Start countdown timer
startCountdown();
});
// Back to Forgot Password from OTP
document.getElementById('backToForgotPasswordLink').addEventListener('click', function(e) {
e.preventDefault();
document.getElementById('otpScreen').classList.add('hidden');
document.getElementById('forgotPasswordScreen').classList.remove('hidden');
});
// OTP Form Submission
document.getElementById('otpForm').addEventListener('submit', function(e) {
e.preventDefault();
// Get all OTP inputs
const otpInputs = document.querySelectorAll('.otp-input');
let otp = '';
otpInputs.forEach(input => {
otp += input.value;
});
if (otp.length !== 6) {
alert('Vui lòng nhập đủ 6 chữ số mã OTP');
return;
}
// In a real app, you would verify OTP with server
// For demo, we'll just accept any 6-digit code
document.getElementById('otpScreen').classList.add('hidden');
document.getElementById('newPasswordScreen').classList.remove('hidden');
});
// Back to OTP from New Password
document.getElementById('backToOtpLink').addEventListener('click', function(e) {
e.preventDefault();
document.getElementById('newPasswordScreen').classList.add('hidden');
document.getElementById('otpScreen').classList.remove('hidden');
});
// Show Password Toggle
document.getElementById('showPassword').addEventListener('change', function(e) {
const passwordInputs = document.querySelectorAll('#newPasswordScreen input[type="password"]');
passwordInputs.forEach(input => {
input.type = e.target.checked ? 'text' : 'password';
});
});
// Show Register Password Toggle
document.getElementById('showRegisterPassword').addEventListener('change', function(e) {
const passwordInputs = document.querySelectorAll('#registerScreen input[type="password"]');
passwordInputs.forEach(input => {
input.type = e.target.checked ? 'text' : 'password';
});
});
// New Password Form Submission
document.getElementById('newPasswordForm').addEventListener('submit', function(e) {
e.preventDefault();
const newPassword = document.getElementById('newPassword').value;
const confirmPassword = document.getElementById('confirmPassword').value;
if (newPassword.length < 8) {
alert('Mật khẩu phải có ít nhất 8 ký tự');
return;
}
if (newPassword !== confirmPassword) {
alert('Mật khẩu xác nhận không khớp');
return;
}
// In a real app, you would send new password to server
// For demo, we'll just show success screen
document.getElementById('newPasswordScreen').classList.add('hidden');
document.getElementById('successScreen').classList.remove('hidden');
});
// Back to Login from Success
document.getElementById('backToLoginFromSuccess').addEventListener('click', function(e) {
e.preventDefault();
document.getElementById('successScreen').classList.add('hidden');
document.getElementById('loginScreen').classList.remove('hidden');
});
// Logout Button
document.getElementById('logoutBtn').addEventListener('click', function(e) {
e.preventDefault();
localStorage.removeItem('loggedInUser');
sessionStorage.removeItem('loggedInUser');
location.reload();
});
// Show Dashboard
function showDashboard(user) {
document.getElementById('loginScreen').classList.add('hidden');
document.getElementById('dashboard').classList.remove('hidden');
// Update user info in dashboard
document.getElementById('loggedInUsername').textContent = user.fullName;
document.getElementById('headerUsername').textContent = user.fullName.split(' ')[0];
// Initialize charts
initCharts();
}
// Initialize OTP Input Fields
function initOtpInputs() {
const otpInputs = document.querySelectorAll('.otp-input');
otpInputs.forEach((input, index) => {
// Only allow numbers
input.addEventListener('input', function() {
this.value = this.value.replace(/[^0-9]/g, '');
// Auto focus to next input
if (this.value.length === 1 && index < otpInputs.length - 1) {
otpInputs[index + 1].focus();
}
});
// Handle backspace
input.addEventListener('keydown', function(e) {
if (e.key === 'Backspace' && this.value.length === 0 && index > 0) {
otpInputs[index - 1].focus();
}
});
});
}
// Initialize Password Strength Checker
function initPasswordStrengthChecker() {
const passwordInput = document.getElementById('registerPassword');
const strengthBars = [
document.getElementById('passwordStrength1'),
document.getElementById('passwordStrength2'),
document.getElementById('passwordStrength3'),
document.getElementById('passwordStrength4')
];
const strengthText = document.getElementById('passwordStrengthText');
passwordInput.addEventListener('input', function() {
const password = this.value;
let strength = 0;
// Length check
if (password.length >= 8) strength++;
if (password.length >= 12) strength++;
// Complexity checks
if (/[A-Z]/.test(password)) strength++; // Uppercase letter
if (/[0-9]/.test(password)) strength++; // Number
if (/[^A-Za-z0-9]/.test(password)) strength++; // Special char
// Cap at 4
strength = Math.min(strength, 4);
// Update UI
strengthBars.forEach((bar, index) => {
if (index < strength) {
let color;
if (strength <= 2) color = 'bg-red-500';
else if (strength === 3) color = 'bg-yellow-500';
else color = 'bg-green-500';
bar.className = `password-strength ${color} rounded`;
} else {
bar.className = 'password-strength bg-gray-300 rounded';
}
});
// Update text
if (password.length === 0) {
strengthText.textContent = 'Mật khẩu phải có ít nhất 8 ký tự';
strengthText.className = 'text-xs text-white opacity-60 mt-1';
} else if (strength <= 1) {
strengthText.textContent = 'Mật khẩu yếu';
strengthText.className = 'text-xs text-red-500 mt-1';
} else if (strength <= 2) {
strengthText.textContent = 'Mật khẩu trung bình';
strengthText.className = 'text-xs text-yellow-500 mt-1';
} else if (strength <= 3) {
strengthText.textContent = 'Mật khẩu mạnh';
strengthText.className = 'text-xs text-green-500 mt-1';
} else {
strengthText.textContent = 'Mật khẩu rất mạnh';
strengthText.className = 'text-xs text-green-500 font-medium mt-1';
}
});
}
// Start Countdown Timer
function startCountdown() {
let timeLeft = 180; // 3 minutes in seconds
const countdownElement = document.getElementById('countdown');
const timer = setInterval(function() {
const minutes = Math.floor(timeLeft / 60);
const seconds = timeLeft % 60;
countdownElement.textContent = `Mã có hiệu lực trong ${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
if (timeLeft <= 0) {
clearInterval(timer);
countdownElement.textContent = 'Mã đã hết hiệu lực';
countdownElement.classList.add('text-red-400');
} else {
timeLeft--;
}
}, 1000);
}
// Initialize Charts
function initCharts() {
// Sales Chart
const salesCtx = document.getElementById('salesChart').getContext('2d');
const salesChart = new Chart(salesCtx, {
type: 'line',
data: {
labels: ['Tháng 1', 'Tháng 2', 'Tháng 3', 'Tháng 4', 'Tháng 5', 'Tháng 6'],
datasets: [{
label: 'Doanh thu',
data: [12500000, 18500000, 21000000, 24500000, 28500000, 32450000],
backgroundColor: 'rgba(99, 102, 241, 0.1)',
borderColor: 'rgba(99, 102, 241, 1)',
borderWidth: 2,
tension: 0.3,
fill: true
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true,
grid: {
drawBorder: false
},
ticks: {
callback: function(value) {
return (value / 1000000) + 'M';
}
}
},
x: {
grid: {
display: false
}
}
}
}
});
// Platform Chart
const platformCtx = document.getElementById('platformChart').getContext('2d');
const platformChart = new Chart(platformCtx, {
type: 'doughnut',
data: {
labels: ['Facebook', 'Shopee', 'TikTok Shop', 'Lazada'],
datasets: [{
data: [42, 28, 18, 12],
backgroundColor: [
'rgba(59, 130, 246, 0.8)',
'rgba(124, 58, 237, 0.8)',
'rgba(22, 163, 74, 0.8)',
'rgba(249, 115, 22, 0.8)'
],
borderWidth: 0
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: false
}
},
cutout: '70%'
}
});
// Toggle sidebar on mobile
document.getElementById('sidebarToggle').addEventListener('click', function() {
document.querySelector('.sidebar').classList.toggle('hidden');
});
}
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=DatPro/sales" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |