mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #1961 from SchrodingersGat/tweaks
Small tweaks here and there
This commit is contained in:
commit
81a8aac623
@ -42,9 +42,32 @@ function loadAttachmentTable(url, options) {
|
|||||||
title: '{% trans "File" %}',
|
title: '{% trans "File" %}',
|
||||||
formatter: function(value, row) {
|
formatter: function(value, row) {
|
||||||
|
|
||||||
var split = value.split('/');
|
var icon = 'fa-file-alt';
|
||||||
|
|
||||||
return renderLink(split[split.length - 1], value);
|
var fn = value.toLowerCase();
|
||||||
|
|
||||||
|
if (fn.endsWith('.pdf')) {
|
||||||
|
icon = 'fa-file-pdf';
|
||||||
|
} else if (fn.endsWith('.xls') || fn.endsWith('.xlsx')) {
|
||||||
|
icon = 'fa-file-excel';
|
||||||
|
} else if (fn.endsWith('.doc') || fn.endsWith('.docx')) {
|
||||||
|
icon = 'fa-file-word';
|
||||||
|
} else {
|
||||||
|
var images = ['.png', '.jpg', '.bmp', '.gif', '.svg', '.tif'];
|
||||||
|
|
||||||
|
images.forEach(function (suffix) {
|
||||||
|
if (fn.endsWith(suffix)) {
|
||||||
|
icon = 'fa-file-image';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var split = value.split('/');
|
||||||
|
var filename = split[split.length - 1];
|
||||||
|
|
||||||
|
var html = `<span class='fas ${icon}'></span> ${filename}`;
|
||||||
|
|
||||||
|
return renderLink(html, value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -252,7 +252,7 @@ function loadBomTable(table, options) {
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row, index, field) {
|
||||||
|
|
||||||
var url = `/part/${row.sub_part_detail.pk}/stock/`;
|
var url = `/part/${row.sub_part_detail.pk}/?display=stock`;
|
||||||
var text = value;
|
var text = value;
|
||||||
|
|
||||||
if (value == null || value <= 0) {
|
if (value == null || value <= 0) {
|
||||||
|
@ -500,7 +500,7 @@ function loadPartVariantTable(table, partId, options={}) {
|
|||||||
field: 'in_stock',
|
field: 'in_stock',
|
||||||
title: '{% trans "Stock" %}',
|
title: '{% trans "Stock" %}',
|
||||||
formatter: function(value, row) {
|
formatter: function(value, row) {
|
||||||
return renderLink(value, `/part/${row.pk}/stock/`);
|
return renderLink(value, `/part/${row.pk}/?display=stock`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -1066,7 +1066,7 @@ function loadStockTable(table, options) {
|
|||||||
return '-';
|
return '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
var link = `/supplier-part/${row.supplier_part}/stock/`;
|
var link = `/supplier-part/${row.supplier_part}/?display=stock`;
|
||||||
|
|
||||||
var text = '';
|
var text = '';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user