From a21959f54d80da1a27847aabc76891b239be40c2 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 27 Oct 2021 23:46:09 +1100 Subject: [PATCH] Refactor stock location view --- InvenTree/stock/templates/stock/location.html | 255 ++++++++---------- .../stock/templates/stock/stock_app_base.html | 2 +- 2 files changed, 120 insertions(+), 137 deletions(-) diff --git a/InvenTree/stock/templates/stock/location.html b/InvenTree/stock/templates/stock/location.html index 30ae429172..290df77536 100644 --- a/InvenTree/stock/templates/stock/location.html +++ b/InvenTree/stock/templates/stock/location.html @@ -7,145 +7,132 @@ {% include "stock/location_navbar.html" %} {% endblock %} -{% block content %} +{% block details_left %} +{% if location %} +

+ {% trans "Stock Location" %}: {{ location.name }} + {% if user.is_staff and roles.stock_location.change %} + + {% endif %} +

+

{{ location.description }}

+{% else %} +

+ {% trans "Stock" %} +

+

{% trans "All stock items" %}

+{% endif %} -
- -
-

- {% if location %} - {{ location.name }} - {% if location %} - {% if user.is_staff and roles.stock_location.change %} - - {% endif %} -

- {% else %} -

{% trans "Stock" %}

-

{% trans "All stock items" %}

- {% endif %} - - {% else %} - {% trans "Stock" %} - {% endif %} - +
+ {% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser or not location %} + {% if roles.stock_location.add %} + + {% endif %} + {% endif %} + {% if barcodes %} + + {% if location %} + - -
- - {% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %} - {% if owner_control.value == "True" %} - {% authorized_owners location.owner as owners %} - - {% if location and not user in owners and not user.is_superuser %} -
- {% trans "You are not in the list of owners of this location. This stock location cannot be edited." %}
+ + {% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser %} + {% if roles.stock.change %} + {% endif %} + {% if roles.stock_location.change %} +
+ + +
+ {% endif %} + {% endif %} + {% endif %} {% endif %} - -
-
-
- {% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser or not location %} - {% if roles.stock_location.add %} - - {% endif %} - {% endif %} - {% if barcodes %} - - {% if location %} - - - {% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser %} - {% if roles.stock.change %} - - {% endif %} - {% if roles.stock_location.change %} -
- - -
- {% endif %} - {% endif %} - {% endif %} - {% endif %} -
-
-
- {% if location %} - - - - - - - - - - - - - - - - - -
{% trans "Description" %}{{ location.description }}
{% trans "Sublocations" %}{{ location.children.count }}
{% trans "Stock Items" %}{{ location.item_count }}
- {% else %} -

{% trans "Stock Details" %}

- - - - - - - - - - - - -
{% trans "Stock Locations" %}{{ loc_count }}
{% trans "Stock Items" %}{{ stock_count }}
- {% endif %} -
-
-
-{% block location_content %} +{% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %} +{% if owner_control.value == "True" %} + {% authorized_owners location.owner as owners %} + + {% if location and not user in owners and not user.is_superuser %} +
+ {% trans "You are not in the list of owners of this location. This stock location cannot be edited." %}
+
+ {% endif %} +{% endif %} + +{% endblock %} + +{% block details_right %} +{% if location %} + + + + + + + + + + + + + + + + + +
{% trans "Description" %}{{ location.description }}
{% trans "Sublocations" %}{{ location.children.count }}
{% trans "Stock Items" %}{{ location.item_count }}
+{% else %} +

{% trans "Stock Details" %}

+ + + + + + + + + + + + +
{% trans "Stock Locations" %}{{ loc_count }}
{% trans "Stock Items" %}{{ stock_count }}
+{% endif %} +{% endblock %} + +{% block page_content %}
@@ -184,10 +171,6 @@ {% endblock %} -
- -{% endblock %} - {% block js_ready %} {{ block.super }} diff --git a/InvenTree/stock/templates/stock/stock_app_base.html b/InvenTree/stock/templates/stock/stock_app_base.html index d66dd6ce4e..72dcd3b2e8 100644 --- a/InvenTree/stock/templates/stock/stock_app_base.html +++ b/InvenTree/stock/templates/stock/stock_app_base.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "page_base.html" %} {% load static %} {% load i18n %} {% load inventree_extras %}