From 05d350b6c83e876a0aef8b5303d5c3958cba9451 Mon Sep 17 00:00:00 2001
From: Oliver <oliver.henry.walters@gmail.com>
Date: Thu, 28 Oct 2021 12:38:33 +1100
Subject: [PATCH] Tweaks for settings pages

---
 InvenTree/InvenTree/settings.py               |  2 +-
 InvenTree/InvenTree/static/css/inventree.css  | 24 +++++++---
 InvenTree/part/templates/part/category.html   |  1 -
 InvenTree/part/templates/part/part_base.html  | 48 ++-----------------
 InvenTree/stock/templates/stock/location.html |  1 -
 .../templates/InvenTree/settings/barcode.html |  1 -
 .../templates/InvenTree/settings/build.html   |  1 -
 .../InvenTree/settings/currencies.html        |  3 +-
 .../templates/InvenTree/settings/global.html  |  1 -
 .../templates/InvenTree/settings/header.html  | 12 -----
 .../templates/InvenTree/settings/login.html   |  1 -
 .../templates/InvenTree/settings/part.html    |  2 -
 .../templates/InvenTree/settings/po.html      |  1 -
 .../templates/InvenTree/settings/report.html  |  1 -
 .../templates/InvenTree/settings/setting.html |  2 +-
 .../InvenTree/settings/settings.html          |  8 ++--
 .../templates/InvenTree/settings/so.html      |  1 -
 .../templates/InvenTree/settings/stock.html   |  1 -
 .../InvenTree/settings/user_homepage.html     |  1 -
 .../InvenTree/settings/user_labels.html       |  1 -
 .../InvenTree/settings/user_reports.html      |  1 -
 .../InvenTree/settings/user_search.html       |  1 -
 .../InvenTree/settings/user_settings.html     |  1 -
 23 files changed, 29 insertions(+), 87 deletions(-)
 delete mode 100644 InvenTree/templates/InvenTree/settings/header.html

diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py
index 2095cab533..7f22ac7813 100644
--- a/InvenTree/InvenTree/settings.py
+++ b/InvenTree/InvenTree/settings.py
@@ -644,7 +644,7 @@ DATE_INPUT_FORMATS = [
 ]
 
 # crispy forms use the bootstrap templates
-CRISPY_TEMPLATE_PACK = 'bootstrap3'
+CRISPY_TEMPLATE_PACK = 'bootstrap4'
 
 # Use database transactions when importing / exporting data
 IMPORT_EXPORT_USE_TRANSACTIONS = True
diff --git a/InvenTree/InvenTree/static/css/inventree.css b/InvenTree/InvenTree/static/css/inventree.css
index 6a4f625284..57ee5ea243 100644
--- a/InvenTree/InvenTree/static/css/inventree.css
+++ b/InvenTree/InvenTree/static/css/inventree.css
@@ -10,6 +10,8 @@
     --label-green: #50aa51;
     --label-grey: #aaa;
     --label-yellow: #fdc82a;
+
+    --bs-body-color: #555;
 }
 
 .login-screen {
@@ -144,18 +146,16 @@
     padding-right: 5px;
 }
 
-.navbar-nav > li {
-    border-left: 1px solid;
-    border-right: 1px solid;
-    border-color: #eee;
-}
-
 .navbar-form {
     padding-right: 3px;
 }
 
+.navbar-light .navbar-nav .nav-link {
+    color: var(--bs-body-color);
+}
+
 #barcode-scan {
