From be149f26cae24b28c8c23d7e014f77a0a37008e3 Mon Sep 17 00:00:00 2001 From: locphamtran Date: Thu, 11 Jun 2026 09:02:54 +0700 Subject: [PATCH] =?UTF-8?q?S=E1=BB=ADa=20ch=E1=BB=AFa=20giao=20di=E1=BB=87?= =?UTF-8?q?n,=20l=E1=BB=97i=20privacy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/routes/hotspotRoutes.js | 6 +- backend/routes/sceneRoutes.js | 2 +- frontend/css/style.css | 63 +++-- frontend/index.html | 2 +- frontend/js/main_map.js | 227 ++++++++++++++---- ... processed_1781139560171_f8226407.jpg.jpg} | Bin 7284641 -> 7284641 bytes ... processed_1781139589281_fb8070bc.jpg.jpg} | Bin 5518395 -> 5518395 bytes ... processed_1781139839363_996f1ac9.jpg.jpg} | Bin 5981449 -> 5981449 bytes .../processed_1781142968008_7b2ac4d4.jpg.jpg | Bin 0 -> 3620089 bytes 9 files changed, 236 insertions(+), 64 deletions(-) rename uploads/{processed_1781103291447_9b5bb55d.jpg.jpg => processed_1781139560171_f8226407.jpg.jpg} (99%) rename uploads/{processed_1781103856812_7d988385.jpg.jpg => processed_1781139589281_fb8070bc.jpg.jpg} (99%) rename uploads/{processed_1781103810966_7acb1aea.jpg.jpg => processed_1781139839363_996f1ac9.jpg.jpg} (99%) create mode 100644 uploads/processed_1781142968008_7b2ac4d4.jpg.jpg diff --git a/backend/routes/hotspotRoutes.js b/backend/routes/hotspotRoutes.js index 1f25572..9a4e08e 100644 --- a/backend/routes/hotspotRoutes.js +++ b/backend/routes/hotspotRoutes.js @@ -34,7 +34,7 @@ router.post('/create', protect, async (req, res) => { const { parent_scene_id, target_scene_id, title, description, coordinates } = req.body; const parentScene = await Scene.findById(parent_scene_id); - if (!parentScene || parentScene.createdBy.toString() !== req.user._id.toString()) { + if (!parentScene || (parentScene.createdBy.toString() !== req.user._id.toString() && req.user.role !== 'admin')) { return res.status(403).json({ message: 'Không có quyền tạo hotspot cho scene này' }); } @@ -102,7 +102,7 @@ router.put('/update/:id', protect, async (req, res) => { if (!hotspot) return res.status(404).json({ message: 'Hotspot không tồn tại' }); const parentScene = await Scene.findById(hotspot.parent_scene_id); - if (parentScene.createdBy.toString() !== req.user._id.toString()) { + if (parentScene.createdBy.toString() !== req.user._id.toString() && req.user.role !== 'admin') { return res.status(403).json({ message: 'Không có quyền cập nhật' }); } @@ -141,7 +141,7 @@ router.delete('/delete/:id', protect, async (req, res) => { if (!hotspot) return res.status(404).json({ message: 'Hotspot không tồn tại' }); const parentScene = await Scene.findById(hotspot.parent_scene_id); - if (parentScene.createdBy.toString() !== req.user._id.toString()) { + if (parentScene.createdBy.toString() !== req.user._id.toString() && req.user.role !== 'admin') { return res.status(403).json({ message: 'Không có quyền xóa' }); } diff --git a/backend/routes/sceneRoutes.js b/backend/routes/sceneRoutes.js index 9640a4c..fd93f88 100644 --- a/backend/routes/sceneRoutes.js +++ b/backend/routes/sceneRoutes.js @@ -216,7 +216,7 @@ router.put('/:id', protect, uploadSinglePanorama, async (req, res) => { const { title, description, privacy, sharedWithUsers, sharedEmails, shareExpireDays, lat, lng } = req.body; const scene = await Scene.findById(req.params.id); - if (!scene || scene.createdBy.toString() !== req.user._id.toString()) { + if (!scene || (scene.createdBy.toString() !== req.user._id.toString() && req.user.role !== 'admin')) { return res.status(403).json({ message: 'Not authorized' }); } diff --git a/frontend/css/style.css b/frontend/css/style.css index 8894315..4585d7f 100644 --- a/frontend/css/style.css +++ b/frontend/css/style.css @@ -1076,8 +1076,12 @@ html, body { box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); } -/* --- Edit Metadata Modal (Dark Theme) --- */ -#edit-scene-metadata-modal .modal-content { +/* --- Unified Dark Theme for Modals (Tour, Scene, Metadata, Hotspot, Actions) --- */ +#edit-scene-metadata-modal .modal-content, +#create-tour-modal .modal-content, +#create-scene-modal .modal-content, +#hotspot-modal .modal-content, +#action-choice-modal .modal-content { background: rgba(30, 30, 30, 0.95); color: #fff; border: 1px solid rgba(255, 255, 255, 0.1); @@ -1085,36 +1089,54 @@ html, body { max-width: 500px; } -#edit-scene-metadata-modal .form-group label { +#edit-scene-metadata-modal .form-group label, +#create-tour-modal .form-group label, +#create-scene-modal .form-group label, +#hotspot-modal .form-group label, +#action-choice-modal .form-group label { color: #ccc; } #edit-scene-metadata-modal input, #edit-scene-metadata-modal textarea, #edit-scene-metadata-modal select { +#create-tour-modal input, +#create-tour-modal select, +#create-tour-modal textarea, +#create-scene-modal input, +#create-scene-modal select, +#create-scene-modal textarea, +#hotspot-modal input, +#hotspot-modal textarea, +#hotspot-modal select { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.2); color: #fff; } -/* Trạng thái vô hiệu hóa (Disabled) cho các trường nhập liệu trong Modal sửa */ -#edit-scene-metadata-modal input:disabled, -#edit-scene-metadata-modal textarea:disabled, -#edit-scene-metadata-modal select:disabled { - background: rgba(255, 255, 255, 0.02) !important; - color: #777 !important; - cursor: not-allowed; - border-color: rgba(255, 255, 255, 0.1) !important; +/* Select option colors for Dark Theme */ +#edit-scene-metadata-modal select option, +#create-tour-modal select option, +#create-scene-modal select option, +#hotspot-modal select option { + background-color: #1e1e1e; + color: #fff; } -/* Tùy chỉnh màu sắc cho danh sách lựa chọn (dropdown options) trong modal tối */ -#edit-scene-metadata-modal select option { - background-color: #000; /* Nền đen cho các item */ - color: #fff; /* Chữ trắng */ +#hs-mini-map { + height: 200px; + width: 100%; + border-radius: 8px; + border: 1px solid rgba(255, 255, 255, 0.1); + margin-top: 10px; } -#edit-scene-metadata-modal select option:hover { - background-color: #555; /* Nền xám khi di chuột qua (tùy trình duyệt hỗ trợ) */ +#edit-scene-metadata-modal .modal-header, +#create-tour-modal .modal-header, +#create-scene-modal .modal-header, +#hotspot-modal .modal-header, +#action-choice-modal .modal-header { + border-bottom: 1px solid rgba(255, 255, 255, 0.1); } #edit-mini-map { @@ -1372,3 +1394,10 @@ html, body { color: #dc3545; border: 1px solid rgba(220, 53, 69, 0.4); } + +/* Temporary hiding rules for notification overlays */ +body.notification-active #dashboard-overlay, +body.notification-active .modal, +body.notification-active .modal-overlay:not(#success-modal):not(#error-modal) { + display: none !important; +} diff --git a/frontend/index.html b/frontend/index.html index f7bd6df..8d92849 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -526,7 +526,7 @@