Add vacate button
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
This commit is contained in:
parent
17ea3dd87f
commit
94093a361e
@ -24,6 +24,7 @@ def view_inventory_view(item_id):
|
||||
user = read_user()
|
||||
template = "inventory_view.html"
|
||||
item = db.inventory.find_one({ "_id": ObjectId(item_id) })
|
||||
item_user = item.get("inventory", {}).get("user", {}).get("username", None)
|
||||
if not user:
|
||||
if not item["inventory"].get("public"):
|
||||
return do_login()
|
||||
@ -31,6 +32,7 @@ def view_inventory_view(item_id):
|
||||
else:
|
||||
can_audit = "k-space:janitors" in user["groups"]
|
||||
can_edit = check_edit_permission(item_id)
|
||||
is_using = item_user and item_user == user["username"]
|
||||
bucket=get_bucket()
|
||||
photo_url = bucket.generate_presigned_url(
|
||||
ClientMethod='get_object',
|
||||
|
@ -150,6 +150,16 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if is_using %}
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<form action="/m/inventory/{{ item._id }}/vacate" method="post" style="display: inline;">
|
||||
<button class="waves-effect waves-light btn" type="submit">Vacate</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col s12">
|
||||
<a {% if not can_edit %} disabled="" {% endif %} href="/m/inventory/{{ item._id }}/edit" class="waves-effect waves-light btn">
|
||||
|
Loading…
Reference in New Issue
Block a user