From f15e53c4e5403e2da8fe216ecdacd20f49f3b115 Mon Sep 17 00:00:00 2001 From: locphamtran Date: Mon, 8 Jun 2026 18:19:59 +0700 Subject: [PATCH] =?UTF-8?q?S=E1=BB=ADa=20l=E1=BB=97i=20x=C3=B3a=20?= =?UTF-8?q?=E1=BA=A3nh=20trong=20qu=E1=BA=A3n=20l=C3=AD=20=E1=BA=A3nh=20v?= =?UTF-8?q?=C3=A0=20media?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/routes/apiRoutes.js | 4 +-- frontend/css/style.css | 4 ++- frontend/index.html | 23 ++++++++++++- frontend/js/main_map.js | 69 ++++++++++++++++++++++++++++++++----- 4 files changed, 88 insertions(+), 12 deletions(-) diff --git a/backend/routes/apiRoutes.js b/backend/routes/apiRoutes.js index aab4a8a..c5d80f4 100644 --- a/backend/routes/apiRoutes.js +++ b/backend/routes/apiRoutes.js @@ -638,7 +638,7 @@ router.delete('/assets/:id', protect, async (req, res) => { if (!asset) return res.status(404).json({ message: 'Ảnh không tồn tại' }); // Kiểm tra quyền: Người upload hoặc Admin (Chủ sở hữu) - const isOwner = asset.uploadedBy.toString() === req.user._id.toString(); + const isOwner = asset.uploadedBy && asset.uploadedBy.toString() === req.user._id.toString(); const isAdmin = req.user.role === 'Chủ sở hữu' || req.user.role === 'admin'; if (!isOwner && !isAdmin) { @@ -659,7 +659,7 @@ router.delete('/assets/:id', protect, async (req, res) => { } // 2. Xóa file vật lý trên disk - if (fs.existsSync(asset.filePath)) { + if (asset.filePath && fs.existsSync(asset.filePath)) { fs.unlinkSync(asset.filePath); } diff --git a/frontend/css/style.css b/frontend/css/style.css index cb70bb3..c1f86f5 100644 --- a/frontend/css/style.css +++ b/frontend/css/style.css @@ -594,7 +594,9 @@ html, body { box-shadow: 0 10px 40px rgba(0,0,0,0.6) !important; } -#logout-confirm-modal { +#logout-confirm-modal, +#delete-asset-confirm-modal, +#success-modal { z-index: 5500; /* Cao hơn Dashboard (4500) và Close Button (5000) */ } diff --git a/frontend/index.html b/frontend/index.html index 820873f..b17f809 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -132,7 +132,7 @@ + + + + + +