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