mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-31 09:01:35 +00:00
170 lines
5.0 KiB
HTML
170 lines
5.0 KiB
HTML
{% extends "stock/stock_app_base.html" %}
|
|
{% load static %}
|
|
{% block content %}
|
|
|
|
<div class='row'>
|
|
<div class='col-sm-6'>
|
|
{% if location %}
|
|
<h3>{{ location.name }}</h3>
|
|
<p>{{ location.description }}</p>
|
|
{% else %}
|
|
<h3>Stock</h3>
|
|
<p>All stock items</p>
|
|
{% endif %}
|
|
</div>
|
|
<div class='col-sm-6'>
|
|
<h3>
|
|
<div style='float: right;'>
|
|
<button class='btn btn-success' id='location-create'>New Stock Location</button>
|
|
{% if location %}
|
|
<div class="dropdown" style="float: right;">
|
|
<button 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='location-edit' title='Edit stock location'>Edit</a></li>
|
|
<li><a href="#" id='location-delete' title='Delete stock location'>Delete</a></li>
|
|
</ul>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</h3>
|
|
</div>
|
|
</div>
|
|
|
|
{% if location %}
|
|
{% include 'stock/location_list.html' with children=location.children.all %}
|
|
{% else %}
|
|
{% include 'stock/location_list.html' with children=locations %}
|
|
{% endif %}
|
|
|
|
<hr>
|
|
|
|
<div id='button-toolbar'>
|
|
<div class='container-fluid' style='float: right;'>
|
|
<button class="btn btn-success" id='item-create'>New Stock Item</span></button>
|
|
<div class="dropdown" style='float: right;'>
|
|
<button 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 'modals.html' %}
|
|
|
|
{% endblock %}
|
|
|
|
{% block js_load %}
|
|
{{ block.super }}
|
|
<script type='text/javascript' src="{% static 'script/inventree/api.js' %}"></script>
|
|
<script type='text/javascript' src="{% static 'script/inventree/stock.js' %}"></script>
|
|
{% endblock %}
|
|
{% block js_ready %}
|
|
{{ block.super }}
|
|
$('#location-create').click(function () {
|
|
launchModalForm("{% url 'stock-location-create' %}",
|
|
{
|
|
data: {
|
|
{% if location %}
|
|
location: {{ location.id }}
|
|
{% endif %}
|
|
},
|
|
follow: true
|
|
});
|
|
return false;
|
|
});
|
|
|
|
{% if location %}
|
|
$('#location-edit').click(function() {
|
|
launchModalForm("{% url 'stock-location-edit' location.id %}",
|
|
{
|
|
reload: true
|
|
});
|
|
return false;
|
|
});
|
|
|
|
$('#location-delete').click(function() {
|
|
launchDeleteForm("{% url 'stock-location-delete' location.id %}",
|
|
{
|
|
redirect: "{% url 'stock-index' %}"
|
|
});
|
|
return false;
|
|
});
|
|
|
|
{% endif %}
|
|
|
|
$('#item-create').click(function () {
|
|
launchModalForm("{% url 'stock-item-create' %}",
|
|
{
|
|
success: function() {
|
|
$("#stock-table").bootstrapTable('refresh');
|
|
},
|
|
data: {
|
|
{% if location %}
|
|
location: {{ location.id }}
|
|
{% endif %}
|
|
}
|
|
});
|
|
|
|
return false;
|
|
});
|
|
|
|
function selectedStock() {
|
|
return $("#stock-table").bootstrapTable('getSelections');
|
|
}
|
|
|
|
$("#multi-item-move").click(function() {
|
|
|
|
var items = selectedStock();
|
|
|
|
moveStockItems(items,
|
|
{
|
|
success: function() {
|
|
$("#stock-table").bootstrapTable('refresh');
|
|
}
|
|
});
|
|
|
|
return false;
|
|
});
|
|
|
|
$('#multi-item-stocktake').click(function() {
|
|
updateStockItems({
|
|
action: 'stocktake',
|
|
});
|
|
return false;
|
|
});
|
|
|
|
$('#multi-item-remove').click(function() {
|
|
updateStockItems({
|
|
action: 'remove',
|
|
});
|
|
return false;
|
|
});
|
|
|
|
$('#multi-item-add').click(function() {
|
|
updateStockItems({
|
|
action: 'add',
|
|
});
|
|
return false;
|
|
});
|
|
|
|
loadStockTable($("#stock-table"), {
|
|
params: {
|
|
{% if location %}
|
|
location: {{ location.id }}
|
|
{% endif %}
|
|
},
|
|
url: "{% url 'api-stock-list' %}",
|
|
});
|
|
|
|
{% endblock %}
|