2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 20:16:44 +00:00

Adds button to expand row for "extra" information

This commit is contained in:
Oliver Walters 2022-04-26 22:14:01 +10:00
parent b8ca7fb092
commit c66cd1d51b
2 changed files with 32 additions and 12 deletions

View File

@ -540,10 +540,13 @@ function orderParts(parts_list, options={}) {
var buttons = `<div class='btn-group float-right' role='group'>`; var buttons = `<div class='btn-group float-right' role='group'>`;
buttons += makeIconButton( buttons += makeIconButton(
'fa-check-circle icon-green', 'fa-layer-group',
'button-row-complete', 'button-row-expand',
pk, pk,
'{% trans "Add to order" %}', '{% trans "Expand Row" %}',
{
collapseTarget: `order_row_expand_${pk}`,
}
); );
if (parts.length > 1) { if (parts.length > 1) {
@ -564,8 +567,18 @@ function orderParts(parts_list, options={}) {
<td id='purchase_order_${pk}'>${purchase_order_input}</td> <td id='purchase_order_${pk}'>${purchase_order_input}</td>
<td id='quantity_${pk}'>${quantity_input}</td> <td id='quantity_${pk}'>${quantity_input}</td>
<td id='actions_${pk}'>${buttons}</td> <td id='actions_${pk}'>${buttons}</td>
</tr> </tr>`;
`;
// Add a second row "underneath" the first one, but collapsed
// Allows extra data to be added if required, but hidden by default
html += `
<tr id='order_row_expand_${pk}' class='part-order-row collapse'>
<td></td>
<td>reference goes here</td>
<td></td>
<td></td>
<td></td>
</tr>`;
return html; return html;
} }
@ -656,6 +669,12 @@ function orderParts(parts_list, options={}) {
} }
}, null, opts); }, null, opts);
// Add callback for "remove row" button
$(opts.modal).find('.button-row-remove').click(function() {
var pk = $(this).attr('pk');
$(opts.modal).find(`#order_row_${pk}`).remove();
});
}); });
} }
}); });

View File

@ -1559,15 +1559,16 @@ function loadPartTable(table, url, options={}) {
var parts = []; var parts = [];
selections.forEach(function(item) { selections.forEach(function(part) {
parts.push(item.pk); parts.push(part);
}); });
launchModalForm('/order/purchase-order/order-parts/', { orderParts(
data: { parts,
parts: parts, {
},
}); }
);
}); });
$('#multi-part-category').click(function() { $('#multi-part-category').click(function() {