StockItem display now uses menubar

This commit is contained in:
Oliver Walters 2021-02-24 21:27:44 +11:00
parent 888fd4116c
commit 89bdfd1c62
9 changed files with 118 additions and 101 deletions

View File

@ -4,16 +4,21 @@
{% load inventree_extras %}
{% load i18n %}
{% block details %}
{% block menubar %}
{% include "stock/navbar.html" with tab="tracking" %}
{% endblock %}
{% include "stock/tabs.html" with tab="tracking" %}
{% block heading %}
{% trans "Stock Tracking Information" %}
{% endblock %}
{% block details %}
{% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %}
{% if owner_control.value == "True" %}
{% authorized_owners item.owner as owners %}
{% endif %}
<h4>{% trans "Stock Tracking Information" %}</h4>
<hr>
<!-- Check permissions and owner -->

View File

@ -3,13 +3,15 @@
{% load static %}
{% load i18n %}
{% block menubar %}
{% include "stock/navbar.html" with tab='attachments' %}
{% endblock %}
{% block heading %}
{% trans "Stock Item Attachments" %}
{% endblock %}
{% block details %}
{% include "stock/tabs.html" with tab='attachments' %}
<h4>{% trans "Stock Item Attachments" %}</h4>
<hr>
{% include "attachment_table.html" with attachments=item.attachments.all %}
{% endblock %}

View File

