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

@@ -78,6 +78,6 @@ class Config:
"Spożywcze,Budowlane,Zabawki,Chemia,Inne,Elektronika,Odzież i obuwie,"
"Artykuły biurowe,Kosmetyki i higiena,Motoryzacja,Ogród i rośliny,"
"Zwierzęta,Sprzęt sportowy,Książki i prasa,Narzędzia i majsterkowanie,"
"RTV / AGD,Apteka i suplementy,Artykuły dekoracyjne,Gry i hobby,Usługi,Pieczywo,Różne,Chiny"
"RTV / AGD,Apteka i suplementy,Artykuły dekoracyjne,Gry i hobby,Usługi,Pieczywo,Różne,Chiny,Dom"
).split(",") if c.strip()
]

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);

View File

@@ -263,9 +263,18 @@
</td>
<td>
<div class="btn-group btn-group-sm" role="group">
<a href="{{ url_for('edit_list', list_id=l.id) }}" class="btn btn-outline-primary">✏️</a>
<a href="{{ url_for('delete_list', list_id=l.id) }}" class="btn btn-outline-danger"
onclick="return confirm('Na pewno usunąć tę listę?')">🗑️</a>
<a href="{{ url_for('edit_list', list_id=l.id) }}"
class="btn btn-outline-primary" title="Edytuj">✏️</a>
<button type="button"
class="btn btn-outline-info preview-btn"
data-list-id="{{ l.id }}"
title="Podgląd produktów">
👁️
</button>
<a href="{{ url_for('delete_list', list_id=l.id) }}"
class="btn btn-outline-danger"
onclick="return confirm('Na pewno usunąć tę listę?')"
title="Usuń">🗑️</a>
</div>
</td>
</tr>
@@ -280,6 +289,29 @@
</div>
</div>
<div class="info-bar-fixed">
Python: {{ python_version.split()[0] }} | {{ system_info }} | RAM app: {{ app_memory }} |
DB: {{ db_info.engine|upper }}{% if db_info.version %} v{{ db_info.version[0] }}{% endif %} |
Tabele: {{ table_count }} | Rekordy: {{ record_total }} |
Uptime: {{ uptime_minutes }} min
</div>
<!-- Modal podglądu produktów -->
<div class="modal fade" id="productPreviewModal" tabindex="-1" aria-labelledby="previewModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-scrollable">
<div class="modal-content bg-dark text-white">
<div class="modal-header">
<h5 class="modal-title" id="previewModalLabel">Podgląd produktów</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"
aria-label="Zamknij"></button>
</div>
<div class="modal-body">
<ul id="product-list" class="list-group list-group-flush"></ul>
</div>
</div>
</div>
</div>
{% block scripts %}
<script>
document.getElementById('select-all').addEventListener('click', function () {
@@ -287,12 +319,7 @@
checkboxes.forEach(cb => cb.checked = this.checked);
});
</script>
<script src="{{ url_for('static_bp.serve_js', filename='preview_list_modal.js') }}"></script>
{% endblock %}
<div class="info-bar-fixed">
Python: {{ python_version.split()[0] }} | {{ system_info }} | RAM app: {{ app_memory }} |
DB: {{ db_info.engine|upper }}{% if db_info.version %} v{{ db_info.version[0] }}{% endif %} |
Tabele: {{ table_count }} | Rekordy: {{ record_total }} |
Uptime: {{ uptime_minutes }} min
</div>
{% endblock %}

View File

@@ -83,6 +83,6 @@
{% endblock %}
{% block scripts %}
<script src="https://cdn.jsdelivr.net/npm/tom-select/dist/js/tom-select.complete.min.js"></script>
<script src="{{ url_for('static_bp.serve_js', filename='admin_mass_categories.js') }}"></script>
<script src="{{ url_for('static_bp.serve_js', filename='preview_list_modal.js') }}"></script>
<script src="{{ url_for('static_bp.serve_js', filename='categories_select_admin.js') }}"></script>
{% endblock %}