1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
{% extends 'base.html' %} {% from 'macros.html' import due with context %} {% block title %}{{ a.name }}{% endblock %} {% block content %} <div class="page-head"> <div><div class="crumb"><a href="/lager">Lager</a>{% if a.category %} · {{ a.category }}{% endif %}</div><h1>{{ a.name }}{% if not a.active %} <span class="badge">inaktiv</span>{% endif %}</h1> <small>{{ [a.article_no, a.supplier, a.location]|select|join(' · ') }}</small></div> <div class="actions"> <form method="post" action="/lager/{{ a.id }}/bestellt"><input type="hidden" name="csrf_token" value="{{ csrf }}"> <button>{{ '✔ bestellt am ' ~ (a.ordered_on|d) ~ ' – zurücknehmen' if a.ordered_on else 'Als bestellt markieren' }}</button></form> <a class="btn" href="/etiketten/druck?typ=a&id={{ a.id }}&format=62x29">QR-Etikett</a> {% if is_leitung %}<a class="btn" href="/lager/{{ a.id }}/bearbeiten">Bearbeiten</a>{% endif %} </div> </div> {% if scan %} <div class="callout {{ 'bad' if scan.expired else 'info' }}">📷 Gescannt{% if scan.lot %}: Charge <b>{{ scan.lot }}</b>{% endif %}{% if scan.expiry %} · verwendbar bis <b>{{ scan.expiry|d }}</b>{% endif %}. {% if scan.expired %}<b>Achtung: Verfallsdatum überschritten!</b>{% elif scan.lot_id %}Diese Charge ist am Lager – unten entnehmen.{% elif scan.lot and a.track_lots %}Diese Charge ist noch nicht gebucht – unten als Zugang einbuchen.{% else %}Unten entnehmen oder einbuchen.{% endif %}</div> {% endif %} <div class="stats"> <div class="stat {{ 'bad' if a.stock <= 0 else ('warn' if a.min_stock and a.stock <= a.min_stock else 'good') }}"><div class="num">{{ a.stock|num }}</div><div class="lbl">{{ a.unit }} auf Lager</div></div> <div class="stat"><div class="num">{{ a.min_stock|num }}</div><div class="lbl">Mindestbestand</div></div> {% if a.order_qty %}<div class="stat"><div class="num">{{ a.order_qty|num }}</div><div class="lbl">übliche Bestellmenge</div></div>{% endif %} </div> <div class="grid two"> <div class="panel"> <h2>Entnahme</h2> <form method="post" action="/lager/{{ a.id }}/entnahme"> <input type="hidden" name="csrf_token" value="{{ csrf }}"> <div class="form-grid"> <div class="field"><label>Menge ({{ a.unit }})</label><input type="text" inputmode="decimal" name="qty" value="1" required></div> {% if a.track_lots %}<div class="field"><label>Charge</label><select name="lot_id"><option value="">automatisch (kürzester Verfall zuerst)</option> {% for l in lots %}<option value="{{ l.id }}" {{ 'selected' if scan and scan.lot_id == l.id }}>{{ l.lot_no or '–' }} · {{ l.quantity|num }} · bis {{ l.expiry|d }}</option>{% endfor %}</select></div>{% endif %} <div class="field full"><label>Notiz</label><input type="text" name="note" placeholder="optional, z. B. Behandlungszimmer"></div> </div> <div class="form-actions"><button class="primary">− Entnehmen</button></div> </form> </div> <div class="panel"> <h2>Zugang (Lieferung)</h2> <form method="post" action="/lager/{{ a.id }}/zugang"> <input type="hidden" name="csrf_token" value="{{ csrf }}"> <div class="form-grid"> <div class="field"><label>Menge ({{ a.unit }})</label><input type="text" inputmode="decimal" name="qty" value="{{ a.order_qty|num if a.order_qty else 1 }}" required></div> {% if a.track_lots %} <div class="field"><label>Charge / LOT *</label><input type="text" name="lot_no" required value="{{ scan.lot if scan and scan.lot else '' }}"></div> <div class="field"><label>Verwendbar bis</label><input type="date" name="expiry" value="{{ scan.expiry.isoformat() if scan and scan.expiry else '' }}"></div> {% endif %} <div class="field {{ 'full' if not a.track_lots }}"><label>Notiz</label><input type="text" name="note" placeholder="Lieferschein-Nr. …"></div> </div> <div class="form-actions"><button class="good">+ Einbuchen</button></div> </form> </div> </div> <div class="panel flush table-wrap" style="margin-top:1.1rem"> <h2>Bestand {{ 'nach Charge' if a.track_lots else '' }}</h2> {% if lots %} <form method="post" action="/lager/{{ a.id }}/inventur"> <input type="hidden" name="csrf_token" value="{{ csrf }}"> <table> <thead><tr>{% if a.track_lots %}<th>Charge</th><th>Verwendbar bis</th>{% endif %}<th class="num">Menge</th>{% if is_leitung %}<th>Inventur: Ist-Bestand</th>{% endif %}<th></th></tr></thead> <tbody>{% for l in lots %} <tr>{% if a.track_lots %}<td>{{ l.lot_no or '–' }}</td><td>{{ due(l.expiry, 30) if l.expiry else '–' }}</td>{% endif %} <td class="num">{{ l.quantity|num }} {{ a.unit }}</td> {% if is_leitung %}<td><input type="text" inputmode="decimal" name="lot_{{ l.id }}" style="max-width:110px" placeholder="{{ l.quantity|num }}"></td>{% endif %} <td>{% if l.expiry and due_status(l.expiry, 0) == 'overdue' %} <button class="small danger" formaction="/lager/{{ a.id }}/verfall/{{ l.id }}" data-confirm="Charge {{ l.lot_no }} komplett als verfallen/entsorgt ausbuchen?">Entsorgt ausbuchen</button>{% endif %}</td></tr> {% endfor %}</tbody> </table> {% if is_leitung %}<div style="padding:.8rem 1.2rem"><button>Inventur speichern</button> <small class="muted">nur ausgefüllte Felder werden übernommen</small></div>{% endif %} </form> {% else %}<div class="empty">Kein Bestand.</div>{% endif %} </div> <div class="panel flush table-wrap"> <h2>Bewegungen</h2> {% if moves %} <table> <thead><tr><th>Zeit</th><th>Art</th><th class="num">Menge</th>{% if a.track_lots %}<th>Charge</th>{% endif %}<th>Wer</th><th>Notiz</th></tr></thead> <tbody>{% for m in moves %} <tr><td>{{ m.created_at|d }}</td><td>{{ STOCK_KINDS.get(m.kind, m.kind) }}</td> <td class="num {{ 'cell-ok' if m.delta > 0 else 'cell-overdue' }}">{{ '+' if m.delta > 0 }}{{ m.delta|num }}</td> {% if a.track_lots %}<td>{{ m.lot.lot_no if m.lot else '–' }}</td>{% endif %} <td>{{ m.user.full_name }}</td><td>{{ m.note or '' }}</td></tr> {% endfor %}</tbody> </table> {% else %}<div class="empty">Noch keine Bewegungen.</div>{% endif %} </div> {% endblock %}