modal w panelu admina

This commit is contained in:
Mateusz Gruszczyński
2025-08-14 16:08:07 +02:00
parent 1befc2f87d
commit 9d777f4fc5
5 changed files with 44 additions and 27 deletions

View File

View File

@@ -1,15 +1,5 @@
// preview-modal.js
document.addEventListener("DOMContentLoaded", function () {
// Inicjalizacja Tom Select dla wszystkich select[multiple]
document.querySelectorAll('select[multiple]').forEach(function (el) {
new TomSelect(el, {
plugins: ['remove_button'],
placeholder: 'Wybierz kategorie...',
create: false,
sortField: { field: "text", direction: "asc" },
dropdownParent: 'body'
});
});
// Obsługa przycisków podglądu produktów
document.querySelectorAll(".preview-btn").forEach((btn) => {
btn.addEventListener("click", async () => {
@@ -43,10 +33,10 @@ document.addEventListener("DOMContentLoaded", function () {
const li = document.createElement("li");
li.className = "list-group-item bg-dark text-white d-flex justify-content-between";
li.innerHTML = `
<span>${item.name}</span>
<span class="badge ${item.purchased ? 'bg-success' : item.not_purchased ? 'bg-warning text-dark' : 'bg-secondary'}">
x${item.quantity}
</span>`;
<span>${item.name}</span>
<span class="badge ${item.purchased ? 'bg-success' : item.not_purchased ? 'bg-warning text-dark' : 'bg-secondary'}">
x${item.quantity}
</span>`;
if (item.purchased) {
purchasedList.appendChild(li);