blocked dates page and warning for special-cake orders

Add blocked_date table (migration 5), model, and store CRUD methods.
Add management page at /blocked with add/delete functionality.
Add nav link 'Terminy zablokowane' with event_busy icon.
Pass blocked dates to order form as JSON data attribute.
On form submit, if the order has special cakes and the date is
blocked, show a confirm() dialog warning the user.
This commit is contained in:
bronkuu 2026-06-15 18:54:48 +02:00
parent 5a5372b831
commit 5f156ab6a0
13 changed files with 175 additions and 16 deletions

View file

@ -125,6 +125,7 @@
/* ========== SPLIT PANE ========== */
.split-pane {
display: flex;
flex-direction: column;
gap: 1rem;
flex: 1;
min-height: 0;
@ -139,19 +140,19 @@
}
.order-aside {
width: 20rem;
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: column;
}
@media (max-width: 64em) {
@media (min-width: 64em) {
.split-pane {
flex-direction: column;
flex-direction: row;
}
.order-aside {
width: 100%;
width: 20rem;
}
}

View file

@ -219,7 +219,7 @@
/* ========== CAKE BREAKDOWN LIST ========== */
.breakdown-list { list-style: none; padding: 0; margin: 0; }
.breakdown-item { display: flex; justify-content: space-between; padding: 0.375rem 0; border-bottom: 1px solid var(--outline-variant); }
.breakdown-item { display: flex; justify-content: space-between; padding: 0.375rem 1rem; margin: 0 -1rem; border-bottom: 1px solid var(--outline-variant); }
.breakdown-amount { font-weight: 600; }
.breakdown-empty { color: var(--on-surface-variant); font-size: 0.75rem; }

View file

@ -267,3 +267,13 @@ function applyCatalogueFilters() {
function filterCatalogue(input) {
applyCatalogueFilters();
}
function confirmBlockedDate(form) {
var date = form.querySelector('[name="date"]').value;
var blocked = JSON.parse(form.getAttribute("data-blocked-dates") || "[]");
var hasSpecial = form.querySelector('[name="special_name[]"]');
if (hasSpecial && blocked.indexOf(date) >= 0) {
return confirm("Data " + date + " jest zablokowana dla zamówień z tortami specjalnymi. Czy na pewno chcesz kontynuować?");
}
return true;
}