diff --git a/inventory-app/inventory.py b/inventory-app/inventory.py index 7aa3712..f035475 100644 --- a/inventory-app/inventory.py +++ b/inventory-app/inventory.py @@ -259,6 +259,18 @@ def save_inventory_item(item_id=None, **_): return render_template("inventory_edit.html", **locals()) return redirect("/m/inventory/%s/view" % item_id) +@page_inventory.route("/m/inventory//archive", methods=['POST']) +@login_required +def archive_inventory_item(item_id): + item = db.inventory.find_one({"_id": ObjectId(item_id)}) + if not item: + return abort(404) + if not check_edit_permission(item_id): + return abort(403) + db.archive.insert_one(item); + db.inventory.delete_one({"_id": ObjectId(item_id)}) + return redirect("/m/inventory") + @page_inventory.route("/m/inventory/add-slug/", methods=['GET']) @login_required def add_inventory_slug(slug): diff --git a/inventory-app/templates/inventory_view.html b/inventory-app/templates/inventory_view.html index b3b2e5f..df6ea35 100644 --- a/inventory-app/templates/inventory_view.html +++ b/inventory-app/templates/inventory_view.html @@ -206,6 +206,17 @@ + +
+
+
+ +
+
+
+ {% if can_audit %}