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'>`;
buttons += makeIconButton(
'fa-check-circle icon-green',
'button-row-complete',
'fa-layer-group',
'button-row-expand',
pk,
'{% trans "Add to order" %}',
'{% trans "Expand Row" %}',
{
collapseTarget: `order_row_expand_${pk}`,
}
);
if (parts.length > 1) {
@ -564,8 +567,18 @@ function orderParts(parts_list, options={}) {
<td id='purchase_order_${pk}'>${purchase_order_input}</td>
<td id='quantity_${pk}'>${quantity_input}</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;
}
@ -656,6 +669,12 @@ function orderParts(parts_list, options={}) {
}
}, 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 = [];
selections.forEach(function(item) {
parts.push(item.pk);
selections.forEach(function(part) {
parts.push(part);
});
launchModalForm('/order/purchase-order/order-parts/', {
data: {
parts: parts,
},
});
orderParts(
parts,
{
}
);
});
$('#multi-part-category').click(function() {