mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
Merge branch 'master' of https://github.com/inventree/InvenTree into price-history
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% load inventree_extras %}
|
||||
|
||||
{% block page_title %}
|
||||
InvenTree | {% trans "Search Results" %}
|
||||
@ -145,6 +146,21 @@ InvenTree | {% trans "Search Results" %}
|
||||
],
|
||||
});
|
||||
|
||||
addItem('manufacturer-part', '{% trans "Manufacturer Parts" %}', 'fa-toolbox');
|
||||
|
||||
loadManufacturerPartTable(
|
||||
"#table-manufacturer-part",
|
||||
"{% url 'api-manufacturer-part-list' %}",
|
||||
{
|
||||
params: {
|
||||
search: "{{ query }}",
|
||||
part_detail: true,
|
||||
supplier_detail: true,
|
||||
manufacturer_detail: true
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
addItem('supplier-part', '{% trans "Supplier Parts" %}', 'fa-pallet');
|
||||
|
||||
loadSupplierPartTable(
|
||||
@ -287,6 +303,15 @@ InvenTree | {% trans "Search Results" %}
|
||||
{% if roles.purchase_order.view or roles.sales_order.view %}
|
||||
addItemTitle('{% trans "Company" %}');
|
||||
|
||||
addItem('manufacturer', '{% trans "Manufacturers" %}', 'fa-industry');
|
||||
|
||||
loadCompanyTable('#table-manufacturer', "{% url 'api-company-list' %}", {
|
||||
params: {
|
||||
search: "{{ query }}",
|
||||
is_manufacturer: "true",
|
||||
}
|
||||
});
|
||||
|
||||
{% if roles.purchase_order.view %}
|
||||
addItem('supplier', '{% trans "Suppliers" %}', 'fa-building');
|
||||
|
||||
@ -305,16 +330,6 @@ InvenTree | {% trans "Search Results" %}
|
||||
}
|
||||
});
|
||||
|
||||
addItem('manufacturer', '{% trans "Manufacturers" %}', 'fa-industry');
|
||||
|
||||
loadCompanyTable('#table-manufacturer', "{% url 'api-company-list' %}", {
|
||||
params: {
|
||||
search: "{{ query }}",
|
||||
is_manufacturer: "true",
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if roles.sales_order.view %}
|
||||
|
@ -101,6 +101,104 @@ function loadCompanyTable(table, url, options={}) {
|
||||
}
|
||||
|
||||
|
||||
function loadManufacturerPartTable(table, url, options) {
|
||||
/*
|
||||
* Load manufacturer part table
|
||||
*
|
||||
*/
|
||||
|
||||
// Query parameters
|
||||
var params = options.params || {};
|
||||
|
||||
// Load filters
|
||||
var filters = loadTableFilters("manufacturer-part");
|
||||
|
||||
for (var key in params) {
|
||||
filters[key] = params[key];
|
||||
}
|
||||
|
||||
setupFilterList("manufacturer-part", $(table));
|
||||
|
||||
$(table).inventreeTable({
|
||||
url: url,
|
||||
method: 'get',
|
||||
original: params,
|
||||
queryParams: filters,
|
||||
name: 'manufacturerparts',
|
||||
groupBy: false,
|
||||
formatNoMatches: function() { return "{% trans "No manufacturer parts found" %}"; },
|
||||
columns: [
|
||||
{
|
||||
checkbox: true,
|
||||
switchable: false,
|
||||
},
|
||||
{
|
||||
visible: params['part_detail'],
|
||||
switchable: params['part_detail'],
|
||||
sortable: true,
|
||||
field: 'part_detail.full_name',
|
||||
title: '{% trans "Part" %}',
|
||||
formatter: function(value, row, index, field) {
|
||||
|
||||
var url = `/part/${row.part}/`;
|
||||
|
||||
var html = imageHoverIcon(row.part_detail.thumbnail) + renderLink(value, url);
|
||||
|
||||
if (row.part_detail.is_template) {
|
||||
html += `<span class='fas fa-clone label-right' title='{% trans "Template part" %}'></span>`;
|
||||
}
|
||||
|
||||
if (row.part_detail.assembly) {
|
||||
html += `<span class='fas fa-tools label-right' title='{% trans "Assembled part" %}'></span>`;
|
||||
}
|
||||
|
||||
if (!row.part_detail.active) {
|
||||
html += `<span class='label label-warning label-right'>{% trans "Inactive" %}</span>`;
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
sortable: true,
|
||||
field: 'manufacturer',
|
||||
title: '{% trans "Manufacturer" %}',
|
||||
formatter: function(value, row, index, field) {
|
||||
if (value && row.manufacturer_detail) {
|
||||
var name = row.manufacturer_detail.name;
|
||||
var url = `/company/${value}/`;
|
||||
var html = imageHoverIcon(row.manufacturer_detail.image) + renderLink(name, url);
|
||||
|
||||
return html;
|
||||
} else {
|
||||
return "-";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
sortable: true,
|
||||
field: 'MPN',
|
||||
title: '{% trans "MPN" %}',
|
||||
formatter: function(value, row, index, field) {
|
||||
return renderLink(value, `/manufacturer-part/${row.pk}/`);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'link',
|
||||
title: '{% trans "Link" %}',
|
||||
formatter: function(value, row, index, field) {
|
||||
if (value) {
|
||||
return renderLink(value, value);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function loadSupplierPartTable(table, url, options) {
|
||||
/*
|
||||
* Load supplier part table
|
||||
@ -133,10 +231,11 @@ function loadSupplierPartTable(table, url, options) {
|
||||
switchable: false,
|
||||
},
|
||||
{
|
||||
visible: params['part_detail'],
|
||||
switchable: params['part_detail'],
|
||||
sortable: true,
|
||||
field: 'part_detail.full_name',
|
||||
title: '{% trans "Part" %}',
|
||||
switchable: false,
|
||||
formatter: function(value, row, index, field) {
|
||||
|
||||
var url = `/part/${row.part}/`;
|
||||
@ -183,6 +282,8 @@ function loadSupplierPartTable(table, url, options) {
|
||||
}
|
||||
},
|
||||
{
|
||||
visible: params['manufacturer_detail'],
|
||||
switchable: params['manufacturer_detail'],
|
||||
sortable: true,
|
||||
field: 'manufacturer',
|
||||
title: '{% trans "Manufacturer" %}',
|
||||
@ -199,9 +300,18 @@ function loadSupplierPartTable(table, url, options) {
|
||||
}
|
||||
},
|
||||
{
|
||||
visible: params['manufacturer_detail'],
|
||||
switchable: params['manufacturer_detail'],
|
||||
sortable: true,
|
||||
field: 'MPN',
|
||||
title: '{% trans "MPN" %}',
|
||||
formatter: function(value, row, index, field) {
|
||||
if (value && row.manufacturer_part) {
|
||||
return renderLink(value, `/manufacturer-part/${row.manufacturer_part.pk}/`);
|
||||
} else {
|
||||
return "-";
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'link',
|
||||
|
@ -164,11 +164,11 @@ function getFilterOptionList(tableKey, filterKey) {
|
||||
return {
|
||||
'1': {
|
||||
key: '1',
|
||||
value: 'true',
|
||||
value: '{% trans "true" %}',
|
||||
},
|
||||
'0': {
|
||||
key: '0',
|
||||
value: 'false',
|
||||
value: '{% trans "false" %}',
|
||||
},
|
||||
};
|
||||
} else if ('options' in settings) {
|
||||
@ -394,8 +394,8 @@ function getFilterOptionValue(tableKey, filterKey, valueKey) {
|
||||
|
||||
// Lookup for boolean options
|
||||
if (filter.type == 'bool') {
|
||||
if (value == '1') return 'true';
|
||||
if (value == '0') return 'false';
|
||||
if (value == '1') return '{% trans "true" %}';
|
||||
if (value == '0') return '{% trans "false" %}';
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ function loadStockTable(table, options) {
|
||||
var html = imageHoverIcon(row.part_detail.thumbnail);
|
||||
|
||||
html += row.part_detail.full_name;
|
||||
html += ` <i>(${data.length} items)</i>`;
|
||||
html += ` <i>(${data.length} {% trans "items" %})</i>`;
|
||||
|
||||
html += makePartIcons(row.part_detail);
|
||||
|
||||
@ -446,7 +446,7 @@ function loadStockTable(table, options) {
|
||||
});
|
||||
|
||||
if (batches.length > 1) {
|
||||
return "" + batches.length + " batches";
|
||||
return "" + batches.length + " {% trans 'batches' %}";
|
||||
} else if (batches.length == 1) {
|
||||
if (batches[0]) {
|
||||
return batches[0];
|
||||
@ -473,9 +473,9 @@ function loadStockTable(table, options) {
|
||||
// Single location, easy!
|
||||
return locations[0];
|
||||
} else if (locations.length > 1) {
|
||||
return "In " + locations.length + " locations";
|
||||
return "In " + locations.length + " {% trans 'locations' %}";
|
||||
} else {
|
||||
return "<i>{% trans "Undefined location" %}</i>";
|
||||
return "<i>{% trans 'Undefined location' %}</i>";
|
||||
}
|
||||
} else if (field == 'notes') {
|
||||
var notes = [];
|
||||
@ -1219,7 +1219,7 @@ function loadInstalledInTable(table, options) {
|
||||
// Add some buttons yo!
|
||||
html += `<div class='btn-group float-right' role='group'>`;
|
||||
|
||||
html += makeIconButton('fa-unlink', 'button-uninstall', pk, "{% trans "Uninstall stock item" %}");
|
||||
html += makeIconButton('fa-unlink', 'button-uninstall', pk, "{% trans 'Uninstall stock item' %}");
|
||||
|
||||
html += `</div>`;
|
||||
|
||||
|
@ -59,11 +59,17 @@
|
||||
{% endif %}
|
||||
<li class='dropdown'>
|
||||
<a class='dropdown-toggle' data-toggle='dropdown' href="#">
|
||||
{% if user.is_staff %}
|
||||
{% if not system_healthy %}
|
||||
<span class='fas fa-exclamation-triangle icon-red'></span>
|
||||
{% if not django_q_running %}
|
||||
<span class='fas fa-exclamation-triangle icon-red'></span>
|
||||
{% else %}
|
||||
<span class='fas fa-exclamation-triangle icon-orange'></span>
|
||||
{% endif %}
|
||||
{% elif not up_to_date %}
|
||||
<span class='fas fa-info-circle icon-green'></span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<span class="fas fa-user"></span> <b>{{ user.get_username }}</b></a>
|
||||
<ul class='dropdown-menu'>
|
||||
{% if user.is_authenticated %}
|
||||
@ -77,10 +83,14 @@
|
||||
<hr>
|
||||
<li><a href="{% url 'settings' %}"><span class="fas fa-cog"></span> {% trans "Settings" %}</a></li>
|
||||
<li id='launch-stats'><a href='#'>
|
||||
{% if system_healthy %}
|
||||
<span class='fas fa-server'>
|
||||
{% if system_healthy or not user.is_staff %}
|
||||
<span class='fas fa-server'></span>
|
||||
{% else %}
|
||||
<span class='fas fa-server icon-red'>
|
||||
{% if not django_q_running %}
|
||||
<span class='fas fa-server icon-red'></span>
|
||||
{% else %}
|
||||
<span class='fas fa-server icon-orange'></span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</span> {% trans "System Information" %}
|
||||
</a></li>
|
||||
|
Reference in New Issue
Block a user