Refactoring for "stock" pages

This commit is contained in:
Oliver 2021-10-27 21:50:18 +11:00
parent 707a03c416
commit e178a2c370
6 changed files with 301 additions and 262 deletions

View File

@ -524,10 +524,6 @@
font-size: 125%;
}
.btn-group {
padding-bottom: 5px;
}
.action-buttons .btn {
font-size: 175%;
align-content: center;

View File

@ -120,17 +120,19 @@
<h4>{% trans "Parts" %}</h4>
</div>
<div id='part-button-toolbar'>
<div class='btn-group'>
<button class='btn btn-default' id='part-export' title='{% trans "Export Part Data" %}'>
<div class='btn-group' role='group'>
<button type='button' class='btn btn-outline-secondary' id='part-export' title='{% trans "Export Part Data" %}'>
<span class='fas fa-file-download'></span> {% trans "Export" %}
</button>
{% if roles.part.add %}
<button class='btn btn-success' id='part-create' title='{% trans "Create new part" %}'>
<button type='button' class='btn btn-success' id='part-create' title='{% trans "Create new part" %}'>
<span class='fas fa-plus-circle'></span> {% trans "New Part" %}
</button>
{% endif %}
<div class='btn-group'>
<button id='part-options' class='btn btn-primary dropdown-toggle' type='button' data-toggle="dropdown">{% trans "Options" %} <span class='caret'></span></button>
<div class='btn-group' role='group'>
<button id='part-options' class='btn btn-primary dropdown-toggle' type='button' data-bs-toggle="dropdown">
{% trans "Options" %}
</button>
<ul class='dropdown-menu'>
{% if roles.part.change %}
<li><a href='#' id='multi-part-category' title='{% trans "Set category" %}'>{% trans "Set Category" %}</a></li>
@ -141,7 +143,7 @@
</ul>
</div>
<!-- Buttons to toggle between grid and table view -->
<button id='view-list' class='btn btn-default' type='button' title='{% trans "View list display" %}'>
<button id='view-list' class='btn btn-outline-secondary' type='button' title='{% trans "View list display" %}'>
<span class='fas fa-th-list'></span>
</button>
<button id='view-grid' class='btn btn-default' type='button' title='{% trans "View grid display" %}'>

View File

@ -1,4 +1,4 @@
{% extends "two_column.html" %}
{% extends "page_base.html" %}
{% load static %}
{% load inventree_extras %}
{% load status_codes %}
@ -16,11 +16,17 @@
{% include 'stock/loc_link.html' with location=item.location %}
{% endblock %}
{% block thumbnail %}
<img class='part-thumb' {% if item.part.image %}src="{{ item.part.image.url }}"{% else %}src="{% static 'img/blank_image.png' %}"{% endif %}/>
{% block heading %}
<h4>
{% trans "Stock Item Details" %}
</h4>
{% endblock %}
{% block page_data %}
{% block details_left %}
<div class='media-left'>
<img class='part-thumb' {% if item.part.image %}src="{{ item.part.image.url }}"{% else %}src="{% static 'img/blank_image.png' %}"{% endif %}/>
</div>
<div class='media-body'>
{% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %}
{% if owner_control.value == "True" %}
@ -65,14 +71,10 @@
<div class='btn-group' role='group'>
</div>
<div class='btn-group action-buttons' role='group'>
{% if barcodes %}
<!-- Barcode actions menu -->
<div class='btn-group'>
<button id='barcode-options' title='{% trans "Barcode actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'>
<button id='barcode-options' title='{% trans "Barcode actions" %}' class='btn btn-default dropdown-toggle' type='button' data-bs-toggle='dropdown'>
<span class='fas fa-qrcode'></span> <span class='caret'></span>
</button>
<ul class='dropdown-menu' role='menu'>
@ -90,7 +92,7 @@
{% endif %}
<!-- Document / label menu -->
<div class='btn-group'>
<button id='document-options' title='{% trans "Printing actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-print'></span> <span class='caret'></span></button>
<button id='document-options' title='{% trans "Printing actions" %}' class='btn btn-default dropdown-toggle' type='button' data-bs-toggle='dropdown'><span class='fas fa-print'></span> <span class='caret'></span></button>
<ul class='dropdown-menu' role='menu'>
<li><a href='#' id='print-label'><span class='fas fa-tag'></span> {% trans "Print Label" %}</a></li>
{% if test_report_enabled %}
@ -103,7 +105,7 @@
{% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser %}
{% if roles.stock.change and not item.is_building %}
<div class='btn-group'>
<button id='stock-actions' title='{% trans "Stock adjustment actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-boxes'></span> <span class='caret'></span></button>
<button id='stock-actions' title='{% trans "Stock adjustment actions" %}' class='btn btn-default dropdown-toggle' type='button' data-bs-toggle='dropdown'><span class='fas fa-boxes'></span> <span class='caret'></span></button>
<ul class='dropdown-menu' role='menu'>
{% if not item.serialized %}
{% if item.in_stock %}
@ -141,7 +143,7 @@
<!-- Edit stock item -->
{% if roles.stock.change and not item.is_building %}
<div class='btn-group'>
<button id='stock-edit-actions' title='{% trans "Stock actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-tools'></span> <span class='caret'></span></button>
<button id='stock-edit-actions' title='{% trans "Stock actions" %}' class='btn btn-default dropdown-toggle' type='button' data-bs-toggle='dropdown'><span class='fas fa-tools'></span> <span class='caret'></span></button>
<ul class='dropdown-menu' role='menu'>
{% if item.part.can_convert %}
<li><a href='#' id='stock-convert' title='{% trans "Convert to variant" %}'><span class='fas fa-screwdriver'></span> {% trans "Convert to variant" %}</a></li>
@ -160,10 +162,7 @@
{% endif %}
{% endif %}
</div>
{% endblock %}
{% block below_thumbnail %}
</div>
<div class='info-messages'>
{% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %}
@ -230,8 +229,7 @@
</div>
{% endblock %}
{% block page_details %}
<h4>{% trans "Stock Item Details" %}</h4>
{% block details_right %}
<table class="table table-striped">
<col width='25'>
<tr>
@ -432,9 +430,9 @@
</tr>
{% endif %}
</table>
{% endblock %}
{% block js_ready %}
{{ block.super }}

View File

@ -11,6 +11,28 @@
<div class='panel panel-default panel-inventree'>
<div class='panel-heading'>
<h4>
{% if location %}
{{ location.name }}
{% if location %}
{% if user.is_staff and roles.stock_location.change %}
<a href="{% url 'admin:stock_stocklocation_change' location.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %}
</h3>
{% else %}
<h3>{% trans "Stock" %}</h3>
<p>{% trans "All stock items" %}</p>
{% endif %}
{% else %}
{% trans "Stock" %}
{% endif %}
</h4>
</div>
<div class='panel-content'>
{% setting_object 'STOCK_OWNERSHIP_CONTROL' as owner_control %}
{% if owner_control.value == "True" %}
{% authorized_owners location.owner as owners %}
@ -24,53 +46,41 @@
<div class='row'>
<div class='col-sm-6'>
{% if location %}
<h3>
{{ location.name }}
{% if user.is_staff and roles.stock_location.change %}
<a href="{% url 'admin:stock_stocklocation_change' location.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %}
</h3>
<p>{{ location.description }}</p>
{% else %}
<h3>{% trans "Stock" %}</h3>
<p>{% trans "All stock items" %}</p>
{% endif %}
<div class='btn-group action-buttons' role='group'>
<div class='btn-group' role='group'>
{% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser or not location %}
{% if roles.stock_location.add %}
<button class='btn btn-default' id='location-create' title='{% trans "Create new stock location" %}'>
<span class='fas fa-plus-circle icon-green'/>
<button class='btn btn-success' id='location-create' title='{% trans "Create new stock location" %}'>
<span class='fas fa-plus-circle'/>
</button>
{% endif %}
{% endif %}
{% if barcodes %}
<!-- Barcode actions menu -->
{% if location %}
<div class='btn-group'>
<button id='barcode-options' title='{% trans "Barcode actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'><span class='fas fa-qrcode'></span> <span class='caret'></span></button>
<ul class='dropdown-menu' role='menu'>
<li><a href='#' id='show-qr-code'><span class='fas fa-qrcode'></span> {% trans "Show QR Code" %}</a></li>
<li><a href='#' id='print-label'><span class='fas fa-tag'></span> {% trans "Print Label" %}</a></li>
<li><a href='#' id='barcode-check-in'><span class='fas fa-arrow-right'></span> {% trans "Check-in Items" %}</a></li>
<div class='btn-group' role='group'>
<button id='barcode-options' title='{% trans "Barcode actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'><span class='fas fa-qrcode'></span> <span class='caret'></span></button>
<ul class='dropdown-menu'>
<li><a class='dropdown-item' href='#' id='show-qr-code'><span class='fas fa-qrcode'></span> {% trans "Show QR Code" %}</a></li>
<li><a class='dropdown-item' href='#' id='print-label'><span class='fas fa-tag'></span> {% trans "Print Label" %}</a></li>
<li><a class='dropdown-item' href='#' id='barcode-check-in'><span class='fas fa-arrow-right'></span> {% trans "Check-in Items" %}</a></li>
</ul>
</div>
<!-- Check permissions and owner -->
{% if owner_control.value == "False" or owner_control.value == "True" and user in owners or user.is_superuser %}
{% if roles.stock.change %}
<div class='btn-group'>
<button id='stock-actions' title='{% trans "Stock actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'>
<div class='btn-group' role='group'>
<button id='stock-actions' title='{% trans "Stock actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'>
<span class='fas fa-boxes'></span> <span class='caret'></span>
</button>
<ul class='dropdown-menu' role='menu'>
<li>
<a href='#' id='location-count'>
<a class='dropdown-item' href='#' id='location-count'>
<span class='fas fa-clipboard-list'></span>
{% trans "Count stock" %}
</a>
</li>
<li>
<a href='#' id='location-move'>
<a class='dropdown-item' href='#' id='location-move'>
<span class='fas fa-exchange-alt'></span>
{% trans "Transfer stock" %}
</a>
@ -79,12 +89,12 @@
</div>
{% endif %}
{% if roles.stock_location.change %}
<div class='btn-group'>
<button id='location-actions' title='{% trans "Location actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle="dropdown"><span class='fas fa-sitemap'></span> <span class='caret'></span></button>
<div class='btn-group' role='group'>
<button id='location-actions' title='{% trans "Location actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle="dropdown"><span class='fas fa-sitemap'></span> <span class='caret'></span></button>
<ul class='dropdown-menu' role='menu'>
<li><a href='#' id='location-edit'><span class='fas fa-edit icon-green'></span> {% trans "Edit location" %}</a></li>
<li><a class='dropdown-item' href='#' id='location-edit'><span class='fas fa-edit icon-green'></span> {% trans "Edit location" %}</a></li>
{% if roles.stock.delete %}
<li><a href='#' id='location-delete'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete location" %}</a></li>
<li><a class='dropdown-item' href='#' id='location-delete'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete location" %}</a></li>
{% endif %}
</ul>
</div>
@ -96,17 +106,11 @@
</div>
<div class='col-sm-6'>
{% if location %}
<h3>{% trans "Location Details" %}</h3>
<table class='table table-striped table-condensed'>
<col width='25'>
<tr>
<td><span class='fas fa-sitemap'></span></td>
<td>{% trans "Location Path" %}</td>
<td>{{ location.pathstring }}</td>
</tr>
<tr>
<td><span class='fas fa-info-circle'></span></td>
<td>{% trans "Location Description" %}</td>
<td>{% trans "Description" %}</td>
<td>{{ location.description }}</td>
</tr>
<tr>
@ -137,7 +141,7 @@
</table>
{% endif %}
</div>
</h3>
</div>
</div>
</div>
@ -147,8 +151,10 @@
<div class='panel-heading'>
<h4>{% trans "Stock Items" %}</h4>
</div>
<div class='panel-content'>
{% include "stock_table.html" %}
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-sublocations'>
<div class='panel-heading'>
@ -156,14 +162,14 @@
</div>
<div class='panel-content'>
<div id='sublocation-button-toolbar'>
<div class='button-toolbar container-fluid' style='float: right;'>
<div class='btn-group' role='group'>
<!-- Printing actions menu -->
<div class='btn-group'>
<button id='location-print-options' class='btn btn-primary dropdown-toggle' type='button' data-toggle="dropdown" title='{% trans "Printing Actions" %}'>
<div class='btn-group' role='group'>
<button id='location-print-options' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle="dropdown" title='{% trans "Printing Actions" %}'>
<span class='fas fa-print'></span> <span class='caret'></span>
</button>
<ul class='dropdown-menu'>
<li><a href='#' id='multi-location-print-label' title='{% trans "Print labels" %}'><span class='fas fa-tags'></span> {% trans "Print labels" %}</a></li>
<li><a class='dropdown-item' href='#' id='multi-location-print-label' title='{% trans "Print labels" %}'><span class='fas fa-tags'></span> {% trans "Print labels" %}</a></li>
</ul>
</div>
<div class='filter-list' id='filter-list-location'>

View File

@ -71,15 +71,16 @@
<div class='inventree-body'>
{% block breadcrumb_list %}
<div class='container-fluid'>
<nav aria-label='breadcrumb'>
<ol class='breadcrumb'>
{% block breadcrumbs %}
<li class='breadcrumb-item active'>Breadcrumbs Go Here!</li>
{% endblock %}
</ol>
</nav>
</div>
{% endblock %}
<div class='containter-fluid inventree-pre-content'>
{% block pre_content %}

View File

@ -0,0 +1,36 @@
{% extends "base.html" %}
{% load static %}
{% load i18n %}
{% block content %}
<div class='panel panel-default panel-inventree'>
<div class='panel-heading'>
{% block heading %}
block heading
{% endblock %}
</div>
<div class='panel-content'>
{% block details %}
<div class='row'>
<div class='col-sm-6' id='detail-panel-left'>
{% block details_left %}
block details_left
{% endblock %}
</div>
<div class='col-sm-6' id='detail-panel-right'>
{% block details_right %}
block details_right
{% endblock %}
</div>
</div>
{% endblock %}
</div>
</div>
{% block page_content %}
block page_content
{% endblock %}
{% endblock %}