mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add items using javascript
This commit is contained in:
parent
b95d6a4ab2
commit
6df6a460e4
@ -9,6 +9,15 @@ InvenTree | {% trans "Index" %}
|
||||
<h3>InvenTree</h3>
|
||||
<hr>
|
||||
|
||||
<div class='col-sm-3' id='item-panel'>
|
||||
<ul class='list-group' id='action-item-list'>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='col-sm-9' id='details-panel'>
|
||||
<ul class='list-group' id='detail-item-list'>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class='col-sm-4'>
|
||||
{% if roles.part.view %}
|
||||
{% include "InvenTree/latest_parts.html" with collapse_id="latest_parts" %}
|
||||
@ -52,6 +61,64 @@ InvenTree | {% trans "Index" %}
|
||||
|
||||
{{ block.super }}
|
||||
|
||||
function addHeaderTitle(title) {
|
||||
// Add a header block to the action list
|
||||
$("#action-item-list").append(
|
||||
`<li class='list-group-item'><b>${title}</b></li>`
|
||||
);
|
||||
}
|
||||
|
||||
function addHeaderAction(label, title, icon) {
|
||||
// Add an action block to the action list
|
||||
$("#action-item-list").append(
|
||||
`<li class='list-group-item' id='action-${title}'>
|
||||
<a href='#'>
|
||||
<span class='fas ${icon}'></span>
|
||||
${title}
|
||||
</a>
|
||||
<span class='badge' id='badge-${label}'>
|
||||
<span class='fas fa-spin fa-spinner'></span>
|
||||
</span>
|
||||
</li>`
|
||||
);
|
||||
}
|
||||
|
||||
{% if roles.part.view %}
|
||||
addHeaderTitle('{% trans "Parts" %}');
|
||||
addHeaderAction('starred-parts', '{% trans "Starred Parts" %}', 'fa-star');
|
||||
addHeaderAction('latest-parts', '{% trans "Latest Parts" %}', 'fa-newspaper');
|
||||
addHeaderAction('bom-validation', '{% trans "BOM Waiting Validation" %}', 'fa-times-circle');
|
||||
{% endif %}
|
||||
|
||||
{% if roles.stock.view %}
|
||||
addHeaderTitle('{% trans "Stock" %}');
|
||||
addHeaderAction('low-stock', '{% trans "Low Stock" %}', 'fa-shopping-cart');
|
||||
addHeaderAction('stock-to-build', '{% trans "Required for Build Orders" %}', 'fa-bullhorn');
|
||||
{% settings_value "STOCK_ENABLE_EXPIRY" as expiry %}
|
||||
{% if expiry %}
|
||||
addHeaderAction('expired-stock', '{% trans "Expired Stock" %}', 'fa-calendar-times');
|
||||
addHeaderAction('stale-stock', '{% trans "Stale Stock" %}', 'fa-stopwatch');
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if roles.build.view %}
|
||||
addHeaderTitle('{% trans "Build Orders" %}');
|
||||
addHeaderAction('build-pending', '{% trans "In Progress" %}', 'fa-cogs');
|
||||
addHeaderAction('build-overdue', '{% trans "Overdue" %}', 'fa-calendar-times');
|
||||
{% endif %}
|
||||
|
||||
{% if roles.purchase_order.view %}
|
||||
addHeaderTitle('{% trans "Purchase Orders" %}');
|
||||
addHeaderAction('po-outstanding', '{% trans "Outstanding" %}', 'fa-sign-in-alt');
|
||||
addHeaderAction('po-overdue', '{% trans "Overdue" %}', 'fa-calendar-times');
|
||||
{% endif %}
|
||||
|
||||
{% if roles.sales_order.view %}
|
||||
addHeaderTitle('{% trans "Sales Orders" %}');
|
||||
addHeaderAction('so-outstanding', '{% trans "Outstanding" %}', 'fa-sign-out-alt');
|
||||
addHeaderAction('so-overdue', '{% trans "Overdue" %}', 'fa-calendar-times');
|
||||
{% endif %}
|
||||
|
||||
loadSimplePartTable("#latest-parts-table", "{% url 'api-part-list' %}", {
|
||||
params: {
|
||||
ordering: "-creation_date",
|
||||
|
Loading…
x
Reference in New Issue
Block a user