desing pruning

This commit is contained in:
bronkuu 2026-06-15 19:48:40 +02:00
parent b8cf13b7d5
commit be80307bde
7 changed files with 159 additions and 367 deletions

View file

@ -1,162 +1,149 @@
:root { :root {
--surface: #fff8f0; --surface: #fff8f0;
--surface-low: #faf3e7; --surface-low: #faf3e7;
--surface-highest: #ede3d4; --surface-highest: #ede3d4;
--surface-white: #ffffff; --surface-white: #ffffff;
--primary: #8c4d50; --primary: #8c4d50;
--primary-container: #fcacaf; --primary-container: #fcacaf;
--on-primary: #ffffff; --on-primary: #ffffff;
--on-surface: #363227; --on-surface: #363227;
--on-surface-dim: #645f52; --on-surface-dim: #645f52;
--outline: #b9b1a3; --outline: #b9b1a3;
--outline-dim: #d4cdbe; --outline-dim: #d4cdbe;
--error: #ba1a1a; --error: #ba1a1a;
--error-container: #ffdad6; --error-container: #ffdad6;
--success-bg: #dcfce7; --success-bg: #dcfce7;
--success-text: #166534; --success-text: #166534;
--warning-bg: #fef08a; --warning-bg: #fef08a;
--warning-text: #854d0e; --warning-text: #854d0e;
--danger-bg: #fee2e2; --danger-bg: #fee2e2;
--danger-text: #991b1b; --danger-text: #991b1b;
--space-xs: 0.25rem; --space-xs: 0.25rem;
--space-sm: 0.5rem; --space-sm: 0.5rem;
--space-md: 1rem; --space-md: 1rem;
--space-lg: 1.5rem; --space-lg: 1.5rem;
--space-xl: 2rem; --space-xl: 2rem;
--sidebar-w: 17.5rem; --sidebar-w: 17.5rem;
--sidebar-w-collapsed: 3.5rem; --topnav-h: 3.5rem;
--topnav-h: 3.5rem;
--radius-sm: 0.25rem; --radius-sm: 0.25rem;
--radius-md: 0.5rem; --radius-md: 0.5rem;
--radius-lg: 0.75rem; --radius-lg: 0.75rem;
--radius-full: 9999px; --radius-full: 9999px;
--font: "Inter", system-ui, -apple-system, sans-serif; --font: "Inter", system-ui, -apple-system, sans-serif;
--transition: 0.15s ease;
} }
*, *::before, *::after { *,
box-sizing: border-box; *::before,
margin: 0; *::after {
padding: 0; box-sizing: border-box;
margin: 0;
padding: 0;
} }
html, body { html,
height: 100%; body {
overflow: hidden; height: 100%;
overflow: hidden;
} }
body { body {
font-family: var(--font); font-family: var(--font);
font-size: 1rem; font-size: 1rem;
line-height: 1.5; line-height: 1.5;
color: var(--on-surface); color: var(--on-surface);
background: var(--surface); background: var(--surface);
} }
h1 { h1 {
font-size: 1.25rem; font-size: 1.25rem;
font-weight: 700; font-weight: 700;
letter-spacing: -0.01em; letter-spacing: -0.01em;
} }
h2 { h2 {
font-size: 1rem; font-size: 1rem;
font-weight: 600; font-weight: 600;
display: flex; display: flex;
align-items: center; align-items: center;
gap: var(--space-sm); gap: var(--space-sm);
} }
table { table {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
} }
th, td { th,
text-align: left; td {
padding: var(--space-sm) var(--space-sm); text-align: left;
font-size: 0.875rem; padding: var(--space-sm);
white-space: nowrap; font-size: 0.875rem;
white-space: nowrap;
} }
th { th {
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.04em; letter-spacing: 0.04em;
font-weight: 600; font-weight: 600;
color: var(--on-surface-dim); color: var(--on-surface-dim);
font-size: 0.75rem; font-size: 0.75rem;
} }
td { td {
color: var(--on-surface); color: var(--on-surface);
border-bottom: 1px solid var(--outline-dim); border-bottom: 1px solid var(--outline-dim);
} }
tbody tr { input,
transition: background var(--transition); select,
height: 2.5rem; textarea {
font: inherit;
font-size: 0.875rem;
height: 2rem;
padding: 0 var(--space-sm);
border: 1px solid var(--outline-dim);
border-radius: var(--radius-sm);
background: var(--surface-white);
color: var(--on-surface);
outline: none;
width: 100%;
} }
tbody tr:hover { input:focus,
background: var(--surface-low); select:focus,
} textarea:focus {
border-color: var(--primary);
input, select, textarea {
font: inherit;
font-size: 0.875rem;
height: 2rem;
padding: 0 var(--space-sm);
border: 1px solid var(--outline-dim);
border-radius: var(--radius-sm);
background: var(--surface-white);
color: var(--on-surface);
outline: none;
width: 100%;
transition: border-color var(--transition);
}
input:focus, select:focus, textarea:focus {
border-color: var(--primary);
}
input::placeholder, select::placeholder, textarea::placeholder {
color: var(--on-surface-dim);
opacity: 0.6;
} }
textarea { textarea {
height: auto; height: auto;
padding: var(--space-sm); padding: var(--space-sm);
resize: vertical; resize: vertical;
} }
select { select {
appearance: auto; appearance: auto;
} }
button { button {
font: inherit; font: inherit;
cursor: pointer; cursor: pointer;
} }
a { a {
color: inherit; color: inherit;
text-decoration: none; text-decoration: none;
} }
ul, ol { ul,
list-style: none; ol {
} list-style: none;
.htmx-request {
opacity: 0.6;
pointer-events: none;
} }
.hidden { .hidden {
display: none !important; display: none !important;
} }

