From 92c1e3c1a573b13f386f2cae89b8158071a115b6 Mon Sep 17 00:00:00 2001
From: Oliver Walters <oliver.henry.walters@gmail.com>
Date: Mon, 19 Oct 2020 23:50:39 +1100
Subject: [PATCH] Update settings pages

---
 InvenTree/InvenTree/urls.py                   |  7 ++-
 .../templates/InvenTree/settings/build.html   | 14 +++++
 .../InvenTree/settings/currency.html          |  9 ++-
 .../templates/InvenTree/settings/other.html   |  7 +++
 .../templates/InvenTree/settings/part.html    |  5 ++
 .../templates/InvenTree/settings/po.html      | 13 +++++
 .../InvenTree/settings/settings.html          | 11 +++-
 .../templates/InvenTree/settings/so.html      | 13 +++++
 .../templates/InvenTree/settings/stock.html   | 13 +++++
 .../templates/InvenTree/settings/tabs.html    | 36 +++++++++---
 .../templates/InvenTree/settings/theme.html   |  6 +-
 .../templates/InvenTree/settings/user.html    | 58 ++++++++++---------
 12 files changed, 149 insertions(+), 43 deletions(-)
 create mode 100644 InvenTree/templates/InvenTree/settings/build.html
 create mode 100644 InvenTree/templates/InvenTree/settings/po.html
 create mode 100644 InvenTree/templates/InvenTree/settings/so.html
 create mode 100644 InvenTree/templates/InvenTree/settings/stock.html

