mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 03:56:43 +00:00
More refactoring
This commit is contained in:
parent
f3e8edaf1f
commit
f0e8e32c8a
@ -754,12 +754,18 @@
|
||||
|
||||
|
||||
$("#part-order2").click(function() {
|
||||
launchModalForm("{% url 'order-parts' %}", {
|
||||
data: {
|
||||
part: {{ part.id }},
|
||||
},
|
||||
reload: true,
|
||||
});
|
||||
inventreeGet(
|
||||
'{% url "api-part-detail" part.pk %}',
|
||||
{},
|
||||
{
|
||||
success: function(part) {
|
||||
orderParts(
|
||||
[part],
|
||||
{}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
onPanelLoad("test-templates", function() {
|
||||
|
@ -549,15 +549,6 @@
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return;
|
||||
|
||||
launchModalForm("{% url 'order-parts' %}", {
|
||||
data: {
|
||||
part: {{ part.id }},
|
||||
},
|
||||
reload: true,
|
||||
});
|
||||
});
|
||||
|
||||
{% if roles.part.add %}
|
||||
|
@ -603,6 +603,17 @@ function orderParts(parts_list, options={}) {
|
||||
return html;
|
||||
}
|
||||
|
||||
// Remove a single row form this dialog
|
||||
function removeRow(pk, opts) {
|
||||
// Remove the row
|
||||
$(opts.modal).find(`#order_row_${pk}`).remove();
|
||||
|
||||
// If the modal is now "empty", dismiss it
|
||||
if (!($(opts.modal).find('.part-order-row').exists())) {
|
||||
closeModal(opts.modal);
|
||||
}
|
||||
}
|
||||
|
||||
var table_entries = '';
|
||||
|
||||
parts.forEach(function(part) {
|
||||
@ -727,8 +738,7 @@ function orderParts(parts_list, options={}) {
|
||||
{
|
||||
method: 'POST',
|
||||
success: function(response) {
|
||||
// Remove the row
|
||||
$(opts.modal).find(`#order_row_${pk}`).remove();
|
||||
removeRow(pk, opts);
|
||||
},
|
||||
error: function(xhr) {
|
||||
switch (xhr.status) {
|
||||
@ -749,7 +759,7 @@ function orderParts(parts_list, options={}) {
|
||||
$(opts.modal).find('.button-row-remove').click(function() {
|
||||
var pk = $(this).attr('pk');
|
||||
|
||||
$(opts.modal).find(`#order_row_${pk}`).remove();
|
||||
removeRow(pk, opts);
|
||||
});
|
||||
|
||||
// Add callback for "new supplier part" button
|
||||
|
Loading…
x
Reference in New Issue
Block a user