läuft
This commit is contained in:
79
templates/product_detail.gohtml
Normal file
79
templates/product_detail.gohtml
Normal file
@@ -0,0 +1,79 @@
|
||||
{{define "title"}}Produkt – Kücheninventar{{end}}
|
||||
{{define "content"}}
|
||||
<section class="card">
|
||||
<div class="flex-between">
|
||||
<div class="flex">
|
||||
{{if .Product.ImagePath}}<img class="cover" src="{{.Product.ImagePath}}" alt="{{.Product.Name}}"/>
|
||||
{{else}}<div class="cover placeholder">Kein Bild</div>{{end}}
|
||||
<div>
|
||||
<h2>{{.Product.Name}}</h2>
|
||||
{{if .Product.Manufacturer}}<div class="muted">{{.Product.Manufacturer}}</div>{{end}}
|
||||
{{if .Product.Size}}<div>Größe: {{.Product.Size}}</div>{{end}}
|
||||
<div>Bevorzugter Händler: {{if .Product.PreferredVendor}}{{.Product.PreferredVendor}}{{else}}–{{end}}</div>
|
||||
<div>Bestand: <strong>{{.Product.CurrentStock}}</strong>{{if gt .Product.MinStock 0}} / Min {{.Product.MinStock}}{{end}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<form method="post" action="/products/{{.Product.ID}}">
|
||||
<div class="form-inline">
|
||||
<label>Min:<input type="number" min="0" name="min_stock" value="{{.Product.MinStock}}"/></label>
|
||||
<label>Händler:<input name="preferred_vendor" value="{{.Product.PreferredVendor}}"/></label>
|
||||
<label>Größe:<input name="size" value="{{.Product.Size}}"/></label>
|
||||
<label>Hersteller:<input name="manufacturer" value="{{.Product.Manufacturer}}"/></label>
|
||||
<button class="btn">Speichern</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<section class="card">
|
||||
<h3>Nächste ablaufende Einheit</h3>
|
||||
{{if .Next}}
|
||||
<div class="flex-between">
|
||||
<div><span>Ablaufdatum: {{dateHuman .Next.ExpiryDate}}</span></div>
|
||||
<form method="post" action="/units/{{.Next.ID}}/checkout?from=/products/{{.Product.ID}}">
|
||||
<button class="btn danger">Ausbuchen</button>
|
||||
</form>
|
||||
</div>
|
||||
{{else}}
|
||||
<p class="muted">Keine Einheiten vorhanden.</p>
|
||||
{{end}}
|
||||
</section>
|
||||
|
||||
|
||||
<section class="card">
|
||||
<h3>Einheiten</h3>
|
||||
{{if .Units}}
|
||||
<table class="table">
|
||||
<thead><tr><th>#</th><th>Ablaufdatum</th><th>Aktion</th></tr></thead>
|
||||
<tbody>
|
||||
{{range .Units}}
|
||||
<tr>
|
||||
<td>{{.ID}}</td>
|
||||
<td>{{dateHuman .ExpiryDate}}</td>
|
||||
<td>
|
||||
<form method="post" action="/units/{{.ID}}/checkout?from=/products/{{$.Product.ID}}">
|
||||
<button class="btn sm">Ausbuchen</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{else}}
|
||||
<p class="muted">Noch keine Einheiten angelegt.</p>
|
||||
{{end}}
|
||||
|
||||
|
||||
<details>
|
||||
<summary>Einheiten hinzufügen</summary>
|
||||
<form method="post" action="/products/{{.Product.ID}}/add-units">
|
||||
<div class="form-inline">
|
||||
<label>Menge:<input type="number" min="1" value="1" name="quantity"/></label>
|
||||
<label>Ablaufdatum:<input type="date" name="expiry_date" required/></label>
|
||||
<button class="btn">Hinzufügen</button>
|
||||
</div>
|
||||
</form>
|
||||
</details>
|
||||
</section>
|
||||
{{end}}
|
||||
Reference in New Issue
Block a user