mirror of
https://github.com/inventree/InvenTree.git
synced 2025-08-01 17:41:33 +00:00
150 lines
4.6 KiB
HTML
150 lines
4.6 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>
|
|
<p>
|
|
<div class='btn-group'>
|
|
{% include "qr_button.html" %}
|
|
</div>
|
|
</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 and location.children.all|length > 0 %}
|
|
{% include 'stock/location_list.html' with children=location.children.all collapse_id="locations" %}
|
|
{% elif locations|length > 0 %}
|
|
{% include 'stock/location_list.html' with children=locations collapse_id="locations" %}
|
|
{% endif %}
|
|
|
|
<hr>
|
|
|
|
{% include "stock_table.html" %}
|
|
|
|
{% include 'modals.html' %}
|
|
|
|
{% endblock %}
|
|
|
|
{% block js_load %}
|
|
{{ block.super }}
|
|
{% endblock %}
|
|
{% block js_ready %}
|
|
{{ block.super }}
|
|
$('#location-create').click(function () {
|
|
launchModalForm("{% url 'stock-location-create' %}",
|
|
{
|
|
data: {
|
|
{% if location %}
|
|
location: {{ location.id }}
|
|
{% endif %}
|
|
},
|
|
follow: true,
|
|
secondary: [
|
|
{
|
|
field: 'parent',
|
|
label: 'New Location',
|
|
title: 'Create new location',
|
|
url: "{% url 'stock-location-create' %}",
|
|
},
|
|
]
|
|
});
|
|
return false;
|
|
});
|
|
|
|
{% if location %}
|
|
$('#location-edit').click(function() {
|
|
launchModalForm("{% url 'stock-location-edit' location.id %}",
|
|
{
|
|
reload: true
|
|
});
|
|
return false;
|
|
});
|
|
|
|
$('#location-delete').click(function() {
|
|
launchModalForm("{% url 'stock-location-delete' location.id %}",
|
|
{
|
|
redirect: "{% url 'stock-index' %}"
|
|
});
|
|
return false;
|
|
});
|
|
|
|
$('#show-qr-code').click(function() {
|
|
launchModalForm("{% url 'stock-location-qr' location.id %}",
|
|
{
|
|
no_post: true,
|
|
});
|
|
});
|
|
|
|
{% endif %}
|
|
|
|
$('#item-create').click(function () {
|
|
launchModalForm("{% url 'stock-item-create' %}",
|
|
{
|
|
success: function() {
|
|
$("#stock-table").bootstrapTable('refresh');
|
|
},
|
|
data: {
|
|
{% if location %}
|
|
location: {{ location.id }}
|
|
{% endif %}
|
|
},
|
|
secondary: [
|
|
{
|
|
field: 'part',
|
|
label: 'New Part',
|
|
title: 'Create New Part',
|
|
url: "{% url 'part-create' %}",
|
|
},
|
|
{
|
|
field: 'location',
|
|
label: 'New Location',
|
|
title: 'Create New Location',
|
|
url: "{% url 'stock-location-create' %}",
|
|
}
|
|
]
|
|
});
|
|
|
|
|
|
return false;
|
|
});
|
|
|
|
loadStockTable($("#stock-table"), {
|
|
buttons: [
|
|
'#stock-options',
|
|
],
|
|
params: {
|
|
{% if location %}
|
|
location: {{ location.id }},
|
|
{% endif %}
|
|
part_detail: true,
|
|
location_detail: true,
|
|
},
|
|
url: "{% url 'api-stock-list' %}",
|
|
});
|
|
{% endblock %}
|