css reducion

This commit is contained in:
bronkuu 2026-06-15 19:33:39 +02:00
parent 5f156ab6a0
commit b8cf13b7d5
20 changed files with 1603 additions and 1677 deletions

View file

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

View file

@ -1,120 +0,0 @@
/* ========== ORDER SUMMARY ========== */
#basket-items {
flex: 1;
overflow-y: auto;
padding: 1rem;
display: flex;
flex-direction: column;
gap: 0.5rem;
list-style: none;
> li {
display: flex;
align-items: flex-start;
justify-content: space-between;
padding-bottom: 0.5rem;
border-bottom: 1px solid var(--outline-variant);
> div:first-child {
flex: 1;
min-width: 0;
padding-right: 0.5rem;
}
.name {
font-size: 0.75rem;
font-weight: 600;
color: var(--on-surface);
}
.detail {
font-size: 0.75rem;
color: var(--on-surface-variant);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.price {
font-size: 0.75rem;
font-weight: 600;
color: var(--on-surface);
white-space: nowrap;
}
.basket-actions .action-btn .material-symbols-outlined {
font-size: 1rem;
}
.remove {
color: var(--error);
cursor: pointer;
transition: opacity var(--transition);
background: none;
border: none;
margin-left: 0.25rem;
&:hover {
opacity: 0.8;
}
.material-symbols-outlined {
font-size: 1rem;
}
}
}
}
.summary-totals {
padding: 1rem;
border-top: 1px solid var(--outline-variant);
background: var(--surface-bright);
.total-row {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 0.75rem;
color: var(--on-surface-variant);
+ .total-row {
margin-top: 0.5rem;
}
&.grand {
font-size: 1rem;
font-weight: 700;
color: var(--on-surface);
padding-top: 0.5rem;
border-top: 1px solid var(--outline-variant);
margin-top: 0.5rem;
}
}
.btn-finalize {
width: 100%;
height: 2.5rem;
margin-top: 0.5rem;
background: var(--primary);
color: var(--on-primary);
border: none;
border-radius: var(--border-radius-sm);
font-size: 0.75rem;
font-weight: 600;
letter-spacing: 0.02em;
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
cursor: pointer;
transition: opacity var(--transition);
&:hover {
opacity: 0.9;
}
.material-symbols-outlined {
font-size: 1.25rem;
}
}
}

View file

