2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 13:35:40 +00:00

Edit / delete / add BOM items

- Remove x-editable inline editing
- Uses only bootstrap-table and modal forms
- Hide the 'part' field in the bom item edit
This commit is contained in:
Oliver Walters
2019-04-16 01:41:01 +10:00
parent 6e2b111b9c
commit bad46f85f4
5 changed files with 4147 additions and 63 deletions

View File

@ -78,8 +78,10 @@ class EditBomItemForm(HelperForm):
fields = [
'part',
'sub_part',
'quantity'
'quantity',
'note'
]
widgets = {'part': forms.HiddenInput()}
class EditSupplierPartForm(HelperForm):

View File

@ -17,6 +17,11 @@
<div><br></div>
{% if editing_enabled %}
<div class='btn-group' style='float: left;'>
<button class='btn btn-basic' type='button' id='bom-item-new'>New</button>
<button class='btn btn-basic' type='button' id='bom-item-new'>Edit</button>
<button class='btn btn-basic' type='button' id='bom-item-new'>Delete</button>
</div>
<div style='float: right;'>
<button class='btn btn-warning' type='button' id='editing-cancel'>Cancel</button>
<button class='btn btn-success' type='button' id='editing-finish'>Save Changes</button>
@ -49,26 +54,17 @@
loadBomTable($("#bom-table"), {
editable: {{ editing_enabled }},
bom_url: "{% url 'api-bom-list' %}",
part_url: "{% url 'api-part-list' %}",
parent_id: {{ part.id }}
});
{% if editing_enabled %}
$("#editing-finish").click(function() {
alert("Finished!");
location.href = "{% url 'part-bom' part.id %}";
});
$("#editing-cancel").click(function() {
alert("Cancelled!");
location.href = "{% url 'part-bom' part.id %}";
});
{% else %}
$("#edit-bom").click(function () {
{% if editing_enabled %}
location.href = "{% url 'part-bom' part.id %}";
{% else %}
location.href = "{% url 'part-bom' part.id %}?edit=True";
{% endif %}
});
$("#export-bom").click(function () {
@ -76,6 +72,8 @@
location.href = "{% url 'bom-export' part.id %}";
});
{% endif %}
$("#bom-item-new").click(function () {
launchModalForm("{% url 'bom-item-create' %}?parent={{ part.id }}", {});
});
{% endblock %}