2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 05:25:42 +00:00

Merge remote-tracking branch 'inventree/master' into build-fixes

# Conflicts:
#	InvenTree/locale/de/LC_MESSAGES/django.mo
#	InvenTree/locale/de/LC_MESSAGES/django.po
#	InvenTree/locale/en/LC_MESSAGES/django.po
#	InvenTree/locale/es/LC_MESSAGES/django.po
#	InvenTree/templates/js/bom.js
This commit is contained in:
Oliver Walters
2020-10-29 15:23:51 +11:00
15 changed files with 1001 additions and 732 deletions

View File

@ -150,17 +150,31 @@ function loadBomTable(table, options) {
var url = `/part/${row.sub_part}/`;
var html = imageHoverIcon(row.sub_part_detail.thumbnail) + renderLink(row.sub_part_detail.full_name, url);
if (row.sub_part_detail.trackable) {
html += `<span title='{% trans "Trackable part" %}' class='fas fa-directions label-right'></span>`;
var sub_part = row.sub_part_detail;
if (sub_part.trackable) {
html += makeIconBadge('fa-directions', '{% trans "Trackable part" %}');
}
if (sub_part.virtual) {
html += makeIconBadge('fa-ghost', '{% trans "Virtual part" %}');
}
if (sub_part.is_template) {
html += makeIconBadge('fa-clone', '{% trans "Templat part" %}');
}
// Display an extra icon if this part is an assembly
if (row.sub_part_detail.assembly) {
if (sub_part.assembly) {
var text = `<span title='{% trans "Open subassembly" %}' class='fas fa-stream label-right'></span>`;
html += renderLink(text, `/part/${row.sub_part}/bom/`);
}
if (!sub_part.active) {
html += `<span class='label label-warning label-right'>{% trans "Inactive" %}</span>`;
}
return html;
}
}
@ -522,4 +536,4 @@ function loadUsedInTable(table, options) {
queryParams: filters,
original: params,
});
}
}

View File

