Create template for stock table

This commit is contained in:
Oliver Walters 2019-05-16 22:15:44 +10:00
parent b8f5c8cca7
commit 0a1887477c
4 changed files with 30 additions and 47 deletions

View File

@ -7,19 +7,20 @@
<h3>Supplier Stock</h3>
<table class='table table-striped table-condensed' id='stock-table'>
</table>
{% include "stock_table.html" %}
{% endblock %}
{% block js_ready %}
{{ block.super }}
loadStockTable($('#stock-table'),
{
url: "{% url 'api-stock-list' %}",
params: {
supplier: {{ company.id }},
}
loadStockTable($('#stock-table'), {
url: "{% url 'api-stock-list' %}",
params: {
supplier: {{ company.id }},
},
buttons: [
'#stock-options',
]
});
{% endblock %}

View File

@ -13,25 +13,7 @@
</div>
<hr>
<div id='button-toolbar'>
{% if part.active %}
<button class='btn btn-success' id='add-stock-item'>New Stock Item</button>
{% endif %}
<div id='opt-dropdown' class="dropdown" style='float: right;'>
<button id='stock-options' class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Options
<span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href='#' id='multi-item-take' title='Take items from stock'>Take items</a></li>
<li><a href='#' id='multi-item-give' title='Give items to stock'>Add items</a></li>
<li><a href="#" id='multi-item-stocktake' title='Stocktake selected stock items'>Stocktake</a></li>
<li><a href='#' id='multi-item-move' title='Move selected stock items'>Move items</a></li>
</ul>
</div>
</div>
<table class='table table-striped table-condensed' data-toolbar='#button-toolbar' id='stock-table'>
</table>
{% include "stock_table.html" %}
{% endblock %}
@ -87,14 +69,14 @@
return false;
});
$("#multi-item-take").click(function() {
$("#multi-item-remove").click(function() {
updateStockItems({
action: 'remove',
});
return false;
});
$("#multi-item-give").click(function() {
$("#multi-item-add").click(function() {
updateStockItems({
action: 'add',
});

View File

@ -44,24 +44,7 @@
<hr>
<div id='button-toolbar'>
<div class='button-toolbar container-fluid' style='float: right;'>
<button class="btn btn-success" id='item-create'>New Stock Item</button>
<div class="dropdown" style='float: right;'>
<button id='stock-options' class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Options<span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="#" id='multi-item-add' title='Add to selected stock items'>Add stock</a></li>
<li><a href="#" id='multi-item-remove' title='Remove from selected stock items'>Remove stock</a></li>
<li><a href="#" id='multi-item-stocktake' title='Stocktake selected stock items'>Stocktake</a></li>
<li><a href='#' id='multi-item-move' title='Move selected stock items'>Move</a></li>
</ul>
</div>
</div>
</div>
<table class='table table-striped table-condensed' data-toolbar='#button-toolbar' id='stock-table'>
</table>
{% include "stock_table.html" %}
{% include 'modals.html' %}

View File

@ -0,0 +1,17 @@
<div id='button-toolbar'>
<div class='button-toolbar container-fluid' style='float: right;'>
<button class="btn btn-success" id='item-create'>New Stock Item</button>
<div class="dropdown" style='float: right;'>
<button id='stock-options' class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Options<span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href="#" id='multi-item-add' title='Add to selected stock items'>Add stock</a></li>
<li><a href="#" id='multi-item-remove' title='Remove from selected stock items'>Remove stock</a></li>
<li><a href="#" id='multi-item-stocktake' title='Stocktake selected stock items'>Stocktake</a></li>
<li><a href='#' id='multi-item-move' title='Move selected stock items'>Move</a></li>
</ul>
</div>
</div>
</div>
<table class='table table-striped table-condensed' data-toolbar='#button-toolbar' id='stock-table'>
</table>