View file

@ -1,9 +1,7 @@
/* ===== Material Icons sizing ===== */
.material-symbols-outlined { .material-symbols-outlined {
font-size: 1.25rem; font-size: 1.25rem;
} }
/* ===== Card ===== */
.card { .card {
background: var(--surface-white); background: var(--surface-white);
border: 1px solid var(--outline-dim); border: 1px solid var(--outline-dim);
@ -55,7 +53,6 @@
max-width: 30rem; max-width: 30rem;
} }
/* ===== Button ===== */
.btn { .btn {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
@ -68,7 +65,6 @@
font-size: 0.875rem; font-size: 0.875rem;
font-weight: 600; font-weight: 600;
cursor: pointer; cursor: pointer;
transition: all var(--transition);
text-decoration: none; text-decoration: none;
white-space: nowrap; white-space: nowrap;
} }
@ -78,20 +74,12 @@
color: var(--on-primary); color: var(--on-primary);
} }
.btn-primary:hover {
opacity: 0.9;
}
.btn-outline { .btn-outline {
background: transparent; background: transparent;
border: 1px solid var(--outline-dim); border: 1px solid var(--outline-dim);
color: var(--on-surface); color: var(--on-surface);
} }
.btn-outline:hover {
background: var(--surface-highest);
}
.btn-sm { .btn-sm {
height: 2rem; height: 2rem;
padding: 0 var(--space-sm); padding: 0 var(--space-sm);
@ -101,7 +89,6 @@
.btn-icon { .btn-icon {
color: var(--on-surface-dim); color: var(--on-surface-dim);
cursor: pointer; cursor: pointer;
transition: color var(--transition);
background: none; background: none;
border: none; border: none;
padding: var(--space-xs); padding: var(--space-xs);
@ -111,11 +98,6 @@
justify-content: center; justify-content: center;
} }
.btn-icon:hover {
color: var(--primary);
background: var(--surface-low);
}
.btn-icon .material-symbols-outlined { .btn-icon .material-symbols-outlined {
font-size: 1.25rem; font-size: 1.25rem;
} }
@ -123,7 +105,6 @@
.remove { .remove {
color: var(--error); color: var(--error);
cursor: pointer; cursor: pointer;
transition: opacity var(--transition);
background: none; background: none;
border: none; border: none;
display: inline-flex; display: inline-flex;
@ -133,16 +114,10 @@
border-radius: var(--radius-sm); border-radius: var(--radius-sm);
} }
.remove:hover {
opacity: 0.8;
background: var(--error-container);
}
.remove .material-symbols-outlined { .remove .material-symbols-outlined {
font-size: 1rem; font-size: 1rem;
} }
/* ===== Tag chip ===== */
.tag-chip { .tag-chip {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
@ -155,7 +130,6 @@
border: 1px solid var(--outline-dim); border: 1px solid var(--outline-dim);
cursor: pointer; cursor: pointer;
user-select: none; user-select: none;
transition: all var(--transition);
white-space: nowrap; white-space: nowrap;
} }
@ -164,7 +138,7 @@
padding: 0.125rem 0.375rem; padding: 0.125rem 0.375rem;
} }
.tag-chip:hover, .tag-chip.active { .tag-chip.active {
color: var(--primary); color: var(--primary);
border-color: var(--primary); border-color: var(--primary);
background: var(--primary-container); background: var(--primary-container);
@ -187,14 +161,6 @@
gap: var(--space-xs); gap: var(--space-xs);
} }
.tag-group {
margin-top: var(--space-xs);
display: flex;
flex-wrap: wrap;
gap: 0.125rem;
}
/* ===== Toggle group ===== */
.toggle-group { .toggle-group {
display: flex; display: flex;
height: 2rem; height: 2rem;
@ -211,7 +177,6 @@
font-size: 0.875rem; font-size: 0.875rem;
font-weight: 600; font-weight: 600;
cursor: pointer; cursor: pointer;
transition: all var(--transition);
padding: 0 var(--space-sm); padding: 0 var(--space-sm);
} }
@ -224,26 +189,12 @@
color: var(--on-primary); color: var(--on-primary);
} }
.toggle-btn:not(.active):hover {
background: var(--surface-highest);
}
/* ===== Data table ===== */
.data-table tbody tr:nth-child(even) {
background: var(--surface);
}
.data-table tbody tr:nth-child(even):hover {
background: var(--surface-low);
}
.data-table .order-id { .data-table .order-id {
font-weight: 700; font-weight: 700;
color: var(--primary); color: var(--primary);
text-decoration: none; text-decoration: none;
} }
/* ===== Search ===== */
.search { .search {
position: relative; position: relative;
} }
@ -263,7 +214,6 @@
font-size: 0.875rem; font-size: 0.875rem;
} }
/* ===== Metrics grid ===== */
.metrics-grid { .metrics-grid {
display: grid; display: grid;
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr);
@ -305,7 +255,6 @@
font-weight: 600; font-weight: 600;
} }
/* ===== Split pane (order form) ===== */
.split-pane { .split-pane {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -338,20 +287,33 @@
#basket-items { #basket-items {
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
padding: var(--space-md);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: var(--space-sm); gap: var(--space-sm);
min-height: 0;
}
#basket-items:empty {
display: none;
} }
#basket-items > li { #basket-items > li {
display: flex; display: flex;
align-items: flex-start; align-items: flex-start;
gap: var(--space-sm); gap: var(--space-sm);
padding-bottom: var(--space-sm); padding: 0 var(--space-md) var(--space-sm);
border-bottom: 1px solid var(--outline-dim); border-bottom: 1px solid var(--outline-dim);
} }
#basket-items > li:first-child {
padding-top: var(--space-md);
}
#basket-items > li:last-child {
border-bottom: none;
padding-bottom: var(--space-md);
}
.basket-item-body { .basket-item-body {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
@ -439,11 +401,6 @@
justify-content: center; justify-content: center;
gap: var(--space-sm); gap: var(--space-sm);
cursor: pointer; cursor: pointer;
transition: opacity var(--transition);
}
.btn-finalize:hover {
opacity: 0.9;
} }
@media (min-width: 64em) { @media (min-width: 64em) {
@ -456,13 +413,6 @@
} }
} }
/* ===== Catalogue grid ===== */
.catalogue-search {
display: flex;
align-items: center;
gap: var(--space-sm);
}
.catalogue-scroll { .catalogue-scroll {
overflow-y: auto; overflow-y: auto;
padding: var(--space-md); padding: var(--space-md);
@ -482,11 +432,6 @@
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
background: var(--surface); background: var(--surface);
transition: border-color var(--transition);
}
#catalogue-grid > li:hover {
border-color: var(--outline);
} }
#catalogue-grid > li > div:first-child { #catalogue-grid > li > div:first-child {
@ -543,7 +488,6 @@
border-radius: var(--radius-sm); border-radius: var(--radius-sm);
cursor: pointer; cursor: pointer;
font-size: 1rem; font-size: 1rem;
transition: all var(--transition);
} }
#catalogue-grid .qty .material-symbols-outlined { #catalogue-grid .qty .material-symbols-outlined {
@ -555,21 +499,11 @@
color: var(--on-surface-dim); color: var(--on-surface-dim);
} }
#catalogue-grid .qty.minus:hover {
background: var(--outline-dim);
color: var(--on-surface);
}
#catalogue-grid .qty.plus { #catalogue-grid .qty.plus {
background: var(--surface-highest); background: var(--surface-highest);
color: var(--on-surface); color: var(--on-surface);
} }
#catalogue-grid .qty.plus:hover {
background: var(--primary);
color: var(--on-primary);
}
#catalogue-grid .value { #catalogue-grid .value {
font-size: 0.75rem; font-size: 0.75rem;
font-weight: 500; font-weight: 500;
@ -577,7 +511,6 @@
text-align: center; text-align: center;
} }
/* ===== Overlay / Drawer ===== */
.overlay { .overlay {
position: fixed; position: fixed;
inset: 0; inset: 0;
@ -605,12 +538,6 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
box-shadow: -0.25rem 0 1.5rem rgba(0, 0, 0, 0.15); box-shadow: -0.25rem 0 1.5rem rgba(0, 0, 0, 0.15);
animation: slideIn 0.2s ease;
}
@keyframes slideIn {
from { transform: translateX(100%); }
to { transform: translateX(0); }
} }
.overlay-panel > header { .overlay-panel > header {
@ -641,18 +568,13 @@
justify-content: center; justify-content: center;
} }
.overlay-panel > header .close-btn:hover {
background: var(--surface-highest);
color: var(--on-surface);
}
.overlay-body { .overlay-body {
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
padding: var(--space-lg); padding: var(--space-lg);
} }
.overlay-body > div { .overlay-body {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: var(--space-sm); gap: var(--space-sm);
@ -673,19 +595,16 @@
border-top: 1px solid var(--outline-dim); border-top: 1px solid var(--outline-dim);
} }
/* ===== Button center (special cakes card) ===== */
.button-center { .button-center {
padding: var(--space-md); padding: var(--space-md);
text-align: center; text-align: center;
} }
/* ===== Catalogue card ===== */
.card-catalogue { .card-catalogue {
flex: 1; flex: 1;
min-height: 12.5rem; min-height: 12.5rem;
} }
/* ===== Form grid ===== */
.form-grid { .form-grid {
display: grid; display: grid;
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
@ -742,7 +661,6 @@ textarea + label {
grid-column: span 2; grid-column: span 2;
} }
/* ===== Horizontal group ===== */
.horizontal-group { .horizontal-group {
display: flex; display: flex;
gap: var(--space-sm); gap: var(--space-sm);
@ -750,7 +668,6 @@ textarea + label {
flex-wrap: wrap; flex-wrap: wrap;
} }
/* ===== Form actions ===== */
.form-actions { .form-actions {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
@ -758,7 +675,6 @@ textarea + label {
padding-top: var(--space-sm); padding-top: var(--space-sm);
} }
/* ===== Preset group (date filter) ===== */
.preset-group { .preset-group {
display: flex; display: flex;
} }
@ -773,11 +689,10 @@ textarea + label {
align-items: center; align-items: center;
} }
.preset-btn:hover, .preset-btn.active { .preset-btn.active {
color: var(--primary); color: var(--primary);
} }
/* ===== Filter bar ===== */
.filter-bar { .filter-bar {
padding: var(--space-sm) var(--space-md); padding: var(--space-sm) var(--space-md);
border-bottom: 1px solid var(--outline-dim); border-bottom: 1px solid var(--outline-dim);
@ -793,14 +708,12 @@ textarea + label {
color: var(--on-surface-dim); color: var(--on-surface-dim);
} }
/* ===== Header actions ===== */
.header-actions { .header-actions {
display: flex; display: flex;
align-items: center; align-items: center;
gap: var(--space-sm); gap: var(--space-sm);
} }
/* ===== Confirmation ===== */
.confirmation { .confirmation {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -816,7 +729,6 @@ textarea + label {
color: var(--success-text); color: var(--success-text);
} }
/* ===== Breakdown list ===== */
.breakdown-list { .breakdown-list {
list-style: none; list-style: none;
} }
@ -838,7 +750,6 @@ textarea + label {
font-size: 0.875rem; font-size: 0.875rem;
} }
/* ===== Icon ===== */
.icon { .icon {
width: 2rem; width: 2rem;
height: 2rem; height: 2rem;
@ -854,7 +765,6 @@ textarea + label {
color: var(--primary); color: var(--primary);
} }
/* ===== Text utilities ===== */
.text-right { text-align: right; } .text-right { text-align: right; }
.text-center { text-align: center; } .text-center { text-align: center; }
.text-muted { color: var(--on-surface-dim); font-weight: 400; } .text-muted { color: var(--on-surface-dim); font-weight: 400; }
@ -862,9 +772,12 @@ textarea + label {
.font-medium { font-weight: 500; } .font-medium { font-weight: 500; }
.grow { flex: 1; } .grow { flex: 1; }
/* ===== Empty state ===== */
.empty-state { .empty-state {
text-align: center; text-align: center;
padding: var(--space-md) 0; padding: var(--space-md) 0;
color: var(--on-surface-dim); color: var(--on-surface-dim);
} }
.hide {
display: none;
}

View file

@ -8,11 +8,6 @@ body {
height: 100dvh; height: 100dvh;
} }
body.sidebar-collapsed {
grid-template-columns: var(--sidebar-w-collapsed) 1fr;
}
/* ===== Sidebar ===== */
aside { aside {
grid-area: sidebar; grid-area: sidebar;
background: var(--surface-white); background: var(--surface-white);
@ -23,27 +18,6 @@ aside {
gap: var(--space-sm); gap: var(--space-sm);
overflow: hidden; overflow: hidden;
z-index: 40; z-index: 40;
transition: width 0.2s ease, padding 0.2s ease;
}
aside > .collapse-btn {
background: none;
border: none;
cursor: pointer;
color: var(--on-surface-dim);
padding: var(--space-xs);
border-radius: var(--radius-sm);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
width: 2rem;
height: 2rem;
}
aside > .collapse-btn:hover {
background: var(--surface-highest);
color: var(--on-surface);
} }
aside > .cta { aside > .cta {
@ -61,11 +35,6 @@ aside > .cta {
font-weight: 600; font-weight: 600;
cursor: pointer; cursor: pointer;
text-decoration: none; text-decoration: none;
transition: opacity var(--transition);
}
aside > .cta:hover {
opacity: 0.9;
} }
aside > nav { aside > nav {
@ -85,12 +54,6 @@ aside > nav > a {
font-weight: 500; font-weight: 500;
text-decoration: none; text-decoration: none;
color: var(--on-surface-dim); color: var(--on-surface-dim);
transition: all var(--transition);
}
aside > nav > a:hover {
background: var(--surface-low);
color: var(--on-surface);
} }
aside > nav > a.active { aside > nav > a.active {
@ -99,33 +62,6 @@ aside > nav > a.active {
font-weight: 700; font-weight: 700;
} }
body.sidebar-collapsed aside {
width: var(--sidebar-w-collapsed);
padding: var(--space-xs);
align-items: center;
}
body.sidebar-collapsed aside > .cta {
width: 2.5rem;
height: 2.5rem;
padding: 0;
border-radius: 50%;
}
body.sidebar-collapsed aside > .cta span:not(.material-symbols-outlined) {
display: none;
}
body.sidebar-collapsed aside > nav > a {
justify-content: center;
padding: var(--space-sm);
}
body.sidebar-collapsed aside > nav > a span:not(.material-symbols-outlined) {
display: none;
}
/* ===== Topnav ===== */
.topnav { .topnav {
grid-area: topnav; grid-area: topnav;
border-bottom: 1px solid var(--outline-dim); border-bottom: 1px solid var(--outline-dim);
@ -165,7 +101,6 @@ body.sidebar-collapsed aside > nav > a span:not(.material-symbols-outlined) {
pointer-events: none; pointer-events: none;
} }
/* ===== Main ===== */
main { main {
grid-area: main; grid-area: main;
overflow-y: auto; overflow-y: auto;
@ -180,7 +115,6 @@ main {
flex: 1; flex: 1;
} }
/* ===== Responsive ===== */
@media (max-width: 64em) { @media (max-width: 64em) {
.topnav > .search { .topnav > .search {
width: 10rem; width: 10rem;
@ -189,9 +123,8 @@ main {
@media (max-width: 48em) { @media (max-width: 48em) {
aside { aside {
width: var(--sidebar-w-collapsed); width: var(--sidebar-w);
padding: var(--space-xs); padding: var(--space-xs);
align-items: center;
} }
aside > .cta { aside > .cta {
@ -214,17 +147,6 @@ main {
display: none; display: none;
} }
body.sidebar-collapsed aside {
width: 0;
padding: 0;
overflow: hidden;
border-right: none;
}
body.sidebar-collapsed {
grid-template-columns: 0 1fr;
}
.topnav { .topnav {
padding: 0 var(--space-sm); padding: 0 var(--space-sm);
} }

View file

@ -3,13 +3,6 @@ var editingSpecialId = null;
var activeCatalogueTags = []; var activeCatalogueTags = [];
var activeCakeTags = []; var activeCakeTags = [];
// ====== Sidebar ======
function toggleSidebar() {
document.body.classList.toggle('sidebar-collapsed');
localStorage.setItem('sidebarCollapsed', document.body.classList.contains('sidebar-collapsed'));
}
// ====== Overlay ======
function openSpecialCakeOverlay() { function openSpecialCakeOverlay() {
editingSpecialId = null; editingSpecialId = null;
document.getElementById('sc-overlay-title').textContent = 'Dodaj tort specjalny'; document.getElementById('sc-overlay-title').textContent = 'Dodaj tort specjalny';
@ -148,7 +141,6 @@ function removeSpecialCake(btn) {
updateTotals(); updateTotals();
} }
// ====== Basket ======
function changeCake(id, name, price, delta) { function changeCake(id, name, price, delta) {
var input = document.querySelector('[name="cake[' + id + ']"]'); var input = document.querySelector('[name="cake[' + id + ']"]');
if (input != null) { if (input != null) {
@ -193,7 +185,6 @@ function removeCake(btn) {
updateCatalogueQty(id, 0); updateCatalogueQty(id, 0);
} }
// ====== Totals ======
function updatePrepaid() { function updatePrepaid() {
var paid = Number(document.querySelector('[name="paid"]')?.value || 0); var paid = Number(document.querySelector('[name="paid"]')?.value || 0);
document.getElementById('paid-amount').innerText = paid.toFixed(2) + ' PLN'; document.getElementById('paid-amount').innerText = paid.toFixed(2) + ' PLN';
@ -222,7 +213,6 @@ function updateCatalogueQty(id, qty) {
if (el) el.innerText = qty; if (el) el.innerText = qty;
} }
// ====== Catalogue Filters ======
function toggleCatalogueTagFilter(btn) { function toggleCatalogueTagFilter(btn) {
var tag = btn.getAttribute('data-tag'); var tag = btn.getAttribute('data-tag');
var idx = activeCatalogueTags.indexOf(tag); var idx = activeCatalogueTags.indexOf(tag);
@ -257,7 +247,7 @@ function applyCatalogueFilters() {
} }
} }
} }
item.style.display = matchesText && matchesTags ? '' : 'none'; item.classList.toggle('hide', !(matchesText && matchesTags));
}); });
} }
@ -265,7 +255,6 @@ function filterCatalogue(input) {
applyCatalogueFilters(); applyCatalogueFilters();
} }
// ====== Cakes Table Filters ======
function toggleCakeTagFilter(btn) { function toggleCakeTagFilter(btn) {
var tag = btn.getAttribute('data-tag'); var tag = btn.getAttribute('data-tag');
var idx = activeCakeTags.indexOf(tag); var idx = activeCakeTags.indexOf(tag);
@ -278,17 +267,16 @@ function toggleCakeTagFilter(btn) {
} }
var rows = document.querySelectorAll('#cakes-table tbody tr'); var rows = document.querySelectorAll('#cakes-table tbody tr');
for (var i = 0; i < rows.length; i++) { for (var i = 0; i < rows.length; i++) {
if (activeCakeTags.length === 0) { rows[i].style.display = ''; continue; } if (activeCakeTags.length === 0) { rows[i].classList.remove('hide'); continue; }
var rowTags = (rows[i].getAttribute('data-tags') || '').split(','); var rowTags = (rows[i].getAttribute('data-tags') || '').split(',');
var match = false; var match = false;
for (var j = 0; j < activeCakeTags.length; j++) { for (var j = 0; j < activeCakeTags.length; j++) {
if (rowTags.indexOf(activeCakeTags[j]) >= 0) { match = true; break; } if (rowTags.indexOf(activeCakeTags[j]) >= 0) { match = true; break; }
} }
rows[i].style.display = match ? '' : 'none'; rows[i].classList.toggle('hide', !match);
} }
} }
// ====== Order Table Filters ======
function filterOrders(input) { function filterOrders(input) {
var q = input.value.toLowerCase(); var q = input.value.toLowerCase();
var table = input.closest('.card').querySelector('.data-table'); var table = input.closest('.card').querySelector('.data-table');
@ -297,11 +285,10 @@ function filterOrders(input) {
for (var i = 0; i < rows.length; i++) { for (var i = 0; i < rows.length; i++) {
var id = rows[i].children[0].textContent.toLowerCase(); var id = rows[i].children[0].textContent.toLowerCase();
var customer = rows[i].children[1].textContent.toLowerCase(); var customer = rows[i].children[1].textContent.toLowerCase();
rows[i].style.display = id.includes(q) || customer.includes(q) ? '' : 'none'; rows[i].classList.toggle('hide', !(id.includes(q) || customer.includes(q)));
} }
} }
// ====== Location Toggle ======
function setLocation(btn, value) { function setLocation(btn, value) {
var group = btn.closest('.toggle-group'); var group = btn.closest('.toggle-group');
group.querySelectorAll('.toggle-btn').forEach(function(b) { b.classList.remove('active'); }); group.querySelectorAll('.toggle-btn').forEach(function(b) { b.classList.remove('active'); });
@ -309,7 +296,6 @@ function setLocation(btn, value) {
group.querySelector('input[type="hidden"]').value = value; group.querySelector('input[type="hidden"]').value = value;
} }
// ====== Blocked Date Confirmation ======
function confirmBlockedDate(form) { function confirmBlockedDate(form) {
var date = form.querySelector('[name="date"]').value; var date = form.querySelector('[name="date"]').value;
var blocked = JSON.parse(form.getAttribute('data-blocked-dates') || '[]'); var blocked = JSON.parse(form.getAttribute('data-blocked-dates') || '[]');
@ -320,7 +306,6 @@ function confirmBlockedDate(form) {
return true; return true;
} }
// ====== Init ======
function initOrderPage() { function initOrderPage() {
var form = document.querySelector('.order-form'); var form = document.querySelector('.order-form');
if (!form) return; if (!form) return;
@ -338,19 +323,13 @@ function initOrderPage() {
function setActiveLink() { function setActiveLink() {
var path = window.location.pathname; var path = window.location.pathname;
var links = document.querySelectorAll('.link'); var links = document.querySelectorAll('nav > a');
for (var i = 0; i < links.length; i++) { for (var i = 0; i < links.length; i++) {
links[i].classList.toggle('active', links[i].getAttribute('href') === path); links[i].classList.toggle('active', links[i].getAttribute('href') === path);
} }
} }
function setSidebarState() {
var collapsed = localStorage.getItem('sidebarCollapsed') === 'true';
document.body.classList.toggle('sidebar-collapsed', collapsed);
}
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
setSidebarState();
setActiveLink(); setActiveLink();
initOrderPage(); initOrderPage();
}); });

View file

@ -1,23 +1,20 @@
package templates package templates
templ Nav() { templ Nav() {
<button type="button" class="collapse-btn" onclick="toggleSidebar()" title="Zwiń / Rozwiń">
<span class="material-symbols-outlined">menu</span>
</button>
<a href="/order" class="cta" hx-get="/order" hx-target="#main" hx-swap="outerHTML" hx-push-url="true"> <a href="/order" class="cta" hx-get="/order" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
<span class="material-symbols-outlined">add</span> <span class="material-symbols-outlined">add</span>
<span>Nowe zamówienie</span> <span>Nowe zamówienie</span>
</a> </a>
<nav> <nav>
<a href="/orders" class="link" hx-get="/orders" hx-target="#main" hx-swap="outerHTML" hx-push-url="true"> <a href="/orders" hx-get="/orders" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
<span class="material-symbols-outlined">dashboard</span> <span class="material-symbols-outlined">dashboard</span>
<span>Panel główny</span> <span>Panel główny</span>
</a> </a>
<a href="/cakes" class="link" hx-get="/cakes" hx-target="#main" hx-swap="outerHTML" hx-push-url="true"> <a href="/cakes" hx-get="/cakes" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
<span class="material-symbols-outlined">inventory_2</span> <span class="material-symbols-outlined">inventory_2</span>
<span>Katalog</span> <span>Katalog</span>
</a> </a>
<a href="/blocked" class="link" hx-get="/blocked" hx-target="#main" hx-swap="outerHTML" hx-push-url="true"> <a href="/blocked" hx-get="/blocked" hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
<span class="material-symbols-outlined">event_busy</span> <span class="material-symbols-outlined">event_busy</span>
<span>Terminy zablokowane</span> <span>Terminy zablokowane</span>
</a> </a>

View file

@ -52,10 +52,7 @@ templ OrderForm(order models.Order, catalogue []models.Cake, allTags []models.Ta
<label>Zaliczka</label> <label>Zaliczka</label>
<input type="number" name="paid" min="0" step="0.01" value={ order.Paid.String() } oninput={ templ.JSFuncCall("updatePrepaid") }/> <input type="number" name="paid" min="0" step="0.01" value={ order.Paid.String() } oninput={ templ.JSFuncCall("updatePrepaid") }/>
</div> </div>
<div class="col-span-2">
<label>Uwagi</label>
<input type="text" placeholder="Alergie, specjalne życzenia..."/>
</div>
</div> </div>
</div> </div>
</section> </section>

View file

@ -20,38 +20,35 @@ templ SpecialCakeOverlay(allTags []models.Tag) {
</button> </button>
</header> </header>
<div class="overlay-body"> <div class="overlay-body">
<div> <label>Nazwa *</label>
<label>Nazwa *</label> <input type="text" id="sc-name" placeholder="Nazwa tortu"/>
<input type="text" id="sc-name" placeholder="Nazwa tortu"/> <label>Cena *</label>
<label>Cena *</label> <input type="number" id="sc-price" min="0" step="0.01" placeholder="0.00"/>
<input type="number" id="sc-price" min="0" step="0.01" placeholder="0.00"/> <label>Wielkość</label>
<label>Wielkość</label> <input type="text" id="sc-size" placeholder="np. 20cm, 30x40"/>
<input type="text" id="sc-size" placeholder="np. 20cm, 30x40"/> <label>Kształt</label>
<label>Kształt</label> <select id="sc-shape">
<select id="sc-shape"> <option value="">—</option>
<option value="">—</option> <option value="round">Okrągły</option>
<option value="round">Okrągły</option> <option value="square">Kwadrat</option>
<option value="square">Kwadrat</option> </select>
</select> <label>Smak</label>
<label>Smak</label> <input type="text" id="sc-flavour" placeholder="np. czekoladowy"/>
<input type="text" id="sc-flavour" placeholder="np. czekoladowy"/> <label>Notatki</label>
<label>Notatki</label> <input type="text" id="sc-notes" placeholder="Dodatkowe informacje"/>
<input type="text" id="sc-notes" placeholder="Dodatkowe informacje"/> if len(allTags) > 0 {
if len(allTags) > 0 { <label>Tagi</label>
<label>Tagi</label> <div class="tag-grid" id="sc-overlay-tags">
<div class="tag-grid" id="sc-overlay-tags"> for _, t := range allTags {
for _, t := range allTags { <label class="tag-chip">
<label class="tag-chip"> <input type="checkbox" class="sc-tag-cb" value={ strconv.Itoa(t.ID) }/>
<input type="checkbox" class="sc-tag-cb" value={ strconv.Itoa(t.ID) }/> { t.Name }
{ t.Name } </label>
</label> }
} </div>
</div> <label>Nowy tag</label>
<div class="horizontal-group"> <input type="text" id="sc-new-tag" placeholder="Nowy tag..."/>
<input type="text" id="sc-new-tag" placeholder="Nowy tag..."/> }
</div>
}
</div>
</div> </div>
<footer> <footer>
<button type="button" class="btn btn-outline" onclick="closeSpecialCakeOverlay()">Anuluj</button> <button type="button" class="btn btn-outline" onclick="closeSpecialCakeOverlay()">Anuluj</button>