Skip to content

Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.

update AI recommendation numbering after delete (#996)

LumiDev4bb69e7df6fe
diff --git a/scripts/dashboard.js b/scripts/dashboard.js
index e0443ef..c9d8e9c 100644
--- a/scripts/dashboard.js
+++ b/scripts/dashboard.js
@@ -1,4 +1,13 @@
document.addEventListener("DOMContentLoaded", function () {
+ function updateAiRecommendationNumbers() {
+ document.querySelectorAll(".ai-recommendation-item").forEach(function (item, index) {
+ const numberSpan = item.querySelector(".ai-recommendation-header h3 > span");
+ if (numberSpan) {
+ numberSpan.textContent = `${index + 1}. `;
+ }
+ });
+ }
+
document.querySelectorAll(".ai-recommendation-item").forEach(function (item) {
item.addEventListener("click", function () {
item.classList.toggle("expanded");
@@ -25,6 +34,7 @@ document.addEventListener("DOMContentLoaded", function () {
.then(data => {
if (data.success) {
item.remove();
+ updateAiRecommendationNumbers();
showSuccessMessage(translate("success"));
} else {
showErrorMessage(data.message || translate("failed_delete_ai_recommendation"));