From cc2e3351ff9dad9ddaccc15b02889b1703265cf5 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 4 Jun 2019 22:34:58 +1000 Subject: [PATCH] Search for company --- InvenTree/templates/InvenTree/search.html | 27 +++++++++++++++++++ .../templates/InvenTree/search_company.html | 14 ++++++++++ 2 files changed, 41 insertions(+) create mode 100644 InvenTree/templates/InvenTree/search_company.html diff --git a/InvenTree/templates/InvenTree/search.html b/InvenTree/templates/InvenTree/search.html index 70915a49fd..a31e4ed1a8 100644 --- a/InvenTree/templates/InvenTree/search.html +++ b/InvenTree/templates/InvenTree/search.html @@ -25,6 +25,8 @@ InvenTree | Search Results {% include "InvenTree/search_parts.html" with collapse_id='parts' %} +{% include "InvenTree/search_company.html" with collapse_id='companies' %} + {% include "InvenTree/search_supplier_parts.html" with collapse_id='supplier_parts' %} {% include "InvenTree/search_stock_location.html" with collapse_id="locations" %} @@ -77,6 +79,8 @@ InvenTree | Search Results onSearchResults('#part-results-table', '#part-result-count'); + onSearchResults('#company-results-table', '#company-result-count'); + onSearchResults('#supplier-part-results-table', '#supplier-part-result-count'); $("#category-results-table").bootstrapTable({ @@ -130,6 +134,29 @@ InvenTree | Search Results } ); + $("#company-results-table").bootstrapTable({ + url: "{% url 'api-company-list' %}", + queryParams: { + search: "{{ query }}", + }, + pagination: true, + pageSize: 25, + search: true, + columns: [ + { + field: 'name', + title: 'Name', + formatter: function(value, row, index, field) { + return imageHoverIcon(row.image) + renderLink(value, row.url); + }, + }, + { + field: 'description', + title: 'Description', + }, + ] + }); + $("#supplier-part-results-table").bootstrapTable({ url: "{% url 'api-part-supplier-list' %}", queryParams: { diff --git a/InvenTree/templates/InvenTree/search_company.html b/InvenTree/templates/InvenTree/search_company.html new file mode 100644 index 0000000000..776f661819 --- /dev/null +++ b/InvenTree/templates/InvenTree/search_company.html @@ -0,0 +1,14 @@ +{% extends "collapse.html" %} + +{% block collapse_title %} +

Companies

+{% endblock %} + +{% block collapse_heading %} +

{% include "InvenTree/searching.html" %}

+{% endblock %} + +{% block collapse_content %} + +
+{% endblock %} \ No newline at end of file