NOTE to migrate database install tinydb & run migrate.py - added new functions to filter data with db queries - in the storage module
24 lines
825 B
Python
24 lines
825 B
Python
# webapp/routes/archive.py
|
|
from __future__ import annotations
|
|
import time
|
|
from flask import Blueprint, render_template, redirect, url_for
|
|
from webapp.storage.orders import load_archived, mark_archived
|
|
|
|
bp = Blueprint("archive", __name__)
|
|
|
|
@bp.get("/archiv")
|
|
def archive_index():
|
|
"""Zeigt ausschließlich Aufträge mit status == 'archived'."""
|
|
archived = load_archived()
|
|
return render_template("archive.html", archived_orders=archived)
|
|
|
|
@bp.post("/archiv/add/<order_id>")
|
|
def archive_add(order_id: str):
|
|
"""
|
|
Markiert einen Auftrag als archiviert.
|
|
Danach BLEIBEN wir auf der Strukturen-Seite (kein Wechsel zur Archiv-Seite).
|
|
"""
|
|
now = time.strftime("%Y-%m-%dT%H:%M:%S%z", time.gmtime())
|
|
mark_archived(order_id)
|
|
return redirect(url_for("structures.structures")) # zurück zu /strukturen
|