diff --git a/InvenTree/InvenTree/urls.py b/InvenTree/InvenTree/urls.py
index d718871851..bc0316cca0 100644
--- a/InvenTree/InvenTree/urls.py
+++ b/InvenTree/InvenTree/urls.py
@@ -69,9 +69,14 @@ apipatterns = [
 settings_urls = [
 
     url(r'^user/?', SettingsView.as_view(template_name='InvenTree/settings/user.html'), name='settings-user'),
+    url(r'^theme/?', ColorThemeSelectView.as_view(), name='settings-theme'),
+   
     url(r'^currency/?', SettingsView.as_view(template_name='InvenTree/settings/currency.html'), name='settings-currency'),
     url(r'^part/?', SettingsView.as_view(template_name='InvenTree/settings/part.html'), name='settings-part'),
-    url(r'^theme/?', ColorThemeSelectView.as_view(), name='settings-theme'),
+    url(r'^stock/?', SettingsView.as_view(template_name='InvenTree/settings/stock.html'), name='settings-stock'),
+    url(r'^build/?', SettingsView.as_view(template_name='InvenTree/settings/build.html'), name='settings-build'),
+    url(r'^purchase-order/?', SettingsView.as_view(template_name='InvenTree/settings/po.html'), name='settings-po'),
+    url(r'^sales-order/?', SettingsView.as_view(template_name='InvenTree/settings/so.html'), name='settings-so'),
     url(r'^other/?', SettingsView.as_view(template_name='InvenTree/settings/other.html'), name='settings-other'),
 
     # Catch any other urls
diff --git a/InvenTree/templates/InvenTree/settings/build.html b/InvenTree/templates/InvenTree/settings/build.html
new file mode 100644
index 0000000000..3197d60fa5
--- /dev/null
+++ b/InvenTree/templates/InvenTree/settings/build.html
@@ -0,0 +1,14 @@
+{% extends "InvenTree/settings/settings.html" %}
+{% load i18n %}
+
+{% block tabs %}
+{% include "InvenTree/settings/tabs.html" with tab='build' %}
+{% endblock %}
+
+{% block subtitle %}
+{% trans "Build Order Settings" %}
+{% endblock %}
+
+{% block settings %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/InvenTree/templates/InvenTree/settings/currency.html b/InvenTree/templates/InvenTree/settings/currency.html
index c585011ecd..99948eeeb1 100644
--- a/InvenTree/templates/InvenTree/settings/currency.html
+++ b/InvenTree/templates/InvenTree/settings/currency.html
@@ -1,4 +1,9 @@
 {% extends "InvenTree/settings/settings.html" %}
+{% load i18n %}
+
+{% block subtitle %}
+{% trans "General Settings" %}
+{% endblock %}
 
 {% block tabs %}
 {% include "InvenTree/settings/tabs.html" with tab='currency' %}
@@ -6,10 +11,10 @@
 
 {% block settings %}
 
-<h4>Currencies</h4>
+<h4>{% trans "Currencies" %}</h4>
 
 <div id='currency-buttons'>
-    <button class='btn btn-success' id='new-currency'>New Currency</button>
+    <button class='btn btn-success' id='new-currency'>{% trans "New Currency" %}</button>
 </div>
 
 <table class='table table-striped table-condensed' id='currency-table' data-toolbar='#currency-buttons'>
diff --git a/InvenTree/templates/InvenTree/settings/other.html b/InvenTree/templates/InvenTree/settings/other.html
index 2f6207b170..c518074fd0 100644
--- a/InvenTree/templates/InvenTree/settings/other.html
+++ b/InvenTree/templates/InvenTree/settings/other.html
@@ -1,9 +1,16 @@
 {% extends "InvenTree/settings/settings.html" %}
 
+{% load i18n %}
+
 {% block tabs %}
 {% include "InvenTree/settings/tabs.html" with tab='other' %}
 {% endblock %}
 
+
+{% block subtitle %}
+{% trans "Other Settings" %}
+{% endblock %}
+
 {% block settings %}
 
 <h4>InvenTree Settings</h4>
diff --git a/InvenTree/templates/InvenTree/settings/part.html b/InvenTree/templates/InvenTree/settings/part.html
index 5eba81a72a..7c028ca6d6 100644
--- a/InvenTree/templates/InvenTree/settings/part.html
+++ b/InvenTree/templates/InvenTree/settings/part.html
@@ -5,7 +5,12 @@
 {% include "InvenTree/settings/tabs.html" with tab='part' %}
 {% endblock %}
 
+{% block subtitle %}
+{% trans "Part Settings" %}
+{% endblock %}
+
 {% block settings %}
+
 <h4>{% trans "Part Parameter Templates" %}</h4>
 
 <div id='param-buttons'>
diff --git a/InvenTree/templates/InvenTree/settings/po.html b/InvenTree/templates/InvenTree/settings/po.html
new file mode 100644
index 0000000000..7d32611404
--- /dev/null
+++ b/InvenTree/templates/InvenTree/settings/po.html
@@ -0,0 +1,13 @@
+{% extends "InvenTree/settings/settings.html" %}
+{% load i18n %}
+
+{% block tabs %}
+{% include "InvenTree/settings/tabs.html" with tab='po' %}
+{% endblock %}
+
+{% block subtitle %}
+{% trans "Purchase Order Settings" %}
+{% endblock %}
+
+{% block settings %}
+{% endblock %}
\ No newline at end of file
diff --git a/InvenTree/templates/InvenTree/settings/settings.html b/InvenTree/templates/InvenTree/settings/settings.html
index dab7ec277b..90adfd5fed 100644
--- a/InvenTree/templates/InvenTree/settings/settings.html
+++ b/InvenTree/templates/InvenTree/settings/settings.html
@@ -1,15 +1,16 @@
 {% extends "base.html" %}
 
+{% load i18n %}
 {% load static %}
 
 {% block page_title %}
-InvenTree | Settings
+InvenTree | {% trans "Settings" %}
 {% endblock %}
 
 {% block content %}
 <div class='settings-container'>
 
-    <h3>InvenTree Settings</h3>
+    <h3>InvenTree {% trans "Settings" %}</h3>
     <hr>
 
     <div class='settings-nav'>
@@ -19,6 +20,12 @@ InvenTree | Settings
     </div>
     
     <div class='settings-content'>
+        <h3>
+            {% block subtitle %}
+            SUBTITLE GOES HERE
+            {% endblock %}
+        </h3>
+        <hr>
         {% block settings %}
         {% endblock %}
     </div>
diff --git a/InvenTree/templates/InvenTree/settings/so.html b/InvenTree/templates/InvenTree/settings/so.html
new file mode 100644
index 0000000000..e66fd85148
--- /dev/null
+++ b/InvenTree/templates/InvenTree/settings/so.html
@@ -0,0 +1,13 @@
+{% extends "InvenTree/settings/settings.html" %}
+{% load i18n %}
+
+{% block tabs %}
+{% include "InvenTree/settings/tabs.html" with tab='so' %}
+{% endblock %}
+
+{% block subtitle %}
+{% trans "Sales Order Settings" %}
+{% endblock %}
+
+{% block settings %}
+{% endblock %}
\ No newline at end of file
diff --git a/InvenTree/templates/InvenTree/settings/stock.html b/InvenTree/templates/InvenTree/settings/stock.html
new file mode 100644
index 0000000000..c3c40087ff
--- /dev/null
+++ b/InvenTree/templates/InvenTree/settings/stock.html
@@ -0,0 +1,13 @@
+{% extends "InvenTree/settings/settings.html" %}
+{% load i18n %}
+
+{% block tabs %}
+{% include "InvenTree/settings/tabs.html" with tab='stock' %}
+{% endblock %}
+
+{% block subtitle %}
+{% trans "Stock Settings" %}
+{% endblock %}
+
+{% block settings %}
+{% endblock %}
\ No newline at end of file
diff --git a/InvenTree/templates/InvenTree/settings/tabs.html b/InvenTree/templates/InvenTree/settings/tabs.html
index 8719d29c81..67207fde52 100644
--- a/InvenTree/templates/InvenTree/settings/tabs.html
+++ b/InvenTree/templates/InvenTree/settings/tabs.html
@@ -1,19 +1,37 @@
+{% load i18n %}
+
+<h4><span class='fas fa-user'></span> {% trans "User Settings" %}</h4>
 <ul class='nav nav-pills nav-stacked'>
     <li{% ifequal tab 'user' %} class='active'{% endifequal %}>
-        <a href="{% url 'settings-user' %}"><span class='fas fa-user'></span> User</a>
-    </li>
-    <li{% ifequal tab 'currency' %} class='active'{% endifequal %}>
-        <a href="{% url 'settings-currency' %}"><span class='fas fa-dollar-sign'></span> Currency</a>
-    </li>
-    <li{% ifequal tab 'part' %} class='active'{% endifequal %}>
-        <a href="{% url 'settings-part' %}"><span class='fas fa-shapes'></span> Part</a>
+        <a href="{% url 'settings-user' %}"><span class='fas fa-user'></span> {% trans "Account" %}</a>
     </li>
     <li{% ifequal tab 'theme' %} class='active'{% endifequal %}>
-        <a href="{% url 'settings-theme' %}"><span class='fas fa-fill'></span> Theme</a>
+        <a href="{% url 'settings-theme' %}"><span class='fas fa-fill'></span> {% trans "Theme" %}</a>
+    </li>
+</ul>
+<h4><span class='fas fa-cogs'></span> {% trans "InvenTree Settings" %}</h4>
+<ul class='nav nav-pills nav-stacked'>
+    <li{% ifequal tab 'currency' %} class='active'{% endifequal %}>
+        <a href="{% url 'settings-currency' %}"><span class='fas fa-dollar-sign'></span> {% trans "Currency" %}</a>
+    </li>
+    <li{% ifequal tab 'part' %} class='active'{% endifequal %}>
+        <a href="{% url 'settings-part' %}"><span class='fas fa-shapes'></span> {% trans "Parts" %}</a>
+    </li>
+    <li {% if tab == 'stock' %} class='active'{% endif %}>
+        <a href='{% url 'settings-stock' %}'><span class='fas fa-boxes'></span> {% trans "Stock" %}</a>
+    </li>
+    <li {% if tab == 'build' %} class='active'{% endif %}>
+        <a href="{% url 'settings-build' %}"><span class='fas fa-tools'></span> {% trans "Build Orders" %}</a>
+    </li>
+    <li {% if tab == 'po' %} class='active'{% endif %}>
+        <a href="{% url 'settings-po' %}"><span class='fas fa-shopping-cart'></span> {% trans "Purchase Orders" %}</a>
+    </li>
+    <li {% if tab == 'so' %} class='active'{% endif %}>
+        <a href="{% url 'settings-so' %}"><span class='fas fa-truck'></span> {% trans "Sales Orders" %}</a>
     </li>
     {% if user.is_staff %}
     <li{% ifequal tab 'other' %} class='active'{% endifequal %}>
-        <a href="{% url 'settings-other' %}"><span class='fas fa-cogs'></span> Other</a>
+        <a href="{% url 'settings-other' %}"><span class='fas fa-cogs'></span> {% trans "Other" %}</a>
     </li>
     {% endif %}
 </ul>
\ No newline at end of file
diff --git a/InvenTree/templates/InvenTree/settings/theme.html b/InvenTree/templates/InvenTree/settings/theme.html
index 90f148b468..413bb67dd3 100644
--- a/InvenTree/templates/InvenTree/settings/theme.html
+++ b/InvenTree/templates/InvenTree/settings/theme.html
@@ -6,11 +6,15 @@
 {% include "InvenTree/settings/tabs.html" with tab='theme' %}
 {% endblock %}
 
+{% block subtitle %}
+{% trans "Theme Settings" %}
+{% endblock %}
+
 {% block settings %}
 
 <div class='row'>
     <div class='col-sm-6'>
-        <h4>Color Themes</h4>
+        <h4>{% trans "Color Themes" %}</h4>
     </div>
 </div>    
 
diff --git a/InvenTree/templates/InvenTree/settings/user.html b/InvenTree/templates/InvenTree/settings/user.html
index 7dcef2bc90..28ab8746cb 100644
--- a/InvenTree/templates/InvenTree/settings/user.html
+++ b/InvenTree/templates/InvenTree/settings/user.html
@@ -1,41 +1,43 @@
 {% extends "InvenTree/settings/settings.html" %}
 
+{% load i18n %}
+
 {% block tabs %}
 {% include "InvenTree/settings/tabs.html" with tab='user' %}
 {% endblock %}
 
+{% block subtitle %}
+{% trans "User Settings" %}
+{% endblock %}
+
 {% block settings %}
 
-<div class='row'>
-    <div class='col-sm-6'>
-        <h4>User Information</h4>
+<div class='container'>
+    <h4>{% trans "User Information" %}</h4>
+    <div class='btn-group' style='float: right;'>
+        <div class='btn btn-primary' type='button' id='edit-user' title='Edit User Information'>Edit</div>
+        <div class='btn btn-primary' type='button' id='edit-password' title='Change Password'>Set Password</div>
     </div>
-    <div class='col-sm-6'>
-        <div class='btn-group' style='float: right;'>
-            <div class='btn btn-primary' type='button' id='edit-user' title='Edit User Information'>Edit</div>
-            <div class='btn btn-primary' type='button' id='edit-password' title='Change Password'>Set Password</div>
-        </div>
-    </div>
-</div>    
 
-<table class='table table-striped table-condensed'>
-    <tr>
-        <td>Username</td>
-        <td>{{ user.username }}</td>
-    </tr>
-    <tr>
-        <td>First Name</td>
-        <td>{{ user.first_name }}</td>
-    </tr>
-    <tr>
-        <td>Last Name</td>
-        <td>{{ user.last_name }}</td>
-    </tr>
-    <tr>
-        <td>Email Address</td>
-        <td>{{ user.email }}</td>
-    </tr>
-</table>
+    <table class='table table-striped table-condensed'>
+        <tr>
+            <td>{% trans "Username" %}</td>
+            <td>{{ user.username }}</td>
+        </tr>
+        <tr>
+            <td>{% trans "First Name" %}</td>
+            <td>{{ user.first_name }}</td>
+        </tr>
+        <tr>
+            <td>{% trans "Last Name" %}</td>
+            <td>{{ user.last_name }}</td>
+        </tr>
+        <tr>
+            <td>{% trans "Email Address" %}</td>
+            <td>{{ user.email }}</td>
+        </tr>
+    </table>
+</div>
 
 {% endblock %}