From 9fa37a915657d3637d53920a348dbc47779ab0a8 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 3 Jan 2021 22:57:39 +1100 Subject: [PATCH] Improve visualisation of global settings --- InvenTree/common/models.py | 16 +++++++++++++++- .../templates/InvenTree/settings/build.html | 2 +- .../templates/InvenTree/settings/global.html | 8 ++++---- .../templates/InvenTree/settings/header.html | 12 ++++++++++++ InvenTree/templates/InvenTree/settings/part.html | 16 +++++++++------- InvenTree/templates/InvenTree/settings/po.html | 2 +- .../templates/InvenTree/settings/setting.html | 9 ++++++++- InvenTree/templates/InvenTree/settings/so.html | 2 +- .../templates/InvenTree/settings/stock.html | 3 +++ 9 files changed, 54 insertions(+), 16 deletions(-) create mode 100644 InvenTree/templates/InvenTree/settings/header.html diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index fa1d4dc5c9..924c55b54d 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -110,7 +110,21 @@ class InvenTreeSetting(models.Model): 'default': True, 'validator': bool }, - + + 'PART_TEMPLATE': { + 'name': _('Template'), + 'description': _('Parts are templates by default'), + 'default': False, + 'validator': bool, + }, + + 'PART_ASSEMBLY': { + 'name': _('Assembly'), + 'description': _('Parts can be assembled from other components by default'), + 'default': False, + 'validator': bool, + }, + 'PART_COMPONENT': { 'name': _('Component'), 'description': _('Parts can be used as sub-components by default'), diff --git a/InvenTree/templates/InvenTree/settings/build.html b/InvenTree/templates/InvenTree/settings/build.html index 781402795b..7d04a8f8b7 100644 --- a/InvenTree/templates/InvenTree/settings/build.html +++ b/InvenTree/templates/InvenTree/settings/build.html @@ -13,7 +13,7 @@ {% block settings %} - + {% include "InvenTree/settings/header.html" %} {% include "InvenTree/settings/setting.html" with key="BUILDORDER_REFERENCE_PREFIX" %} {% include "InvenTree/settings/setting.html" with key="BUILDORDER_REFERENCE_REGEX" %} diff --git a/InvenTree/templates/InvenTree/settings/global.html b/InvenTree/templates/InvenTree/settings/global.html index 775d30b915..76af68b441 100644 --- a/InvenTree/templates/InvenTree/settings/global.html +++ b/InvenTree/templates/InvenTree/settings/global.html @@ -13,11 +13,11 @@ {% block settings %}
- + {% include "InvenTree/settings/header.html" %} - {% include "InvenTree/settings/setting.html" with key="INVENTREE_INSTANCE" %} - {% include "InvenTree/settings/setting.html" with key="INVENTREE_COMPANY_NAME" %} - {% include "InvenTree/settings/setting.html" with key="INVENTREE_DEFAULT_CURRENCY" %} + {% include "InvenTree/settings/setting.html" with key="INVENTREE_INSTANCE" icon="fa-info-circle" %} + {% include "InvenTree/settings/setting.html" with key="INVENTREE_COMPANY_NAME" icon="fa-building" %} + {% include "InvenTree/settings/setting.html" with key="INVENTREE_DEFAULT_CURRENCY" icon="fa-dollar-sign" %}
diff --git a/InvenTree/templates/InvenTree/settings/header.html b/InvenTree/templates/InvenTree/settings/header.html new file mode 100644 index 0000000000..d60a4dd784 --- /dev/null +++ b/InvenTree/templates/InvenTree/settings/header.html @@ -0,0 +1,12 @@ +{% load i18n %} + + + + + + {% trans "Setting" %} + {% trans "Value" %} + {% trans "Description" %} + + + diff --git a/InvenTree/templates/InvenTree/settings/part.html b/InvenTree/templates/InvenTree/settings/part.html index d1ad6e98e9..415449a559 100644 --- a/InvenTree/templates/InvenTree/settings/part.html +++ b/InvenTree/templates/InvenTree/settings/part.html @@ -14,16 +14,18 @@

{% trans "Part Options" %}

- + {% include "InvenTree/settings/header.html" %} {% include "InvenTree/settings/setting.html" with key="PART_IPN_REGEX" %} {% include "InvenTree/settings/setting.html" with key="PART_ALLOW_DUPLICATE_IPN" %} - - {% include "InvenTree/settings/setting.html" with key="PART_COMPONENT" %} - {% include "InvenTree/settings/setting.html" with key="PART_PURCHASEABLE" %} - {% include "InvenTree/settings/setting.html" with key="PART_SALABLE" %} - {% include "InvenTree/settings/setting.html" with key="PART_TRACKABLE" %} - + + {% include "InvenTree/settings/setting.html" with key="PART_TEMPLATE" icon="fa-clone" %} + {% include "InvenTree/settings/setting.html" with key="PART_ASSEMBLY" icon="fa-tools" %} + {% include "InvenTree/settings/setting.html" with key="PART_COMPONENT" icon="fa-th"%} + {% include "InvenTree/settings/setting.html" with key="PART_TRACKABLE" icon="fa-directions" %} + {% include "InvenTree/settings/setting.html" with key="PART_PURCHASEABLE" icon="fa-shopping-cart" %} + {% include "InvenTree/settings/setting.html" with key="PART_SALABLE" icon="fa-dollar-sign" %} + {% include "InvenTree/settings/setting.html" with key="PART_COPY_BOM" %} {% include "InvenTree/settings/setting.html" with key="PART_COPY_PARAMETERS" %} {% include "InvenTree/settings/setting.html" with key="PART_COPY_TESTS" %} diff --git a/InvenTree/templates/InvenTree/settings/po.html b/InvenTree/templates/InvenTree/settings/po.html index a709d40dd3..20e3b0074b 100644 --- a/InvenTree/templates/InvenTree/settings/po.html +++ b/InvenTree/templates/InvenTree/settings/po.html @@ -11,7 +11,7 @@ {% block settings %}
- + {% include "InvenTree/settings/header.html" %} {% include "InvenTree/settings/setting.html" with key="PURCHASEORDER_REFERENCE_PREFIX" %} diff --git a/InvenTree/templates/InvenTree/settings/setting.html b/InvenTree/templates/InvenTree/settings/setting.html index ffbb78cbbc..b08f4aeb3a 100644 --- a/InvenTree/templates/InvenTree/settings/setting.html +++ b/InvenTree/templates/InvenTree/settings/setting.html @@ -3,6 +3,11 @@ {% setting_object key as setting %} + + + {{ setting.value }}{{ setting.units }} + {% else %} {% trans "No value set" %} {% endif %} diff --git a/InvenTree/templates/InvenTree/settings/so.html b/InvenTree/templates/InvenTree/settings/so.html index 368374532f..4ef1709068 100644 --- a/InvenTree/templates/InvenTree/settings/so.html +++ b/InvenTree/templates/InvenTree/settings/so.html @@ -12,7 +12,7 @@ {% block settings %}
+ {% if icon %} + + {% endif %} + {{ setting.name }} {% if setting.is_bool %} @@ -11,7 +16,9 @@ {% else %} {% if setting.value %} - {{ setting.value }}{{ setting.units }}
- + {% include "InvenTree/settings/header.html" %} {% include "InvenTree/settings/setting.html" with key="SALESORDER_REFERENCE_PREFIX" %} diff --git a/InvenTree/templates/InvenTree/settings/stock.html b/InvenTree/templates/InvenTree/settings/stock.html index c3c40087ff..7bec8b566c 100644 --- a/InvenTree/templates/InvenTree/settings/stock.html +++ b/InvenTree/templates/InvenTree/settings/stock.html @@ -10,4 +10,7 @@ {% endblock %} {% block settings %} +
+ No Stock settings available +
{% endblock %} \ No newline at end of file