feat: Abgeholt-Status + Archiv-Drawer für abgeschlossene Bestellungen
This commit is contained in:
@@ -155,6 +155,8 @@ if (!cols.includes('bemerkung')) db.exec("ALTER TABLE calculations ADD COLUMN be
|
||||
const ordCols = db.prepare("PRAGMA table_info(orders)").all().map(r => r.name);
|
||||
if (!ordCols.includes('bezahlt')) db.exec("ALTER TABLE orders ADD COLUMN bezahlt INTEGER NOT NULL DEFAULT 0");
|
||||
if (!ordCols.includes('bezahlt_am')) db.exec("ALTER TABLE orders ADD COLUMN bezahlt_am DATETIME");
|
||||
if (!ordCols.includes('abgeholt')) db.exec("ALTER TABLE orders ADD COLUMN abgeholt INTEGER NOT NULL DEFAULT 0");
|
||||
if (!ordCols.includes('abgeholt_am'))db.exec("ALTER TABLE orders ADD COLUMN abgeholt_am DATETIME");
|
||||
|
||||
// Migrationen order_items
|
||||
// files migrations
|
||||
|
||||
@@ -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)));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user