feat: Datum-Picker beim Bezahlt/Abgeholt markieren

This commit is contained in:
2026-06-18 01:30:21 +02:00
parent 336ad848fc
commit fa68a9083b
2 changed files with 91 additions and 10 deletions

View File

@@ -69,20 +69,24 @@ router.put('/:id', authenticate, (req, res) => {
if (!ex) return res.status(404).json({ error: 'Nicht gefunden' });
const { name=ex.name, bemerkung=ex.bemerkung, status=ex.status, custom_price=ex.custom_price } = req.body;
// Bezahlt-Status mit Datum
// Bezahlt-Status mit Datum (optional überschreibbar)
let bezahlt = ex.bezahlt;
let bezahlt_am = ex.bezahlt_am;
if (req.body.bezahlt !== undefined) {
bezahlt = req.body.bezahlt ? 1 : 0;
bezahlt_am = req.body.bezahlt ? new Date().toISOString() : null;
bezahlt_am = req.body.bezahlt
? (req.body.bezahlt_am_override || new Date().toISOString())
: null;
}
// Abgeholt-Status mit Datum
// Abgeholt-Status mit Datum (optional überschreibbar)
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;
abgeholt_am = req.body.abgeholt
? (req.body.abgeholt_am_override || 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=?')