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

Merge pull request #1168 from SchrodingersGat/order-date

Build Order Target Date
This commit is contained in:
Oliver
2020-12-16 19:36:10 +11:00
committed by GitHub
17 changed files with 1610 additions and 1227 deletions

View File

@ -0,0 +1,15 @@
{% extends "collapse_index.html" %}
{% load i18n %}
{% block collapse_title %}
<span class='fas fa-calendar-times icon-header'></span>
{% trans "Overdue Builds" %}<span class='badge' id='build-overdue-count'><span class='fas fa-spin fa-spinner'></span></span>
{% endblock %}
{% block collapse_content %}
<table class='table table-striped table-condensed' id='build-overdue-table'>
</table>
{% endblock %}

View File

@ -16,6 +16,7 @@ InvenTree | {% trans "Index" %}
{% endif %}
{% if roles.build.view %}
{% include "InvenTree/build_pending.html" with collapse_id="build_pending" %}
{% include "InvenTree/build_overdue.html" with collapse_id="build_overdue" %}
{% endif %}
</div>
<div class='col-sm-6'>
@ -72,6 +73,15 @@ loadBuildTable("#build-pending-table", {
disableFilters: true,
});
loadBuildTable("#build-overdue-table", {
url: "{% url 'api-build-list' %}",
params: {
part_detail: true,
overdue: true,
},
disableFilters: true,
});
loadSimplePartTable("#low-stock-table", "{% url 'api-part-list' %}", {
params: {
low_stock: true,
@ -126,6 +136,12 @@ $("#build-pending-table").on('load-success.bs.table', function() {
$("#build-pending-count").html(count);
});
$("#build-overdue-table").on('load-success.bs.table', function() {
var count = $("#build-overdue-table").bootstrapTable('getData').length;
$("#build-overdue-count").html(count);
});
$("#low-stock-table").on('load-success.bs.table', function() {
var count = $("#low-stock-table").bootstrapTable('getData').length;

View File

@ -650,7 +650,13 @@ function loadBuildTable(table, options) {
value = `${prefix}${value}`;
}
return renderLink(value, '/build/' + row.pk + '/');
var html = renderLink(value, '/build/' + row.pk + '/');
if (row.overdue) {
html += makeIconBadge('fa-calendar-times icon-red', '{% trans "Build order is overdue" %}');
}
return html;
}
},
{
@ -699,6 +705,11 @@ function loadBuildTable(table, options) {
title: '{% trans "Created" %}',
sortable: true,
},
{
field: 'target_date',
title: '{% trans "Target Date" %}',
sortable: true,
},
{
field: 'completion_date',
title: '{% trans "Completed" %}',

View File

@ -184,7 +184,11 @@ function getAvailableTableFilters(tableKey) {
active: {
type: 'bool',
title: '{% trans "Active" %}',
}
},
overdue: {
type: 'bool',
title: '{% trans "Overdue" %}',
},
};
}