-    margin-top: 8px;
+    margin-top: 1px;
 }
 
 .icon-header {
@@ -895,6 +895,16 @@ input[type="submit"] {
     margin-right: 2px;
 }
 
+.btn-secondary {
+    background-color: var(--bs-body-color);
+    border-color: var(--bs-body-color);
+}
+
+.btn-outline-secondary {
+    color: var(--bs-body-color);
+    border-color: var(--bs-body-color);
+}
+
 .btn-small {
     padding: 3px;
     padding-left: 5px;
diff --git a/InvenTree/part/templates/part/category.html b/InvenTree/part/templates/part/category.html
index 54f8b81e0a..5cede4d803 100644
--- a/InvenTree/part/templates/part/category.html
+++ b/InvenTree/part/templates/part/category.html
@@ -85,7 +85,6 @@
     </tr>
 </table>
 {% else %}
-<h3>{% trans "Category Details" %}</h3>
 <table class='table table-striped table-condensed'>
     <col width='25'>
     <tr>
diff --git a/InvenTree/part/templates/part/part_base.html b/InvenTree/part/templates/part/part_base.html
index 1fc286b503..54ed4d9580 100644
--- a/InvenTree/part/templates/part/part_base.html
+++ b/InvenTree/part/templates/part/part_base.html
@@ -150,9 +150,9 @@
     <table class='table table-condensed table-striped'>
         <col width='25'>
         <tr>
-            <td><h4><span class='fas fa-boxes'></span></h4></td>
-            <td><h4>{% trans "Available Stock" %}</h4></td>
-            <td><h4>{% decimal available %}{% if part.units %} {{ part.units }}{% endif %}</h4></td>
+            <td><h5><span class='fas fa-boxes'></span></h5></td>
+            <td><h5>{% trans "Available Stock" %}</h5></td>
+            <td><h5>{% decimal available %}{% if part.units %} {{ part.units }}{% endif %}</h5></td>
         </tr>
         <tr>
             <td><span class='fas fa-map-marker-alt'></span></td>
@@ -191,9 +191,9 @@
         {% if not part.is_template %}
         {% if part.assembly %}
         <tr>
-            <td><h4><span class='fas fa-tools'></span></h4></td>
+            <td><h5><span class='fas fa-tools'></span></h5></td>
             <td colspan='2'>
-                <h4>{% trans "Build Status" %}</h4>
+                <h5>{% trans "Build Status" %}</h5>
             </td>
         </tr>
         <tr>
@@ -424,42 +424,4 @@
     });
     {% endif %}
 
-    $("#toggle-part-details").click(function() {
-        if (this.value == 'show') {
-            this.innerHTML = '<span class="fas fa-chevron-up"></span> {% trans "Hide Part Details" %}';
-            this.value = 'hide';
-            // Store state of part details section
-            localStorage.setItem("part-details-show", true);
-        } else {
-            this.innerHTML = '<span class="fas fa-chevron-down"></span> {% trans "Show Part Details" %}';
-            this.value = 'show';
-            // Store state of part details section
-            localStorage.setItem("part-details-show", false);
-        }
-    });
-
-    // Load part details section
-    window.onload = function() {
-        details_show = localStorage.getItem("part-details-show")
-
-        if (details_show === 'true') {
-            console.log(details_show)
-            // Get collapsible details section
-            details = document.getElementById('collapsible-part-details');
-            // Add "show" class
-            details.classList.add("in");
-            // Get toggle
-            toggle = document.getElementById('toggle-part-details');
-            // Change state of toggle
-            toggle.innerHTML = '<span class="fas fa-chevron-up"></span> {% trans "Hide Part Details" %}';
-            toggle.value = 'hide';
-        } else {
-            // Get toggle
-            toggle = document.getElementById('toggle-part-details');
-            // Change state of toggle
-            toggle.innerHTML = '<span class="fas fa-chevron-down"></span> {% trans "Show Part Details" %}';
-            toggle.value = 'show';
-        }
-    }
-
 {% endblock %}
\ No newline at end of file
diff --git a/InvenTree/stock/templates/stock/location.html b/InvenTree/stock/templates/stock/location.html
index 86e6a91fc0..8e304b31dd 100644
--- a/InvenTree/stock/templates/stock/location.html
+++ b/InvenTree/stock/templates/stock/location.html
@@ -115,7 +115,6 @@
     </tr>
 </table>
 {% else %}
-<h3>{% trans "Stock Details" %}</h3>
 <table class='table table-striped table-condensed'>
     <col width='25'>
     <tr>
diff --git a/InvenTree/templates/InvenTree/settings/barcode.html b/InvenTree/templates/InvenTree/settings/barcode.html
index 32b85151d7..8532476b75 100644
--- a/InvenTree/templates/InvenTree/settings/barcode.html
+++ b/InvenTree/templates/InvenTree/settings/barcode.html
@@ -11,7 +11,6 @@
 {% block content %}
 
 <table class='table table-striped table-condensed'>
-    {% include "InvenTree/settings/header.html" %}
     <tbody>
         {% include "InvenTree/settings/setting.html" with key="BARCODE_ENABLE" icon="fa-qrcode" %}
     </tbody>
diff --git a/InvenTree/templates/InvenTree/settings/build.html b/InvenTree/templates/InvenTree/settings/build.html
index 6d16512a99..d567197959 100644
--- a/InvenTree/templates/InvenTree/settings/build.html
+++ b/InvenTree/templates/InvenTree/settings/build.html
@@ -11,7 +11,6 @@
 {% block content %}
 
 <table class='table table-striped table-condensed'>
