mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Move "stock" part view
This commit is contained in:
parent
0667857754
commit
2d2ad91545
@ -7,8 +7,7 @@
|
||||
{% load markdownify %}
|
||||
|
||||
{% block menubar %}
|
||||
{% include 'order/po_navbar.html' with tab='details' %}
|
||||
|
||||
{% include 'order/po_navbar.html' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block page_content %}
|
||||
|
@ -7,7 +7,7 @@
|
||||
{% load markdownify %}
|
||||
|
||||
{% block menubar %}
|
||||
{% include "order/so_navbar.html" with tab='details' %}
|
||||
{% include "order/so_navbar.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block page_content %}
|
||||
|
@ -5,58 +5,47 @@
|
||||
|
||||
|
||||
{% block menubar %}
|
||||
{% include 'part/navbar.html' with tab='details' %}
|
||||
{% include 'part/navbar.html' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block heading %}
|
||||
{% trans "Part Details" %}
|
||||
{% endblock %}
|
||||
{% block page_content %}
|
||||
|
||||
{% block details %}
|
||||
<div class='panel panel-default panel-inventree panel-hidden' id='panel-part-stock'>
|
||||
<div class='panel-heading'>
|
||||
<h4>{% trans "Part Stock" %}</h4>
|
||||
</div>
|
||||
<div class='panel-content'>
|
||||
{% if part.is_template %}
|
||||
<div class='alert alert-info alert-block'>
|
||||
{% blocktrans with full_name=part.full_name%}Showing stock for all variants of <i>{{full_name}}</i>{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% include "stock_table.html" %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='panel panel-default panel-inventree panel-hidden' id='panel-part-notes'>
|
||||
<div class='panel-heading'>
|
||||
<div class='row'>
|
||||
<div class='col-sm-6'>
|
||||
<table class='table table-striped'>
|
||||
<col width='25'>
|
||||
|
||||
<tr>
|
||||
<td><span class='fas fa-sticky-note'></span></td>
|
||||
<td>
|
||||
<strong>{% trans "Notes" %}</strong>
|
||||
</td>
|
||||
<td>
|
||||
<h4>{% trans "Notes" %}</h4>
|
||||
</div>
|
||||
<div class='col-sm-6'>
|
||||
<div class='btn-group float-right'>
|
||||
<button type='button' id='edit-notes' title='{% trans "Edit Notes" %}' class='btn btn-small btn-default'>
|
||||
<span class='fas fa-edit'>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='3'>
|
||||
{% if part.notes %}
|
||||
<div class='notes'>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='panel-content'>
|
||||
{{ part.notes | markdownify }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<div class='col-sm-6'>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block post_content_panel %}
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-sm-6'>
|
||||
<div class='panel panel-default panel-inventree'>
|
||||
<div class='panel panel-default panel-inventree panel-hidden' id='panel-part-parameters'>
|
||||
<div class='panel-heading'>
|
||||
<h4>{% trans "Parameters" %}</h4>
|
||||
</div>
|
||||
@ -73,9 +62,8 @@
|
||||
<table id='parameter-table' class='table table-condensed table-striped' data-toolbar="#param-button-toolbar"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-sm-6'>
|
||||
<div class='panel panel-default panel-inventree'>
|
||||
|
||||
<div class='panel panel-default panel-inventree panel-hidden' id='panel-part-attachments'>
|
||||
<div class='panel-heading'>
|
||||
<h4>{% trans "Attachments" %}</h4>
|
||||
</div>
|
||||
@ -83,8 +71,6 @@
|
||||
{% include "attachment_table.html" %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@ -95,6 +81,53 @@
|
||||
{% block js_ready %}
|
||||
{{ block.super }}
|
||||
|
||||
$('#add-stock-item').click(function () {
|
||||
createNewStockItem({
|
||||
reload: true,
|
||||
data: {
|
||||
part: {{ part.id }},
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
loadStockTable($("#stock-table"), {
|
||||
params: {
|
||||
part: {{ part.id }},
|
||||
location_detail: true,
|
||||
part_detail: true,
|
||||
supplier_part_detail: true,
|
||||
},
|
||||
groupByField: 'location',
|
||||
buttons: [
|
||||
'#stock-options',
|
||||
],
|
||||
url: "{% url 'api-stock-list' %}",
|
||||
});
|
||||
|
||||
$("#stock-export").click(function() {
|
||||
launchModalForm("{% url 'stock-export-options' %}", {
|
||||
submit_text: "{% trans 'Export' %}",
|
||||
success: function(response) {
|
||||
var url = "{% url 'stock-export' %}";
|
||||
|
||||
url += "?format=" + response.format;
|
||||
url += "&cascade=" + response.cascade;
|
||||
url += "&part={{ part.id }}";
|
||||
|
||||
location.href = url;
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$('#item-create').click(function () {
|
||||
createNewStockItem({
|
||||
reload: true,
|
||||
data: {
|
||||
part: {{ part.id }},
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#edit-notes').click(function() {
|
||||
constructForm('{% url "api-part-detail" part.pk %}', {
|
||||
fields: {
|
||||
@ -239,4 +272,9 @@
|
||||
)
|
||||
});
|
||||
|
||||
attachNavCallbacks({
|
||||
name: 'part',
|
||||
default: 'part-stock'
|
||||
});
|
||||
|
||||
{% endblock %}
|
||||
|
@ -11,46 +11,44 @@
|
||||
<span class='menu-tab-icon fas fa-expand-arrows-alt'></span>
|
||||
</a>
|
||||
</li>
|
||||
<li class='list-group-item {% if tab == "details" %}active{% endif %}' title='{% trans "Part Details" %}'>
|
||||
<a href='{% url "part-detail" part.id %}'>
|
||||
<span class='menu-tab-icon fas fa-info-circle sidebar-icon'></span>
|
||||
<span class='tab-text'>
|
||||
{% trans "Details" %}
|
||||
</span>
|
||||
<li class='list-group-item' title='{% trans "Parameters" %}'>
|
||||
<a href='#' id='select-part-parameters' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-th-list sidebar-icon'></span>
|
||||
{% trans "Parameters" %}
|
||||
</a>
|
||||
</li>
|
||||
{% if part.is_template %}
|
||||
<li class='list-group-item {% if tab == "variants" %}active{% endif %}' title='{% trans "Part Variants" %}'>
|
||||
<a href='{% url "part-variants" part.id %}'>
|
||||
<li class='list-group-item' title='{% trans "Part Variants" %}'>
|
||||
<a href='#' id='select-part-variants' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-shapes sidebar-icon'></span>
|
||||
{% trans "Variants" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class='list-group-item {% if tab == "stock" %}active{% endif %}' title='{% trans "Stock Items" %}'>
|
||||
<a href='{% url "part-stock" part.id %}'>
|
||||
<li class='list-group-item' title='{% trans "Stock Items" %}'>
|
||||
<a href='#' id='select-part-stock' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-boxes sidebar-icon'></span>
|
||||
{% trans "Stock" %}
|
||||
</a>
|
||||
</li>
|
||||
{% if part.component or part.salable %}
|
||||
<li class='list-group-item {% if tab == "allocation" %}active{% endif %}' title='{% trans "Allocated Stock" %}'>
|
||||
<a href='{% url "part-allocation" part.id %}'>
|
||||
<li class='list-group-item' title='{% trans "Allocated Stock" %}'>
|
||||
<a href='#' id='select-part-allocations' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-sign-out-alt sidebar-icon'></span>
|
||||
{% trans "Allocations" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if part.assembly %}
|
||||
<li class='list-group-item {% if tab == "bom" %}active{% endif %}' title='{% trans "Bill of Materials" %}'>
|
||||
<a href='{% url "part-bom" part.id %}'>
|
||||
<li class='list-group-item' title='{% trans "Bill of Materials" %}'>
|
||||
<a href='#' id='select-part-bom' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-list sidebar-icon'></span>
|
||||
{% trans "Bill of Materials" %}
|
||||
</a>
|
||||
</li>
|
||||
{% if roles.build.view %}
|
||||
<li class='list-group-item {% if tab == "build" %}active{% endif %}' title='{% trans "Build Orders" %}'>
|
||||
<a href='{% url "part-build" part.id %}'>
|
||||
<li class='list-group-item ' title='{% trans "Build Orders" %}'>
|
||||
<a href='#' id='select-build-orders' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-tools sidebar-icon'></span>
|
||||
{% trans "Build Orders" %}
|
||||
</a>
|
||||
@ -58,55 +56,73 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if part.component %}
|
||||
<li class='list-group-item {% if tab == "used" %}active{% endif %}' title='{% trans "Used In" %}'>
|
||||
<a href='{% url "part-used-in" part.id %}'>
|
||||
<li class='list-group-item ' title='{% trans "Used In" %}'>
|
||||
<a href='#' id='select-used-in' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-layer-group sidebar-icon'></span>
|
||||
{% trans "Used In" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class='list-group-item {% if tab == "prices" %}active{% endif %}' title='{% trans "Pricing Information" %}'>
|
||||
<a href='{% url "part-prices" part.id %}'>
|
||||
<li class='list-group-item' title='{% trans "Pricing Information" %}'>
|
||||
<a href='#' id='select-part-pricing' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-dollar-sign sidebar-icon'></span>
|
||||
{% trans "Prices" %}
|
||||
</a>
|
||||
</li>
|
||||
{% if part.purchaseable and roles.purchase_order.view %}
|
||||
<li class='list-group-item {% if tab == "suppliers" %}active{% endif %}' title='{% trans "Suppliers" %}'>
|
||||
<a href='{% url "part-suppliers" part.id %}'>
|
||||
<li class='list-group-item' title='{% trans "Suppliers" %}'>
|
||||
<a href='#' id='select-part-suppliers' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-building sidebar-icon'></span>
|
||||
{% trans "Suppliers" %}
|
||||
</a>
|
||||
</li>
|
||||
<li class='list-group-item {% if tab == "orders" %}active{% endif %}' title='{% trans "Purchase Orders" %}'>
|
||||
<a href='{% url "part-orders" part.id %}'>
|
||||
<li class='list-group-item' title='{% trans "Manufacturers" %}'>
|
||||
<a href='#' id='select-part-manufacturers' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-tools sidebar-icon'></span>
|
||||
{% trans "Manufacturers" %}
|
||||
</a>
|
||||
</li>
|
||||
<li class='list-group-item' title='{% trans "Purchase Orders" %}'>
|
||||
<a href='#' id='select-purchase-orders' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-shopping-cart sidebar-icon'></span>
|
||||
{% trans "Purchase Orders" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if roles.sales_order.view %}
|
||||
<li class='list-group-item {% if tab == "sales-orders" %}active{% endif %}' title='{% trans "Sales Orders" %}'>
|
||||
<a href='{% url "part-sales-orders" part.id %}'>
|
||||
<li class='list-group-item' title='{% trans "Sales Orders" %}'>
|
||||
<a href='#' id='select-sales-orders' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-truck sidebar-icon'></span>
|
||||
{% trans "Sales Orders" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if part.trackable %}
|
||||
<li class='list-group-item {% if tab == "tests" %}active{% endif %}' title='{% trans "Part Test Templates" %}'>
|
||||
<a href='{% url "part-test-templates" part.id %}'>
|
||||
<li class='list-group-item' title='{% trans "Part Test Templates" %}'>
|
||||
<a href='#' id='select-test-templates' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-vial sidebar-icon'></span>
|
||||
{% trans "Test Templates" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if show_related %}
|
||||
<li class='list-group-item {% if tab == "related" %}active{% endif %}' title='{% trans "Related Parts" %}'>
|
||||
<a href='{% url "part-related" part.id %}'>
|
||||
<li class='list-group-item' title='{% trans "Related Parts" %}'>
|
||||
<a href='#' id='select-related-parts' class='nav-toggle'>
|
||||
<span class='menu-tab-icon fas fa-random sidebar-icon'></span>
|
||||
{% trans "Related Parts" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class='list-group-item' title='{% trans "Attachments" %}'>
|
||||
<a href='#' id='select-part-attachments' class='nav-toggle'>
|
||||
<span class='fas fa-paperclip side-icon'></span>
|
||||
{% trans "Attachments" %}
|
||||
</a>
|
||||
</li>
|
||||
<li class='list-group-item' title='{% trans "Notes" %}'>
|
||||
<a href='#' id='select-part-notes' class='nav-toggle'>
|
||||
<span class='fas fa-clipboard side-icon'></span>
|
||||
{% trans "Notes" %}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -245,30 +245,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
{% block pre_content_panel %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<div class='panel panel-default panel-inventree'>
|
||||
|
||||
|
||||
<div class='panel-heading'>
|
||||
<h4>
|
||||
{% block heading %}
|
||||
<!-- Heading goes here -->
|
||||
{% endblock %}
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div class='panel-content'>
|
||||
{% block details %}
|
||||
<!-- Specific part details go here... -->
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% block post_content_panel %}
|
||||
|
||||
{% block page_content %}
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,77 +0,0 @@
|
||||
{% extends "part/part_base.html" %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block menubar %}
|
||||
{% include 'part/navbar.html' with tab='stock' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block heading %}
|
||||
{% trans "Part Stock" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block details %}
|
||||
{% if part.is_template %}
|
||||
<div class='alert alert-info alert-block'>
|
||||
{% blocktrans with full_name=part.full_name%}Showing stock for all variants of <i>{{full_name}}</i>{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% include "stock_table.html" %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block js_load %}
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
||||
{% block js_ready %}
|
||||
{{ block.super }}
|
||||
|
||||
$('#add-stock-item').click(function () {
|
||||
createNewStockItem({
|
||||
reload: true,
|
||||
data: {
|
||||
part: {{ part.id }},
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
loadStockTable($("#stock-table"), {
|
||||
params: {
|
||||
part: {{ part.id }},
|
||||
location_detail: true,
|
||||
part_detail: true,
|
||||
supplier_part_detail: true,
|
||||
},
|
||||
groupByField: 'location',
|
||||
buttons: [
|
||||
'#stock-options',
|
||||
],
|
||||
url: "{% url 'api-stock-list' %}",
|
||||
});
|
||||
|
||||
$("#stock-export").click(function() {
|
||||
launchModalForm("{% url 'stock-export-options' %}", {
|
||||
submit_text: "{% trans 'Export' %}",
|
||||
success: function(response) {
|
||||
var url = "{% url 'stock-export' %}";
|
||||
|
||||
url += "?format=" + response.format;
|
||||
url += "&cascade=" + response.cascade;
|
||||
url += "&part={{ part.id }}";
|
||||
|
||||
location.href = url;
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
$('#item-create').click(function () {
|
||||
createNewStockItem({
|
||||
reload: true,
|
||||
data: {
|
||||
part: {{ part.id }},
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
{% endblock %}
|
@ -49,7 +49,6 @@ part_detail_urls = [
|
||||
url(r'^bom-duplicate/?', views.BomDuplicate.as_view(), name='duplicate-bom'),
|
||||
|
||||
url(r'^variants/?', views.PartDetail.as_view(template_name='part/variants.html'), name='part-variants'),
|
||||
url(r'^stock/?', views.PartDetail.as_view(template_name='part/stock.html'), name='part-stock'),
|
||||
url(r'^allocation/?', views.PartDetail.as_view(template_name='part/allocation.html'), name='part-allocation'),
|
||||
url(r'^bom/?', views.PartDetail.as_view(template_name='part/bom.html'), name='part-bom'),
|
||||
url(r'^build/?', views.PartDetail.as_view(template_name='part/build.html'), name='part-build'),
|
||||
|
@ -235,7 +235,7 @@
|
||||
<td>{% trans "Base Part" %}</td>
|
||||
<td>
|
||||
{% if roles.part.view %}
|
||||
<a href="{% url 'part-stock' item.part.id %}">
|
||||
<a href="{% url 'part-detail' item.part.id %}">
|
||||
{% endif %}
|
||||
{{ item.part.full_name }}
|
||||
{% if roles.part.view %}
|
||||
@ -561,7 +561,7 @@ $("#stock-delete").click(function () {
|
||||
launchModalForm(
|
||||
"{% url 'stock-item-delete' item.id %}",
|
||||
{
|
||||
redirect: "{% url 'part-stock' item.part.id %}"
|
||||
redirect: "{% url 'part-detail' item.part.id %}"
|
||||
}
|
||||
);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user