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

Homepage Improvements (#5057)

* remove STOCK_RECENT_COUNT parameter

- Now "recent" is set by date
- Tables are paginated by the server

* Display total row count

* remove PART_RECENT_COUNT

- Replace with date filter
- Update Part.api

* Bump API version
This commit is contained in:
Oliver
2023-06-17 08:21:25 +10:00
committed by GitHub
parent 31ff3599eb
commit 61d2f452b2
5 changed files with 19 additions and 24 deletions

View File

@ -60,11 +60,16 @@ function addHeaderAction(label, title, icon, options) {
</div>`
);
// Connect a callback to the table
$(`#table-${label}`).on('load-success.bs.table', function() {
var count = $(`#table-${label}`).bootstrapTable('getData').length;
let table_name = `#table-${label}`;
var badge = $(`#sidebar-badge-${label}`);
// Connect a callback to the table
$(table_name).on('load-success.bs.table', function(data) {
let options = $(table_name).bootstrapTable('getOptions');
let count = options.totalRows;
let badge = $(`#sidebar-badge-${label}`);
badge.html(count);
@ -113,7 +118,7 @@ addHeaderAction('latest-parts', '{% trans "Latest Parts" %}', 'fa-newspaper');
loadSimplePartTable("#table-latest-parts", "{% url 'api-part-list' %}", {
params: {
ordering: "-creation_date",
limit: {% settings_value "PART_RECENT_COUNT" user=request.user %},
created_after: moment().subtract(1, 'months').format('YYYY-MM-DD'),
{% if hide_inactive %}
active: true,
{% endif %}
@ -150,14 +155,13 @@ loadSimplePartTable("#table-bom-validation", "{% url 'api-part-list' %}", {
{% endif %}
{% if roles.stock.view %}
{% if setting_stock_recent %}
addHeaderAction('recently-updated-stock', '{% trans "Recently Updated" %}', 'fa-clock');
loadStockTable($('#table-recently-updated-stock'), {
params: {
part_detail: true,
ordering: "-updated",
limit: {% settings_value "STOCK_RECENT_COUNT" user=request.user %},
updated_after: moment().subtract(1, 'months').format('YYYY-MM-DD'),
},
name: 'recently-updated-stock',
});

View File

@ -18,11 +18,9 @@
{% include "InvenTree/settings/setting.html" with key="HOMEPAGE_PART_STARRED" icon='fa-bell' user_setting=True %}
{% include "InvenTree/settings/setting.html" with key="HOMEPAGE_CATEGORY_STARRED" icon='fa-bell' user_setting=True %}
{% include "InvenTree/settings/setting.html" with key="HOMEPAGE_PART_LATEST" icon='fa-history' user_setting=True %}
{% include "InvenTree/settings/setting.html" with key="PART_RECENT_COUNT" icon="fa-clock" user_setting=True %}
{% include "InvenTree/settings/setting.html" with key="HOMEPAGE_BOM_REQUIRES_VALIDATION" user_setting=True %}
<tr><td colspan='5'></td></tr>
{% include "InvenTree/settings/setting.html" with key="HOMEPAGE_STOCK_RECENT" icon='fa-history' user_setting=True %}
{% include "InvenTree/settings/setting.html" with key="STOCK_RECENT_COUNT" icon="fa-clock" user_setting=True %}
{% include "InvenTree/settings/setting.html" with key="HOMEPAGE_STOCK_LOW" user_setting=True %}
{% include "InvenTree/settings/setting.html" with key="HOMEPAGE_SHOW_STOCK_DEPLETED" user_setting=True %}
{% include "InvenTree/settings/setting.html" with key="HOMEPAGE_BUILD_STOCK_NEEDED" user_setting=True %}