2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-04 12:40:57 +00:00

Refactor edit and delete views for ManufacturerPart

This commit is contained in:
Oliver Walters
2021-07-18 22:59:34 +10:00
parent 0c91691ed2
commit 0288a1acbf
4 changed files with 119 additions and 51 deletions

View File

@ -284,23 +284,9 @@
$("#manufacturer-part-create").click(function () {
constructForm('{% url "api-manufacturer-part-list" %}', {
fields: {
part: {},
manufacturer: {
value: {{ company.pk }},
},
MPN: {
icon: 'fa-hashtag',
},
description: {},
link: {
icon: 'fa-link',
},
},
method: 'POST',
title: '{% trans "Add Manufacturer Part" %}',
onSuccess: function() {
createManufacturerPart({
manufacturer: {{ company.pk }},
onSuccess: function() {
$("#part-table").bootstrapTable("refresh");
}
});

View File

@ -297,29 +297,19 @@ $('#order-part, #order-part2').click(function() {
$('#edit-part').click(function () {
constructForm('{% url "api-manufacturer-part-detail" part.pk %}', {
fields: {
part: {},
manufacturer: {},
MPN: {
icon: 'fa-hashtag',
},
description: {},
link: {
icon: 'fa-link',
},
},
title: '{% trans "Edit Manufacturer Part" %}',
reload: true,
editManufacturerPart({{ part.pk }}, {
onSuccess: function() {
location.reload();
}
});
});
$('#delete-part').click(function() {
constructForm('{% url "api-manufacturer-part-detail" part.pk %}', {
method: 'DELETE',
title: '{% trans "Delete Manufacturer Part" %}',
redirect: "{% url 'company-detail' part.manufacturer.id %}",
deleteManufacturerPart({{ part.pk }}, {
onSuccess: function() {
window.location.href = "{% url 'company-detail' part.manufacturer.id %}";
}
});
});