Adds new buttons to create a new stock item

This commit is contained in:
Oliver 2021-11-03 07:27:58 +11:00
parent d8e3c40f78
commit aaf27d4098
5 changed files with 34 additions and 15 deletions

View File

@ -134,7 +134,15 @@ src="{% static 'img/blank_image.png' %}"
<div class='panel panel-hidden' id='panel-stock'>
<div class='panel-heading'>
<h4>{% trans "Supplier Part Stock" %}</h4>
<span class='d-flex flex-wrap'>
<h4>{% trans "Supplier Part Stock" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
<button type='button' class='btn btn-success' id='item-create' title='{% trans "Create new stock item" %}'>
<span class='fas fa-plus-circle'></span> {% trans "New Stock Item" %}
</button>
</div>
</span>
</div>
<div class='panel-content'>
{% include "stock_table.html" %}

View File

@ -50,7 +50,7 @@
<h4>{% trans "Received Items" %}</h4>
</div>
<div class='panel-content'>
{% include "stock_table.html" with prevent_new_stock=True %}
{% include "stock_table.html" %}
</div>
</div>

View File

@ -95,7 +95,15 @@
<div class='panel panel-hidden' id='panel-part-stock'>
<div class='panel-heading'>
<h4>{% trans "Part Stock" %}</h4>
<div class='d-flex flex-wrap'>
<h4>{% trans "Part Stock" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
<button type='button' class='btn btn-success' id='new-stock-item' title='{% trans "Create new stock item" %}'>
<span class='fas fa-plus-circle'></span> {% trans "New Stock Item" %}
</button>
</div>
</div>
</div>
<div class='panel-content'>
{% if part.is_template %}
@ -851,11 +859,14 @@
});
onPanelLoad("part-stock", function() {
$('#add-stock-item').click(function () {
$('#new-stock-item').click(function () {
createNewStockItem({
reload: true,
data: {
part: {{ part.id }},
{% if part.default_location %}
location: {{ part.default_location.pk }},
{% endif %}
}
});
});

View File

@ -140,7 +140,15 @@
<div class='panel panel-hidden' id='panel-stock'>
<div class='panel-heading'>
<h4>{% trans "Stock Items" %}</h4>
<div class='d-flex flex-wrap'>
<h4>{% trans "Stock Items" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
<button type='button' class='btn btn-success' id='item-create' title='{% trans "Create new stock item" %}'>
<span class='fas fa-plus-circle'></span> {% trans "New Stock Item" %}
</button>
</div>
</div>
</div>
<div class='panel-content'>
{% include "stock_table.html" %}

View File

@ -10,17 +10,10 @@
<div id='{{ prefix }}button-toolbar'>
<div class='button-toolbar container-fluid' style='float: right;'>
<div class='btn-group'>
<div class='btn-group' role='group'>
<button class='btn btn-outline-secondary' id='stock-export' title='{% trans "Export Stock Information" %}'>
<span class='fas fa-download'></span>
</button>
{% if owner_control.value == "True" and user in owners or user.is_superuser or owner_control.value == "False" %}
{% if not read_only and not prevent_new_stock and roles.stock.add %}
<button class="btn btn-success" id='item-create' title='{% trans "New Stock Item" %}'>
<span class='fas fa-plus-circle'></span>
</button>
{% endif %}
{% if barcodes %}
<!-- Barcode actions menu -->
<div class='btn-group' role='group'>
@ -46,7 +39,7 @@
</div>
{% if not read_only %}
{% if roles.stock.change or roles.stock.delete %}
<div class="btn-group">
<div class="btn-group" role="group">
<button id='stock-options' class="btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" title='{% trans "Stock Options" %}'>
<span class='fas fa-boxes'></span> <span class="caret"></span>
</button>
@ -66,7 +59,6 @@
</div>
{% endif %}
{% endif %}
{% endif %}
{% include "filter_list.html" with id="stock" %}
</div>
</div>