330 lines
18 KiB
HTML
330 lines
18 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Virtual 3D Tour Map</title>
|
|
<!-- Leaflet CSS -->
|
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="" />
|
|
<!-- Pannellum (3D Viewer) CSS -->
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pannellum@2.5.6/build/pannellum.css"/>
|
|
<!-- Leaflet MarkerCluster CSS -->
|
|
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.css" />
|
|
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.Default.css" />
|
|
<!-- Custom Style -->
|
|
<link rel="stylesheet" href="css/style.css">
|
|
</head>
|
|
<body>
|
|
|
|
<!-- Map container -->
|
|
<div id="map"></div>
|
|
|
|
<!-- Top Bar -->
|
|
<div id="top-bar">
|
|
<div class="app-brand">
|
|
<h1>Virtual 3D Tour Map</h1>
|
|
</div>
|
|
<div id="user-controls">
|
|
<div id="user-avatar" onclick="toggleDropdown()">
|
|
<span id="avatar-initials">?</span>
|
|
</div>
|
|
<div id="user-dropdown" class="dropdown-content">
|
|
<div id="auth-guest">
|
|
<h3>Login / Register</h3>
|
|
<input type="text" id="username-input" placeholder="Username">
|
|
<input type="password" id="password-input" placeholder="Password">
|
|
<div class="btn-group">
|
|
<button onclick="handleLogin()">Login</button>
|
|
<button onclick="handleRegister()">Register</button>
|
|
</div>
|
|
</div>
|
|
<div id="auth-logged-in" style="display: none;">
|
|
<!--<p>Welcome, <strong id="logged-username"></strong> (<span id="logged-role"></span>)</p>-->
|
|
<button onclick="openDashboard()">Manage Profile</button>
|
|
<button onclick="handleLogout()">Logout</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Dashboard Overlay -->
|
|
<div id="dashboard-overlay" class="modal-overlay">
|
|
<div class="modal-content dashboard-content">
|
|
<span class="close-btn" onclick="closeDashboard()">×</span>
|
|
<div class="dashboard-tabs">
|
|
<!-- Dòng 1: Avatar và Tên -->
|
|
<div class="sidebar-user-header">
|
|
<div id="sidebar-avatar" class="avatar-circle">?</div>
|
|
<div id="sidebar-username" class="user-name-text">Username</div>
|
|
</div>
|
|
<!-- Dòng 2: Status -->
|
|
<div id="sidebar-status" class="user-status-text">Status...</div>
|
|
<!-- Dòng 3: Dòng kẻ ngang -->
|
|
<hr class="sidebar-divider">
|
|
<!-- Dòng 4-8: Menu điều hướng -->
|
|
<button class="tab-btn active" onclick="openDashboardTab('profile')">Hồ sơ</button>
|
|
<button class="tab-btn" onclick="openDashboardTab('my-scenes')">Quản lí scene</button>
|
|
<button class="tab-btn" onclick="openDashboardTab('media-library')">Quản lí ảnh và media</button>
|
|
<button class="tab-btn admin-only" id="admin-tab-users" onclick="openDashboardTab('user-management')">Quản lí users</button>
|
|
<button class="tab-btn admin-only" id="admin-tab-system" onclick="openDashboardTab('system-settings')">Cài đặt hệ thống</button>
|
|
<!-- Dòng 9: Đăng xuất -->
|
|
<button class="tab-btn logout-item" onclick="handleLogout()">Đăng xuất</button>
|
|
</div>
|
|
<div id="dashboard-tab-content">
|
|
<div id="tab-profile" class="dashboard-tab-pane active">
|
|
<h3>Thông tin hồ sơ</h3>
|
|
<form id="profile-form" onsubmit="updateProfile(event)">
|
|
<div class="form-group">
|
|
<label>Username</label>
|
|
<input type="text" id="profile-username" name="username" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Mật khẩu mới (để trống nếu không đổi)</label>
|
|
<input type="password" id="profile-password" name="password" placeholder="********">
|
|
</div>
|
|
<button type="submit" class="submit-btn">Cập nhật hồ sơ</button>
|
|
</form>
|
|
</div>
|
|
<div id="tab-my-scenes" class="dashboard-tab-pane">
|
|
<h3>Các scene đã tạo</h3>
|
|
<div id="my-scenes-list" class="dashboard-list">
|
|
<!-- Nạp dữ liệu qua JS -->
|
|
<p>Đang tải danh sách...</p>
|
|
</div>
|
|
</div>
|
|
<div id="tab-media-library" class="dashboard-tab-pane">
|
|
<h3>Quản lí ảnh và media</h3>
|
|
<div id="media-library-list" class="dashboard-grid">
|
|
<!-- Nạp dữ liệu qua JS -->
|
|
<p>Đang tải kho ảnh...</p>
|
|
</div>
|
|
</div>
|
|
<div id="tab-user-management" class="dashboard-tab-pane admin-only">
|
|
<h3>Quản lý người dùng</h3>
|
|
<div id="admin-users-list" class="dashboard-list"></div>
|
|
</div>
|
|
<div id="tab-system-settings" class="dashboard-tab-pane admin-only">
|
|
<h3>Cài đặt hệ thống</h3>
|
|
<form id="system-settings-form" onsubmit="updateSystemSettings(event)">
|
|
<div class="form-group">
|
|
<label>Múi giờ (Timezone)</label>
|
|
<select id="sys-timezone" name="timezone">
|
|
<option value="Asia/Ho_Chi_Minh">Asia/Ho Chi Minh (GMT+7)</option>
|
|
<option value="UTC">UTC</option>
|
|
</select>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Ngôn ngữ mặc định</label>
|
|
<select id="sys-language" name="language">
|
|
<option value="vi">Tiếng Việt</option>
|
|
<option value="en">English</option>
|
|
</select>
|
|
</div>
|
|
<button type="submit" class="submit-btn">Lưu cấu hình</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Modal for Creating Scene -->
|
|
<div id="create-scene-modal" class="modal">
|
|
<div class="modal-content">
|
|
<span class="close-btn" onclick="closeModal()">×</span>
|
|
<h2>Create New 3D Scene</h2>
|
|
<form id="create-scene-form" onsubmit="submitScene(event)">
|
|
<!-- Hidden field for editing existing scene -->
|
|
<input type="hidden" id="modal-scene-id" name="sceneId">
|
|
<div class="form-group">
|
|
<label>Selected Coordinates:</label>
|
|
<div style="display: flex; gap: 10px;">
|
|
<input type="text" id="modal-lat" name="lat" readonly>
|
|
<input type="text" id="modal-lng" name="lng" readonly>
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="modal-title">Scene Title:</label>
|
|
<input type="text" id="modal-title" name="title" required placeholder="My Awesome Room">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="modal-panorama">Upload 360° Panorama Image:</label>
|
|
<input type="file" id="modal-panorama" name="panorama" accept="image/*" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="modal-privacy">Privacy:</label>
|
|
<select id="modal-privacy" name="privacy" onchange="toggleSharedUsers()">
|
|
<option value="public">Public (Everyone)</option>
|
|
<option value="private">Private (Only Me)</option>
|
|
<option value="member">Members (Logged-in Only)</option>
|
|
<option value="shared">Shared via Link/Token</option>
|
|
</select>
|
|
</div>
|
|
<div class="form-group" id="shared-with-group" style="display: none;">
|
|
<label for="modal-shared-users">Shared with User IDs (JSON Array):</label>
|
|
<input type="text" id="modal-shared-users" name="sharedWithUsers" placeholder='["60c72b2f9b1d8a41c8888888"]'>
|
|
</div>
|
|
<!-- Progress Bar for Scene Upload -->
|
|
<div id="create-progress-container" style="display: none; margin-bottom: 15px;">
|
|
<div style="display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 5px;">
|
|
<span id="create-progress-status">Uploading image...</span>
|
|
<span id="create-progress-percent">0%</span>
|
|
</div>
|
|
<div style="width: 100%; height: 8px; background: #eee; border-radius: 4px; overflow: hidden;">
|
|
<div id="create-progress-bar" style="width: 0%; height: 100%; background: #28a745; transition: width 0.3s;"></div>
|
|
</div>
|
|
</div>
|
|
<button type="submit" class="submit-btn">Save Scene</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Modal for Action Choice (Edit/Delete) -->
|
|
<div id="action-choice-modal" class="modal">
|
|
<div class="modal-content action-modal-content">
|
|
<span class="close-btn" onclick="closeActionModal()">×</span>
|
|
<h2 id="action-modal-title">Tùy chọn Scene</h2>
|
|
<p id="action-modal-desc">Bạn muốn thực hiện thao tác gì với scene này?</p>
|
|
<div class="action-buttons">
|
|
<button id="btn-edit-action" class="edit-btn-large">
|
|
<span class="icon">✏️</span> Chỉnh sửa thông tin
|
|
</button>
|
|
<button id="btn-delete-action" class="delete-btn-large">
|
|
<span class="icon">🗑️</span> Xóa vĩnh viễn
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Hotspot Action Choice Modal -->
|
|
<div id="hotspot-action-modal" class="modal">
|
|
<div class="modal-content action-modal-content">
|
|
<span class="close-btn" onclick="closeHotspotActionModal()">×</span>
|
|
<h2 id="hs-action-title">Tùy chọn Hotspot</h2>
|
|
<div class="action-buttons">
|
|
<button id="btn-hs-edit" class="edit-btn-large">
|
|
<span class="icon">✏️</span> Chỉnh sửa Hotspot
|
|
</button>
|
|
<button id="btn-hs-delete" class="delete-btn-large">
|
|
<span class="icon">🗑️</span> Xóa Hotspot
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 3D Panorama Viewer Container -->
|
|
<div id="viewer-container" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 2000; background: #000;">
|
|
<div id="panorama-viewer"></div>
|
|
<button id="close-viewer-btn" onclick="closeViewer()">Close 3D View</button>
|
|
</div>
|
|
<!-- Hotspot Editor Modal -->
|
|
<div id="hotspot-modal" class="modal-overlay" style="display: none; z-index: 3000;">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h3 id="hotspot-modal-title">Biên tập điểm điều hướng</h3>
|
|
<span class="close-btn" onclick="closeHotspotModal()">×</span>
|
|
</div>
|
|
|
|
<form id="hotspot-form">
|
|
<!-- Tọa độ ẩn để xử lý GPS và vị trí -->
|
|
<input type="hidden" id="hs-pitch">
|
|
<input type="hidden" id="hs-yaw">
|
|
<input type="hidden" id="hs-id">
|
|
|
|
<div class="form-group">
|
|
<label for="hs-title">Tiêu đề (Label)</label>
|
|
<input type="text" id="hs-title" name="title" placeholder="Ví dụ: Cổng vào, Phòng khách..." required>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="hs-desc">Mô tả chi tiết</label>
|
|
<textarea id="hs-desc" name="description" rows="3" placeholder="Thông tin thêm về vị trí này..."></textarea>
|
|
</div>
|
|
|
|
<div class="form-group divider">
|
|
<label>Kiểu liên kết:</label>
|
|
<div class="radio-group">
|
|
<label class="radio-item">
|
|
<input type="radio" name="hsLinkType" value="existing" checked onclick="toggleHSLinkType('existing')">
|
|
Chọn từ ảnh có sẵn
|
|
</label>
|
|
<label class="radio-item">
|
|
<input type="radio" name="hsLinkType" value="upload" onclick="toggleHSLinkType('upload')">
|
|
Upload ảnh mới
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Lựa chọn B: Chọn ảnh có sẵn -->
|
|
<div id="hs-section-existing" class="tab-content">
|
|
<label for="hs-target-id">Danh sách Scene của bạn:</label>
|
|
<select id="hs-target-id" name="targetSceneId">
|
|
<option value="">-- Chọn một cảnh để liên kết --</option>
|
|
<!-- Sẽ được fill bằng JS -->
|
|
</select>
|
|
</div>
|
|
|
|
<!-- Lựa chọn A: Tải ảnh mới -->
|
|
<div id="hs-section-upload" class="tab-content" style="display: none;">
|
|
<label for="hs-panorama-file">Chọn ảnh Panorama 360°:</label>
|
|
<input type="file" id="hs-panorama-file" name="panorama-file" accept="image/*">
|
|
|
|
<div class="gps-inheritance">
|
|
<label>Xử lý GPS cho ảnh mới:</label>
|
|
<div class="radio-group" style="flex-direction: column; gap: 5px;">
|
|
<label class="radio-item">
|
|
<input type="radio" name="hsGPSMode" value="map" checked onclick="toggleHSGPSMode('map')">
|
|
Map Selection (Chọn trên bản đồ con)
|
|
</label>
|
|
<label class="radio-item">
|
|
<input type="radio" name="hsGPSMode" value="manual" onclick="toggleHSGPSMode('manual')">
|
|
Manual Input (Nhập thủ công)
|
|
</label>
|
|
<label class="radio-item">
|
|
<input type="radio" name="hsGPSMode" value="inherit" onclick="toggleHSGPSMode('inherit')">
|
|
Inherit Parent (Kế thừa từ cảnh hiện tại)
|
|
</label>
|
|
</div>
|
|
|
|
<div id="hs-map-selector" style="margin-top: 10px;">
|
|
<div id="hs-mini-map"></div>
|
|
</div>
|
|
|
|
<div id="hs-manual-gps" style="display: none; margin-top: 10px;">
|
|
<input type="number" step="any" id="hs-lat" name="hs-lat" placeholder="Latitude">
|
|
<input type="number" step="any" id="hs-lng" name="hs-lng" placeholder="Longitude">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Progress Bar for Hotspot Upload -->
|
|
<div id="hs-progress-container" style="display: none; margin-bottom: 15px;">
|
|
<div style="display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 5px;">
|
|
<span id="hs-progress-status">Uploading image...</span>
|
|
<span id="hs-progress-percent">0%</span>
|
|
</div>
|
|
<div style="width: 100%; height: 8px; background: #eee; border-radius: 4px; overflow: hidden;">
|
|
<div id="hs-progress-bar" style="width: 0%; height: 100%; background: #007bff; transition: width 0.3s;"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
<button type="button" class="cancel-btn" onclick="closeHotspotModal()">Hủy</button>
|
|
<button type="submit" class="save-btn">Lưu điểm điều hướng</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Leaflet JS -->
|
|
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
|
|
<!-- Pannellum JS -->
|
|
<script src="https://cdn.jsdelivr.net/npm/pannellum@2.5.6/build/pannellum.js"></script>
|
|
<!-- Leaflet MarkerCluster JS -->
|
|
<script src="https://unpkg.com/leaflet.markercluster@1.4.1/dist/leaflet.markercluster.js"></script>
|
|
|
|
<!-- Custom Scripts -->
|
|
<script src="js/viewer360.js"></script>
|
|
<script src="js/main_map.js"></script>
|
|
</body>
|
|
</html>
|