2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-14 23:51:08 +00:00

Simplify BOM editing view

- A user with permission to edit BOM data can immediately access the BOM editing tools
This commit is contained in:
Oliver
2021-10-13 14:44:59 +11:00
parent 51efd6b2e4
commit 6816071388
4 changed files with 11 additions and 47 deletions

View File

@@ -1,7 +1,7 @@
{% load i18n %}
{% load inventree_extras %}
{% if roles.part.change != True and editing_enabled %}
{% if not roles.part.change %}
<div class='alert alert-danger alert-block'>
{% trans "You do not have permission to edit the BOM." %}
</div>
@@ -23,7 +23,7 @@
<div id='bom-button-toolbar'>
<div class="btn-group" role="group" aria-label="...">
{% if editing_enabled %}
{% if roles.part.change %}
<button class='btn btn-default' type='button' title='{% trans "Remove selected BOM items" %}' id='bom-item-delete'>
<span class='fas fa-trash-alt icon-red'></span>
</button>
@@ -35,17 +35,9 @@
<span class='fas fa-clone'></span>
</button>
{% endif %}
<button class='btn btn-default' type='button' title='{% trans "New BOM Item" %}' id='bom-item-new'>
<button class='btn btn-success' type='button' title='{% trans "New BOM Item" %}' id='bom-item-new'>
<span class='fas fa-plus-circle'></span>
</button>
<button class='btn btn-success' type='button' title='{% trans "Finish Editing" %}' id='editing-finished'>
<span class='fas fa-check-circle'></span>
</button>
{% elif part.active %}
{% if roles.part.change %}
<button class='btn btn-primary' type='button' title='{% trans "Edit BOM" %}' id='edit-bom'>
<span class='fas fa-edit'></span>
</button>
{% if part.is_bom_valid == False %}
<button class='btn btn-success' id='validate-bom' title='{% trans "Validate Bill of Materials" %}' type='button'>
<span class='fas fa-clipboard-check'></span>
@@ -67,4 +59,3 @@
<table class='table table-bom table-condensed' data-toolbar="#bom-button-toolbar" id='bom-table'>
</table>
{% endif %}

View File

@@ -473,7 +473,11 @@
onPanelLoad("bom", function() {
// Load the BOM table data
loadBomTable($("#bom-table"), {
editable: {{ editing_enabled }},
{% if roles.part.change %}
editable: true,
{% else %}
editable: false,
{% endif %}
bom_url: "{% url 'api-bom-list' %}",
part_url: "{% url 'api-part-list' %}",
parent_id: {{ part.id }} ,
@@ -486,11 +490,6 @@
]
);
{% if editing_enabled %}
$("#editing-finished").click(function() {
location.href = "{% url 'part-detail' part.id %}?display=bom";
});
$('#bom-item-delete').click(function() {
// Get a list of the selected BOM items
@@ -559,8 +558,6 @@
});
});
{% else %}
$("#validate-bom").click(function() {
launchModalForm(
"{% url 'bom-validate' part.id %}",
@@ -570,10 +567,6 @@
);
});
$("#edit-bom").click(function () {
location.href = "{% url 'part-detail' part.id %}?display=bom&edit=1";
});
$("#download-bom").click(function () {
launchModalForm("{% url 'bom-export' part.id %}",
{
@@ -584,8 +577,6 @@
);
});
{% endif %}
$("#print-bom-report").click(function() {
printBomReports([{{ part.pk }}]);
});
@@ -629,10 +620,9 @@
});
});
// Load the BOM table data in the pricing view
loadBomTable($("#bom-pricing-table"), {
editable: {{ editing_enabled }},
editable: false,
bom_url: "{% url 'api-bom-list' %}",
part_url: "{% url 'api-part-list' %}",
parent_id: {{ part.id }} ,