@ -381,9 +381,12 @@ InvenTree | {% trans "Stock Item" %} - {{ item }}
{% endblock %}
{% block js_ready %}
{{ block.super }}
enableRightNavbar({
minWidth: '50px'
});
loadTree("{% url 'api-stock-tree' %}",
"#stock-tree",
{

View File

@ -3,14 +3,16 @@
{% load static %}
{% load i18n %}
{% block menubar %}
{% include "stock/navbar.html" with tab='children' %}
{% endblock %}
{% block heading %}
{% trans "Child Stock Items" %}
{% endblock %}
{% block details %}
{% include "stock/tabs.html" with tab='children' %}
<hr>
<h4>{% trans "Child Stock Items" %}</h4>
{% if item.child_count > 0 %}
{% include "stock_table.html" %}
{% else %}

View File

@ -3,13 +3,15 @@
{% load static %}
{% load i18n %}
{% block menubar %}
{% include "stock/navbar.html" with tab='installed' %}
{% endblock %}
{% block heading %}
{% trans "Installed Stock Items" %}
{% endblock %}
{% block details %}
{% include "stock/tabs.html" with tab='installed' %}
<h4>{% trans "Installed Stock Items" %}</h4>
<hr>
<table class='table table-striped table-condensed' id='installed-table'></table>
{% endblock %}

View File

@ -5,15 +5,16 @@
{% load i18n %}
{% load markdownify %}
{% block menubar %}
{% include "stock/navbar.html" with tab="notes" %}
{% endblock %}
{% block heading %}
{% trans "Stock Item Notes" %}
{% endblock %}
{% block details %}
{% include "stock/tabs.html" with tab="notes" %}
{% if editing %}
<h4>{% trans "Stock Item Notes" %}</h4>
<hr>
<form method='POST'>
{% csrf_token %}
@ -25,22 +26,10 @@
{{ form.media }}
{% else %}
<div class='row'>
<div class='col-sm-6'>
<h4>{% trans "Stock Item Notes" %}</h4>
</div>
<div class='col-sm-6'>
<button title='{% trans "Edit notes" %}' class='btn btn-default action-button float-right' id='edit-notes'><span class='fas fa-edit'></span></button>
</div>
</div>
<hr>
<div class='panel panel-default'>
<div class='panel-content'>
{% if item.notes %}
{{ item.notes | markdownify }}
{% endif %}
</div>
</div>
<button title='{% trans "Edit notes" %}' class='btn btn-default action-button' id='edit-notes'><span class='fas fa-edit'></span></button>
{% if item.notes %}
{{ item.notes | markdownify }}
{% endif %}
{% endif %}

View File

@ -3,13 +3,15 @@
{% load static %}
{% load i18n %}
{% block menubar %}
{% include "stock/navbar.html" with tab='tests' %}
{% endblock %}
{% block heading %}
{% trans "Test Data" %}
{% endblock %}
{% block details %}
{% include "stock/tabs.html" with tab='tests' %}
<h4>{% trans "Test Data" %}</h4>
<hr>
<div id='button-toolbar'>
<div class='button-toolbar container-fluid' style="float: right;">
<div class='btn-group' role='group'>

View File

@ -0,0 +1,61 @@
{% load i18n %}
<ul class='list-group'>
<li class='list-group-item'>
<a href='#' id='company-menu-toggle'>
<span class='menu-tab-icon fas fa-expand-arrows-alt'></span>
</a>
</li>
<li class='list-group-item {% if tab == "tracking" %}active{% endif %}' title='{% trans "Stock Item Tracking" %}'>
<a href='{% url "stock-item-detail" item.id %}'>
<span class='fas fa-history'></span>
{% trans "History" %}
</a>
</li>
{% if item.part.trackable %}
<li class='list-group-item {% if tab == "tests" %}active{% endif %}' title='{% trans "Test Data" %}'>
<a href='{% url "stock-item-test-results" item.id %}'>
<span class='fas fa-vial'></span>
{% trans "Test Data" %}
</a>
</li>
{% if item.part.assembly %}
<li class='list-group-item {% if tab == "installed" %}active{% endif %}' title='{% trans "Installed Stock Items" %}'>
<a href='{% url "stock-item-installed" item.id %}'>
<span class='fas fa-sign-in-alt'></span>
{% trans "Installed Items" %}
</a>
</li>
{% endif %}
{% endif %}
{% if item.child_count > 0 %}
<li class='list-group-item {% if tab == "children" %}active{% endif %}' title='{% trans "Child Items" %}'>
<a href='{% url "stock-item-children" item.id %}'>
<span class='fas fa-sitemap'></span>
{% trans "Children" %}
</a>
</li>
{% endif %}
<li class='list-group-item {% if tab == "attachments" %}active{% endif %}' title='{% trans "Attachments" %}'>
<a href='{% url "stock-item-attachments" item.id %}'>
<span class='fas fa-paperclip'></span>
{% trans "Attachments" %}
</a>
</li>
<li class='list-group-item {% if tab == "notes" %}active{% endif %}' title='{% trans "Stock Item Notes" %}'>
<a href='{% url "stock-item-notes" item.id %}'>
<span class='fas fa-clipboard'></span>
{% trans "Notes" %}
</a>
</li>
</ul>

View File

@ -1,49 +0,0 @@
{% load i18n %}
<ul class='nav nav-tabs'>
<li{% ifequal tab 'tracking' %} class='active'{% endifequal %}>
<a href="{% url 'stock-item-detail' item.id %}">
{% trans "Tracking" %}
{% if item.tracking_info.count > 0 %}<span class='badge'>{{ item.tracking_info.count }}</span>{% endif %}
</a>
</li>
{% if item.part.trackable %}
<li{% if tab == 'tests' %} class='active'{% endif %}>
<a href="{% url 'stock-item-test-results' item.id %}">
{% trans "Test Data" %}
{% if item.test_results.count > 0 %}<span class='badge'>{{ item.test_results.count }}</span>{% endif %}
</a>
</li>
{% endif %}
{% if 0 %}
<!-- These tabs are to be implemented in the future -->
<li{% ifequal tab 'builds' %} class='active'{% endifequal %}>
<a href='#'>{% trans "Builds" %}</a>
</li>
{% endif %}
<li{% ifequal tab 'notes' %} class='active'{% endifequal %}>
<a href="{% url 'stock-item-notes' item.id %}">
{% trans "Notes" %}
{% if item.notes %} <span class='fas fa-info-circle'></span>{% endif %}
</a>
</li>
<li{% if tab == 'attachments' %} class='active'{% endif %}>
<a href="{% url 'stock-item-attachments' item.id %}">
{% trans "Attachments" %}
{% if item.attachments.count > 0 %}<span class='badge'>{{ item.attachments.count }}</span>{% endif %}
</a>
</li>
{% if item.child_count > 0 %}
<li{% ifequal tab 'children' %} class='active'{% endifequal %}>
<a href="{% url 'stock-item-children' item.id %}">{% trans "Children" %}{% if item.child_count > 0 %}<span class='badge'>{{ item.child_count }}</span>{% endif %}</a>
</li>
{% endif %}
{% if item.part.assembly or item.installedItemCount > 0 %}
<li {% if tab == 'installed' %} class='active'{% endif %}>
<a href="{% url 'stock-item-installed' item.id %}">
{% trans "Installed Items" %}
{% if item.installedItemCount > 0 %}<span class='badge'>{{ item.installedItemCount }}</span>{% endif %}
</a>
</li>
{% endif %}
</ul>