2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-11 07:24:15 +00:00

Add search preview for purchase orders and sales orders

This commit is contained in:
Oliver Walters
2022-03-29 23:38:01 +11:00
parent 2a604c244e
commit f724f4a845
2 changed files with 55 additions and 5 deletions

View File

@ -79,12 +79,19 @@ function updateSearch() {
$('#offcanvas-search').find('#search-pending').show();
if (user_settings.SEARCH_PREVIEW_SHOW_PARTS) {
var params = {};
if (user_settings.SEARCH_HIDE_INACTIVE_PARTS) {
params.active = false;
}
// Search for matching parts
addSearchQuery(
'part',
'{% trans "Parts" %}',
'{% url "api-part-list" %}',
{},
params,
renderPart,
{
url: '/part',
@ -150,6 +157,40 @@ function updateSearch() {
}
);
}
if (user_settings.SEARCH_PREVIEW_SHOW_PURCHASE_ORDERS) {
// Search for matching purchase orders
addSearchQuery(
'purchaseorder',
'{% trans "Purchase Orders" %}',
'{% url "api-po-list" %}',
{
supplier_detail: true,
outstanding: true,
},
renderPurchaseOrder,
{
url: '/order/purchase-order',
}
);
}
if (user_settings.SEARCH_PREVIEW_SHOW_SALES_ORDERS) {
// Search for matching sales orders
addSearchQuery(
'salesorder',
'{% trans "Sales Orders" %}',
'{% url "api-so-list" %}',
{
customer_detail: true,
outstanding: true,
},
renderSalesOrder,
{
url: '/order/sales-order',
}
);
}
// Wait until all the pending queries are completed
$.when.apply($, searchQueries).done(function() {