@ -110,7 +110,7 @@ function loadSupplierPartTable(table, url, options) {
// Query parameters
var params = options.params || {};
// Load 'user' filters
// Load filters
var filters = loadTableFilters("supplier-part");
for (var key in params) {
@ -122,6 +122,7 @@ function loadSupplierPartTable(table, url, options) {
$(table).inventreeTable({
url: url,
method: 'get',
original: params,
queryParams: filters,
name: 'supplierparts',
groupBy: false,
@ -135,6 +136,7 @@ function loadSupplierPartTable(table, url, options) {
sortable: true,
field: 'part_detail.full_name',
title: '{% trans "Part" %}',
switchable: false,
formatter: function(value, row, index, field) {
var url = `/part/${row.part}/`;

View File

@ -61,13 +61,22 @@ function toggleStar(options) {
}
function loadPartVariantTable(table, partId, options) {
function loadPartVariantTable(table, partId, options={}) {
/* Load part variant table
*/
var params = {
ancestor: partId,
};
var params = options.params || {};
params.ancestor = partId;
// Load filters
var filters = loadTableFilters("variants");
for (var key in params) {
filters[key] = params[key];
}
setupFilterList("variants", $(table));
var cols = [
{
@ -104,16 +113,36 @@ function loadPartVariantTable(table, partId, options) {
html += imageHoverIcon(row.thumbnail);
html += renderLink(name, `/part/${row.pk}/`);
if (row.trackable) {
html += makeIconBadge('fa-directions', '{% trans "Trackable part" %}');
}
if (row.virtual) {
html += makeIconBadge('fa-ghost', '{% trans "Virtual part" %}');
}
if (row.is_template) {
html += makeIconBadge('fa-clone', '{% trans "Template part" %}');
}
if (row.assembly) {
html += makeIconBadge('fa-tools', '{% trans "Assembled part" %}');
}
if (!row.active) {
html += `<span class='label label-warning label-right'>{% trans "Inactive" %}</span>`;
}
return html;
},
},
{
field: 'IPN',
title: '{% trans 'IPN' %}',
title: '{% trans "IPN" %}',
},
{
field: 'revision',
title: '{% trans 'Revision' %}',
title: '{% trans "Revision" %}',
},
{
field: 'description',
@ -133,7 +162,7 @@ function loadPartVariantTable(table, partId, options) {
name: 'partvariants',
showColumns: true,
original: params,
queryParams: params,
queryParams: filters,
formatNoMatches: function() { return "{% trans "No variants found" %}"; },
columns: cols,
treeEnable: true,
@ -272,7 +301,7 @@ function loadPartTable(table, url, options={}) {
if (options.checkbox) {
columns.push({
checkbox: true,
title: '{% trans 'Select' %}',
title: '{% trans "Select" %}',
searchable: false,
switchable: false,
});
@ -286,8 +315,9 @@ function loadPartTable(table, url, options={}) {
columns.push({
field: 'name',
title: '{% trans 'Part' %}',
title: '{% trans "Part" %}',
sortable: true,
switchable: false,
formatter: function(value, row, index, field) {
var name = '';
@ -310,20 +340,29 @@ function loadPartTable(table, url, options={}) {
var display = imageHoverIcon(row.thumbnail) + renderLink(name, '/part/' + row.pk + '/');
if (row.trackable) {
display += makeIconBadge('fa-directions', '{% trans "Trackable part" %}');
}
if (row.virtual) {
display += makeIconBadge('fa-ghost', '{% trans "Virtual part" %}');
}
if (row.is_template) {
display += `<span class='fas fa-clone label-right' title='{% trans "Template part" %}'></span>`;
display += makeIconBadge('fa-clone', '{% trans "Template part" %}');
}
if (row.assembly) {
display += `<span class='fas fa-tools label-right' title='{% trans "Assembled part" %}'></span>`;
display += makeIconBadge('fa-tools', '{% trans "Assembled part" %}');
}
if (row.starred) {
display += `<span class='fas fa-star label-right' title='{% trans "Starred part" %}'></span>`;
display += makeIconBadge('fa-star', '{% trans "Starred part" %}');
}
if (row.salable) {
display += `<span class='fas fa-dollar-sign label-right' title='{% trans "Salable part" %}'></span>`;
display += makeIconBadge('fa-dollar-sign', title='{% trans "Salable part" %}');
}
/*
@ -342,7 +381,7 @@ function loadPartTable(table, url, options={}) {
columns.push({
sortable: true,
field: 'description',
title: '{% trans 'Description' %}',
title: '{% trans "Description" %}',
formatter: function(value, row, index, field) {
if (row.is_template) {
@ -356,7 +395,7 @@ function loadPartTable(table, url, options={}) {
columns.push({
sortable: true,
field: 'category_detail',
title: '{% trans 'Category' %}',
title: '{% trans "Category" %}',
formatter: function(value, row, index, field) {
if (row.category) {
return renderLink(value.pathstring, "/part/category/" + row.category + "/");

View File

@ -11,6 +11,28 @@ function getAvailableTableFilters(tableKey) {
tableKey = tableKey.toLowerCase();
// Filters for "variant" table
if (tableKey == "variants") {
return {
active: {
type: 'bool',
title: '{% trans "Active" %}',
},
template: {
type: 'bool',
title: '{% trans "Template" %}',
},
virtual: {
type: 'bool',
title: '{% trans "Virtual" %}',
},
trackable: {
type: 'bool',
title: '{% trans "Trackable" %}',
},
};
}
// Filters for Bill of Materials table
if (tableKey == "bom") {
return {
@ -194,6 +216,15 @@ function getAvailableTableFilters(tableKey) {
};
}
if (tableKey == 'supplier-part') {
return {
active: {
type: 'bool',
title: '{% trans "Active parts" %}',
}
};
}
// Filters for the "Parts" table
if (tableKey == "parts") {
return {