mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add search results for part-category and stock-location
This commit is contained in:
parent
3427f81a34
commit
fd2e2a71f9
@ -51,7 +51,7 @@ class CategoryList(generics.ListCreateAPIView):
|
||||
|
||||
filter_backends = [
|
||||
DjangoFilterBackend,
|
||||
# filters.SearchFilter,
|
||||
filters.SearchFilter,
|
||||
filters.OrderingFilter,
|
||||
]
|
||||
|
||||
|
@ -236,6 +236,11 @@ class StockLocationList(generics.ListCreateAPIView):
|
||||
'parent',
|
||||
]
|
||||
|
||||
search_fields = [
|
||||
'name',
|
||||
'description',
|
||||
]
|
||||
|
||||
|
||||
class StockList(generics.ListCreateAPIView):
|
||||
""" API endpoint for list view of Stock objects
|
||||
|
@ -17,10 +17,14 @@ InvenTree | Search Results
|
||||
<br><br>
|
||||
<hr>
|
||||
|
||||
{% include "InvenTree/search_part_category.html" with collapse_id="categories" %}
|
||||
|
||||
{% include "InvenTree/search_parts.html" with collapse_id='parts' %}
|
||||
|
||||
{% include "InvenTree/search_supplier_parts.html" with collapse_id='supplier_parts' %}
|
||||
|
||||
{% include "InvenTree/search_stock_location.html" with collapse_id="locations" %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block js_load %}
|
||||
@ -50,10 +54,54 @@ InvenTree | Search Results
|
||||
});
|
||||
}
|
||||
|
||||
onSearchResults("#category-results-table", "#category-results-count");
|
||||
|
||||
onSearchResults("#location-results-table", "#location-results-count");
|
||||
|
||||
onSearchResults('#part-results-table', '#part-result-count');
|
||||
|
||||
onSearchResults('#supplier-part-results-table', '#supplier-part-result-count');
|
||||
|
||||
$("#category-results-table").bootstrapTable({
|
||||
url: "{% url 'api-part-category-list' %}",
|
||||
queryParams: {
|
||||
search: "{{ query }}",
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
field: 'name',
|
||||
title: 'Name',
|
||||
formatter: function(value, row, index, field) {
|
||||
return renderLink(value, '/part/category/' + row.pk + '/');
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'description',
|
||||
title: 'Description',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
$("#location-results-table").bootstrapTable({
|
||||
url: "{% url 'api-location-list' %}",
|
||||
queryParams: {
|
||||
search: "{{ query }}",
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
field: 'name',
|
||||
title: 'Name',
|
||||
formatter: function(value, row, index, field) {
|
||||
return renderLink(value, '/stock/location/' + row.pk + '/');
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'description',
|
||||
title: 'Description',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
loadPartTable("#part-results-table",
|
||||
"{% url 'api-part-list' %}",
|
||||
{
|
||||
|
14
InvenTree/templates/InvenTree/search_part_category.html
Normal file
14
InvenTree/templates/InvenTree/search_part_category.html
Normal file
@ -0,0 +1,14 @@
|
||||
{% extends "collapse.html" %}
|
||||
|
||||
{% block collapse_title %}
|
||||
<h4>Part Categories</h4>
|
||||
{% endblock %}
|
||||
|
||||
{% block collapse_heading %}
|
||||
<h4><span id='category-results-count'>{% include "InvenTree/searching.html" %}</span></h4>
|
||||
{% endblock %}
|
||||
|
||||
{% block collapse_content %}
|
||||
<table class='table table-striped table-condensed' data-toolbar="#button-toolbar" id='category-results-table'>
|
||||
</table>
|
||||
{% endblock %}
|
14
InvenTree/templates/InvenTree/search_stock_location.html
Normal file
14
InvenTree/templates/InvenTree/search_stock_location.html
Normal file
@ -0,0 +1,14 @@
|
||||
{% extends "collapse.html" %}
|
||||
|
||||
{% block collapse_title %}
|
||||
<h4>Stock Locations</h4>
|
||||
{% endblock %}
|
||||
|
||||
{% block collapse_heading %}
|
||||
<h4><span id='location-results-count'>{% include "InvenTree/searching.html" %}</span></h4>
|
||||
{% endblock %}
|
||||
|
||||
{% block collapse_content %}
|
||||
<table class='table table-striped table-condensed' data-toolbar="#button-toolbar" id='location-results-table'>
|
||||
</table>
|
||||
{% endblock %}
|
@ -1 +1 @@
|
||||
<span class='glyphicon glyphicon-refresh glyphicon-refresh-animate'></span> Searching...
|
||||
<span class='glyphicon glyphicon-refresh glyphicon-refresh-animate'></span> Searching
|
Loading…
Reference in New Issue
Block a user