From e178a2c370f2f2cd1e27e602d8fb11e4880705fb Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 27 Oct 2021 21:50:18 +1100 Subject: [PATCH] Refactoring for "stock" pages --- InvenTree/InvenTree/static/css/inventree.css | 4 - InvenTree/part/templates/part/category.html | 14 +- .../stock/templates/stock/item_base.html | 254 +++++++++--------- InvenTree/stock/templates/stock/location.html | 252 ++++++++--------- InvenTree/templates/base.html | 3 +- InvenTree/templates/page_base.html | 36 +++ 6 files changed, 301 insertions(+), 262 deletions(-) create mode 100644 InvenTree/templates/page_base.html diff --git a/InvenTree/InvenTree/static/css/inventree.css b/InvenTree/InvenTree/static/css/inventree.css index 0df86700e5..3b1e34922d 100644 --- a/InvenTree/InvenTree/static/css/inventree.css +++ b/InvenTree/InvenTree/static/css/inventree.css @@ -524,10 +524,6 @@ font-size: 125%; } -.btn-group { - padding-bottom: 5px; -} - .action-buttons .btn { font-size: 175%; align-content: center; diff --git a/InvenTree/part/templates/part/category.html b/InvenTree/part/templates/part/category.html index 803d265af6..0ab9345a88 100644 --- a/InvenTree/part/templates/part/category.html +++ b/InvenTree/part/templates/part/category.html @@ -120,17 +120,19 @@

{% trans "Parts" %}

-
- {% if roles.part.add %} - {% endif %} -
- +
+
- - -
- {% endif %} - -
- - -
- - - {% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser %} - {% if roles.stock.change and not item.is_building %} + +
+ + {% if barcodes %} +
- +
{% endif %} - - {% if roles.stock.change and not item.is_building %} +
- +
+ + + {% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser %} + {% if roles.stock.change and not item.is_building %} +
+ + +
+ {% endif %} + + {% if roles.stock.change and not item.is_building %} +
+ + +
+ {% endif %} {% endif %} - {% endif %} +
- -{% endblock %} - -{% block below_thumbnail %}
{% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %} @@ -230,8 +229,7 @@
{% endblock %} -{% block page_details %} -

{% trans "Stock Item Details" %}

+{% block details_right %} @@ -432,9 +430,9 @@ {% endif %}
- {% endblock %} + {% block js_ready %} {{ block.super }} diff --git a/InvenTree/stock/templates/stock/location.html b/InvenTree/stock/templates/stock/location.html index 3afaf45635..0181f62c61 100644 --- a/InvenTree/stock/templates/stock/location.html +++ b/InvenTree/stock/templates/stock/location.html @@ -11,133 +11,137 @@
-{% 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 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 %} +
- {% endif %} -{% endif %} -
-
- {% if location %} -

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

-

{{ location.description }}

- {% else %} -

{% trans "Stock" %}

-

{% trans "All stock items" %}

- {% 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 %} + {% 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 roles.stock_location.change %} -
- -
+
+
+ {% 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 %}
-
-
- {% if location %} -

{% trans "Location Details" %}

- - - - - - - - - - - - - - - - - - - - - - -
{% trans "Location Path" %}{{ location.pathstring }}
{% trans "Location 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 %} -
- +
@@ -147,7 +151,9 @@

{% trans "Stock Items" %}

- {% include "stock_table.html" %} +
+ {% include "stock_table.html" %} +
@@ -156,14 +162,14 @@
-
+
-
diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html index e545a748c0..f1280eaf87 100644 --- a/InvenTree/templates/base.html +++ b/InvenTree/templates/base.html @@ -71,15 +71,16 @@
+ {% block breadcrumb_list %}
+ {% endblock %}
{% block pre_content %} diff --git a/InvenTree/templates/page_base.html b/InvenTree/templates/page_base.html new file mode 100644 index 0000000000..4980fb7d47 --- /dev/null +++ b/InvenTree/templates/page_base.html @@ -0,0 +1,36 @@ +{% extends "base.html" %} + +{% load static %} +{% load i18n %} + +{% block content %} + +
+
+ {% block heading %} + block heading + {% endblock %} +
+
+ {% block details %} +
+
+ {% block details_left %} + block details_left + {% endblock %} +
+
+ {% block details_right %} + block details_right + {% endblock %} +
+
+ {% endblock %} +
+
+ +{% block page_content %} +block page_content +{% endblock %} + +{% endblock %} \ No newline at end of file