-    {% include "InvenTree/settings/header.html" %}
     <tbody>
         {% 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/currencies.html b/InvenTree/templates/InvenTree/settings/currencies.html
index 08434cc704..ba6e782508 100644
--- a/InvenTree/templates/InvenTree/settings/currencies.html
+++ b/InvenTree/templates/InvenTree/settings/currencies.html
@@ -11,7 +11,6 @@
 {% block content %}
 
 <table class='table table-striped table-condensed'>
-    {% include "InvenTree/settings/header.html" %}
     <tbody>
         {% include "InvenTree/settings/setting.html" with key="INVENTREE_DEFAULT_CURRENCY" icon="fa-globe" %}
     </tbody>
@@ -45,7 +44,7 @@
                 <form action='{% url "settings-currencies-refresh" %}' method='post'>
                     <div id='refresh-rates-form'>
                         {% csrf_token %}
-                        <button type='submit' id='update-rates' class='btn btn-default float-right'>{% trans "Update Now" %}</button>
+                        <button type='submit' id='update-rates' class='btn btn-outline-secondary float-right'>{% trans "Update Now" %}</button>
                     </div>
                 </form>
             </td>
diff --git a/InvenTree/templates/InvenTree/settings/global.html b/InvenTree/templates/InvenTree/settings/global.html
index 1723f36b72..60ae84f001 100644
--- a/InvenTree/templates/InvenTree/settings/global.html
+++ b/InvenTree/templates/InvenTree/settings/global.html
@@ -12,7 +12,6 @@
 {% block content %}
 
 <table class='table table-striped table-condensed'>
-    {% include "InvenTree/settings/header.html" %}
     <tbody>
         {% include "InvenTree/settings/setting.html" with key="INVENTREE_INSTANCE" icon="fa-info-circle" %}
         {% include "InvenTree/settings/setting.html" with key="INVENTREE_INSTANCE_TITLE" icon="fa-info-circle" %}
diff --git a/InvenTree/templates/InvenTree/settings/header.html b/InvenTree/templates/InvenTree/settings/header.html
deleted file mode 100644
index d60a4dd784..0000000000
--- a/InvenTree/templates/InvenTree/settings/header.html
+++ /dev/null
@@ -1,12 +0,0 @@
-{% load i18n %}
-
-<col width='25'>
-<thead>
-    <tr>
-        <th></th>
-        <th>{% trans "Setting" %}</th>
-        <th>{% trans "Value" %}</th>
-        <th>{% trans "Description" %}</th>
-        <th></th>
-    </tr>
-</thead>
diff --git a/InvenTree/templates/InvenTree/settings/login.html b/InvenTree/templates/InvenTree/settings/login.html
index 7ffebee91e..d3cba1180f 100644
--- a/InvenTree/templates/InvenTree/settings/login.html
+++ b/InvenTree/templates/InvenTree/settings/login.html
@@ -12,7 +12,6 @@
 {% block content %}
 
 <table class='table table-striped table-condensed'>
-    {% include "InvenTree/settings/header.html" %}
     <tbody>
         {% include "InvenTree/settings/setting.html" with key="LOGIN_ENABLE_SSO" icon="fa-info-circle" %}
         {% include "InvenTree/settings/setting.html" with key="LOGIN_ENABLE_PWD_FORGOT" icon="fa-info-circle" %}
diff --git a/InvenTree/templates/InvenTree/settings/part.html b/InvenTree/templates/InvenTree/settings/part.html
index ddd6fae1a9..351810b7dc 100644
--- a/InvenTree/templates/InvenTree/settings/part.html
+++ b/InvenTree/templates/InvenTree/settings/part.html
@@ -12,7 +12,6 @@
 <h4>{% trans "Part Options" %}</h4>
 
 <table class='table table-striped table-condensed'>
-    {% include "InvenTree/settings/header.html" %}
     <tbody>
         {% include "InvenTree/settings/setting.html" with key="PART_IPN_REGEX" %}
         {% include "InvenTree/settings/setting.html" with key="PART_ALLOW_DUPLICATE_IPN" %}
@@ -49,7 +48,6 @@
 
 
 <table class='table table-striped table-condensed'>
-    {% include "InvenTree/settings/header.html" %}
     <tbody>
         {% include "InvenTree/settings/setting.html" with key="PART_SHOW_IMPORT" icon="fa-file-upload" %}
     </tbody>
diff --git a/InvenTree/templates/InvenTree/settings/po.html b/InvenTree/templates/InvenTree/settings/po.html
index f8a114bb12..f1ad603db5 100644
--- a/InvenTree/templates/InvenTree/settings/po.html
+++ b/InvenTree/templates/InvenTree/settings/po.html
@@ -9,7 +9,6 @@
 
 {% block content %}
 <table class='table table-striped table-condensed'>
-    {% include "InvenTree/settings/header.html" %}
     <tbody>
         {% include "InvenTree/settings/setting.html" with key="PURCHASEORDER_REFERENCE_PREFIX" %}
     </tbody>
diff --git a/InvenTree/templates/InvenTree/settings/report.html b/InvenTree/templates/InvenTree/settings/report.html
index b9a2bd6aec..84de0f074b 100644
--- a/InvenTree/templates/InvenTree/settings/report.html
+++ b/InvenTree/templates/InvenTree/settings/report.html
@@ -11,7 +11,6 @@
 {% block content %}
 
 <table class='table table-striped table-condensed'>
-    {% include "InvenTree/settings/header.html" %}
     <tbody>
         {% include "InvenTree/settings/setting.html" with key="REPORT_DEFAULT_PAGE_SIZE" %}
         {% include "InvenTree/settings/setting.html" with key="REPORT_DEBUG_MODE" %}
diff --git a/InvenTree/templates/InvenTree/settings/setting.html b/InvenTree/templates/InvenTree/settings/setting.html
index 6b62c4c92c..4a506b46e6 100644
--- a/InvenTree/templates/InvenTree/settings/setting.html
+++ b/InvenTree/templates/InvenTree/settings/setting.html
@@ -38,7 +38,7 @@
     </td>
     <td>
         <div class='btn-group float-right'>
-            <button class='btn btn-default btn-edit-setting' pk='{{ setting.pk }}' setting='{{ setting.key.upper }}' title='{% trans "Edit setting" %}' {% if user_setting %}user='{{request.user.id}}'{% endif %}>
+            <button class='btn btn-outline-secondary btn-small btn-edit-setting' pk='{{ setting.pk }}' setting='{{ setting.key.upper }}' title='{% trans "Edit setting" %}' {% if user_setting %}user='{{request.user.id}}'{% endif %}>
                 <span class='fas fa-edit icon-green'></span>
             </button>
         </div>
diff --git a/InvenTree/templates/InvenTree/settings/settings.html b/InvenTree/templates/InvenTree/settings/settings.html
index 9d6f85d163..fd920e42b4 100644
--- a/InvenTree/templates/InvenTree/settings/settings.html
+++ b/InvenTree/templates/InvenTree/settings/settings.html
@@ -174,8 +174,8 @@ $('#cat-param-table').inventreeTable({
             title: '{% trans "Default Value" %}',
             sortable: 'true',
             formatter: function(value, row, index, field) {
-                var bEdit = "<button title='{% trans "Edit Template" %}' class='template-edit btn btn-default' type='button' pk='" + row.pk + "'><span class='fas fa-edit'></span></button>";
-                var bDel = "<button title='{% trans "Delete Template" %}' class='template-delete btn btn-default' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>";
+                var bEdit = "<button title='{% trans "Edit Template" %}' class='template-edit btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-edit'></span></button>";
+                var bDel = "<button title='{% trans "Delete Template" %}' class='template-delete btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>";
 
                 var html = value
                 html += "<div class='btn-group float-right' role='group'>" + bEdit + bDel + "</div>";
@@ -273,8 +273,8 @@ $("#param-table").inventreeTable({
         },
         {
             formatter: function(value, row, index, field) {
-                var bEdit = "<button title='{% trans "Edit Template" %}' class='template-edit btn btn-default' type='button' pk='" + row.pk + "'><span class='fas fa-edit'></span></button>";
-                var bDel = "<button title='{% trans "Delete Template" %}' class='template-delete btn btn-default' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>";
+                var bEdit = "<button title='{% trans "Edit Template" %}' class='template-edit btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-edit'></span></button>";
+                var bDel = "<button title='{% trans "Delete Template" %}' class='template-delete btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>";
 
                 var html = "<div class='btn-group float-right' role='group'>" + bEdit + bDel + "</div>";
 
diff --git a/InvenTree/templates/InvenTree/settings/so.html b/InvenTree/templates/InvenTree/settings/so.html
index 2fe5680d71..e6fde3a093 100644
--- a/InvenTree/templates/InvenTree/settings/so.html
+++ b/InvenTree/templates/InvenTree/settings/so.html
@@ -10,7 +10,6 @@
 {% block content %}
 
 <table class='table table-striped table-condensed'>
-    {% include "InvenTree/settings/header.html" %}
     <tbody>
         {% include "InvenTree/settings/setting.html" with key="SALESORDER_REFERENCE_PREFIX" %}
     </tbody>
diff --git a/InvenTree/templates/InvenTree/settings/stock.html b/InvenTree/templates/InvenTree/settings/stock.html
index e05def09a6..d5455750d7 100644
--- a/InvenTree/templates/InvenTree/settings/stock.html
+++ b/InvenTree/templates/InvenTree/settings/stock.html
@@ -10,7 +10,6 @@
 {% block content %}
 
 <table class='table table-striped table-condensed'>
-    {% include "InvenTree/settings/header.html" %}
     <tbody>
         {% include "InvenTree/settings/setting.html" with key="STOCK_GROUP_BY_PART" icon="fa-layer-group" %}
         {% include "InvenTree/settings/setting.html" with key="STOCK_ENABLE_EXPIRY" icon="fa-stopwatch" %}
diff --git a/InvenTree/templates/InvenTree/settings/user_homepage.html b/InvenTree/templates/InvenTree/settings/user_homepage.html
index ccaae6fa8a..7eed850ad5 100644
--- a/InvenTree/templates/InvenTree/settings/user_homepage.html
+++ b/InvenTree/templates/InvenTree/settings/user_homepage.html
@@ -13,7 +13,6 @@
 
 <div class='row'>
     <table class='table table-striped table-condensed'>
-        {% include "InvenTree/settings/header.html" %}
         <tbody>
             {% include "InvenTree/settings/setting.html" with key="HOMEPAGE_PART_STARRED" icon='fa-star' user_setting=True %}
             {% include "InvenTree/settings/setting.html" with key="HOMEPAGE_PART_LATEST" icon='fa-history' user_setting=True %}
diff --git a/InvenTree/templates/InvenTree/settings/user_labels.html b/InvenTree/templates/InvenTree/settings/user_labels.html
index bd3d041544..a2d9b7b89c 100644
--- a/InvenTree/templates/InvenTree/settings/user_labels.html
+++ b/InvenTree/templates/InvenTree/settings/user_labels.html
@@ -13,7 +13,6 @@
 
 <div class='row'>
     <table class='table table-striped table-condensed'>
-        {% include "InvenTree/settings/header.html" %}
         <tbody>
             {% include "InvenTree/settings/setting.html" with key="LABEL_INLINE" icon='fa-tag' user_setting=True %}
         </tbody>
diff --git a/InvenTree/templates/InvenTree/settings/user_reports.html b/InvenTree/templates/InvenTree/settings/user_reports.html
index 8e93d41457..186adfe31c 100644
--- a/InvenTree/templates/InvenTree/settings/user_reports.html
+++ b/InvenTree/templates/InvenTree/settings/user_reports.html
@@ -13,7 +13,6 @@
 
 <div class='row'>
     <table class='table table-striped table-condensed'>
-        {% include "InvenTree/settings/header.html" %}
         <tbody>
             {% include "InvenTree/settings/setting.html" with key="REPORT_INLINE" icon='fa-file-pdf' user_setting=True %}
         </tbody>
diff --git a/InvenTree/templates/InvenTree/settings/user_search.html b/InvenTree/templates/InvenTree/settings/user_search.html
index 1779445e64..43eab057c3 100644
--- a/InvenTree/templates/InvenTree/settings/user_search.html
+++ b/InvenTree/templates/InvenTree/settings/user_search.html
@@ -13,7 +13,6 @@
 
 <div class='row'>
     <table class='table table-striped table-condensed'>
-        {% include "InvenTree/settings/header.html" %}
         <tbody>
             {% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_RESULTS" user_setting=True icon='fa-search' %}
             {% include "InvenTree/settings/setting.html" with key="SEARCH_SHOW_STOCK_LEVELS" user_setting=True icon='fa-boxes' %}
diff --git a/InvenTree/templates/InvenTree/settings/user_settings.html b/InvenTree/templates/InvenTree/settings/user_settings.html
index a9b9b0a82f..80c01f6919 100644
--- a/InvenTree/templates/InvenTree/settings/user_settings.html
+++ b/InvenTree/templates/InvenTree/settings/user_settings.html
@@ -13,7 +13,6 @@
 
 <div class='row'>
     <table class='table table-striped table-condensed'>
-        {% include "InvenTree/settings/header.html" %}
 
     </table>
 </div>