File size: 32,228 Bytes
f3483eb f726e18 f3483eb f726e18 f3483eb f726e18 f3483eb f726e18 f3483eb f726e18 92ffa2b f726e18 92ffa2b f3483eb 92ffa2b f3483eb 92ffa2b f3483eb 92ffa2b f3483eb 92ffa2b f3483eb 92ffa2b f3483eb 92ffa2b f3483eb 92ffa2b f3483eb | 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 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Real-time RTLS Tracking</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/all.min.css') }}">
<style>
/* Sidebar styles */
.sidebar {
width: 60px;
height: 100vh;
background-color: #222;
position: fixed;
left: 0;
top: 0;
display: flex;
flex-direction: column;
align-items: center;
padding-top: 20px;
z-index: 1000;
}
.sidebar-icon {
color: white;
font-size: 1.5em;
margin: 15px 0;
cursor: pointer;
transition: color 0.3s;
}
.sidebar-icon:hover {
color: var(--color-accent);
}
/* Shift main content to right */
.main-container {
margin-left: 60px;
width: calc(100% - 60px);
}
/* Màu nền chung */
:root {
--color-bg-main: #333;
--color-bg-panel: #444;
--color-bg-card: #555;
--color-text: white;
--color-accent: #4CAF50;
--color-danger: #d9534f;
--color-progress-bg: #666; /* Màu nền thanh tiến trình */
--color-progress-fill: var(--color-accent); /* Màu lấp đầy thanh tiến trình */
}
body {
margin: 0;
padding: 0;
background-color: var(--color-bg-main);
color: var(--color-text);
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
height: 100vh;
}
/* -------------------------------------- */
/* Cấu trúc 3 cột chính */
/* -------------------------------------- */
.main-container {
display: flex;
justify-content: center;
align-items: stretch;
gap: 10px;
padding: 10px 10px 0 10px;
width: 100%;
height: 98vh;
max-width: none;
box-sizing: border-box;
}
.panel {
background-color: var(--color-bg-panel);
border-radius: 12px;
padding: 10px;
box-sizing: border-box;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
display: flex;
flex-direction: column;
overflow: hidden;
}
/* Tiêu đề cột */
.panel-title {
font-size: 1.2em;
text-align: center;
margin-bottom: 8px;
color: var(--color-accent);
}
.panel-title2 {
/* font-size: 1.0em; */
margin-bottom: 8px;
margin-top: 0px;
color: var(--color-accent);
}
/* Cột Camera */
.video-column {
width: 22%;
min-width: 180px;
max-width: 22%;
overflow-y: hidden; /* QUAN TRỌNG: Ngăn cuộn tổng thể ở đây */
/* gap: 10px; Bỏ gap để dễ kiểm soát layout */
padding-top: 5px;
padding-bottom: 0; /* Đảm bảo không có padding dưới để nút vừa khít */
/* CẤU HÌNH MỚI: Dùng flex để xếp chồng nội dung và nút */
display: flex;
flex-direction: column;
}
/* TẠO KHU VỰC CUỘN RIÊNG CHO CÁC VIDEO */
.video-column-content {
overflow-y: auto;
/* flex-grow: 1; */
/* padding: 0 5px 0 0; Padding phải để thanh cuộn không dính sát */
}
/* FIX: Layout Section - CĂN GIỮA THEO CHIỀU DỌC */
.video-layout-section {
width: 63%;
padding: 10px;
overflow-y: auto;
/* justify-content: center; FIX: Căn giữa nội dung theo chiều dọc */
align-items: center; /* Căn giữa nội dung theo chiều ngang */
}
/* Cột Controls - KHÔNG SỬA */
.control-column {
width: 15%;
min-width: 160px;
max-width: 15%;
padding-top: 5px;
}
/* -------------------------------------- */
/* Cột Camera (16:9 và Cuộn) - KHÔNG SỬA */
/* -------------------------------------- */
.video-box {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
background-color: var(--color-bg-card);
border-radius: 8px;
padding: 5px;
margin-bottom: 8px;
transition: transform 0.2s, box-shadow 0.2s;
overflow: hidden;
width: 100%;
flex-shrink: 0;
}
/* Wrapper 16:9 */
.video-aspect-ratio-container {
width: 100%;
padding-top: 56.25%;
position: relative;
}
/* Tên Camera */
.video-box h2 {
position: absolute;
top: 3px;
left: 50%;
transform: translateX(-50%);
z-index: 12;
padding: 2px 6px;
font-size: 0.8em;
color: var(--color-text);
background-color: rgba(0, 0, 0, 0.5);
border-radius: 4px;
margin: 0;
text-transform: uppercase;
}
/* Video element */
.video-box video {
position: absolute;
top: 0;
left: 0;
width: 98%;
height: 100%;
border: 2px solid var(--color-accent);
border-radius: 6px;
background-color: black;
display: block;
}
.video-controls {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 10;
display: flex;
justify-content: center;
align-items: center;
}
/* Nút Play/Stop - KHÔNG SỬA */
.video-controls .play-control-button {
position: relative;
background-color: rgba(0, 0, 0, 0.7);
border: 2px solid var(--color-accent);
color: var(--color-text);
font-size: 1.3em;
padding: 7px 11px;
border-radius: 50%;
opacity: 0;
transition: opacity 0.3s;
cursor: pointer;
}
.video-box.stopped .play-control-button {
opacity: 1;
}
.video-box.stopped .play-control-button i.fa-play {
display: inline;
}
.video-box.stopped .play-control-button i.fa-stop {
display: none;
}
.video-box:not(.stopped) .play-control-button i.fa-play {
display: none;
}
.video-box:not(.stopped) .play-control-button i.fa-stop {
display: inline;
}
.video-box:hover .play-control-button {
opacity: 1;
}
/* Nút Fullscreen - KHÔNG SỬA */
.full-screen-btn {
position: absolute;
right: 10px;
bottom: 10px;
top: unset;
transform: none;
z-index: 11;
opacity: 0;
transition: opacity 0.3s;
font-size: 1em !important;
background-color: rgba(0, 0, 0, 0.7);
border: none;
padding: 5px 8px;
border-radius: 50%;
}
.video-box:hover .full-screen-btn {
opacity: 1;
}
/* -------------------------------------- */
/* Layout Canvas (Giữ tỷ lệ) - KHÔNG SỬA */
/* -------------------------------------- */
.video-layout-section header {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
margin-bottom: 8px;
}
.video-layout-title {
font-size: 1.5em;
margin: 0;
}
#timestamp-display,
#count-display {
font-size: 0.8em;
padding: 4px 7px;
border-radius: 4px;
background-color: rgba(255, 255, 255, 0.1);
color: white;
}
/* Layout Wrapper chịu trách nhiệm giữ tỷ lệ */
.layout-aspect-ratio-wrapper {
width: 100%;
padding-top: 57.72%;
position: relative;
margin-bottom: 8px;
flex-shrink: 0;
margin: 0 auto 8px auto;
}
/* Canvas chiếm trọn wrapper (tỷ lệ đã được cố định) */
.layout-aspect-ratio-wrapper canvas {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 1px solid var(--color-accent);
}
/* Style cho container nút cố định ở cuối cột Camera */
.main-controls-fixed {
/* Đảm bảo chiều rộng bằng với cột */
width: 100%;
padding: 10px; /* Thêm padding để nút không bị dính vào mép */
box-sizing: border-box;
background-color: var(--color-bg-panel); /* Màu nền giống cột */
border-top: 1px solid #555; /* Đường phân cách */
/* Giữ nguyên style flex cho nút bên trong */
display: flex;
justify-content: center;
gap: 15px;
flex-shrink: 0; /* Không co lại khi cuộn */
}
/* Tinh chỉnh lại style nút để phù hợp hơn với cột hẹp */
.main-controls-fixed button {
background-color: var(--color-accent);
color: white;
border: none;
padding: 8px 15px;
text-align: center;
font-size: 0.9em;
cursor: pointer;
border-radius: 20px;
transition: background-color 0.3s, transform 0.2s;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.main-controls-fixed button#stopAllBtn {
background-color: var(--color-danger);
}
.main-controls-fixed button#stopAllBtn:hover {
background-color: #c9302c;
}
.main-controls-fixed button:hover {
background-color: #3e8e41;
transform: scale(1.05);
}
/* Scrollbar (Đã tinh chỉnh: Nhỏ và Tinh tế hơn) */
/* Bao gồm các khu vực cuộn cũ và khu vực 50/50 mới */
.video-column-content::-webkit-scrollbar,
.video-layout-section::-webkit-scrollbar,
.scrollable-half::-webkit-scrollbar,
#event-list-scroll::-webkit-scrollbar { /* THÊM .scrollable-half */
width: 4px;
height: 4px;
}
/* Thay đổi màu thumb (thanh kéo) */
.video-column-content::-webkit-scrollbar-thumb,
.video-layout-section::-webkit-scrollbar-thumb,
.scrollable-half::-webkit-scrollbar-thumb,
#event-list-scroll::-webkit-scrollbar { /* THÊM .scrollable-half */
background: rgba(119, 119, 119, 0.2); /* Mặc định mờ */
border-radius: 10px;
}
/* Thay đổi màu thumb khi hover */
.video-column-content::-webkit-scrollbar-thumb:hover,
.video-layout-section::-webkit-scrollbar-thumb:hover,
.scrollable-half::-webkit-scrollbar-thumb:hover,
#event-list-scroll::-webkit-scrollbar { /* THÊM .scrollable-half */
background: rgba(153, 153, 153, 0.7); /* Rõ hơn khi hover */
}
/* Giữ track trong suốt */
.video-column-content::-webkit-scrollbar-track,
.video-layout-section::-webkit-scrollbar-track,
.scrollable-half::-webkit-scrollbar-track,
#event-list-scroll::-webkit-scrollbar { /* THÊM .scrollable-half */
background: transparent;
}
/* CÁC STYLE CHO CONTROL COLUMN ĐƠN GIẢN HÓA */
.tab-content { display: flex; flex-grow: 1; overflow-y: hidden; padding: 0; height: 100%; flex-direction: column; }
.video-box2 {
flex-grow: 1;
min-height: 0;
overflow: hidden; /* Quan trọng: Ngăn cuộn tổng thể ở đây */
background-color: var(--color-bg-card);
padding: 10px;
border-radius: 8px;
border: none;
display: flex;
flex-direction: column;
gap: 10px; /* Khoảng cách giữa 2 khu vực 50/50 */
}
/* KHU VỰC 50/50 */
.scrollable-half {
height: 50%; /* Chia đôi không gian còn lại */
min-height: 0; /* Cho phép flex item co lại mà vẫn giữ được cuộn */
overflow-y: auto; /* CUỘN RIÊNG */
padding-right: 5px; /* Thêm padding để cuộn không bị dính sát mép */
box-sizing: border-box;
background-color: var(--color-bg-card); /* Màu nền riêng cho mỗi phần */
border-radius: 8px;
padding: 8px;
}
/* Loại bỏ padding và background cho video-box2 nếu đã áp dụng cho scrollable-half */
.control-column .video-box2 {
padding: 0;
background-color: transparent;
border-radius: 0;
}
#personList { list-style: none; padding: 0; margin: 0;}
.video-all-section { display: none !important; }
/* ************************************** */
/* STYLE CHO SYSTEM INFO (ĐÃ TINH CHỈNH) */
/* ************************************** */
/* Thêm đường viền hoặc nền nhẹ để phân tách 2 khu vực rõ ràng hơn */
#tracking-content {
border-bottom: 2px solid var(--color-bg-panel);
margin-bottom: 10px;
}
/* Giảm padding cho khu vực scrollable, vì padding đã có trong .scrollable-half */
.system-info {
font-size: 0.9em;
padding-top: 0;
}
.system-info p {
font-size: 13px;
/* margin: 8px 0; */
margin-top: 12px;
padding: 5px 0;
border-top: 1px solid #444;
}
.system-info h4 {
font-size: 1.1em;
margin-top: 10px;
margin-bottom: 5px;
color: var(--color-accent);
border-bottom: 1px dashed #777;
padding-bottom: 3px;
}
/* Style cho Thanh tiến trình */
.progress-bar-container {
height: 10px;
width: 100%;
background-color: var(--color-progress-bg);
border-radius: 3px;
overflow: hidden;
margin-top: 3px;
display: flex;
align-items: center;
box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}
.progress-bar {
height: 100%;
background-color: var(--color-progress-fill);
width: 0%;
transition: width 0.5s ease-out;
}
.progress-bar.danger {
background-color: var(--color-danger);
}
/* Cấu trúc cho các dòng không có progress bar */
.system-info p:not(:has(.progress-bar-container)) {
display: flex;
justify-content: space-between;
align-items: center;
}
/* --- VỊ TRÍ MỚI: Thêm vào cuối thẻ <style> --- */
/* Cấu trúc cho Event Panel */
.video-container {
/* height: 74vh; */
flex-direction: column;
display: flex;
width: 100%;
}
.event-container {
background-color: var(--color-bg-card);
border-radius: 12px;
padding: 10px;
box-sizing: border-box;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
display: flex;
flex-direction: column;
overflow: hidden;
height: 25vh;
width: 100%;
flex-grow: 1;
}
/* Event List */
#event-list-scroll {
flex-grow: 1;
overflow-y: auto; /* CUỘN CHO DANH SÁCH CẢNH BÁO */
padding-right: 5px;
margin-top: 5px;
}
#event-list {
list-style: none;
padding: 0;
margin: 0;
}
/* Vị trí cũ: .event-item */
.event-item {
padding: 6px 8px;
margin-top: 1px;
margin-bottom: 4px;
border-radius: 6px;
font-size: 0.9em;
transition: background-color 0.3s;
/* 📌 SỬA ĐỔI: BỐ CỤC CHÍNH (Một dòng ngang) */
display: flex;
flex-direction: row; /* Xếp ngang (Mặc định, nhưng ghi rõ) */
align-items: center; /* Căn giữa theo chiều dọc */
line-height: 1.3;
/* wi
dth: 100%; Chiếm hết chiều ngang */
/* NGĂN CHẶN TOÀN BỘ NỘI DUNG CUỘN XUỐNG DÒNG */
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.alert-message {
flex-shrink: 1; /* Cho phép co lại nếu cần */
margin-right: 10px;
overflow: hidden;
text-overflow: ellipsis;
/* Giữ lại white-space: nowrap */
}
.status-icon {
margin-right: 8px;
}
.person-id, .status-text {
flex-shrink: 0; /* Đảm bảo Person ID và Status không bao giờ bị cắt/ẩn */
font-weight: bold;
margin-right: 25px;
}
/* 📌 CÁC THÔNG TIN THỜI GIAN/THỜI LƯỢNG (Phải luôn hiển thị) */
.alert-time, .alert-duration {
flex-shrink: 0; /* KHÔNG BAO GIỜ CHO PHÉP CO */
margin-left: 5px;
font-size: 0.8em;
color: #ccc;
}
/* Đảm bảo thời gian không bị co lại */
.alert-time, .alert-duration {
flex-shrink: 0;
margin-left: 10px;
}
/* Màu cho cảnh báo DEPARTED */
.event-item.departed {
background-color: rgba(217, 83, 79, 0.2); /* Đỏ nhạt */
border-left: 5px solid var(--color-danger);
}
/* Màu cho thông báo RETURNED */
.event-item.returned {
background-color: rgba(76, 175, 80, 0.2); /* Xanh lá nhạt */
border-left: 5px solid var(--color-accent);
}
.event-item.ongoing {
background-color: rgba(255, 165, 0, 0.3); /* Nền cam nhạt */
border-left: 5px solid orange; /* Đường viền cam */
box-shadow: 0 0 5px orange; /* Hiệu ứng nhẹ */
}
@keyframes alert-flash {
0% {
background-color: var(--color-danger); /* Bắt đầu bằng màu đỏ đậm */
opacity: 1;
}
50% {
background-color: rgba(255, 255, 255, 0.2); /* Chuyển sang màu nền nhẹ */
opacity: 0.9;
}
100% {
background-color: rgba(217, 83, 79, 0.2); /* Quay về màu nền Alert thông thường */
opacity: 1;
}
}
/* 2. Áp dụng hiệu ứng và đảm bảo nó chạy hết và dừng lại */
.event-item.new-alert {
animation: alert-flash 0.2s ease-out 4; /* Chạy 1.5 giây và chỉ 1 lần */
}
</style>
</head>
<body>
<div class="sidebar">
<i class="fas fa-home sidebar-icon" title="Dashboard"></i>
<i class="fas fa-video sidebar-icon" title="Cameras"></i>
<i class="fas fa-map sidebar-icon" title="Layout"></i>
<i class="fas fa-bell sidebar-icon" title="Alerts"></i>
<i class="fas fa-cog sidebar-icon" title="Settings"></i>
</div>
<div class="main-container">
<div class="panel video-column">
<h3 class="panel-title">CAMERA FEEDS</h3>
<div class="video-column-content">
<div class="video-box stopped" id="cam-box-d15">
<h2>CAMERA D15</h2>
<div class="video-aspect-ratio-container">
<video id="video-d15" muted></video>
<div class="video-controls">
<button class="play-control-button" onclick="toggleVideo('d15', 'video-d15')"><i class="fas fa-play"></i><i class="fas fa-stop"></i></button>
<button class="full-screen-btn" onclick="toggleFullScreen('video-d15')"><i class="fas fa-expand"></i></button>
</div>
</div>
</div>
<div class="video-box stopped" id="cam-box-d19">
<h2>CAMERA D19</h2>
<div class="video-aspect-ratio-container">
<video id="video-d19" muted></video>
<div class="video-controls">
<button class="play-control-button" onclick="toggleVideo('d19', 'video-d19')"><i class="fas fa-play"></i><i class="fas fa-stop"></i></button>
<button class="full-screen-btn" onclick="toggleFullScreen('video-d19')"><i class="fas fa-expand"></i></button>
</div>
</div>
</div>
<div class="video-box stopped" id="cam-box-d28">
<h2>CAMERA D28</h2>
<div class="video-aspect-ratio-container">
<video id="video-d28" muted></video>
<div class="video-controls">
<button class="play-control-button" onclick="toggleVideo('d28', 'video-d28')"><i class="fas fa-play"></i><i class="fas fa-stop"></i></button>
<button class="full-screen-btn" onclick="toggleFullScreen('video-d28')"><i class="fas fa-expand"></i></button>
</div>
</div>
</div>
<div class="video-box stopped" id="cam-box-d25">
<h2>CAMERA D25</h2>
<div class="video-aspect-ratio-container">
<video id="video-d25" muted></video>
<div class="video-controls">
<button class="play-control-button" onclick="toggleVideo('d25', 'video-d25')"><i class="fas fa-play"></i><i class="fas fa-stop"></i></button>
<button class="full-screen-btn" onclick="toggleFullScreen('video-d25')"><i class="fas fa-expand"></i></button>
</div>
</div>
</div>
<div class="video-box stopped" id="cam-box-d58">
<h2>CAMERA D58</h2>
<div class="video-aspect-ratio-container">
<video id="video-d58" muted></video>
<div class="video-controls">
<button class="play-control-button" onclick="toggleVideo('d58', 'video-d58')"><i class="fas fa-play"></i><i class="fas fa-stop"></i></button>
<button class="full-screen-btn" onclick="toggleFullScreen('video-d58')"><i class="fas fa-expand"></i></button>
</div>
</div>
</div>
<div class="video-box stopped" id="cam-box-d39">
<h2>CAMERA D39</h2>
<div class="video-aspect-ratio-container">
<video id="video-d39" muted></video>
<div class="video-controls">
<button class="play-control-button" onclick="toggleVideo('d39', 'video-d39')"><i class="fas fa-play"></i><i class="fas fa-stop"></i></button>
<button class="full-screen-btn" onclick="toggleFullScreen('video-d39')"><i class="fas fa-expand"></i></button>
</div>
</div>
</div>
</div>
<div class="main-controls-fixed">
<button id="viewAllBtn" onclick="viewAllCameras()"><i class="fas fa-play"></i> View Cameras</button>
<button id="stopAllBtn" onclick="stopAllCameras()"><i class="fas fa-stop"></i> Stop Cameras</button>
</div>
</div>
<div class="panel video-layout-section">
<div class="video-container">
<header>
<h3 class="video-layout-title">LINE LAYOUT</h3>
<div>
<a id="count-display">--</a>
<a id="timestamp-display">--</a>
</div>
</header>
<div class="layout-aspect-ratio-wrapper">
<canvas id="layoutCanvas" class="video-layout-canvas" width="1920" height="1280"></canvas>
</div>
</div>
<div class="event-container">
<h4 class="panel-title2" style="margin-bottom: 0; color: white;">EVENTS / ALERTS</h4>
<div id="event-list-scroll">
<ul id="event-list">
</ul>
</div>
</div>
</div>
<div class="panel control-column">
<h3 class="panel-title">CONTROLS / SYSTEM</h3>
<div id="control-content" class="tab-content active">
<div class="video-box2">
<div id="tracking-content" class="scrollable-half">
<h4>Tracked Subjects</h4>
<select id="timeSelector" style="margin-bottom:10px; width: 100%; padding: 5px; border-radius: 5px; background-color: var(--color-bg-panel); color: var(--color-text); border: none;">
<option value="1">1 minute ago</option>
<option value="3" selected>3 minutes ago</option>
<option value="5">5 minutes ago</option>
<option value="10">10 minutes ago</option>
<option value="30">30 minutes ago</option>
<option value="60">1 hour ago</option>
</select>
<button onclick="enableLiveMode()" style="margin-bottom:10px; background-color: var(--color-danger); border-radius: 5px; padding: 8px; width: 100%; border: none; color: white; cursor: pointer;">🔴 Live Mode</button>
<ul id="personList"></ul>
</div>
<div id="system-content" class="scrollable-half">
<h4>System Health</h4>
<div class="system-info">
<p>CPU Usage<span id="cpu-percent-text">-- %</span>
<div class="progress-bar-container">
<div class="progress-bar" id="cpu-percent-bar"></div>
</div>
</p>
<p>RAM Usage<span id="ram-percent-text">-- %</span>
<div class="progress-bar-container">
<div class="progress-bar" id="ram-percent-bar"></div>
</div>
</p>
<h4>GPU Metrics</h4>
<p>GPU Name<span id="gpu-name">--</span></p>
<!-- <p>GPU Usage<span id="gpu-percent-text">-- %</span>
<div class="progress-bar-container">
<div class="progress-bar" id="gpu-percent-bar"></div>
</div>
</p> -->
<p>GPU Usage<span><span id="gpu-mem-used">-- GB</span> / <span id="gpu-mem-total">-- GB</span> (<span id="gpu-mem-percent-text">-- %</span>)</span>
<div class="progress-bar-container">
<div class="progress-bar" id="gpu-mem-percent-bar"></div>
</div>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script src="{{ url_for('static', filename='js/socket.io.js') }}">
// Initialize socket listeners
app.socket.on('update_positions', UI.handlePositionUpdates);
app.socket.on('system_update', System.handleSystemUpdate);
app.socket.on('update_alerts_list', Alerts.handleAlertsUpdate);
</script>
<script src="{{ url_for('static', filename='js/reader.js') }}"></script>
<script src="{{ url_for('static', filename='js/hls.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/main.js') }}"></script>
<script src="{{ url_for('static', filename='js/ui.js') }}"></script>
<script src="{{ url_for('static', filename='js/alerts.js') }}"></script>
<script src="{{ url_for('static', filename='js/system.js') }}"></script>
<script src="{{ url_for('static', filename='js/webrtc.js') }}"></script>
<script>
// Configuration constants
const CONFIG = {
WEBRTC_STREAMS: {
'd15': "http://10.62.162.104:3003/D15/whep",
'd19': "http://10.62.162.104:3003/D19/whep",
'd25': "http://10.62.162.104:3003/D25/whep",
'd28': "http://10.62.162.104:3003/D28/whep",
'd58': "http://10.62.162.104:3003/D58/whep"
},
LAYOUT_IMAGE: "{{ url_for('static', filename='cua5.png') }}",
ORIGINAL_WIDTH: 1920,
ORIGINAL_HEIGHT: 1280,
MAX_EVENTS: 100,
CALIBRATION_FILE: '/static/calibration.json'
};
// Initialize core modules
const app = {
init: function() {
this.socket = io();
this.canvas = document.getElementById('layoutCanvas');
this.ctx = this.canvas.getContext('2d');
this.layoutImage = new Image();
this.layoutImage.src = CONFIG.LAYOUT_IMAGE;
this.webrtcPlayers = {};
this.cameraIDs = Object.keys(CONFIG.WEBRTC_STREAMS);
this.liveMode = true;
// Initialize modules
UI.init(this);
WebRTC.init(this);
Alerts.init(this);
System.init(this);
// Load initial data
this.loadInitialData();
},
loadInitialData: function() {
UI.loadCalibrationData(CONFIG.CALIBRATION_FILE);
Alerts.loadInitialAlerts(10);
System.startMonitoring();
}
};
// Start the application
document.addEventListener('DOMContentLoaded', function() {
app.init();
});
</script>
</body>
</html> |