mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add forms for editing and deleting a SalesOrderAllocation item
This commit is contained in:
parent
2a4e903785
commit
6112be2df0
@ -325,6 +325,12 @@
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
.btn-large {
|
||||
font-size: 150%;
|
||||
align-content: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.badge {
|
||||
float: right;
|
||||
background-color: #777;
|
||||
|
@ -27,27 +27,27 @@ src="{% static 'img/blank_image.png' %}"
|
||||
<p>
|
||||
<div class='btn-row'>
|
||||
<div class='btn-group'>
|
||||
<button type='button' class='btn btn-default btn-glyph' id='edit-order' title='Edit order information'>
|
||||
<span class='glyphicon glyphicon-edit'></span>
|
||||
<button type='button' class='btn btn-default btn-glyph btn-large' id='edit-order' title='Edit order information'>
|
||||
<span class='fas fa-edit'></span>
|
||||
</button>
|
||||
<button type='button' class='btn btn-default btn-glyph' id='export-order' title='Export order to file'>
|
||||
<span class='glyphicon glyphicon-download-alt'></span>
|
||||
<button type='button' class='btn btn-default btn-glyph btn-large' id='export-order' title='Export order to file'>
|
||||
<span class='fas fa-file-download'></span>
|
||||
</button>
|
||||
{% if order.status == OrderStatus.PENDING and order.lines.count > 0 %}
|
||||
<button type='button' class='btn btn-default btn-glyph' id='place-order' title='Place order'>
|
||||
<span class='glyphicon glyphicon-send'></span>
|
||||
<button type='button' class='btn btn-default btn-glyph btn-large' id='place-order' title='Place order'>
|
||||
<span class='fas fa-paper-plane'></span>
|
||||
</button>
|
||||
{% elif order.status == OrderStatus.PLACED %}
|
||||
<button type='button' class='btn btn-default btn-glyph' id='receive-order' title='Receive items'>
|
||||
<span class='glyphicon glyphicon-check'></span>
|
||||
<button type='button' class='btn btn-default btn-glyph btn-large' id='receive-order' title='Receive items'>
|
||||
<span class='fas fa-clipboard-check'></span>
|
||||
</button>
|
||||
<button type='button' class='btn btn-default btn-glyph' id='complete-order' title='Mark order as complete'>
|
||||
<span class='glyphicon glyphicon-ok'></span>
|
||||
<button type='button' class='btn btn-default btn-glyph btn-large' id='complete-order' title='Mark order as complete'>
|
||||
<span class='fas fa-check-circle'></span>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if order.status == OrderStatus.PENDING or order.status == OrderStatus.PLACED %}
|
||||
<button type='button' class='btn btn-default btn-glyph' id='cancel-order' title='Cancel order'>
|
||||
<span class='glyphicon glyphicon-remove'></span>
|
||||
<button type='button' class='btn btn-default btn-glyph btn-large' id='cancel-order' title='Cancel order'>
|
||||
<span class='fas fa-times-circle'></span>
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
@ -34,8 +34,8 @@ src="{% static 'img/blank_image.png' %}"
|
||||
<p>{{ order.description }}</p>
|
||||
<div class='btn-row'>
|
||||
<div class='btn-group'>
|
||||
<button type='button' class='btn btn-default btn-glyph' id='edit-order' title='Edit order information'>
|
||||
<span class='glyphicon glyphicon-edit'></span>
|
||||
<button type='button' class='btn btn-default btn-glyph btn-large' id='edit-order' title='Edit order information'>
|
||||
<span class='fas fa-edit'></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -55,7 +55,11 @@ $("#so-lines-table").inventreeTable({
|
||||
|
||||
element.html(html);
|
||||
|
||||
$(`#allocation-table-${row.pk}`).bootstrapTable({
|
||||
var lineItem = row;
|
||||
|
||||
var table = $(`#allocation-table-${row.pk}`);
|
||||
|
||||
table.bootstrapTable({
|
||||
data: row.allocations,
|
||||
showHeader: false,
|
||||
columns: [
|
||||
@ -64,7 +68,7 @@ $("#so-lines-table").inventreeTable({
|
||||
field: 'allocated',
|
||||
title: 'Quantity',
|
||||
formatter: function(value, row, index, field) {
|
||||
return renderLink(value, `/stock/item/${row.pk}/`);
|
||||
return renderLink(value, `/stock/item/${row.item}/`);
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -78,11 +82,37 @@ $("#so-lines-table").inventreeTable({
|
||||
field: 'buttons',
|
||||
title: 'Actions',
|
||||
formatter: function(value, row, index, field) {
|
||||
return '';
|
||||
|
||||
var html = "<div class='btn-group float-right' role='group'>";
|
||||
var pk = row.pk;
|
||||
|
||||
html += makeIconButton('fa-edit', 'button-allocation-edit', pk, '{% trans "Edit stock allocation" %}');
|
||||
html += makeIconButton('fa-trash-alt', 'button-allocation-delete', pk, '{% trans "Delete stock allocation" %}');
|
||||
|
||||
html += "</div>";
|
||||
|
||||
return html;
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
table.find(".button-allocation-edit").click(function() {
|
||||
|
||||
var pk = $(this).attr('pk');
|
||||
|
||||
launchModalForm(`/order/sales-order/allocation/${pk}/edit/`, {
|
||||
success: reloadTable,
|
||||
});
|
||||
});
|
||||
|
||||
table.find(".button-allocation-delete").click(function() {
|
||||
var pk = $(this).attr('pk');
|
||||
|
||||
launchModalForm(`/order/sales-order/allocation/${pk}/delete/`, {
|
||||
success: reloadTable,
|
||||
});
|
||||
});
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
@ -202,7 +232,6 @@ $("#so-lines-table").on('load-success.bs.table', function() {
|
||||
line: pk,
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
table.find(".button-build").click(function() {
|
||||
|
@ -98,6 +98,7 @@ sales_order_urls = [
|
||||
url(r'^new/', views.SalesOrderAllocationCreate.as_view(), name='so-allocation-create'),
|
||||
url(r'(?P<pk>\d+)/', include([
|
||||
url(r'^edit/', views.SalesOrderAllocationEdit.as_view(), name='so-allocation-edit'),
|
||||
url(r'^delete/', views.SalesOrderAllocationDelete.as_view(), name='so-allocation-delete'),
|
||||
])),
|
||||
])),
|
||||
|
||||
|
@ -1248,6 +1248,7 @@ class SalesOrderAllocationCreate(AjaxCreateView):
|
||||
class SalesOrderAllocationEdit(AjaxUpdateView):
|
||||
|
||||
model = SalesOrderAllocation
|
||||
form_class = order_forms.EditSalesOrderAllocationForm
|
||||
ajax_form_title = _('Edit Allocation Quantity')
|
||||
|
||||
def get_form(self):
|
||||
@ -1258,3 +1259,9 @@ class SalesOrderAllocationEdit(AjaxUpdateView):
|
||||
form.fields.pop('line')
|
||||
|
||||
return form
|
||||
|
||||
|
||||
class SalesOrderAllocationDelete(AjaxDeleteView):
|
||||
|
||||
model = SalesOrderAllocation
|
||||
ajax_form_title = _("Remove allocation")
|
||||
|
Loading…
Reference in New Issue
Block a user