";
html += "
";
@@ -140,15 +138,45 @@ function fillAllocationTable(table, index, parent_row, parent_table, options) {
{
field: 'stock_item_detail.quantity',
title: 'Available',
- },
+ },
{
field: 'quantity',
- title: 'Allocated'
- },
+ title: 'Allocated',
+ formatter: function(value, row, index, field) {
+
+ var html = value;
+
+ var bEdit = "
";
+ var bDel = "
";
+
+ html += "
" + bEdit + bDel + "
";
+
+ return html;
+ }
+ }
],
url: "/api/build/item?build=" + options.build + "&part=" + parent_row.sub_part,
});
+ // Button callbacks for editing and deleting the allocations
+ table.on('click', '.item-edit-button', function() {
+ var button = $(this);
+
+ launchModalForm(button.attr('url'), {
+ success: function() {
+ }
+ });
+ });
+
+ table.on('click', '.item-del-button', function() {
+ var button = $(this);
+
+ launchDeleteForm(button.attr('url'), {
+ success: function() {
+ }
+ });
+ });
+
table.on('load-success.bs.table', function(data) {
var allocated = 0;