order form

This commit is contained in:
bronku 2026-06-16 16:37:48 +02:00
parent 2465956fc2
commit 4666618151
2 changed files with 165 additions and 189 deletions

View file

@ -71,36 +71,16 @@ main {
grid-column: 1 / -1; grid-column: 1 / -1;
display: grid; display: grid;
grid-template-columns: 1fr 1fr; grid-template-columns: 1fr 1fr;
grid-auto-flow: column;
gap: var(--space-md); gap: var(--space-md);
} }
@media (max-width: 48em) { #order {
.topnav { display: grid;
padding: 0 var(--space-sm); grid-template-columns: auto 20rem;
gap: var(--space-xs); grid-template-rows: auto auto auto 1fr;
} > aside {
grid-column: 2;
.topnav > nav > a span:not(.material-symbols-outlined) { grid-row: span;
display: none;
}
.topnav > .cta span:not(.material-symbols-outlined) {
display: none;
}
.topnav > .cta {
width: 2.25rem;
height: 2.25rem;
padding: 0;
border-radius: 50%;
justify-content: center;
}
.main-content {
padding: var(--space-sm);
}
.topnav > h1 {
font-size: 1rem;
} }
} }

View file

@ -9,182 +9,178 @@ import (
) )
templ OrderForm(dto dto.OrderPage) { templ OrderForm(dto dto.OrderPage) {
<form method="post" class="split-pane order-form" onsubmit="return confirmBlockedDate(this)" data-blocked-dates={ blockedDatesJSON(dto.BlockedDates) } data-state={ orderStateJSON(dto.Order) }> <form method="post" id="order" onsubmit="return confirmBlockedDate(this)" data-blocked-dates={ blockedDatesJSON(dto.BlockedDates) } data-state={ orderStateJSON(dto.Order) }>
<input type="hidden" name="id" value={ dto.Order.ID }/> <input type="hidden" name="id" value={ dto.Order.ID }/>
<div class="order-left"> <section class="card">
<section class="card"> <header>
<header> <h2>
<h2> <span class="material-symbols-outlined">person_add</span>
<span class="material-symbols-outlined">person_add</span> Dane klienta
Dane klienta </h2>
</h2> </header>
</header> <div>
<div> <div class="form-grid">
<div class="form-grid"> <div>
<div> <label>Imię *</label>
<label>Imię *</label> <input type="text" name="name" value={ dto.Order.Name } placeholder="Jan"/>
<input type="text" name="name" value={ dto.Order.Name } placeholder="Jan"/> </div>
</div> <div>
<div> <label>Nazwisko *</label>
<label>Nazwisko *</label> <input type="text" name="surname" value={ dto.Order.Surname } placeholder="Kowalski"/>
<input type="text" name="surname" value={ dto.Order.Surname } placeholder="Kowalski"/> </div>
</div> <div>
<div> <label>Telefon</label>
<label>Telefon</label> <input type="tel" name="phone" value={ dto.Order.Phone } placeholder="+48 123 456 789"/>
<input type="tel" name="phone" value={ dto.Order.Phone } placeholder="+48 123 456 789"/> </div>
</div> <div>
<div> <label>Lokalizacja</label>
<label>Lokalizacja</label> <div class="toggle-group">
<div class="toggle-group"> <input type="hidden" name="location" value={ dto.Order.Location }/>
<input type="hidden" name="location" value={ dto.Order.Location }/> <button type="button" class={ "toggle-btn", templ.KV("active", dto.Order.Location == "Kartuzy") } onclick="setLocation(this, 'Kartuzy')">Kartuzy</button>
<button type="button" class={ "toggle-btn", templ.KV("active", dto.Order.Location == "Kartuzy") } onclick="setLocation(this, 'Kartuzy')">Kartuzy</button> <button type="button" class={ "toggle-btn", templ.KV("active", dto.Order.Location == "Somonino") } onclick="setLocation(this, 'Somonino')">Somonino</button>
<button type="button" class={ "toggle-btn", templ.KV("active", dto.Order.Location == "Somonino") } onclick="setLocation(this, 'Somonino')">Somonino</button>
</div>
</div>
<div>
<label>Data dostawy *</label>
<input type="date" name="date" value={ dto.Order.Date.Format("2006-01-02") }/>
</div>
<div>
<label>Zaliczka</label>
<input type="number" name="paid" min="0" step="0.01" value={ dto.Order.Paid.String() } oninput={ templ.JSFuncCall("updatePrepaid") }/>
</div> </div>
</div> </div>
</div> <div>
</section> <label>Data dostawy *</label>
<section class="card"> <input type="date" name="date" value={ dto.Order.Date.Format("2006-01-02") }/>
<header>
<h2>
<span class="material-symbols-outlined">cake_add</span>
Torty specjalne
</h2>
</header>
<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 card-catalogue">
<header>
<h2>
<span class="material-symbols-outlined">inventory_2</span>
Katalog produktów
</h2>
<div class="search">
<span class="material-symbols-outlined">search</span>
<input type="text" placeholder="Filtruj produkty..." oninput="filterCatalogue(this)"/>
</div> </div>
</header> <div>
if len(dto.Tags) > 0 { <label>Zaliczka</label>
<div class="tag-row"> <input type="number" name="paid" min="0" step="0.01" value={ dto.Order.Paid.String() } oninput={ templ.JSFuncCall("updatePrepaid") }/>
for _, t := range dto.Tags {
<button type="button" class="tag-chip" data-tag={ t.Name } onclick="toggleCatalogueTagFilter(this)">{ t.Name }</button>
}
</div> </div>
}
<div class="catalogue-scroll">
<ul id="catalogue-grid">
for _, c := range dto.Catalogue {
<li data-name={ c.Name } data-tags={ tagNames(c.Tags) }>
<div>
<div class="icon cake">
<span class="material-symbols-outlined">cake</span>
</div>
<div>
<div class="name">{ c.Name }</div>
<div class="price">{ c.Price.String() } PLN</div>
</div>
</div>
<div class="actions">
<button type="button" class="qty minus" onclick={ templ.JSFuncCall("changeCake", c.ID, c.Name, c.Price.String(), -1) }>
<span class="material-symbols-outlined">remove</span>
</button>
<span class="value" id={ "qty-" + strconv.Itoa(c.ID) }>0</span>
<button type="button" class="qty plus" onclick={ templ.JSFuncCall("changeCake", c.ID, c.Name, c.Price.String(), 1) }>
<span class="material-symbols-outlined">add</span>
</button>
</div>
</li>
}
</ul>
</div> </div>
</section> </div>
</div> </section>
<aside class="order-aside"> <section class="card">
<section class="card"> <header>
<header> <h2>
<h2> <span class="material-symbols-outlined">cake_add</span>
<span class="material-symbols-outlined">receipt_long</span> Torty specjalne
Podsumowanie </h2>
</h2> </header>
</header> <div class="button-center">
<ul id="basket-items"> <button type="button" class="btn btn-outline" onclick="openSpecialCakeOverlay()">
for _, c := range dto.Order.Cakes { <span class="material-symbols-outlined">add</span>
<li data-cake-id={ strconv.Itoa(c.ID) }> Dodaj tort specjalny
<div class="basket-item-body"> </button>
<div class="name">{ c.Name }</div> </div>
<div class="detail">{ c.Price.String() } PLN × <span class="qty">{ strconv.Itoa(c.Amount) }</span></div> </section>
</div> <section class="card card-catalogue">
<div class="price">{ c.Total().String() } PLN</div> <header>
<button type="button" class="remove" onclick="removeCake(this)"> <h2>
<span class="material-symbols-outlined">close</span> <span class="material-symbols-outlined">inventory_2</span>
</button> Katalog produktów
<input type="hidden" name={ "cake[" + strconv.Itoa(c.ID) + "]" } value={ strconv.Itoa(c.Amount) }/> </h2>
</li> <div class="search">
<span class="material-symbols-outlined">search</span>
<input type="text" placeholder="Filtruj produkty..." oninput="filterCatalogue(this)"/>
</div>
</header>
if len(dto.Tags) > 0 {
<div class="tag-row">
for _, t := range dto.Tags {
<button type="button" class="tag-chip" data-tag={ t.Name } onclick="toggleCatalogueTagFilter(this)">{ t.Name }</button>
} }
for _, s := range dto.Order.SpecialCakes { </div>
<li data-special-id={ strconv.Itoa(s.ID) }> }
<div class="basket-item-body"> <div class="catalogue-scroll">
<div class="name">{ s.Name }</div> <ul id="catalogue-grid">
<div class="detail">{ s.Detail() }</div> for _, c := range dto.Catalogue {
if len(s.Tags) > 0 { <li data-name={ c.Name } data-tags={ tagNames(c.Tags) }>
<div class="basket-item-tags"> <div>
for _, t := range s.Tags { <div class="icon cake">
<span class="tag-chip sm">{ t.Name }</span> <span class="material-symbols-outlined">cake</span>
} </div>
</div> <div>
} <div class="name">{ c.Name }</div>
<div class="price">{ c.Price.String() } PLN</div>
</div>
</div> </div>
<div class="price">{ s.Price.String() } PLN</div> <div class="actions">
<div class="basket-item-actions"> <button type="button" class="qty minus" onclick={ templ.JSFuncCall("changeCake", c.ID, c.Name, c.Price.String(), -1) }>
<button type="button" class="btn-icon" onclick="editSpecialCake(this)" title="Edytuj"> <span class="material-symbols-outlined">remove</span>
<span class="material-symbols-outlined">edit</span>
</button> </button>
<button type="button" class="remove" onclick="removeSpecialCake(this)" title="Usuń"> <span class="value" id={ "qty-" + strconv.Itoa(c.ID) }>0</span>
<span class="material-symbols-outlined">close</span> <button type="button" class="qty plus" onclick={ templ.JSFuncCall("changeCake", c.ID, c.Name, c.Price.String(), 1) }>
<span class="material-symbols-outlined">add</span>
</button> </button>
</div> </div>
<input type="hidden" name="special_name[]" value={ s.Name }/>
<input type="hidden" name="special_price[]" value={ s.Price.String() }/>
<input type="hidden" name="special_size[]" value={ s.Size }/>
<input type="hidden" name="special_shape[]" value={ s.Shape }/>
<input type="hidden" name="special_flavour[]" value={ s.Flavour }/>
<input type="hidden" name="special_notes[]" value={ s.Notes }/>
<input type="hidden" name="special_tags[]" value={ tagIDsComma(s.Tags) }/>
</li> </li>
} }
</ul> </ul>
<div class="summary-totals"> </div>
<div class="total-row"> </section>
<span>Subtotal</span> <aside class="card">
<span id="subtotal-price">{ dto.Order.Subtotal().String() } PLN</span> <header>
</div> <h2>
<div class="total-row"> <span class="material-symbols-outlined">receipt_long</span>
<span>Zaliczka</span> Podsumowanie
<span id="paid-amount">{ dto.Order.Paid.String() } PLN</span> </h2>
</div> </header>
<div class="total-row grand"> <ul id="basket-items">
<span>Do zapłaty</span> for _, c := range dto.Order.Cakes {
<span id="total-price">{ dto.Order.Total().String() } PLN</span> <li data-cake-id={ strconv.Itoa(c.ID) }>
</div> <div class="basket-item-body">
<button type="submit" class="btn-finalize"> <div class="name">{ c.Name }</div>
<span class="material-symbols-outlined">check_circle</span> <div class="detail">{ c.Price.String() } PLN × <span class="qty">{ strconv.Itoa(c.Amount) }</span></div>
Finalizuj zamówienie </div>
</button> <div class="price">{ c.Total().String() } PLN</div>
<button type="button" class="remove" onclick="removeCake(this)">
<span class="material-symbols-outlined">close</span>
</button>
<input type="hidden" name={ "cake[" + strconv.Itoa(c.ID) + "]" } value={ strconv.Itoa(c.Amount) }/>
</li>
}
for _, s := range dto.Order.SpecialCakes {
<li data-special-id={ strconv.Itoa(s.ID) }>
<div class="basket-item-body">
<div class="name">{ s.Name }</div>
<div class="detail">{ s.Detail() }</div>
if len(s.Tags) > 0 {
<div class="basket-item-tags">
for _, t := range s.Tags {
<span class="tag-chip sm">{ t.Name }</span>
}
</div>
}
</div>
<div class="price">{ s.Price.String() } PLN</div>
<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>
</button>
</div>
<input type="hidden" name="special_name[]" value={ s.Name }/>
<input type="hidden" name="special_price[]" value={ s.Price.String() }/>
<input type="hidden" name="special_size[]" value={ s.Size }/>
<input type="hidden" name="special_shape[]" value={ s.Shape }/>
<input type="hidden" name="special_flavour[]" value={ s.Flavour }/>
<input type="hidden" name="special_notes[]" value={ s.Notes }/>
<input type="hidden" name="special_tags[]" value={ tagIDsComma(s.Tags) }/>
</li>
}
</ul>
<div class="summary-totals">
<div class="total-row">
<span>Subtotal</span>
<span id="subtotal-price">{ dto.Order.Subtotal().String() } PLN</span>
</div> </div>
</section> <div class="total-row">
<span>Zaliczka</span>
<span id="paid-amount">{ dto.Order.Paid.String() } PLN</span>
</div>
<div class="total-row grand">
<span>Do zapłaty</span>
<span id="total-price">{ dto.Order.Total().String() } PLN</span>
</div>
<button type="submit" class="btn-finalize">
<span class="material-symbols-outlined">check_circle</span>
Finalizuj zamówienie
</button>
</div>
</aside> </aside>
</form> </form>
@SpecialCakeOverlay(dto.Tags) @SpecialCakeOverlay(dto.Tags)