diff --git a/InvenTree/InvenTree/static/script/inventree/company.js b/InvenTree/InvenTree/static/script/inventree/company.js
index f007ed8c14..3bb9da60b8 100644
--- a/InvenTree/InvenTree/static/script/inventree/company.js
+++ b/InvenTree/InvenTree/static/script/inventree/company.js
@@ -40,7 +40,7 @@ function loadCompanyTable(table, url, options={}) {
var html = imageHoverIcon(row.image) + renderLink(value, row.url);
if (row.is_customer) {
- html += ``;
+ html += ``;
}
if (row.is_manufacturer) {
diff --git a/InvenTree/company/templates/company/index.html b/InvenTree/company/templates/company/index.html
index 245e357489..e264c376c9 100644
--- a/InvenTree/company/templates/company/index.html
+++ b/InvenTree/company/templates/company/index.html
@@ -9,12 +9,12 @@ InvenTree | {% trans "Supplier List" %}
{% block content %}
-
{% trans "Supplier List" %}
+{{ title }}
@@ -35,6 +35,9 @@ InvenTree | {% trans "Supplier List" %}
loadCompanyTable("#company-table", "{% url 'api-company-list' %}",
{
+ params: {
+ {% for key,value in filters.items %}{{ key }}: "{{ value }}",{% endfor %}
+ }
}
);
diff --git a/InvenTree/company/urls.py b/InvenTree/company/urls.py
index c00d1e7a4b..848463610c 100644
--- a/InvenTree/company/urls.py
+++ b/InvenTree/company/urls.py
@@ -33,10 +33,12 @@ company_urls = [
url(r'^(?P\d+)/', include(company_detail_urls)),
- url(r'', views.CompanyIndex.as_view(), name='company-index'),
+ url(r'suppliers/', views.CompanyIndex.as_view(), name='supplier-index'),
+ url(r'manufacturers/', views.CompanyIndex.as_view(), name='manufacturer-index'),
+ url(r'customers/', views.CompanyIndex.as_view(), name='customer-index'),
# Redirect any other patterns to the 'company' index which displays all companies
- url(r'^.*$', RedirectView.as_view(url='', permanent=False), name='company-index'),
+ url(r'^.*$', views.CompanyIndex.as_view(), name='company-index'),
]
price_break_urls = [
diff --git a/InvenTree/company/views.py b/InvenTree/company/views.py
index 243a982872..36e1e7bd91 100644
--- a/InvenTree/company/views.py
+++ b/InvenTree/company/views.py
@@ -39,6 +39,37 @@ class CompanyIndex(ListView):
context_object_name = 'companies'
paginate_by = 50
+ def get_context_data(self, **kwargs):
+
+ ctx = super().get_context_data(**kwargs)
+
+ url = self.request.path
+
+ print(url)
+ print(reverse('supplier-index'))
+ print(reverse('manufacturer-index'))
+ print(reverse('customer-index'))
+
+ if url == reverse('supplier-index'):
+ ctx["title"] = _("Suppliers")
+ ctx['new_button_text'] = _("New Supplier")
+ ctx["filters"] = {"is_supplier": "true"}
+ elif url == reverse('manufacturer-index'):
+ ctx["title"] = _("Manufacturers")
+ ctx['new_button_text'] = _("New Manufacturer")
+ ctx["filters"] = {"is_manufacturer": "true"}
+ elif url == reverse('customer-index'):
+ ctx["title"] = _("Customers")
+ ctx['new_button_text'] = _("New Customer")
+ ctx["filters"] = {"is_customer": "true"}
+ else:
+ ctx["title"] = _("Companies")
+ ctx["new_button_text"] = _("New Company")
+ ctx["filters"] = {}
+
+ return ctx
+
+
def get_queryset(self):
""" Retrieve the Company queryset based on HTTP request parameters.
diff --git a/InvenTree/templates/navbar.html b/InvenTree/templates/navbar.html
index 202fb2a0ce..c41ef3718f 100644
--- a/InvenTree/templates/navbar.html
+++ b/InvenTree/templates/navbar.html
@@ -13,11 +13,17 @@
{% trans "Buy" %}
+
+ {% trans "Sell" %}
+
+
{% include "search_form.html" %}