feat: Abgeholt-Status + Archiv-Drawer für abgeschlossene Bestellungen

This commit is contained in:
2026-06-16 20:21:46 +02:00
parent fe6fc33165
commit ca2bdc3267
3 changed files with 115 additions and 2 deletions

View File

@@ -77,8 +77,16 @@ router.put('/:id', authenticate, (req, res) => {
bezahlt_am = req.body.bezahlt ? new Date().toISOString() : null;
}
db.prepare('UPDATE orders SET name=?,bemerkung=?,status=?,custom_price=?,bezahlt=?,bezahlt_am=?,updated_at=CURRENT_TIMESTAMP WHERE id=? AND user_id=?')
.run(name, bemerkung, status, custom_price, bezahlt, bezahlt_am, req.params.id, uid(req));
// Abgeholt-Status mit Datum
let abgeholt = ex.abgeholt;
let abgeholt_am = ex.abgeholt_am;
if (req.body.abgeholt !== undefined) {
abgeholt = req.body.abgeholt ? 1 : 0;
abgeholt_am = req.body.abgeholt ? new Date().toISOString() : null;
}
db.prepare('UPDATE orders SET name=?,bemerkung=?,status=?,custom_price=?,bezahlt=?,bezahlt_am=?,abgeholt=?,abgeholt_am=?,updated_at=CURRENT_TIMESTAMP WHERE id=? AND user_id=?')
.run(name, bemerkung, status, custom_price, bezahlt, bezahlt_am, abgeholt, abgeholt_am, req.params.id, uid(req));
res.json(loadOrder(req.params.id, uid(req)));
});