@ -1,243 +0,0 @@
/* ========== CARDS ========== */
.card {
background: var(--surface-container-lowest);
border: 1px solid var(--outline-variant);
border-radius: var(--border-radius-md);
display: flex;
flex-direction: column;
> header {
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--outline-variant);
display: flex;
align-items: center;
justify-content: space-between;
background: var(--surface-container-low);
h2 {
font-size: 1rem;
font-weight: 600;
color: var(--on-surface);
display: flex;
align-items: center;
gap: 0.5rem;
.material-symbols-outlined {
font-size: 1.25rem;
color: var(--on-surface-variant);
}
}
}
> div,
> form {
padding: 1rem;
flex: 1;
}
> footer {
padding: 0.5rem 0.75rem;
border-top: 1px solid var(--outline-variant);
background: var(--surface-container-lowest);
display: flex;
justify-content: space-between;
align-items: center;
font-size: 0.75rem;
color: var(--on-surface-variant);
}
}
.card > .table-container {
overflow-x: auto;
padding: 0;
}
/* ========== METRICS GRID ========== */
.metrics-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 0.75rem;
> div {
background: var(--surface-container-lowest);
border: 1px solid var(--outline-variant);
border-radius: var(--border-radius-md);
padding: 1rem;
display: flex;
flex-direction: column;
gap: 0.25rem;
.label {
font-size: 0.75rem;
font-weight: 500;
color: var(--on-surface-variant);
letter-spacing: 0.02em;
display: flex;
align-items: center;
gap: 0.25rem;
.material-symbols-outlined {
font-size: 1rem;
}
}
.value {
font-size: 1.75rem;
font-weight: 700;
color: var(--on-surface);
line-height: 1.2;
}
.change {
font-size: 0.75rem;
font-weight: 600;
display: flex;
align-items: center;
gap: 0.25rem;
&.positive {
color: var(--success-text);
}
&.warning {
color: var(--warning-text);
}
.material-symbols-outlined {
font-size: 1rem;
}
}
}
}
@media (max-width: 64em) {
.metrics-grid {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 48em) {
.metrics-grid {
grid-template-columns: 1fr 1fr;
}
}
/* ========== SPLIT PANE ========== */
.split-pane {
display: flex;
flex-direction: column;
gap: 1rem;
flex: 1;
min-height: 0;
}
.order-left {
flex: 1;
display: flex;
flex-direction: column;
gap: 1rem;
min-width: 0;
}
.order-aside {
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: column;
}
@media (min-width: 64em) {
.split-pane {
flex-direction: row;
}
.order-aside {
width: 20rem;
}
}
/* ========== DATA TABLE ========== */
.data-table {
width: 100%;
border-collapse: collapse;
font-size: 0.75rem;
thead {
background: var(--surface-container-low);
border-bottom: 1px solid var(--outline-variant);
}
th {
padding: 0.5rem 0.75rem;
font-size: 0.75rem;
font-weight: 600;
color: var(--on-surface-variant);
text-transform: uppercase;
letter-spacing: 0.04em;
text-align: left;
white-space: nowrap;
&.right {
text-align: right;
}
&.center {
text-align: center;
}
}
td {
padding: 0.5rem 0.75rem;
color: var(--on-surface);
white-space: nowrap;
.truncate {
max-width: 12.5rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: block;
}
}
tbody tr {
border-bottom: 1px solid var(--outline-variant);
transition: background var(--transition);
height: 2.5rem;
&:hover {
background: var(--surface-container-low);
}
&:nth-child(even) {
background: var(--surface-bright);
&:hover {
background: var(--surface-container-low);
}
}
}
.order-id {
font-weight: 700;
color: var(--primary);
text-decoration: none;
}
.customer {
font-weight: 500;
}
.text-right {
text-align: right;
}
.text-center {
text-align: center;
}
.text-muted {
color: var(--on-surface-variant);
font-weight: 400;
}
}

View file

@ -1,117 +0,0 @@
/* ========== CATALOGUE GRID ========== */
#catalogue-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(8.75rem, 1fr));
gap: 0.5rem;
> li {
border: 1px solid var(--outline-variant);
border-radius: var(--border-radius-sm);
padding: 0.5rem;
display: flex;
flex-direction: column;
justify-content: space-between;
background: var(--surface-bright);
transition: border-color var(--transition);
list-style: none;
&:hover {
border-color: var(--outline);
}
> div:first-child {
display: flex;
align-items: flex-start;
gap: 0.5rem;
}
.icon {
width: 2rem;
height: 2rem;
border-radius: var(--border-radius-sm);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
font-size: 1rem;
&.cake {
background: var(--primary-container);
color: var(--primary);
}
&.cookie {
background: var(--surface-container-high);
color: var(--on-surface-variant);
}
}
.name {
font-size: 0.75rem;
font-weight: 600;
color: var(--on-surface);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.price {
font-size: 0.75rem;
color: var(--on-surface-variant);
}
.actions {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 0.5rem;
padding-top: 0.5rem;
border-top: 1px solid var(--outline-variant);
.qty {
width: 1.5rem;
height: 1.5rem;
display: flex;
align-items: center;
justify-content: center;
border: none;
border-radius: var(--border-radius-sm);
cursor: pointer;
font-size: 1rem;
transition: all var(--transition);
.material-symbols-outlined {
font-size: 1rem;
}
&.minus {
background: var(--surface-container-low);
color: var(--on-surface-variant);
&:hover {
background: var(--outline-variant);
color: var(--on-surface);
}
}
&.plus {
background: var(--surface-container-high);
color: var(--on-surface);
&:hover {
background: var(--primary);
color: var(--on-primary);
}
}
}
.value {
font-size: 0.75rem;
font-weight: 500;
color: var(--on-surface);
width: 1.5rem;
text-align: center;
}
}
}
}

View file

@ -1,280 +0,0 @@
/* ========== BUTTONS ========== */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
padding: 0 1rem;
height: 2.5rem;
border: none;
border-radius: var(--border-radius-sm);
font-size: 0.75rem;
font-weight: 600;
cursor: pointer;
transition: all var(--transition);
text-decoration: none;
.material-symbols-outlined {
font-size: 1.25rem;
}
&.primary {
background: var(--primary);
color: var(--on-primary);
&:hover {
opacity: 0.9;
}
}
&.outline {
background: transparent;
border: 1px solid var(--outline-variant);
color: var(--on-surface);
&:hover {
background: var(--surface-container-high);
}
}
&.sm {
height: 2rem;
padding: 0 0.75rem;
}
}
/* ========== TABLE ACTIONS ========== */
.action-btn {
color: var(--on-surface-variant);
cursor: pointer;
transition: color var(--transition);
background: none;
border: none;
&:hover {
color: var(--primary);
}
.material-symbols-outlined {
font-size: 1.25rem;
}
}
/* ========== TAG CHIPS ========== */
.tag-chip {
display: inline-flex;
align-items: center;
padding: 0.25rem 0.5rem;
border-radius: var(--border-radius-full);
font-size: 0.75rem;
font-weight: 600;
color: var(--on-surface-variant);
background: var(--surface-container-high);
border: 1px solid var(--outline-variant);
cursor: pointer;
user-select: none;
transition: all var(--transition);
&.sm {
font-size: 0.625rem;
padding: 0.125rem 0.375rem;
}
&:hover,
&.active {
color: var(--primary);
border-color: var(--primary);
background: var(--primary-container);
}
}
/* ========== PRESET BUTTONS ========== */
.preset-group {
display: flex;
}
.preset-btn {
padding: 0.375rem 0.625rem;
font-size: 0.8125rem;
font-weight: 600;
color: var(--on-surface-variant);
text-decoration: none;
display: inline-flex;
align-items: center;
&:hover,
&.active {
color: var(--primary);
}
}
/* ========== OVERLAY / DRAWER ========== */
.overlay {
position: fixed;
inset: 0;
z-index: 1000;
display: none;
}
.overlay.open {
display: flex;
justify-content: flex-end;
}
.overlay-backdrop {
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.3);
}
.overlay-panel {
position: relative;
width: 22rem;
max-width: 100vw;
height: 100%;
background: var(--surface);
display: flex;
flex-direction: column;
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-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1rem 1.25rem;
border-bottom: 1px solid var(--outline-variant);
}
.overlay-header h2 {
font-size: 1rem;
font-weight: 600;
display: flex;
align-items: center;
gap: 0.5rem;
}
.overlay-header .close-btn {
background: none;
border: none;
cursor: pointer;
color: var(--on-surface-variant);
padding: 0.25rem;
border-radius: var(--border-radius-sm);
display: flex;
align-items: center;
justify-content: center;
}
.overlay-header .close-btn:hover {
background: var(--surface-container-high);
color: var(--on-surface);
}
.overlay-body {
flex: 1;
overflow-y: auto;
padding: 1.25rem;
}
.overlay-footer {
display: flex;
gap: 0.5rem;
justify-content: flex-end;
padding: 1rem 1.25rem;
border-top: 1px solid var(--outline-variant);
}
/* ========== CARD HEADER ACTIONS ========== */
.header-actions {
display: flex;
align-items: center;
gap: 0.5rem;
}
/* ========== TORT BADGE ========== */
.tort-badge {
display: inline-flex;
align-items: center;
justify-content: center;
width: 1.25rem;
height: 1.25rem;
border-radius: var(--border-radius-full);
background: var(--primary-container);
color: var(--primary);
flex-shrink: 0;
vertical-align: middle;
margin-right: 0.25rem;
}
.tort-badge .material-symbols-outlined {
font-size: 0.75rem;
}
/* ========== SEARCH INPUT UTILITY ========== */
.search-wrapper { position: relative; width: 11.25rem; }
.search-icon { position: absolute; left: 0.5rem; top: 50%; transform: translateY(-50%); font-size: 1rem; color: var(--on-surface-variant); pointer-events: none; }
.search-input { height: 1.75rem; padding-left: 1.75rem; padding-right: 0.5rem; font-size: 0.75rem; border: 1px solid var(--outline-variant); border-radius: var(--border-radius-sm); background: var(--surface-container-lowest); color: var(--on-surface); outline: none; width: 100%; }
/* ========== STATUS SELECT ========== */
.status-select { font-size: 0.75rem; font-weight: 600; padding: 0.25rem 0.375rem; border: 1px solid var(--outline-variant); border-radius: var(--border-radius-sm); background: var(--surface); color: var(--on-surface); cursor: pointer; }
/* ========== FONT UTILITIES ========== */
.font-bold { font-weight: 700; }
/* ========== CAKE BREAKDOWN LIST ========== */
.breakdown-list { list-style: none; padding: 0; margin: 0; }
.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; }
/* ========== FILTER BAR (catalogue/cakes page) ========== */
.filter-bar { padding: 0.5rem 1rem; border-bottom: 1px solid var(--outline-variant); display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; }
.filter-bar .filter-label { font-size: 0.75rem; font-weight: 600; color: var(--on-surface-variant); align-self: center; margin-right: 0.25rem; }
/* ========== CATALOGUE TAG ROW ========== */
.tag-row { padding: 0.5rem 1rem 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
/* ========== CATALOGUE SCROLL ========== */
.catalogue-scroll { overflow-y: auto; padding: 1rem; }
/* ========== BASKET ACTIONS ========== */
.basket-actions { display: flex; flex-direction: column; gap: 0.125rem; }
/* ========== TAG GROUP ========== */
.tag-group { margin-top: 0.25rem; display: flex; flex-wrap: wrap; gap: 0.125rem; }
/* ========== OVERLAY FORM ========== */
.overlay-form { display: flex; flex-direction: column; gap: 0.75rem; }
/* ========== TAG CONTAINER ========== */
.tag-grid { display: flex; flex-wrap: wrap; gap: 0.25rem; }
/* ========== FONT UTILITIES ========== */
.font-medium { font-weight: 500; }
/* ========== FLEX UTILITIES ========== */
.grow { flex: 1; }
.icon.sm { width: 1.75rem; height: 1.75rem; }
.icon.sm .material-symbols-outlined { font-size: 1rem; }
/* ========== RESULTS PANE ========== */
#results-pane { display: flex; flex-direction: column; gap: 1rem; }
/* ========== CONFIRMATION ========== */
section.confirmation {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex: 1;
gap: 0.5rem;
text-align: center;
.success-icon {
font-size: 3rem;
color: var(--success-text);
}
h2 {
font-size: 1.25rem;
font-weight: 600;
color: var(--on-surface);
}
}

View file

@ -0,0 +1,870 @@
/* ===== Material Icons sizing ===== */
.material-symbols-outlined {
font-size: 1.25rem;
}
/* ===== Card ===== */
.card {
background: var(--surface-white);
border: 1px solid var(--outline-dim);
border-radius: var(--radius-md);
display: flex;
flex-direction: column;
}
.card > header {
padding: var(--space-sm) var(--space-md);
border-bottom: 1px solid var(--outline-dim);
display: flex;
align-items: center;
justify-content: space-between;
background: var(--surface-low);
gap: var(--space-sm);
}
.card > header h2 .material-symbols-outlined {
color: var(--on-surface-dim);
}
.card > div, .card > form {
padding: var(--space-md);
flex: 1;
}
.card > footer {
padding: var(--space-sm) var(--space-md);
border-top: 1px solid var(--outline-dim);
display: flex;
justify-content: flex-end;
align-items: center;
gap: var(--space-sm);
flex-shrink: 0;
}
.card > table {
border-collapse: separate;
border-spacing: 0;
}
.card > table th:first-child { padding-left: var(--space-md); }
.card > table td:first-child { padding-left: var(--space-md); }
.card > table th:last-child { padding-right: var(--space-md); }
.card > table td:last-child { padding-right: var(--space-md); }
.card-sm {
max-width: 30rem;
}
/* ===== Button ===== */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: var(--space-sm);
padding: 0 var(--space-md);
height: 2.5rem;
border: none;
border-radius: var(--radius-sm);
font-size: 0.875rem;
font-weight: 600;
cursor: pointer;
transition: all var(--transition);
text-decoration: none;
white-space: nowrap;
}
.btn-primary {
background: var(--primary);
color: var(--on-primary);
}
.btn-primary:hover {
opacity: 0.9;
}
.btn-outline {
background: transparent;
border: 1px solid var(--outline-dim);
color: var(--on-surface);
}
.btn-outline:hover {
background: var(--surface-highest);
}
.btn-sm {
height: 2rem;
padding: 0 var(--space-sm);
font-size: 0.75rem;
}
.btn-icon {
color: var(--on-surface-dim);
cursor: pointer;
transition: color var(--transition);
background: none;
border: none;
padding: var(--space-xs);
border-radius: var(--radius-sm);
display: inline-flex;
align-items: center;
justify-content: center;
}
.btn-icon:hover {
color: var(--primary);
background: var(--surface-low);
}
.btn-icon .material-symbols-outlined {
font-size: 1.25rem;
}
.remove {
color: var(--error);
cursor: pointer;
transition: opacity var(--transition);
background: none;
border: none;
display: inline-flex;
align-items: center;
justify-content: center;
padding: var(--space-xs);
border-radius: var(--radius-sm);
}
.remove:hover {
opacity: 0.8;
background: var(--error-container);
}
.remove .material-symbols-outlined {
font-size: 1rem;
}
/* ===== Tag chip ===== */
.tag-chip {
display: inline-flex;
align-items: center;
padding: var(--space-xs) var(--space-sm);
border-radius: var(--radius-full);
font-size: 0.75rem;
font-weight: 600;
color: var(--on-surface-dim);
background: var(--surface-highest);
border: 1px solid var(--outline-dim);
cursor: pointer;
user-select: none;
transition: all var(--transition);
white-space: nowrap;
}
.tag-chip.sm {
font-size: 0.625rem;
padding: 0.125rem 0.375rem;
}
.tag-chip:hover, .tag-chip.active {
color: var(--primary);
border-color: var(--primary);
background: var(--primary-container);
}
.tag-chip input[type="checkbox"] {
display: none;
}
.tag-grid {
display: flex;
flex-wrap: wrap;
gap: var(--space-xs);
}
.tag-row {
padding: var(--space-sm) var(--space-md) 0;
display: flex;
flex-wrap: wrap;
gap: var(--space-xs);
}
.tag-group {
margin-top: var(--space-xs);
display: flex;
flex-wrap: wrap;
gap: 0.125rem;
}
/* ===== Toggle group ===== */
.toggle-group {
display: flex;
height: 2rem;
border-radius: var(--radius-sm);
border: 1px solid var(--outline-dim);
overflow: hidden;
}
.toggle-btn {
flex: 1;
border: none;
background: var(--surface-white);
color: var(--on-surface-dim);
font-size: 0.875rem;
font-weight: 600;
cursor: pointer;
transition: all var(--transition);
padding: 0 var(--space-sm);
}
.toggle-btn:not(:last-child) {
border-right: 1px solid var(--outline-dim);
}
.toggle-btn.active {
background: var(--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 {
font-weight: 700;
color: var(--primary);
text-decoration: none;
}
/* ===== Search ===== */
.search {
position: relative;
}
.search .material-symbols-outlined {
position: absolute;
left: var(--space-sm);
top: 50%;
transform: translateY(-50%);
font-size: 1rem;
color: var(--on-surface-dim);
pointer-events: none;
}
.search input {
padding-left: 1.75rem;
font-size: 0.875rem;
}
/* ===== Metrics grid ===== */
.metrics-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: var(--space-sm);
}
.metrics-grid > div {
background: var(--surface-white);
border: 1px solid var(--outline-dim);
border-radius: var(--radius-md);
padding: var(--space-md);
display: flex;
flex-direction: column;
gap: var(--space-xs);
}
.metrics-grid .label {
font-size: 0.75rem;
font-weight: 500;
color: var(--on-surface-dim);
letter-spacing: 0.02em;
display: flex;
align-items: center;
gap: var(--space-xs);
}
.metrics-grid .label .material-symbols-outlined {
font-size: 1rem;
}
.metrics-grid .value {
font-size: 1.75rem;
font-weight: 700;
line-height: 1.2;
}
.metrics-grid .change {
font-size: 0.75rem;
font-weight: 600;
}
/* ===== Split pane (order form) ===== */
.split-pane {
display: flex;
flex-direction: column;
gap: var(--space-md);
flex: 1;
min-height: 0;
}
.order-left {
flex: 1;
display: flex;
flex-direction: column;
gap: var(--space-md);
min-width: 0;
}
.order-aside {
width: 100%;
flex-shrink: 0;
display: flex;
flex-direction: column;
}
.order-aside .card {
flex: 1;
display: flex;
flex-direction: column;
}
#basket-items {
flex: 1;
overflow-y: auto;
padding: var(--space-md);
display: flex;
flex-direction: column;
gap: var(--space-sm);
}
#basket-items > li {
display: flex;
align-items: flex-start;
gap: var(--space-sm);
padding-bottom: var(--space-sm);
border-bottom: 1px solid var(--outline-dim);
}
.basket-item-body {
flex: 1;
min-width: 0;
}
.basket-item-body .name {
font-size: 0.875rem;
font-weight: 600;
}
.basket-item-body .detail {
font-size: 0.75rem;
color: var(--on-surface-dim);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.basket-item-tags {
margin-top: var(--space-xs);
display: flex;
flex-wrap: wrap;
gap: 0.125rem;
}
#basket-items .price {
font-size: 0.875rem;
font-weight: 600;
white-space: nowrap;
flex-shrink: 0;
}
.basket-item-actions {
display: flex;
flex-direction: column;
gap: 0.125rem;
flex-shrink: 0;
}
.basket-item-actions .btn-icon .material-symbols-outlined,
.basket-item-actions .remove .material-symbols-outlined {
font-size: 1rem;
}
.summary-totals {
padding: var(--space-md);
border-top: 1px solid var(--outline-dim);
background: var(--surface);
flex-shrink: 0;
}
.total-row {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 0.875rem;
color: var(--on-surface-dim);
}
.total-row + .total-row {
margin-top: var(--space-sm);
}
.total-row.grand {
font-size: 1rem;
font-weight: 700;
color: var(--on-surface);
padding-top: var(--space-sm);
border-top: 1px solid var(--outline-dim);
margin-top: var(--space-sm);
}
.btn-finalize {
width: 100%;
height: 2.5rem;
margin-top: var(--space-sm);
background: var(--primary);
color: var(--on-primary);
border: none;
border-radius: var(--radius-sm);
font-size: 0.875rem;
font-weight: 600;
display: flex;
align-items: center;
justify-content: center;
gap: var(--space-sm);
cursor: pointer;
transition: opacity var(--transition);
}
.btn-finalize:hover {
opacity: 0.9;
}
@media (min-width: 64em) {
.split-pane {
flex-direction: row;
}
.order-aside {
width: 20rem;
}
}
/* ===== Catalogue grid ===== */
.catalogue-search {
display: flex;
align-items: center;
gap: var(--space-sm);
}
.catalogue-scroll {
overflow-y: auto;
padding: var(--space-md);
}
#catalogue-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(8.75rem, 1fr));
gap: var(--space-sm);
}
#catalogue-grid > li {
border: 1px solid var(--outline-dim);
border-radius: var(--radius-sm);
padding: var(--space-sm);
display: flex;
flex-direction: column;
justify-content: space-between;
background: var(--surface);
transition: border-color var(--transition);
}
#catalogue-grid > li:hover {
border-color: var(--outline);
}
#catalogue-grid > li > div:first-child {
display: flex;
align-items: flex-start;
gap: var(--space-sm);
}
#catalogue-grid .icon {
width: 2rem;
height: 2rem;
border-radius: var(--radius-sm);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
font-size: 1rem;
}
#catalogue-grid .icon.cake {
background: var(--primary-container);
color: var(--primary);
}
#catalogue-grid .name {
font-size: 0.75rem;
font-weight: 600;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
#catalogue-grid .price {
font-size: 0.75rem;
color: var(--on-surface-dim);
}
#catalogue-grid .actions {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: var(--space-sm);
padding-top: var(--space-sm);
border-top: 1px solid var(--outline-dim);
}
#catalogue-grid .qty {
width: 1.5rem;
height: 1.5rem;
display: flex;
align-items: center;
justify-content: center;
border: none;
border-radius: var(--radius-sm);
cursor: pointer;
font-size: 1rem;
transition: all var(--transition);
}
#catalogue-grid .qty .material-symbols-outlined {
font-size: 1rem;
}
#catalogue-grid .qty.minus {
background: var(--surface-low);
color: var(--on-surface-dim);
}
#catalogue-grid .qty.minus:hover {
background: var(--outline-dim);
color: var(--on-surface);
}
#catalogue-grid .qty.plus {
background: var(--surface-highest);
color: var(--on-surface);
}
#catalogue-grid .qty.plus:hover {
background: var(--primary);
color: var(--on-primary);
}
#catalogue-grid .value {
font-size: 0.75rem;
font-weight: 500;
width: 1.5rem;
text-align: center;
}
/* ===== Overlay / Drawer ===== */
.overlay {
position: fixed;
inset: 0;
z-index: 1000;
display: none;
}
.overlay.open {
display: flex;
justify-content: flex-end;
}
.overlay-backdrop {
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.3);
}
.overlay-panel {
position: relative;
width: 22rem;
max-width: 100vw;
height: 100%;
background: var(--surface);
display: flex;
flex-direction: column;
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 {
display: flex;
align-items: center;
justify-content: space-between;
padding: var(--space-md) var(--space-lg);
border-bottom: 1px solid var(--outline-dim);
}
.overlay-panel > header h2 {
font-size: 1rem;
font-weight: 600;
display: flex;
align-items: center;
gap: var(--space-sm);
}
.overlay-panel > header .close-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;
}
.overlay-panel > header .close-btn:hover {
background: var(--surface-highest);
color: var(--on-surface);
}
.overlay-body {
flex: 1;
overflow-y: auto;
padding: var(--space-lg);
}
.overlay-body > div {
display: flex;
flex-direction: column;
gap: var(--space-sm);
}
.overlay-body label {
font-size: 0.75rem;
font-weight: 600;
color: var(--on-surface-dim);
letter-spacing: 0.02em;
}
.overlay-panel > footer {
display: flex;
gap: var(--space-sm);
justify-content: flex-end;
padding: var(--space-md) var(--space-lg);
border-top: 1px solid var(--outline-dim);
}
/* ===== Button center (special cakes card) ===== */
.button-center {
padding: var(--space-md);
text-align: center;
}
/* ===== Catalogue card ===== */
.card-catalogue {
flex: 1;
min-height: 12.5rem;
}
/* ===== Form grid ===== */
.form-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: var(--space-sm);
}
@media (max-width: 64em) {
.form-grid {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 48em) {
.form-grid {
grid-template-columns: 1fr;
}
}
label {
font-size: 0.75rem;
font-weight: 600;
color: var(--on-surface-dim);
letter-spacing: 0.02em;
}
label + input,
label + select,
label + textarea,
label + div:not(.tag-grid) {
margin-top: var(--space-xs);
}
input + label,
select + label,
textarea + label {
margin-top: var(--space-sm);
}
.form-grid label {
display: block;
font-size: 0.75rem;
font-weight: 600;
color: var(--on-surface-dim);
letter-spacing: 0.02em;
margin-bottom: var(--space-xs);
}
.form-grid > div {
display: flex;
flex-direction: column;
}
.col-span-2 {
grid-column: span 2;
}
/* ===== Horizontal group ===== */
.horizontal-group {
display: flex;
gap: var(--space-sm);
align-items: center;
flex-wrap: wrap;
}
/* ===== Form actions ===== */
.form-actions {
display: flex;
justify-content: flex-end;
gap: var(--space-sm);
padding-top: var(--space-sm);
}
/* ===== Preset group (date filter) ===== */
.preset-group {
display: flex;
}
.preset-btn {
padding: 0.375rem 0.625rem;
font-size: 0.875rem;
font-weight: 600;
color: var(--on-surface-dim);
text-decoration: none;
display: inline-flex;
align-items: center;
}
.preset-btn:hover, .preset-btn.active {
color: var(--primary);
}
/* ===== Filter bar ===== */
.filter-bar {
padding: var(--space-sm) var(--space-md);
border-bottom: 1px solid var(--outline-dim);
display: flex;
flex-wrap: wrap;
gap: var(--space-xs);
align-items: center;
}
.filter-bar .filter-label {
font-size: 0.75rem;
font-weight: 600;
color: var(--on-surface-dim);
}
/* ===== Header actions ===== */
.header-actions {
display: flex;
align-items: center;
gap: var(--space-sm);
}
/* ===== Confirmation ===== */
.confirmation {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex: 1;
gap: var(--space-sm);
text-align: center;
}
.confirmation .success-icon {
font-size: 3rem;
color: var(--success-text);
}
/* ===== Breakdown list ===== */
.breakdown-list {
list-style: none;
}
.breakdown-item {
display: flex;
justify-content: space-between;
padding: 0.375rem var(--space-md);
margin: 0 calc(-1 * var(--space-md));
border-bottom: 1px solid var(--outline-dim);
}
.breakdown-amount {
font-weight: 600;
}
.breakdown-empty {
color: var(--on-surface-dim);
font-size: 0.875rem;
}
/* ===== Icon ===== */
.icon {
width: 2rem;
height: 2rem;
border-radius: var(--radius-sm);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.icon.cake {
background: var(--primary-container);
color: var(--primary);
}
/* ===== Text utilities ===== */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--on-surface-dim); font-weight: 400; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.grow { flex: 1; }
/* ===== Empty state ===== */
.empty-state {
text-align: center;
padding: var(--space-md) 0;
color: var(--on-surface-dim);
}

View file

@ -1,126 +0,0 @@
/* ========== FORM ========== */
.form-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 0.75rem;
}
@media (max-width: 64em) {
.form-grid {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 48em) {
.form-grid {
grid-template-columns: 1fr;
}
}
.form-group,
.horizontal-group {
display: flex;
gap: 0.25rem;
&.form-group {
flex-direction: column;
}
&.horizontal-group {
align-items: center;
}
}
form {
& label {
font-size: 0.75rem;
font-weight: 600;
color: var(--on-surface-variant);
letter-spacing: 0.02em;
}
& input,
& select,
& textarea {
height: 2rem;
padding: 0 0.5rem;
border: 1px solid var(--outline-variant);
border-radius: var(--border-radius-sm);
background: var(--surface-container-lowest);
font-size: 0.75rem;
color: var(--on-surface);
outline: none;
transition: border-color var(--transition);
width: 100%;
&:focus {
border-color: var(--primary);
}
&::placeholder {
color: var(--on-surface-variant);
opacity: 0.6;
}
&:is(textarea) {
height: auto;
padding: 0.5rem;
resize: vertical;
}
&:is(select) {
appearance: auto;
}
}
}
.form-card {
max-width: 30rem;
.card > div {
display: flex;
flex-direction: column;
gap: 1rem;
}
}
/* ========== TOGGLE GROUP ========== */
.toggle-group {
display: flex;
height: 2rem;
border-radius: var(--border-radius-sm);
border: 1px solid var(--outline-variant);
overflow: hidden;
}
.toggle-btn {
flex: 1;
border: none;
background: var(--surface-container-lowest);
color: var(--on-surface-variant);
font-size: 0.75rem;
font-weight: 600;
cursor: pointer;
transition: all var(--transition);
padding: 0 0.5rem;
}
.toggle-btn:not(:last-child) {
border-right: 1px solid var(--outline-variant);
}
.toggle-btn.active {
background: var(--primary);
color: var(--on-primary);
}
.toggle-btn:not(.active):hover {
background: var(--surface-container-high);
}
.form-actions {
display: flex;
justify-content: flex-end;
gap: 0.5rem;
padding-top: 0.5rem;
border-top: 1px solid var(--outline-variant);
margin-top: 0.5rem;
}

View file

@ -1,361 +1,239 @@
/* ========== SIDEBAR ========== */
aside.sidebar {
position: fixed;
left: 0;
top: 0;
bottom: 0;
width: var(--sidebar-width);
background: var(--surface-container-lowest);
border-right: 1px solid var(--outline-variant);
display: flex;
flex-direction: column;
padding: 1rem;
z-index: 40;
transition: width 0.2s ease, padding 0.2s ease;
.brand {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 1.5rem;
padding: 0 0.5rem;
.collapse-btn {
background: none;
border: none;
cursor: pointer;
color: var(--on-surface-variant);
padding: 0.25rem;
border-radius: var(--border-radius-sm);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
&:hover {
background: var(--surface-container-high);
color: var(--on-surface);
}
.material-symbols-outlined {
font-size: 1.25rem;
}
}
.brand-text {
overflow: hidden;
white-space: nowrap;
h1 {
font-size: 1.25rem;
font-weight: 700;
color: var(--primary);
letter-spacing: -0.01em;
line-height: 1.3;
}
p {
font-size: 0.75rem;
color: var(--on-surface-variant);
margin-top: 0.25rem;
}
}
}
.cta {
width: 100%;
height: 2.5rem;
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
background: var(--primary);
color: var(--on-primary);
border: none;
border-radius: var(--border-radius-md);
font-size: 0.75rem;
font-weight: 600;
letter-spacing: 0.02em;
cursor: pointer;
text-decoration: none;
margin-bottom: 1.5rem;
transition: opacity var(--transition);
&:hover {
opacity: 0.9;
}
.material-symbols-outlined {
font-size: 1.25rem;
}
}
nav {
flex: 1;
display: flex;
flex-direction: column;
gap: 0.25rem;
a.link {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.75rem 1rem;
border-radius: var(--border-radius-md);
font-size: 0.75rem;
font-weight: 500;
text-decoration: none;
color: var(--on-surface-variant);
transition: all var(--transition);
cursor: pointer;
&:hover {
background: var(--surface-container-low);
color: var(--on-surface);
}
&.active {
background: var(--primary-container);
color: var(--primary);
font-weight: 700;
}
.material-symbols-outlined {
font-size: 1.25rem;
}
}
}
footer {
margin-top: auto;
padding-top: 1rem;
border-top: 1px solid var(--outline-variant);
.user {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.5rem;
margin-top: 0.75rem;
.avatar {
width: 2rem;
height: 2rem;
border-radius: 50%;
background: var(--surface-container-high);
display: flex;
align-items: center;
justify-content: center;
color: var(--on-surface);
font-size: 1rem;
font-weight: 700;
flex-shrink: 0;
}
.info {
display: flex;
flex-direction: column;
.name {
font-size: 0.75rem;
font-weight: 600;
color: var(--on-surface);
}
.status {
font-size: 0.75rem;
color: var(--on-surface-variant);
}
}
}
}
body {
display: grid;
grid-template-columns: var(--sidebar-w) 1fr;
grid-template-rows: var(--topnav-h) 1fr;
grid-template-areas:
"sidebar topnav"
"sidebar main";
height: 100dvh;
}
/* ---------- COLLAPSED ---------- */
body.sidebar-collapsed aside.sidebar {
width: 3.5rem;
padding: 0.5rem;
.brand .brand-text {
display: none;
}
.cta {
padding: 0;
width: 2.5rem;
height: 2.5rem;
margin-left: auto;
margin-right: auto;
border-radius: 50%;
span:not(.material-symbols-outlined) {
display: none;
}
}
nav a.link {
justify-content: center;
padding: 0.75rem 0.5rem;
span:not(.material-symbols-outlined) {
display: none;
}
}
footer .user .info {
display: none;
}
body.sidebar-collapsed {
grid-template-columns: var(--sidebar-w-collapsed) 1fr;
}
body.sidebar-collapsed main {
margin-left: 3.5rem;
width: calc(100% - 3.5rem);
/* ===== Sidebar ===== */
aside {
grid-area: sidebar;
background: var(--surface-white);
border-right: 1px solid var(--outline-dim);
display: flex;
flex-direction: column;
padding: var(--space-md);
gap: var(--space-sm);
overflow: hidden;
z-index: 40;
transition: width 0.2s ease, padding 0.2s ease;
}
/* ========== MAIN LAYOUT ========== */
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 {
width: 100%;
height: 2.5rem;
display: flex;
align-items: center;
justify-content: center;
gap: var(--space-sm);
background: var(--primary);
color: var(--on-primary);
border: none;
border-radius: var(--radius-md);
font-size: 0.875rem;
font-weight: 600;
cursor: pointer;
text-decoration: none;
transition: opacity var(--transition);
}
aside > .cta:hover {
opacity: 0.9;
}
aside > nav {
flex: 1;
display: flex;
flex-direction: column;
gap: var(--space-xs);
}
aside > nav > a {
display: flex;
align-items: center;
gap: var(--space-sm);
padding: var(--space-sm) var(--space-md);
border-radius: var(--radius-md);
font-size: 0.875rem;
font-weight: 500;
text-decoration: none;
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 {
background: var(--primary-container);
color: var(--primary);
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 {
grid-area: topnav;
border-bottom: 1px solid var(--outline-dim);
background: var(--surface);
display: flex;
align-items: center;
gap: var(--space-lg);
padding: 0 var(--space-lg);
flex-shrink: 0;
position: sticky;
top: 0;
z-index: 30;
}
.topnav > h1 {
margin-right: auto;
}
.topnav > .search {
position: relative;
width: 15rem;
}
.topnav > .search input {
height: 2rem;
padding-left: 2rem;
font-size: 0.875rem;
}
.topnav > .search .material-symbols-outlined {
position: absolute;
left: var(--space-sm);
top: 50%;
transform: translateY(-50%);
font-size: 1.25rem;
color: var(--on-surface-dim);
pointer-events: none;
}
/* ===== Main ===== */
main {
margin-left: var(--sidebar-width);
width: calc(100% - var(--sidebar-width));
display: flex;
flex-direction: column;
height: 100dvh;
transition: margin-left 0.2s ease, width 0.2s ease;
grid-area: main;
overflow-y: auto;
}
/* ========== TOP NAVBAR ========== */
header.topnav {
height: var(--topnav-height);
border-bottom: 1px solid var(--outline-variant);
background: var(--surface);
display: flex;
align-items: center;
gap: 1.5rem;
padding: 0 1.5rem;
flex-shrink: 0;
position: sticky;
top: 0;
z-index: 30;
h1 {
font-size: 1.25rem;
font-weight: 700;
color: var(--on-surface);
letter-spacing: -0.01em;
white-space: nowrap;
margin-right: auto;
}
search {
position: relative;
width: 15rem;
.material-symbols-outlined {
position: absolute;
left: 0.5rem;
top: 50%;
transform: translateY(-50%);
font-size: 1.25rem;
color: var(--on-surface-variant);
pointer-events: none;
}
input {
width: 100%;
height: 2rem;
padding: 0 0.5rem 0 2rem;
border: 1px solid var(--outline-variant);
border-radius: var(--border-radius-sm);
background: var(--surface-container-lowest);
font-size: 0.75rem;
color: var(--on-surface);
outline: none;
transition: border-color var(--transition);
&:focus {
border-color: var(--primary);
}
&::placeholder {
color: var(--on-surface-variant);
opacity: 0.6;
}
}
}
}
/* ========== MAIN CONTENT ========== */
.main-content {
flex: 1;
overflow-y: auto;
padding: 1rem;
display: flex;
flex-direction: column;
gap: 1rem;
padding: var(--space-md);
display: flex;
flex-direction: column;
gap: var(--space-md);
min-height: 0;
flex: 1;
}
/* ========== RESPONSIVE ========== */
/* ===== Responsive ===== */
@media (max-width: 64em) {
header.topnav search {
width: 10rem;
}
.topnav > .search {
width: 10rem;
}
}
@media (max-width: 48em) {
body:not(.sidebar-collapsed) aside.sidebar {
width: 3.5rem;
padding: 0.5rem;
aside {
width: var(--sidebar-w-collapsed);
padding: var(--space-xs);
align-items: center;
}
.brand .brand-text,
.cta span:not(.material-symbols-outlined),
nav a.link span:not(.material-symbols-outlined),
.user .info {
display: none;
}
aside > .cta {
width: 2.5rem;
height: 2.5rem;
padding: 0;
border-radius: 50%;
}
.cta {
padding: 0;
width: 2.5rem;
height: 2.5rem;
margin: 0 auto 1rem;
border-radius: 50%;
}
aside > .cta span:not(.material-symbols-outlined) {
display: none;
}
nav a.link {
justify-content: center;
padding: 0.75rem 0.5rem;
}
aside > nav > a {
justify-content: center;
padding: var(--space-sm);
}
.user {
justify-content: center;
}
}
aside > nav > a span:not(.material-symbols-outlined) {
display: none;
}
body.sidebar-collapsed aside.sidebar {
width: 0;
padding: 0;
overflow: hidden;
border-right: none;
}
body.sidebar-collapsed aside {
width: 0;
padding: 0;
overflow: hidden;
border-right: none;
}
body.sidebar-collapsed main {
margin-left: 0;
width: 100%;
}
body.sidebar-collapsed {
grid-template-columns: 0 1fr;
}
main {
margin-left: 3.5rem;
width: calc(100% - 3.5rem);
}
.topnav {
padding: 0 var(--space-sm);
}
header.topnav {
padding: 0 0.75rem;
.topnav > .search {
display: none;
}
search {
display: none;
}
}
.main-content {
padding: 0.5rem;
}
.main-content {
padding: var(--space-sm);
}
}

View file

@ -1,48 +1,58 @@
var subtotal = 0;
var editingSpecialId = null;
var activeCatalogueTags = [];
var activeCakeTags = [];
// ====== Sidebar ======
function toggleSidebar() {
document.body.classList.toggle('sidebar-collapsed');
localStorage.setItem('sidebarCollapsed', document.body.classList.contains('sidebar-collapsed'));
}
// ====== Overlay ======
function openSpecialCakeOverlay() {
editingSpecialId = null;
document.getElementById("sc-overlay-title").textContent = "Dodaj tort specjalny";
document.getElementById("sc-name").value = "";
document.getElementById("sc-price").value = "";
document.getElementById("sc-size").value = "";
document.getElementById("sc-shape").value = "";
document.getElementById("sc-flavour").value = "";
document.getElementById("sc-notes").value = "";
document.getElementById("sc-new-tag").value = "";
var cbs = document.querySelectorAll(".sc-tag-cb");
document.getElementById('sc-overlay-title').textContent = 'Dodaj tort specjalny';
document.getElementById('sc-name').value = '';
document.getElementById('sc-price').value = '';
document.getElementById('sc-size').value = '';
document.getElementById('sc-shape').value = '';
document.getElementById('sc-flavour').value = '';
document.getElementById('sc-notes').value = '';
document.getElementById('sc-new-tag').value = '';
var cbs = document.querySelectorAll('.sc-tag-cb');
for (var i = 0; i < cbs.length; i++) cbs[i].checked = false;
document.getElementById("sc-overlay").classList.add("open");
document.getElementById("sc-name").focus();
document.getElementById('sc-overlay').classList.add('open');
document.getElementById('sc-name').focus();
}
function closeSpecialCakeOverlay() {
document.getElementById("sc-overlay").classList.remove("open");
document.getElementById('sc-overlay').classList.remove('open');
editingSpecialId = null;
}
function getOverlayFormData() {
return {
name: document.getElementById("sc-name").value.trim(),
price: document.getElementById("sc-price").value,
size: document.getElementById("sc-size").value.trim(),
shape: document.getElementById("sc-shape").value,
flavour: document.getElementById("sc-flavour").value.trim(),
notes: document.getElementById("sc-notes").value.trim(),
name: document.getElementById('sc-name').value.trim(),
price: document.getElementById('sc-price').value,
size: document.getElementById('sc-size').value.trim(),
shape: document.getElementById('sc-shape').value,
flavour: document.getElementById('sc-flavour').value.trim(),
notes: document.getElementById('sc-notes').value.trim(),
tagIds: (function() {
var ids = [];
var cbs = document.querySelectorAll(".sc-tag-cb:checked");
var cbs = document.querySelectorAll('.sc-tag-cb:checked');
for (var i = 0; i < cbs.length; i++) ids.push(cbs[i].value);
return ids;
})(),
tagNames: (function() {
var names = [];
var cbs = document.querySelectorAll(".sc-tag-cb:checked");
var cbs = document.querySelectorAll('.sc-tag-cb:checked');
for (var i = 0; i < cbs.length; i++)
names.push(cbs[i].closest(".tag-chip").textContent.trim());
names.push(cbs[i].closest('.tag-chip').textContent.trim());
return names;
})(),
newTag: document.getElementById("sc-new-tag").value.trim()
newTag: document.getElementById('sc-new-tag').value.trim()
};
}
@ -50,30 +60,30 @@ function buildSpecialCakeHTML(d) {
var parts = [];
if (d.size) parts.push(d.size);
if (d.flavour) parts.push(d.flavour);
if (d.shape === "round") parts.push("okragly");
else if (d.shape === "square") parts.push("kwadrat");
if (d.notes) parts.push("notatka: " + d.notes);
var detail = parts.length ? parts.join(", ") : "";
var tagHtml = d.tagNames.length > 0 || d.newTag ? '<div style="margin-top:0.25rem;display:flex;flex-wrap:wrap;gap:0.125rem">' : "";
if (d.shape === 'round') parts.push('okragly');
else if (d.shape === 'square') parts.push('kwadrat');
if (d.notes) parts.push('notatka: ' + d.notes);
var detail = parts.length ? parts.join(', ') : '';
var tagHtml = d.tagNames.length > 0 || d.newTag ? '<div class="basket-item-tags">' : '';
for (var i = 0; i < d.tagNames.length; i++)
tagHtml += '<span class="tag-chip" style="font-size:0.625rem;padding:0.125rem 0.375rem">' + d.tagNames[i] + "</span>";
tagHtml += '<span class="tag-chip sm">' + d.tagNames[i] + '</span>';
if (d.newTag)
tagHtml += '<span class="tag-chip" style="font-size:0.625rem;padding:0.125rem 0.375rem">' + d.newTag + "</span>";
if (d.tagNames.length > 0 || d.newTag) tagHtml += "</div>";
tagHtml += '<span class="tag-chip sm">' + d.newTag + '</span>';
if (d.tagNames.length > 0 || d.newTag) tagHtml += '</div>';
var priceVal = Number(d.price).toFixed(2);
var tagIdsStr = d.tagIds.join(",");
var tagIdsStr = d.tagIds.join(',');
var html =
'<div style="flex:1;min-width:0;padding-right:0.5rem">' +
'<div class="basket-item-body">' +
'<div class="name">' + d.name + '</div>' +
'<div class="detail">' + detail + '</div>' +
tagHtml +
'</div>' +
'<div class="price">' + priceVal + ' PLN</div>' +
'<div style="display:flex;flex-direction:column;gap:0.125rem">' +
'<button type="button" class="action-btn" onclick="editSpecialCake(this)" title="Edytuj">' +
'<span class="material-symbols-outlined" style="font-size:1rem">edit</span></button>' +
'<div class="basket-item-actions">' +
'<button type="button" class="btn-icon" onclick="editSpecialCake(this)" title="Edytuj">' +
'<span class="material-symbols-outlined">edit</span></button>' +
'<button type="button" class="remove" onclick="removeSpecialCake(this)" title="Usuń">' +
'<span class="material-symbols-outlined" style="font-size:1rem">close</span></button>' +
'<span class="material-symbols-outlined">close</span></button>' +
'</div>' +
'<input type="hidden" name="special_name[]" value="' + d.name + '">' +
'<input type="hidden" name="special_price[]" value="' + d.price + '">' +
@ -97,162 +107,149 @@ function saveSpecialCake() {
}
} else {
d.id = Date.now();
var item = document.createElement("li");
item.setAttribute("data-special-id", d.id);
var item = document.createElement('li');
item.setAttribute('data-special-id', d.id);
item.innerHTML = buildSpecialCakeHTML(d);
document.getElementById("basket-items").appendChild(item);
document.getElementById('basket-items').appendChild(item);
}
closeSpecialCakeOverlay();
updateTotals();
}
function editSpecialCake(btn) {
var item = btn.closest("li");
var id = item.getAttribute("data-special-id");
var item = btn.closest('li');
var id = item.getAttribute('data-special-id');
editingSpecialId = id;
document.getElementById("sc-overlay-title").textContent = "Edytuj tort specjalny";
document.getElementById('sc-overlay-title').textContent = 'Edytuj tort specjalny';
var hidden = item.querySelectorAll('input[type="hidden"]');
var vals = {};
for (var i = 0; i < hidden.length; i++) {
var name = hidden[i].getAttribute("name");
var name = hidden[i].getAttribute('name');
vals[name] = hidden[i].value;
}
document.getElementById("sc-name").value = vals["special_name[]"] || "";
document.getElementById("sc-price").value = vals["special_price[]"] || "";
document.getElementById("sc-size").value = vals["special_size[]"] || "";
document.getElementById("sc-shape").value = vals["special_shape[]"] || "";
document.getElementById("sc-flavour").value = vals["special_flavour[]"] || "";
document.getElementById("sc-notes").value = vals["special_notes[]"] || "";
var currentTagIds = (vals["special_tags[]"] || "").split(",").filter(function(x) { return x; });
document.getElementById("sc-new-tag").value = "";
var cbs = document.querySelectorAll(".sc-tag-cb");
document.getElementById('sc-name').value = vals['special_name[]'] || '';
document.getElementById('sc-price').value = vals['special_price[]'] || '';
document.getElementById('sc-size').value = vals['special_size[]'] || '';
document.getElementById('sc-shape').value = vals['special_shape[]'] || '';
document.getElementById('sc-flavour').value = vals['special_flavour[]'] || '';
document.getElementById('sc-notes').value = vals['special_notes[]'] || '';
var currentTagIds = (vals['special_tags[]'] || '').split(',').filter(function(x) { return x; });
document.getElementById('sc-new-tag').value = '';
var cbs = document.querySelectorAll('.sc-tag-cb');
for (var i = 0; i < cbs.length; i++) {
cbs[i].checked = currentTagIds.indexOf(cbs[i].value) >= 0;
}
document.getElementById("sc-overlay").classList.add("open");
document.getElementById("sc-name").focus();
document.getElementById('sc-overlay').classList.add('open');
document.getElementById('sc-name').focus();
}
function removeSpecialCake(btn) {
var item = btn.closest("li");
item.remove();
btn.closest('li').remove();
updateTotals();
}
// ====== Basket ======
function changeCake(id, name, price, delta) {
var input = document.querySelector('[name="cake[' + id + ']"]');
if (input != null) {
var qty = Number(input.value) + delta;
if (qty <= 0) {
var item = input.closest("li");
if (item) item.remove();
input.closest('li').remove();
updateTotals();
updateCatalogueQty(id, 0);
return;
}
input.value = qty;
var item = input.closest("li");
item.querySelector(".qty").innerText = qty;
item.querySelector(".price").innerText = price * qty + " PLN";
var item = input.closest('li');
item.querySelector('.qty').innerText = qty;
item.querySelector('.price').innerText = price * qty + ' PLN';
updateTotals();
updateCatalogueQty(id, qty);
return;
}
if (delta <= 0) return;
var item = document.createElement("li");
item.setAttribute("data-cake-id", id);
var item = document.createElement('li');
item.setAttribute('data-cake-id', id);
item.innerHTML =
'<div style="flex:1;min-width:0;padding-right:0.5rem">' +
'<div class="name">' +
name +
"</div>" +
'<div class="detail">' +
price +
' PLN × <span class="qty">1</span></div>' +
"</div>" +
'<div class="price">' +
price +
" PLN</div>" +
'<div class="basket-item-body">' +
'<div class="name">' + name + '</div>' +
'<div class="detail">' + price + ' PLN × <span class="qty">1</span></div>' +
'</div>' +
'<div class="price">' + price + ' PLN</div>' +
'<button type="button" class="remove" onclick="removeCake(this)">' +
'<span class="material-symbols-outlined">close</span>' +
"</button>" +
'<input type="hidden" name="cake[' +
id +
']" value="1">';
document.getElementById("basket-items").appendChild(item);
'</button>' +
'<input type="hidden" name="cake[' + id + ']" value="1">';
document.getElementById('basket-items').appendChild(item);
updateTotals();
updateCatalogueQty(id, 1);
}
function removeCake(btn) {
var item = btn.closest("li");
var id = item.getAttribute("data-cake-id");
var item = btn.closest('li');
var id = item.getAttribute('data-cake-id');
item.remove();
updateTotals();
updateCatalogueQty(id, 0);
}
var subtotal = 0;
// ====== Totals ======
function updatePrepaid() {
var paid = Number(document.querySelector('[name="paid"]')?.value || 0);
document.getElementById("paid-amount").innerText = paid.toFixed(2) + " PLN";
document.getElementById("total-price").innerText = (subtotal - paid).toFixed(2) + " PLN";
document.getElementById('paid-amount').innerText = paid.toFixed(2) + ' PLN';
document.getElementById('total-price').innerText = (subtotal - paid).toFixed(2) + ' PLN';
}
function updateTotals() {
subtotal = 0;
var items = document.querySelectorAll("#basket-items li");
var items = document.querySelectorAll('#basket-items li');
items.forEach(function (item) {
var priceText = item.querySelector(".price").innerText;
var price = Number(priceText.split(" ")[0]);
if (item.hasAttribute("data-special-id")) {
var priceText = item.querySelector('.price').innerText;
var price = Number(priceText.split(' ')[0]);
if (item.hasAttribute('data-special-id')) {
subtotal += price;
} else {
var qty = Number(item.querySelector(".qty").innerText);
var qty = Number(item.querySelector('.qty').innerText);
subtotal += price * qty;
}
});
document.getElementById("subtotal-price").innerText = subtotal.toFixed(2) + " PLN";
document.getElementById('subtotal-price').innerText = subtotal.toFixed(2) + ' PLN';
updatePrepaid();
}
function updateCatalogueQty(id, qty) {
var el = document.getElementById("qty-" + id);
var el = document.getElementById('qty-' + id);
if (el) el.innerText = qty;
}
var activeCatalogueTags = [];
// ====== Catalogue Filters ======
function toggleCatalogueTagFilter(btn) {
var tag = btn.getAttribute("data-tag");
var tag = btn.getAttribute('data-tag');
var idx = activeCatalogueTags.indexOf(tag);
if (idx >= 0) {
activeCatalogueTags.splice(idx, 1);
btn.classList.remove("active");
btn.classList.remove('active');
} else {
activeCatalogueTags.push(tag);
btn.classList.add("active");
btn.classList.add('active');
}
applyCatalogueFilters();
}
function getCatalogueTextQuery() {
var input = document.querySelector(
'#catalogue-grid').closest('.card').querySelector('input[type="text"]'
);
return input ? input.value.toLowerCase() : "";
var input = document.querySelector('#catalogue-grid').closest('.card').querySelector('input[type="text"]');
return input ? input.value.toLowerCase() : '';
}
function applyCatalogueFilters() {
var query = getCatalogueTextQuery();
var items = document.querySelectorAll("#catalogue-grid > li");
var items = document.querySelectorAll('#catalogue-grid > li');
items.forEach(function (item) {
var name = item.getAttribute("data-name").toLowerCase();
var name = item.getAttribute('data-name').toLowerCase();
var matchesText = name.includes(query);
var matchesTags = true;
if (activeCatalogueTags.length > 0) {
var itemTags = (item.getAttribute("data-tags") || "").split(",");
var itemTags = (item.getAttribute('data-tags') || '').split(',');
for (var i = 0; i < activeCatalogueTags.length; i++) {
if (itemTags.indexOf(activeCatalogueTags[i]) < 0) {
matchesTags = false;
@ -260,7 +257,7 @@ function applyCatalogueFilters() {
}
}
}
item.style.display = matchesText && matchesTags ? "" : "none";
item.style.display = matchesText && matchesTags ? '' : 'none';
});
}
@ -268,12 +265,97 @@ function filterCatalogue(input) {
applyCatalogueFilters();
}
// ====== Cakes Table Filters ======
function toggleCakeTagFilter(btn) {
var tag = btn.getAttribute('data-tag');
var idx = activeCakeTags.indexOf(tag);
if (idx >= 0) {
activeCakeTags.splice(idx, 1);
btn.classList.remove('active');
} else {
activeCakeTags.push(tag);
btn.classList.add('active');
}
var rows = document.querySelectorAll('#cakes-table tbody tr');
for (var i = 0; i < rows.length; i++) {
if (activeCakeTags.length === 0) { rows[i].style.display = ''; continue; }
var rowTags = (rows[i].getAttribute('data-tags') || '').split(',');
var match = false;
for (var j = 0; j < activeCakeTags.length; j++) {
if (rowTags.indexOf(activeCakeTags[j]) >= 0) { match = true; break; }
}
rows[i].style.display = match ? '' : 'none';
}
}
// ====== Order Table Filters ======
function filterOrders(input) {
var q = input.value.toLowerCase();
var table = input.closest('.card').querySelector('.data-table');
if (!table) return;
var rows = table.querySelectorAll('tbody tr');
for (var i = 0; i < rows.length; i++) {
var id = rows[i].children[0].textContent.toLowerCase();
var customer = rows[i].children[1].textContent.toLowerCase();
rows[i].style.display = id.includes(q) || customer.includes(q) ? '' : 'none';
}
}
// ====== Location Toggle ======
function setLocation(btn, value) {
var group = btn.closest('.toggle-group');
group.querySelectorAll('.toggle-btn').forEach(function(b) { b.classList.remove('active'); });
btn.classList.add('active');
group.querySelector('input[type="hidden"]').value = value;
}
// ====== Blocked Date Confirmation ======
function confirmBlockedDate(form) {
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') || '[]');
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 confirm('Data ' + date + ' jest zablokowana dla zamówień z tortami specjalnymi. Czy na pewno chcesz kontynuować?');
}
return true;
}
// ====== Init ======
function initOrderPage() {
var form = document.querySelector('.order-form');
if (!form) return;
var state = form.getAttribute('data-state');
if (state) {
try {
var data = JSON.parse(state);
for (var id in data) {
updateCatalogueQty(Number(id), data[id]);
}
} catch(e) {}
}
updateTotals();
}
function setActiveLink() {
var path = window.location.pathname;
var links = document.querySelectorAll('.link');
for (var i = 0; i < links.length; i++) {
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() {
setSidebarState();
setActiveLink();
initOrderPage();
});
document.addEventListener('htmx:afterSettle', function() {
setActiveLink();
initOrderPage();
});

View file

@ -1,7 +1,3 @@
@import url("base.css");
@import url("layout.css");
@import url("card.css");
@import url("form.css");
@import url("catalogue.css");
@import url("basket.css");
@import url("component.css");
@import url("components.css");

View file

@ -11,7 +11,7 @@ templ BlockedPage(blocked []models.BlockedDate) {
}
templ BlockedMain(blocked []models.BlockedDate) {
<section class="card" style="max-width:30rem">
<section class="card card-sm">
<header>
<h2>
<span class="material-symbols-outlined">block</span>
@ -19,19 +19,19 @@ templ BlockedMain(blocked []models.BlockedDate) {
</h2>
</header>
<div>
<form method="POST" action="/blocked" class="horizontal-group" style="gap:0.5rem;margin-bottom:1rem">
<input type="date" name="date" required class="form-input" style="width:auto"/>
<button type="submit" class="btn primary">Zablokuj</button>
<form method="POST" action="/blocked" class="horizontal-group">
<input type="date" name="date" required/>
<button type="submit" class="btn btn-primary">Zablokuj</button>
</form>
if len(blocked) == 0 {
<p class="text-muted" style="text-align:center;padding:1rem 0">Brak zablokowanych terminów</p>
<p class="empty-state">Brak zablokowanych terminów</p>
} else {
<ul class="breakdown-list">
for _, b := range blocked {
<li class="breakdown-item">
<span>{ b.Date }</span>
<form method="POST" action={ templ.URL("/blocked/" + strconv.Itoa(b.ID) + "/delete") } style="display:inline">
<button type="submit" class="action-btn" title="Usuń">
<form method="POST" action={ templ.URL("/blocked/" + strconv.Itoa(b.ID) + "/delete") }>
<button type="submit" class="btn-icon" title="Usuń">
<span class="material-symbols-outlined">close</span>
</button>
</form>

View file

@ -11,51 +11,43 @@ templ CakePage(cake models.Cake, allTags []models.Tag) {
}
templ CakeForm(cake models.Cake, allTags []models.Tag) {
<div class="form-card">
<section class="card">
<header>
<h2>
<span class="material-symbols-outlined">cake</span>
if cake.ID != 0 {
Edytuj ciasto #{ strconv.Itoa(cake.ID) }
} else {
Nowe ciasto
}
</h2>
</header>
<form method="post">
<input type="hidden" name="id" value={ strconv.Itoa(cake.ID) }/>
<div class="form-group">
<label>Nazwa *</label>
<input class="form-input" type="text" name="name" value={ cake.Name } placeholder="Nazwa ciasta"/>
</div>
<div class="form-group">
<label>Cena</label>
<input class="form-input" type="number" name="price" min="0" value={ cake.Price.String() }/>
</div>
<div class="form-group">
<label>Tagi</label>
<div class="tag-grid">
for _, t := range allTags {
<label class="tag-chip">
<input type="checkbox" name="tag" value={ strconv.Itoa(t.ID) } style="display:none"
if cakeHasTag(cake.Tags, t.ID) { checked }/>
{ t.Name }
</label>
}
</div>
<div class="horizontal-group" style="margin-top:0.375rem">
<input class="form-input grow" type="text" name="new_tag" placeholder="Nowy tag..."/>
</div>
</div>
<div class="form-actions">
<a href="/cakes" class="btn outline">Anuluj</a>
<button type="submit" class="btn primary">
<span class="material-symbols-outlined">save</span>
Zapisz ciasto
</button>
</div>
</form>
</section>
<div class="card card-sm">
<header>
<h2>
<span class="material-symbols-outlined">cake</span>
if cake.ID != 0 {
Edytuj ciasto #{ strconv.Itoa(cake.ID) }
} else {
Nowe ciasto
}
</h2>
</header>
<form method="post">
<input type="hidden" name="id" value={ strconv.Itoa(cake.ID) }/>
<label>Nazwa *</label>
<input type="text" name="name" value={ cake.Name } placeholder="Nazwa ciasta"/>
<label>Cena</label>
<input type="number" name="price" min="0" value={ cake.Price.String() }/>
<label>Tagi</label>
<div class="tag-grid">
for _, t := range allTags {
<label class="tag-chip">
<input type="checkbox" name="tag" value={ strconv.Itoa(t.ID) } class="hidden"
if cakeHasTag(cake.Tags, t.ID) { checked }/>
{ t.Name }
</label>
}
</div>
<div class="horizontal-group">
<input type="text" name="new_tag" placeholder="Nowy tag..."/>
</div>
<div class="form-actions">
<a href="/cakes" class="btn btn-outline">Anuluj</a>
<button type="submit" class="btn btn-primary">
<span class="material-symbols-outlined">save</span>
Zapisz ciasto
</button>
</div>
</form>
</div>
}

View file

@ -17,7 +17,7 @@ templ CakesMain(cakes []models.Cake, allTags []models.Tag) {
<span class="material-symbols-outlined">inventory_2</span>
Zarządzanie katalogiem
</h2>
<a href="/cake" class="btn primary sm">
<a href="/cake" class="btn btn-primary btn-sm">
<span class="material-symbols-outlined">add</span>
Nowe ciasto
</a>
@ -30,62 +30,41 @@ templ CakesMain(cakes []models.Cake, allTags []models.Tag) {
}
</div>
}
<div class="table-container">
<table class="data-table" id="cakes-table">
<thead>
<tr>
<th style="width:2rem"></th>
<th>Nazwa</th>
<th>SKU</th>
<th>Tagi</th>
<th class="right">Cena bazowa</th>
<th class="center"></th>
<table class="data-table" id="cakes-table">
<thead>
<tr>
<th></th>
<th>Nazwa</th>
<th>SKU</th>
<th>Tagi</th>
<th class="text-right">Cena bazowa</th>
<th class="text-center"></th>
</tr>
</thead>
<tbody>
for _, c := range cakes {
<tr data-tags={ tagNames(c.Tags) }>
<td>
<div class="icon cake">
<span class="material-symbols-outlined">cake</span>
</div>
</td>
<td class="font-medium">{ c.Name }</td>
<td class="text-muted">#{ strconv.Itoa(c.ID) }</td>
<td>
for _, t := range c.Tags {
<span class="tag-chip">{ t.Name }</span>
}
</td>
<td class="text-right">{ c.Price.String() } PLN</td>
<td class="text-center">
<a href={ templ.URL("/cake/" + strconv.Itoa(c.ID)) } class="btn-icon">
<span class="material-symbols-outlined">edit</span>
</a>
</td>
</tr>
</thead>
<tbody>
for _, c := range cakes {
<tr data-tags={ tagNames(c.Tags) }>
<td>
<div class="icon cake sm">
<span class="material-symbols-outlined">cake</span>
</div>
</td>
<td class="font-medium">{ c.Name }</td>
<td class="text-muted">#{ strconv.Itoa(c.ID) }</td>
<td>
for _, t := range c.Tags {
<span class="tag-chip">{ t.Name }</span>
}
</td>
<td class="text-right">{ c.Price.String() } PLN</td>
<td class="text-center">
<a href={ templ.URL("/cake/" + strconv.Itoa(c.ID)) } class="action-btn">
<span class="material-symbols-outlined">edit</span>
</a>
</td>
</tr>
}
</tbody>
</table>
</div>
</section>
<script>
var activeCakeTags = [];
function toggleCakeTagFilter(btn) {
var tag = btn.getAttribute('data-tag');
var idx = activeCakeTags.indexOf(tag);
if (idx >= 0) { activeCakeTags.splice(idx, 1); btn.classList.remove('active'); }
else { activeCakeTags.push(tag); btn.classList.add('active'); }
var rows = document.querySelectorAll('#cakes-table tbody tr');
for (var i = 0; i < rows.length; i++) {
if (activeCakeTags.length === 0) { rows[i].style.display = ''; continue; }
var rowTags = (rows[i].getAttribute('data-tags') || '').split(',');
var match = false;
for (var j = 0; j < activeCakeTags.length; j++) {
if (rowTags.indexOf(activeCakeTags[j]) >= 0) { match = true; break; }
}
rows[i].style.display = match ? '' : 'none';
}
}
</script>
</tbody>
</table>
</section>
}

View file

@ -10,7 +10,7 @@ templ ConfirmationBody(id int) {
<section class="confirmation">
<span class="material-symbols-outlined success-icon">check_circle</span>
<h2>{ strconv.Itoa(id) } — zapisano</h2>
<a href="/orders" class="btn primary" style="margin-top:1rem">
<a href="/orders" class="btn btn-primary">
<span class="material-symbols-outlined">arrow_back</span>
Powrót do zamówień
</a>

View file

@ -2,7 +2,6 @@ package templates
import (
"encoding/json"
"fmt"
"strconv"
"strings"
@ -83,14 +82,4 @@ func blockedDatesJSON(dates []models.BlockedDate) string {
return string(b)
}
func orderScript(order models.Order) string {
var b strings.Builder
b.WriteString("<script>")
if order.ID != 0 {
for _, c := range order.Cakes {
b.WriteString(fmt.Sprintf("updateCatalogueQty(%d,%d);", c.ID, c.Amount))
}
}
b.WriteString("updateTotals();</script>")
return b.String()
}

View file

@ -14,7 +14,7 @@ templ Layout(title string, header, main templ.Component) {
<script src="/static/order.js"></script>
</head>
<body>
<aside class="sidebar">
<aside>
@Nav()
</aside>
<main id="main">
@ -26,44 +26,6 @@ templ Layout(title string, header, main templ.Component) {
@main
</div>
</main>
<script>
function filterOrders(input) {
var q = input.value.toLowerCase();
var table = input.closest('.card').querySelector('.data-table');
if (!table) return;
var rows = table.querySelectorAll('tbody tr');
for (var i = 0; i < rows.length; i++) {
var id = rows[i].children[0].textContent.toLowerCase();
var customer = rows[i].children[1].textContent.toLowerCase();
rows[i].style.display = id.includes(q) || customer.includes(q) ? '' : 'none';
}
}
(function() {
function setActiveLink() {
var path = window.location.pathname;
var links = document.querySelectorAll('.link');
for (var i = 0; i < links.length; i++) {
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);
}
setActiveLink();
setSidebarState();
document.addEventListener('htmx:afterSettle', setActiveLink);
})();
function toggleSidebar() {
var collapsed = document.body.classList.toggle('sidebar-collapsed');
localStorage.setItem('sidebarCollapsed', collapsed);
}
</script>
</body>
</html>
}

View file

@ -1,15 +1,9 @@
package templates
templ Nav() {
<div class="brand">
<button type="button" class="collapse-btn" onclick="toggleSidebar()" title="Zwiń / Rozwiń">
<span class="material-symbols-outlined">menu</span>
</button>
<div class="brand-text">
<h1>Cake Order</h1>
<p>Tracker</p>
</div>
</div>
<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">
<span class="material-symbols-outlined">add</span>
<span>Nowe zamówienie</span>

View file

@ -1,6 +1,7 @@
package templates
import (
"encoding/json"
"strconv"
"git.bronku.xyz/bronku/cake-order-tracker/models"
@ -11,7 +12,7 @@ templ OrderPage(order models.Order, catalogue []models.Cake, allTags []models.Ta
}
templ OrderForm(order models.Order, catalogue []models.Cake, allTags []models.Tag, blockedDates []models.BlockedDate) {
<form method="post" class="split-pane" onsubmit="return confirmBlockedDate(this)" data-blocked-dates={ blockedDatesJSON(blockedDates) }>
<form method="post" class="split-pane order-form" onsubmit="return confirmBlockedDate(this)" data-blocked-dates={ blockedDatesJSON(blockedDates) } data-state={ orderStateJSON(order) }>
<input type="hidden" name="id" value={ strconv.Itoa(order.ID) }/>
<div class="order-left">
<section class="card">
@ -23,19 +24,19 @@ templ OrderForm(order models.Order, catalogue []models.Cake, allTags []models.Ta
</header>
<div>
<div class="form-grid">
<div class="form-group">
<div>
<label>Imię *</label>
<input class="form-input" type="text" name="name" value={ order.Name } placeholder="Jan"/>
<input type="text" name="name" value={ order.Name } placeholder="Jan"/>
</div>
<div class="form-group">
<div>
<label>Nazwisko *</label>
<input class="form-input" type="text" name="surname" value={ order.Surname } placeholder="Kowalski"/>
<input type="text" name="surname" value={ order.Surname } placeholder="Kowalski"/>
</div>
<div class="form-group">
<div>
<label>Telefon</label>
<input class="form-input" type="tel" name="phone" value={ order.Phone } placeholder="+48 123 456 789"/>
<input type="tel" name="phone" value={ order.Phone } placeholder="+48 123 456 789"/>
</div>
<div class="form-group">
<div>
<label>Lokalizacja</label>
<div class="toggle-group">
<input type="hidden" name="location" value={ order.Location }/>
@ -43,17 +44,17 @@ templ OrderForm(order models.Order, catalogue []models.Cake, allTags []models.Ta
<button type="button" class={ "toggle-btn", templ.KV("active", order.Location == "Somonino") } onclick="setLocation(this, 'Somonino')">Somonino</button>
</div>
</div>
<div class="form-group">
<div>
<label>Data dostawy *</label>
<input class="form-input" type="date" name="date" value={ order.Date.Format("2006-01-02") }/>
<input type="date" name="date" value={ order.Date.Format("2006-01-02") }/>
</div>
<div class="form-group">
<div>
<label>Zaliczka</label>
<input class="form-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 class="form-group" style="grid-column:span 2">
<div class="col-span-2">
<label>Uwagi</label>
<input class="form-input" type="text" placeholder="Alergie, specjalne życzenia..."/>
<input type="text" placeholder="Alergie, specjalne życzenia..."/>
</div>
</div>
</div>
@ -65,22 +66,22 @@ templ OrderForm(order models.Order, catalogue []models.Cake, allTags []models.Ta
Torty specjalne
</h2>
</header>
<div style="padding:1rem;text-align:center">
<button type="button" class="btn outline" onclick="openSpecialCakeOverlay()">
<div class="button-center">
<button type="button" class="btn btn-outline" onclick="openSpecialCakeOverlay()">
<span class="material-symbols-outlined">add</span>
Dodaj tort specjalny
</button>
</div>
</section>
<section class="card" style="flex:1;min-height:12.5rem">
<section class="card card-catalogue">
<header>
<h2>
<span class="material-symbols-outlined">inventory_2</span>
Katalog produktów
</h2>
<div class="search-wrapper">
<span class="material-symbols-outlined search-icon">search</span>
<input class="search-input" type="text" placeholder="Filtruj produkty..." oninput="filterCatalogue(this)"/>
<div class="search">
<span class="material-symbols-outlined">search</span>
<input type="text" placeholder="Filtruj produkty..." oninput="filterCatalogue(this)"/>
</div>
</header>
if len(allTags) > 0 {
@ -98,7 +99,7 @@ templ OrderForm(order models.Order, catalogue []models.Cake, allTags []models.Ta
<div class="icon cake">
<span class="material-symbols-outlined">cake</span>
</div>
<div style="min-width:0">
<div>
<div class="name">{ c.Name }</div>
<div class="price">{ c.Price.String() } PLN</div>
</div>
@ -119,7 +120,7 @@ templ OrderForm(order models.Order, catalogue []models.Cake, allTags []models.Ta
</section>
</div>
<aside class="order-aside">
<section class="card grow">
<section class="card">
<header>
<h2>
<span class="material-symbols-outlined">receipt_long</span>
@ -129,7 +130,7 @@ templ OrderForm(order models.Order, catalogue []models.Cake, allTags []models.Ta
<ul id="basket-items">
for _, c := range order.Cakes {
<li data-cake-id={ strconv.Itoa(c.ID) }>
<div>
<div class="basket-item-body">
<div class="name">{ c.Name }</div>
<div class="detail">{ c.Price.String() } PLN × <span class="qty">{ strconv.Itoa(c.Amount) }</span></div>
</div>
@ -142,11 +143,11 @@ templ OrderForm(order models.Order, catalogue []models.Cake, allTags []models.Ta
}
for _, s := range order.SpecialCakes {
<li data-special-id={ strconv.Itoa(s.ID) }>
<div>
<div class="basket-item-body">
<div class="name">{ s.Name }</div>
<div class="detail">{ specialCakeDetail(s) }</div>
if len(s.Tags) > 0 {
<div class="tag-group">
<div class="basket-item-tags">
for _, t := range s.Tags {
<span class="tag-chip sm">{ t.Name }</span>
}
@ -154,9 +155,9 @@ templ OrderForm(order models.Order, catalogue []models.Cake, allTags []models.Ta
}
</div>
<div class="price">{ s.Price.String() } PLN</div>
<div class="basket-actions">
<button type="button" class="action-btn" onclick="editSpecialCake(this)" title="Edytuj">
<span class="material-symbols-outlined" style="font-size:1rem">edit</span>
<div class="basket-item-actions">
<button type="button" class="btn-icon" onclick="editSpecialCake(this)" title="Edytuj">
<span class="material-symbols-outlined">edit</span>
</button>
<button type="button" class="remove" onclick="removeSpecialCake(this)" title="Usuń">
<span class="material-symbols-outlined">close</span>
@ -195,15 +196,13 @@ templ OrderForm(order models.Order, catalogue []models.Cake, allTags []models.Ta
</form>
@SpecialCakeOverlay(allTags)
@templ.Raw(orderScript(order))
<script>
function setLocation(btn, value) {
var group = btn.closest('.toggle-group');
group.querySelectorAll('.toggle-btn').forEach(function(b) { b.classList.remove('active'); });
btn.classList.add('active');
group.querySelector('input[type=hidden]').value = value;
}
</script>
}
func orderStateJSON(order models.Order) string {
state := make(map[int]int)
for _, c := range order.Cakes {
state[c.ID] = c.Amount
}
b, _ := json.Marshal(state)
return string(b)
}

View file

@ -11,13 +11,13 @@ templ OrdersPage(first, last, today, tomorrow, special string, counts models.Ord
}
templ DateForm(first, last, today, tomorrow, special string) {
<div class="horizontal-group" style="gap:0.5rem;flex-wrap:wrap">
<div class="horizontal-group">
<div class="preset-group">
<a href={ templ.URL("/orders?from=" + today + "&to=" + today + "&special=" + special) } hx-get={ templ.URL("/orders?from=" + today + "&to=" + today + "&special=" + special) } hx-target="#results-pane" class="preset-btn">Dzisiaj</a>
<a href={ templ.URL("/orders?from=" + tomorrow + "&to=" + tomorrow + "&special=" + special) } hx-get={ templ.URL("/orders?from=" + tomorrow + "&to=" + tomorrow + "&special=" + special) } hx-target="#results-pane" class="preset-btn">Jutro</a>
<a href={ templ.URL("/orders?special=" + special) } hx-get={ templ.URL("/orders?special=" + special) } hx-target="#results-pane" class="preset-btn">W tym tygodniu</a>
</div>
<form method="GET" action="/orders" class="horizontal-group" style="align-items:center;gap:0.25rem" hx-get="/orders" hx-target="#results-pane" hx-trigger="change, keyup delay:500ms">
<form method="GET" action="/orders" class="horizontal-group" hx-get="/orders" hx-target="#results-pane" hx-trigger="change, keyup delay:500ms">
<label>Od</label>
<input type="date" name="from" value={ first }/>
<label>Do</label>
@ -65,32 +65,30 @@ templ OrdersContent(orders []models.Order, cakeCounts []models.CakeCount, first,
<a href={ templ.URL("/orders?from=" + first + "&to=" + last) } hx-get={ templ.URL("/orders?from=" + first + "&to=" + last) } hx-target="#results-pane"
class={ "preset-btn", templ.KV("active", special != "true") }>Wszystkie</a>
</div>
<div class="search-wrapper">
<span class="material-symbols-outlined search-icon">search</span>
<input type="text" class="search-input" placeholder="Szukaj..." oninput="filterOrders(this)"/>
<div class="search">
<span class="material-symbols-outlined">search</span>
<input type="text" placeholder="Szukaj..." oninput="filterOrders(this)"/>
</div>
</div>
</header>
<div class="table-container">
<table class="data-table">
<thead>
<tr>
<th>ID zamówienia</th>
<th>Klient</th>
<th>Data odbioru</th>
<th>Pozycje</th>
<th class="right">Suma</th>
<th class="center">Status</th>
<th class="center"></th>
</tr>
</thead>
<tbody>
for _, o := range orders {
@OrderRow(o)
}
</tbody>
</table>
</div>
<table class="data-table">
<thead>
<tr>
<th>ID zamówienia</th>
<th>Klient</th>
<th>Data odbioru</th>
<th>Pozycje</th>
<th class="text-right">Suma</th>
<th class="text-center">Status</th>
<th class="text-center"></th>
</tr>
</thead>
<tbody>
for _, o := range orders {
@OrderRow(o)
}
</tbody>
</table>
</section>
@CakeBreakdown(cakeCounts)
}
@ -98,15 +96,13 @@ templ OrdersContent(orders []models.Order, cakeCounts []models.CakeCount, first,
templ OrderRow(order models.Order) {
<tr>
<td><a href={ templ.URL("/order/" + strconv.Itoa(order.ID)) } class="order-id">#{ strconv.Itoa(order.ID) }</a></td>
<td class="customer">{ order.Surname } { order.Name }<br/><span class="text-muted">{ order.Phone }</span></td>
<td>{ order.Surname } { order.Name }<br/><span class="text-muted">{ order.Phone }</span></td>
<td class="text-muted">{ order.Date.Format("2006-01-02 15:04") }</td>
<td>
if len(order.SpecialCakes) > 0 {
<span class="tort-badge" title="Tort specjalny">
<span class="material-symbols-outlined">cake</span>
</span>
<span class="material-symbols-outlined" title="Tort specjalny">cake</span>
}
<span class="truncate" title={ orderItemsDesc(order) }>
<span title={ orderItemsDesc(order) }>
for i, c := range order.Cakes {
if i > 0 {
{ ", " }
@ -121,7 +117,7 @@ templ OrderRow(order models.Order) {
</td>
<td class="text-right font-bold">{ order.Total().String() } PLN</td>
<td class="text-center">
<select name="status" class="status-select"
<select name="status"
hx-post={ templ.URL("/order/" + strconv.Itoa(order.ID) + "/status") }
hx-trigger="change"
hx-target="closest tr"
@ -154,7 +150,7 @@ templ OrderRow(order models.Order) {
</select>
</td>
<td class="text-center">
<a href={ templ.URL("/order/" + strconv.Itoa(order.ID)) } class="action-btn">
<a href={ templ.URL("/order/" + strconv.Itoa(order.ID)) } class="btn-icon">
<span class="material-symbols-outlined">edit</span>
</a>
</td>

View file

@ -10,7 +10,7 @@ templ SpecialCakeOverlay(allTags []models.Tag) {
<div id="sc-overlay" class="overlay">
<div class="overlay-backdrop" onclick="closeSpecialCakeOverlay()"></div>
<div class="overlay-panel">
<div class="overlay-header">
<header>
<h2>
<span class="material-symbols-outlined">cake_add</span>
<span id="sc-overlay-title">Dodaj tort specjalny</span>
@ -18,62 +18,48 @@ templ SpecialCakeOverlay(allTags []models.Tag) {
<button type="button" class="close-btn" onclick="closeSpecialCakeOverlay()">
<span class="material-symbols-outlined">close</span>
</button>
</div>
</header>
<div class="overlay-body">
<div class="overlay-form">
<div class="form-group">
<label>Nazwa *</label>
<input class="form-input" type="text" id="sc-name" placeholder="Nazwa tortu"/>
</div>
<div class="form-group">
<label>Cena *</label>
<input class="form-input" type="number" id="sc-price" min="0" step="0.01" placeholder="0.00"/>
</div>
<div class="form-group">
<label>Wielkość</label>
<input class="form-input" type="text" id="sc-size" placeholder="np. 20cm, 30x40"/>
</div>
<div class="form-group">
<label>Kształt</label>
<select class="form-input" id="sc-shape">
<option value="">—</option>
<option value="round">Okrągły</option>
<option value="square">Kwadrat</option>
</select>
</div>
<div class="form-group">
<label>Smak</label>
<input class="form-input" type="text" id="sc-flavour" placeholder="np. czekoladowy"/>
</div>
<div class="form-group">
<label>Notatki</label>
<input class="form-input" type="text" id="sc-notes" placeholder="Dodatkowe informacje"/>
</div>
<div>
<label>Nazwa *</label>
<input type="text" id="sc-name" placeholder="Nazwa tortu"/>
<label>Cena *</label>
<input type="number" id="sc-price" min="0" step="0.01" placeholder="0.00"/>
<label>Wielkość</label>
<input type="text" id="sc-size" placeholder="np. 20cm, 30x40"/>
<label>Kształt</label>
<select id="sc-shape">
<option value="">—</option>
<option value="round">Okrągły</option>
<option value="square">Kwadrat</option>
</select>
<label>Smak</label>
<input type="text" id="sc-flavour" placeholder="np. czekoladowy"/>
<label>Notatki</label>
<input type="text" id="sc-notes" placeholder="Dodatkowe informacje"/>
if len(allTags) > 0 {
<div class="form-group">
<label>Tagi</label>
<div class="tag-grid" id="sc-overlay-tags">
for _, t := range allTags {
<label class="tag-chip">
<input type="checkbox" class="sc-tag-cb" value={ strconv.Itoa(t.ID) } style="display:none"/>
{ t.Name }
</label>
}
</div>
<div class="horizontal-group" style="margin-top:0.375rem">
<input class="form-input grow" type="text" id="sc-new-tag" placeholder="Nowy tag..."/>
</div>
<label>Tagi</label>
<div class="tag-grid" id="sc-overlay-tags">
for _, t := range allTags {
<label class="tag-chip">
<input type="checkbox" class="sc-tag-cb" value={ strconv.Itoa(t.ID) }/>
{ t.Name }
</label>
}
</div>
<div class="horizontal-group">
<input type="text" id="sc-new-tag" placeholder="Nowy tag..."/>
</div>
}
</div>
</div>
<div class="overlay-footer">
<button type="button" class="btn outline" onclick="closeSpecialCakeOverlay()">Anuluj</button>
<button type="button" class="btn primary" onclick="saveSpecialCake()">
<footer>
<button type="button" class="btn btn-outline" onclick="closeSpecialCakeOverlay()">Anuluj</button>
<button type="button" class="btn btn-primary" onclick="saveSpecialCake()">
<span class="material-symbols-outlined">check</span>
Zapisz
</button>
</div>
</footer>
</div>
</div>
}