mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Delete rows interactively from stock adjustment form
This commit is contained in:
parent
6a04c8cbd3
commit
011f5a5efd
@ -282,6 +282,13 @@
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
.btn-remove {
|
||||
padding: 3px;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
color: #A11;
|
||||
}
|
||||
|
||||
.button-toolbar {
|
||||
padding-left: 0px;
|
||||
}
|
||||
|
@ -14,6 +14,20 @@ function getStockLocations(filters={}, options={}) {
|
||||
return inventreeGet('/api/stock/location/', filters, options)
|
||||
}
|
||||
|
||||
/* Functions for interacting with stock management forms
|
||||
*/
|
||||
|
||||
function removeStockRow(e) {
|
||||
// Remove a selected row from a stock modal form
|
||||
|
||||
e = e || window.event;
|
||||
var src = e.target || e.srcElement;
|
||||
|
||||
var row = $(src).attr('row');
|
||||
|
||||
$('#' + row).remove();
|
||||
}
|
||||
|
||||
|
||||
/* Present user with a dialog to update multiple stock items
|
||||
* Possible actions:
|
||||
|
@ -69,7 +69,7 @@ class MoveMultipleStockItemsForm(forms.ModelForm):
|
||||
|
||||
location = forms.ChoiceField(label='Destination', required=True, help_text='Destination stock location')
|
||||
note = forms.CharField(label='Notes', required=True, help_text='Add note (required)')
|
||||
transaction = forms.BooleanField(required=False, initial=False, label='Create Transaction', help_text='Create a stock transaction for these parts')
|
||||
# transaction = forms.BooleanField(required=False, initial=False, label='Create Transaction', help_text='Create a stock transaction for these parts')
|
||||
confirm = forms.BooleanField(required=False, initial=False, label='Confirm Stock Movement', help_text='Confirm movement of stock items')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -83,7 +83,7 @@ class MoveMultipleStockItemsForm(forms.ModelForm):
|
||||
fields = [
|
||||
'location',
|
||||
'note',
|
||||
'transaction',
|
||||
# 'transaction',
|
||||
'confirm',
|
||||
]
|
||||
|
||||
|
@ -1,33 +1,32 @@
|
||||
{% block pre_form_content %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<form method="post" action='' class='js-modal-form' enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{% load crispy_forms_tags %}
|
||||
|
||||
<b>Stock Items</b>
|
||||
<table class='table table-condensed table-striped' id='stock-table'>
|
||||
<tr>
|
||||
<th>Item</th>
|
||||
<th>Location</th>
|
||||
<th>{{ stock_action }}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
{% for item in stock_items %}
|
||||
<tr id='stock-row-{{ item.id }}' class='error'>
|
||||
<td>{% include "hover_image.html" with image=item.part.image %}
|
||||
{{ item.part.full_name }} <small><i>{{ item.part.description }}</i></small></td>
|
||||
<td>{{ item.location.pathstring }}</td>
|
||||
<td>
|
||||
<input class='numberinput' min='0' max='{{ item.quantity }}' value='{{ item.quantity }}' type='number' name='stock-id-{{ item.id }}' id='stock-id-{{ item.id }}'/>
|
||||
</td>
|
||||
<td><button class='btn btn-default btn-remove' id='del-{{ item.id }}' title='Remove item' type='button'><span row='stock-row-{{ item.id }}' onclick='removeStockRow()' class='glyphicon glyphicon-small glyphicon-remove'></span></button></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
{% crispy form %}
|
||||
|
||||
{% block form_data %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<hr>
|
||||
<table class='table table-condensed table-striped' id='stock-table'>
|
||||
<tr>
|
||||
<th>Item</th>
|
||||
<th>Location</th>
|
||||
<th>{{ stock_action }}</th>
|
||||
</tr>
|
||||
{% for item in stock_items %}
|
||||
<tr id='stock-row-{{ item.id }}'>
|
||||
<td>{% include "hover_image.html" with image=item.part.image %}
|
||||
{{ item.part.full_name }} <small><i>{{ item.part.description }}</i></small></td>
|
||||
<td>{{ item.location.pathstring }}</td>
|
||||
<td>
|
||||
<input class='form-control' min='0' max='{{ item.quantity }}' value='{{ item.quantity }}' type='number' name='stock-id-{{ item.id }}' id='stock-id-{{ item.id }}'/>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
</form>
|
Loading…
Reference in New Issue
Block a user