Skip to content

🛡️ Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!

Edit modal fixed

sassanix9990422f2e23
diff --git a/frontend/js/components/editModal.js b/frontend/js/components/editModal.js
index 22e318b..ea4b70c 100644
--- a/frontend/js/components/editModal.js
+++ b/frontend/js/components/editModal.js
@@ -420,6 +420,7 @@ export async function saveWarranty() {
if (window && window.hideLoadingSpinner) window.hideLoadingSpinner();
if (window && window.showToast) window.showToast('Warranty updated successfully', 'success');
+ if (window) window.currentWarrantyId = null; // Clear the warranty ID after successful save
if (window && typeof window.closeModals === 'function') window.closeModals();
// Reload warranties to pick up processed assets/paths
diff --git a/frontend/script.js b/frontend/script.js
index b057d13..48469e4 100644
--- a/frontend/script.js
+++ b/frontend/script.js
@@ -2967,6 +2967,7 @@ async function openEditModal(warranty) {
closeModals();
currentWarrantyId = warranty.id;
+ window.currentWarrantyId = warranty.id; // Also set on window for editModal.js module
// Load currencies for the dropdown and wait for it to complete
await loadCurrencies();
@@ -3557,6 +3558,7 @@ async function confirmArchive() {
const guidance = 'You can find archived warranties by selecting "Archived" in Filters.';
showToast(guidance, 'info');
currentWarrantyId = null;
+ window.currentWarrantyId = null; // Also clear window property
} catch (e) {
// toggleArchiveStatus already toasts on failure
console.error('Archive failed', e);
@@ -5691,6 +5693,7 @@ function deleteWarranty() {
const __updated = __w.filter(warranty => warranty.id !== deletedId);
if (window.store && window.store.setWarranties) window.store.setWarranties(__updated);
currentWarrantyId = null; // Reset current ID
+ window.currentWarrantyId = null; // Also clear window property
// Re-render the list using the updated local array
applyFilters();