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;
|
margin-right: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-remove {
|
||||||
|
padding: 3px;
|
||||||
|
padding-left: 5px;
|
||||||
|
padding-right: 5px;
|
||||||
|
color: #A11;
|
||||||
|
}
|
||||||
|
|
||||||
.button-toolbar {
|
.button-toolbar {
|
||||||
padding-left: 0px;
|
padding-left: 0px;
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,20 @@ function getStockLocations(filters={}, options={}) {
|
|||||||
return inventreeGet('/api/stock/location/', 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
|
/* Present user with a dialog to update multiple stock items
|
||||||
* Possible actions:
|
* Possible actions:
|
||||||
|
@ -69,7 +69,7 @@ class MoveMultipleStockItemsForm(forms.ModelForm):
|
|||||||
|
|
||||||
location = forms.ChoiceField(label='Destination', required=True, help_text='Destination stock location')
|
location = forms.ChoiceField(label='Destination', required=True, help_text='Destination stock location')
|
||||||
note = forms.CharField(label='Notes', required=True, help_text='Add note (required)')
|
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')
|
confirm = forms.BooleanField(required=False, initial=False, label='Confirm Stock Movement', help_text='Confirm movement of stock items')
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -83,7 +83,7 @@ class MoveMultipleStockItemsForm(forms.ModelForm):
|
|||||||
fields = [
|
fields = [
|
||||||
'location',
|
'location',
|
||||||
'note',
|
'note',
|
||||||
'transaction',
|
# 'transaction',
|
||||||
'confirm',
|
'confirm',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1,33 +1,32 @@
|
|||||||
{% block pre_form_content %}
|
{% block pre_form_content %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
<form method="post" action='' class='js-modal-form' enctype="multipart/form-data">
|
<form method="post" action='' class='js-modal-form' enctype="multipart/form-data">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% load crispy_forms_tags %}
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
<b>Stock Items</b>
|
||||||
{% crispy form %}
|
|
||||||
|
|
||||||
{% block form_data %}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
<table class='table table-condensed table-striped' id='stock-table'>
|
<table class='table table-condensed table-striped' id='stock-table'>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Item</th>
|
<th>Item</th>
|
||||||
<th>Location</th>
|
<th>Location</th>
|
||||||
<th>{{ stock_action }}</th>
|
<th>{{ stock_action }}</th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
{% for item in stock_items %}
|
{% for item in stock_items %}
|
||||||
<tr id='stock-row-{{ item.id }}'>
|
<tr id='stock-row-{{ item.id }}' class='error'>
|
||||||
<td>{% include "hover_image.html" with image=item.part.image %}
|
<td>{% include "hover_image.html" with image=item.part.image %}
|
||||||
{{ item.part.full_name }} <small><i>{{ item.part.description }}</i></small></td>
|
{{ item.part.full_name }} <small><i>{{ item.part.description }}</i></small></td>
|
||||||
<td>{{ item.location.pathstring }}</td>
|
<td>{{ item.location.pathstring }}</td>
|
||||||
<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 }}'/>
|
<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>
|
||||||
|
<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>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
{% crispy form %}
|
||||||
|
|
||||||
</form>
|
</form>
|
Loading…
Reference in New Issue
Block a user