dropbne poprawki w js

This commit is contained in:
Mateusz Gruszczyński
2025-07-20 10:36:58 +02:00
parent f71697b6db
commit 1f609b6dba
3 changed files with 7 additions and 6 deletions

View File

@@ -124,11 +124,11 @@ function setupList(listId, username) {
summaryEl.innerHTML = `<b>💸 Łącznie wydano:</b> ${data.total.toFixed(2)} PLN`;
}
showToast(`Dodano wydatek: ${data.amount.toFixed(2)} PLN`);
showToast(`Dodano wydatek: ${data.amount.toFixed(2)} PLN`, 'info');
});
socket.on('item_added', data => {
showToast(`${data.added_by} dodał: ${data.name}`);
showToast(`${data.added_by} dodał: ${data.name}`, 'info');
const li = document.createElement('li');
li.className = 'list-group-item d-flex justify-content-between align-items-center flex-wrap item-not-checked';
li.id = `item-${data.id}`;
@@ -175,7 +175,7 @@ function setupList(listId, username) {
if (li) {
li.remove();
}
showToast('Usunięto produkt');
showToast('Usunięto produkt z listy', 'success');
updateProgressBar();
toggleEmptyPlaceholder();
});
@@ -215,7 +215,7 @@ function setupList(listId, username) {
}
}
}
showToast('Notatka zaktualizowana!');
showToast('Notatka dodana/zaktualizowana', 'success');
});
socket.on('item_edited', data => {
@@ -227,7 +227,7 @@ function setupList(listId, username) {
}
nameSpan.innerHTML = `${data.new_name}${quantityBadge}`;
}
showToast(`Zaktualizowano produkt: ${data.new_name} (x${data.new_quantity})`);
showToast(`Zaktualizowano produkt: ${data.new_name} (x${data.new_quantity})`, 'success');
});
updateProgressBar();

View File

@@ -79,6 +79,7 @@ document.addEventListener('DOMContentLoaded', function () {
btn.onclick = () => {
const quantity = parseInt(qty.value) || 1;
socket.emit('add_item', { list_id: LIST_ID, name: name, quantity: quantity });
socket.emit('request_full_list', { list_id: LIST_ID });
};
li.appendChild(qtyWrapper);

View File

@@ -46,7 +46,7 @@ socket.on('connect', function () {
});
socket.on('disconnect', function (reason) {
showToast('Utracono połączenie z serwerem...', 'warning');
//showToast('Utracono połączenie z serwerem...', 'warning');
disableCheckboxes(true);
});