mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
commit
4a99996be8
@ -81,15 +81,19 @@ function loadPartTable(table, url, options={}) {
|
|||||||
* - table: HTML reference to the table
|
* - table: HTML reference to the table
|
||||||
* - url: Base URL for API query
|
* - url: Base URL for API query
|
||||||
* - options: object containing following (optional) fields
|
* - options: object containing following (optional) fields
|
||||||
* allowInactive: If true, allow display of inactive parts
|
|
||||||
* checkbox: Show the checkbox column
|
* checkbox: Show the checkbox column
|
||||||
* query: extra query params for API request
|
* query: extra query params for API request
|
||||||
* buttons: If provided, link buttons to selection status of this table
|
* buttons: If provided, link buttons to selection status of this table
|
||||||
|
* disableFilters: If true, disable custom filters
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var params = options.params || {};
|
var params = options.params || {};
|
||||||
|
|
||||||
var filters = loadTableFilters("parts");
|
var filters = {};
|
||||||
|
|
||||||
|
if (!options.disableFilters) {
|
||||||
|
filters = loadTableFilters("parts");
|
||||||
|
}
|
||||||
|
|
||||||
for (var key in params) {
|
for (var key in params) {
|
||||||
filters[key] = params[key];
|
filters[key] = params[key];
|
||||||
|
@ -41,6 +41,7 @@ function loadStockTable(table, options) {
|
|||||||
* groupByField - Column for grouping stock items
|
* groupByField - Column for grouping stock items
|
||||||
* buttons - Which buttons to link to stock selection callbacks
|
* buttons - Which buttons to link to stock selection callbacks
|
||||||
* filterList - <ul> element where filters are displayed
|
* filterList - <ul> element where filters are displayed
|
||||||
|
* disableFilters: If true, disable custom filters
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// List of user-params which override the default filters
|
// List of user-params which override the default filters
|
||||||
@ -48,7 +49,11 @@ function loadStockTable(table, options) {
|
|||||||
|
|
||||||
var filterListElement = options.filterList || "#filter-list-stock";
|
var filterListElement = options.filterList || "#filter-list-stock";
|
||||||
|
|
||||||
var filters = loadTableFilters("stock");
|
var filters = {};
|
||||||
|
|
||||||
|
if (!options.disableFilters) {
|
||||||
|
filters = loadTableFilters("stock");
|
||||||
|
}
|
||||||
|
|
||||||
var original = {};
|
var original = {};
|
||||||
|
|
||||||
|
@ -137,29 +137,30 @@
|
|||||||
|
|
||||||
$("#cat-create").click(function() {
|
$("#cat-create").click(function() {
|
||||||
launchModalForm(
|
launchModalForm(
|
||||||
"{% url 'category-create' %}",
|
"{% url 'category-create' %}",
|
||||||
{
|
{
|
||||||
follow: true,
|
follow: true,
|
||||||
{% if category %}
|
{% if category %}
|
||||||
data: {
|
data: {
|
||||||
category: {{ category.id }}
|
category: {{ category.id }}
|
||||||
},
|
},
|
||||||
{% endif %}
|
{% endif %}
|
||||||
secondary: [
|
secondary: [
|
||||||
{
|
{
|
||||||
field: 'default_location',
|
field: 'default_location',
|
||||||
label: 'New Location',
|
label: 'New Location',
|
||||||
title: 'Create new location',
|
title: 'Create new location',
|
||||||
url: "{% url 'stock-location-create' %}",
|
url: "{% url 'stock-location-create' %}",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'parent',
|
field: 'parent',
|
||||||
label: 'New Category',
|
label: 'New Category',
|
||||||
title: 'Create new category',
|
title: 'Create new category',
|
||||||
url: "{% url 'category-create' %}",
|
url: "{% url 'category-create' %}",
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
});
|
}
|
||||||
|
);
|
||||||
})
|
})
|
||||||
|
|
||||||
$("#part-export").click(function() {
|
$("#part-export").click(function() {
|
||||||
|
@ -104,6 +104,7 @@ InvenTree | {% trans "Search Results" %}
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("#location-results-table").inventreeTable({
|
$("#location-results-table").inventreeTable({
|
||||||
url: "{% url 'api-location-list' %}",
|
url: "{% url 'api-location-list' %}",
|
||||||
queryParams: {
|
queryParams: {
|
||||||
@ -124,20 +125,22 @@ InvenTree | {% trans "Search Results" %}
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
loadPartTable("#part-results-table",
|
loadPartTable("#part-results-table",
|
||||||
"{% url 'api-part-list' %}",
|
"{% url 'api-part-list' %}",
|
||||||
{
|
{
|
||||||
query: {
|
params: {
|
||||||
search: "{{ query }}",
|
search: "{{ query }}",
|
||||||
},
|
},
|
||||||
allowInactive: true,
|
|
||||||
checkbox: false,
|
checkbox: false,
|
||||||
|
disableFilters: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
loadCompanyTable('#company-results-table', "{% url 'api-company-list' %}", {
|
loadCompanyTable('#company-results-table', "{% url 'api-company-list' %}", {
|
||||||
params: {
|
params: {
|
||||||
serach: "{{ query }}",
|
search: "{{ query }}",
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -153,5 +156,5 @@ InvenTree | {% trans "Search Results" %}
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -9,6 +9,13 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block collapse_content %}
|
{% block collapse_content %}
|
||||||
|
<div id='button-toolbar'>
|
||||||
|
<div class='button-toolbar container-fluid' style='float: right;'>
|
||||||
|
<button class='btn btn-default'>Hello</button>
|
||||||
|
<div class='filter-list' id='filter-list-parts'></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' data-toolbar="#button-toolbar" id='part-results-table'>
|
<table class='table table-striped table-condensed' data-toolbar="#button-toolbar" id='part-results-table'>
|
||||||
</table>
|
</table>
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user