cập nhật tính năng sửa scene từ quản lí ảnh và media
This commit is contained in:
+12
-1
@@ -408,6 +408,7 @@ function handleLogout() {
|
||||
* Opens Modal for creating a Scene and sets lat/lng inputs
|
||||
*/
|
||||
function openCreateSceneModal(lat, lng) {
|
||||
returnToDashboardAfterEdit = false;
|
||||
const token = localStorage.getItem('jwt');
|
||||
if (!token) {
|
||||
alert('Please log in first to create a 3D scene.');
|
||||
@@ -439,6 +440,12 @@ function closeModal() {
|
||||
}
|
||||
document.getElementById('create-scene-form').reset();
|
||||
document.getElementById('shared-with-group').style.display = 'none';
|
||||
|
||||
if (returnToDashboardAfterEdit) {
|
||||
returnToDashboardAfterEdit = false;
|
||||
openDashboard();
|
||||
openDashboardTab('media-library');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -662,6 +669,7 @@ async function handleEditDeleteScene(scene) {
|
||||
|
||||
// Gán sự kiện cho nút Sửa
|
||||
editBtn.onclick = () => {
|
||||
returnToDashboardAfterEdit = false;
|
||||
closeActionModal();
|
||||
openEditSceneModal(scene);
|
||||
};
|
||||
@@ -1203,7 +1211,10 @@ async function loadMyScenes() {
|
||||
`;
|
||||
listContainer.appendChild(item);
|
||||
// Gán sự kiện sửa bằng code để truyền object scene an toàn
|
||||
document.getElementById(`edit-${scene._id}`).onclick = () => openEditSceneModal(scene);
|
||||
document.getElementById(`edit-${scene._id}`).onclick = () => {
|
||||
returnToDashboardAfterEdit = false;
|
||||
openEditSceneModal(scene);
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
listContainer.innerHTML = `<p style="color:#ff4d4d">Lỗi: ${e.message}</p>`;
|
||||
|
||||
Reference in New Issue
Block a user