2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 21:45:39 +00:00

Merge branch 'inventree:master' into matmair/issue2181

This commit is contained in:
Matthias Mair
2021-10-30 17:24:03 +02:00
committed by GitHub
254 changed files with 72043 additions and 5816 deletions

View File

@ -6,7 +6,6 @@ Provides a JSON API for the Part app
from __future__ import unicode_literals
from django.conf.urls import url, include
from django.urls import reverse
from django.http import JsonResponse
from django.db.models import Q, F, Count, Min, Max, Avg
from django.db import transaction
@ -43,28 +42,12 @@ from build.models import Build
from . import serializers as part_serializers
from InvenTree.views import TreeSerializer
from InvenTree.helpers import str2bool, isNull
from InvenTree.api import AttachmentMixin
from InvenTree.status_codes import BuildStatus
class PartCategoryTree(TreeSerializer):
title = _("Parts")
model = PartCategory
queryset = PartCategory.objects.all()
@property
def root_url(self):
return reverse('part-index')
def get_items(self):
return PartCategory.objects.all().prefetch_related('parts', 'children')
class CategoryList(generics.ListCreateAPIView):
""" API endpoint for accessing a list of PartCategory objects.
@ -1332,7 +1315,6 @@ class BomItemSubstituteDetail(generics.RetrieveUpdateDestroyAPIView):
part_api_urls = [
url(r'^tree/?', PartCategoryTree.as_view(), name='api-part-tree'),
# Base URL for PartCategory API endpoints
url(r'^category/', include([

View File

@ -24,36 +24,16 @@
<div id='bom-button-toolbar'>
<div class="btn-group" role="group" aria-label="...">
<!-- Export menu -->
<div class='btn-group'>
<button id='export-options' title='{% trans "Export actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'>
<span class='fas fa-download'></span> <span class='caret'></span>
</button>
<ul class='dropdown-menu' role='menu'>
<li><a href='#' id='download-bom'><span class='fas fa-file-download'></span> {% trans "Export BOM" %}</a></li>
<li><a href='#' id='print-bom-report'><span class='fas fa-file-pdf'></span> {% trans "Print BOM Report" %}</a></li>
</ul>
</div>
{% if roles.part.change %}
<!-- Action menu -->
<div class='btn-group'>
<button id='bom-actions' title='{% trans "BOM actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'>
<span class='fas fa-wrench'></span> <span class='caret'></span>
<button id='bom-actions' title='{% trans "BOM actions" %}' class='btn btn-outline-secondary 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'>
<li><a href='#' id='bom-upload'><span class='fas fa-file-upload'></span> {% trans "Upload BOM" %}</a></li>
{% if part.variant_of %}
<li><a href='#' id='bom-duplicate'><span class='fas fa-clone'></span> {% trans "Copy BOM" %}</a></li>
{% endif %}
{% if not part.is_bom_valid %}
<li><a href='#' id='validate-bom'><span class='fas fa-clipboard-check icon-green'></span> {% trans "Validate BOM" %}</a></li>
{% endif %}
<li><a href='#' id='bom-item-delete'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete Items" %}</a></li>
<li><a class='dropdown-item' href='#' id='bom-item-delete'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete Items" %}</a></li>
</ul>
</div>
<button class='btn btn-success' type='button' title='{% trans "New BOM Item" %}' id='bom-item-new'>
<span class='fas fa-plus-circle'></span> {% trans "Add BOM Item" %}
</button>
{% endif %}
<div class='filter-list' id='filter-list-bom'>

View File

@ -24,9 +24,9 @@
{% block form_buttons_top %}
{% if wizard.steps.prev %}
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}" class="save btn btn-default">{% trans "Previous Step" %}</button>
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}" class="save btn btn-outline-secondary">{% trans "Previous Step" %}</button>
{% endif %}
<button type="submit" class="save btn btn-default">{% trans "Submit Selections" %}</button>
<button type="submit" class="save btn btn-outline-secondary">{% trans "Submit Selections" %}</button>
{% endblock form_buttons_top %}
{% block form_content %}
@ -39,7 +39,7 @@
<div>
<input type='hidden' name='col_name_{{ forloop.counter0 }}' value='{{ col.name }}'/>
{{ col.name }}
<button class='btn btn-default btn-remove' onClick='removeColFromBomWizard()' id='del_col_{{ forloop.counter0 }}' style='display: inline; float: right;' title='{% trans "Remove column" %}'>
<button class='btn btn-outline-secondary btn-remove' onClick='removeColFromBomWizard()' id='del_col_{{ forloop.counter0 }}' style='display: inline; float: right;' title='{% trans "Remove column" %}'>
<span col_id='{{ forloop.counter0 }}' class='fas fa-trash-alt icon-red'></span>
</button>
</div>
@ -68,7 +68,7 @@
{% with forloop.counter as row_index %}
<tr>
<td style='width: 32px;'>
<button class='btn btn-default btn-remove' onClick='removeRowFromBomWizard()' id='del_row_{{ row_index }}' style='display: inline; float: left;' title='{% trans "Remove row" %}'>
<button class='btn btn-outline-secondary btn-remove' onClick='removeRowFromBomWizard()' id='del_row_{{ row_index }}' style='display: inline; float: left;' title='{% trans "Remove row" %}'>
<span row_id='{{ row_index }}' class='fas fa-trash-alt icon-red'></span>
</button>
</td>

View File

@ -16,9 +16,9 @@
{% block form_buttons_top %}
{% if wizard.steps.prev %}
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}" class="save btn btn-default">{% trans "Previous Step" %}</button>
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}" class="save btn btn-outline-secondary">{% trans "Previous Step" %}</button>
{% endif %}
<button type="submit" class="save btn btn-default">{% trans "Submit Selections" %}</button>
<button type="submit" class="save btn btn-outline-secondary">{% trans "Submit Selections" %}</button>
{% endblock form_buttons_top %}
{% block form_content %}
@ -49,7 +49,7 @@
{% for row in rows %}
<tr {% if row.errors %} style='background: #ffeaea;'{% endif %} part-select='#select_part_{{ row.index }}'>
<td>
<button class='btn btn-default btn-remove' onClick='removeRowFromBomWizard()' id='del_row_{{ row.index }}' style='display: inline; float: right;' title='{% trans "Remove row" %}'>
<button class='btn btn-outline-secondary btn-remove' onClick='removeRowFromBomWizard()' id='del_row_{{ row.index }}' style='display: inline; float: right;' title='{% trans "Remove row" %}'>
<span row_id='{{ row.index }}' class='fas fa-trash-alt icon-red'></span>
</button>
</td>

View File

@ -3,25 +3,14 @@
{% load i18n %}
{% load static %}
{% block menubar %}
<ul class='list-group'>
<li class='list-group-item'>
<a href='#' id='part-menu-toggle'>
<span class='menu-tab-icon fas fa-expand-arrows-alt'></span>
</a>
</li>
<li class='list-group-item' title='{% trans "Return To BOM" %}'>
<a href='{% url "part-detail" part.id %}' id='select-upload-file' class='nav-toggle'>
<span class='fas fa-undo side-icon'></span>
{% trans "Return To BOM" %}
</a>
</li>
</ul>
{% block sidebar %}
{% url "part-detail" part.id as url %}
{% include "sidebar_link.html" with url=url text="Return to BOM" icon="fa-undo" %}
{% endblock %}
{% block page_content %}
<div class='panel panel-default panel-inventree' id='panel-upload-file'>
<div class='panel' id='panel-upload-file'>
<div class='panel-heading'>
{% block heading %}
<h4>{% trans "Upload Bill of Materials" %}</h4>
@ -60,9 +49,9 @@
{% block form_buttons_bottom %}
{% if wizard.steps.prev %}
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}" class="save btn btn-default">{% trans "Previous Step" %}</button>
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}" class="save btn btn-outline-secondary">{% trans "Previous Step" %}</button>
{% endif %}
<button type="submit" class="save btn btn-default">{% trans "Upload File" %}</button>
<button type="submit" class="save btn btn-outline-secondary">{% trans "Upload File" %}</button>
</form>
{% endblock form_buttons_bottom %}

View File

@ -1,16 +1,12 @@
{% load i18n %}
<div class='navigation'>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li><a href='#' id='toggle-part-tree'><strong><span class='fas fa-stream'></span></strong></a></li>
<li class="breadcrumb-item{% if category is None %} active" aria-current="page{% endif %}"><a href="/part/">{% trans "Parts" %}</a></li>
<li class="breadcrumb-item{% if category is None %} active" aria-current="page{% endif %}"><a href="/part/">{% trans "Parts" %}</a></li>
{% if category %}
{% for path_item in category.parentpath %}
<li class="breadcrumb-item"><a href="{% url 'category-detail' path_item.id %}">{{ path_item.name }}</a></li>
<li class="breadcrumb-item"><a href="{% url 'category-detail' path_item.id %}">{{ path_item.name }}</a></li>
{% endfor %}
<li class="breadcrumb-item active" aria-current="page"><a href="{% url 'category-detail' category.id %}">{{ category.name }}</a></li>
<li class="breadcrumb-item"><a href="{% url 'category-detail' category.id %}">{{ category.name }}</a></li>
{% endif %}
</ol>
</nav>
</div>
{% if part %}
<li class="breadcrumb-item" aria-current="page"><a href="{% url 'part-detail' part.id %}">{{ part.name }}</a></li>
{% endif %}

View File

@ -2,11 +2,109 @@
{% load static %}
{% load i18n %}
{% block menubar %}
{% include 'part/category_navbar.html' %}
{% block sidebar %}
{% include 'part/category_sidebar.html' %}
{% endblock %}
{% block content %}
{% block heading %}
{% if category %}
{% trans "Part Category" %}: {{ category.name }}
{% else %}
{% trans "Parts" %}
{% endif %}
{% endblock %}
{% block actions %}
{% if user.is_staff and roles.part_category.change %}
{% url 'admin:part_partcategory_change' category.pk as url %}
{% include "admin_button.html" with url=url %}
{% endif %}
{% if category %}
{% if roles.part_category.change %}
<button class='btn btn-outline-secondary' id='cat-edit' title='{% trans "Edit part category" %}'>
<span class='fas fa-edit'/>
</button>
{% endif %}
{% if roles.part_category.delete %}
<button class='btn btn-outline-secondary' id='cat-delete' title='{% trans "Delete part category" %}'>
<span class='fas fa-trash-alt icon-red'/>
</button>
{% endif %}
{% endif %}
{% if roles.part_category.add %}
<button class='btn btn-success' id='cat-create' title='{% trans "Create new part category" %}'>
<span class='fas fa-plus-circle'></span> {% trans "New Category" %}
</button>
{% endif %}
{% endblock %}
{% block details_left %}
{% if category %}
<p>{{ category.description }}</p>
{% else %}
<p>{% trans "Top level part category" %}</p>
{% endif %}
{% endblock %}
{% block details_right %}
{% if category %}
<table class='table table-condensed table-striped'>
<col width='25'>
<tr>
<td><span class='fas fa-sitemap'></span></td>
<td>{% trans "Category Path" %}</td>
<td>{{ category.pathstring }}</td>
</tr>
<tr>
<td><span class='fas fa-info-circle'></span></td>
<td>{% trans "Category Description" %}</td>
<td>{{ category.description }}</td>
</tr>
{% if category.default_location %}
<tr>
<td><span class='fas fa-map-marker-alt'></span></td>
<td>{% trans "Default Location" %}</td>
<td><a href="{% url 'stock-location-detail' category.default_location.pk %}">{{ category.default_location.pathstring }}</a></td>
</tr>
{% endif %}
{% if category.default_keywords %}
<tr>
<td><span class='fas fa-key'></span></td>
<td>{% trans "Keywords" %}</td>
<td>{{ category.default_keywords }}</td>
</tr>
{% endif %}
<tr>
<td><span class='fas fa-sitemap'></span></td>
<td>{% trans "Subcategories" %}</td>
<td>{{ category.children.count }}</td>
</tr>
<tr>
<td><span class='fas fa-shapes'></span></td>
<td>{% trans "Parts (Including subcategories)" %}</td>
<td>{{ category.partcount }}</td>
</tr>
</table>
{% else %}
<table class='table table-striped table-condensed'>
<col width='25'>
<tr>
<td><span class='fas fa-sitemap'></span></td>
<td>{% trans "Part Categories" %}</td>
<td>{{ category_count }}</td>
</tr>
<tr>
<td><span class='fas fa-shapes'></span></td>
<td>{% trans "Parts" %}</td>
<td>{{ part_count }}</td>
</tr>
</table>
{% endif %}
{% endblock %}
{% block page_content %}
{% if messages %}
{% for message in messages %}
@ -16,139 +114,38 @@
{% endfor %}
{% endif %}
<div class='panel panel-default panel-inventree'>
<div class='row'>
<div class='col-sm-6'>
{% if category %}
<h3>
{{ category.name }}
{% if user.is_staff and roles.part_category.change %}
<a href="{% url 'admin:part_partcategory_change' category.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>
{% endif %}
</h3>
<p>{{ category.description }}</p>
{% else %}
<h3>{% trans "Part Categories" %}</h3>
<p>{% trans "All parts" %}</p>
{% endif %}
<p>
<div class='btn-group action-buttons'>
{% if roles.part_category.add %}
<button class='btn btn-default' id='cat-create' title='{% trans "Create new part category" %}'>
<span class='fas fa-plus-circle icon-green'/>
</button>
{% endif %}
{% if category %}
{% if roles.part_category.change %}
<button class='btn btn-default' id='cat-edit' title='{% trans "Edit part category" %}'>
<span class='fas fa-edit icon-blue'/>
</button>
{% endif %}
{% if roles.part_category.delete %}
<button class='btn btn-default' id='cat-delete' title='{% trans "Delete part category" %}'>
<span class='fas fa-trash-alt icon-red'/>
</button>
{% endif %}
{% endif %}
</div>
</p>
</div>
<div class='col-sm-6'>
{% if category %}
<h3>{% trans "Category Details" %}</h3>
<table class='table table-condensed table-striped'>
<col width='25'>
<tr>
<td><span class='fas fa-sitemap'></span></td>
<td>{% trans "Category Path" %}</td>
<td>{{ category.pathstring }}</td>
</tr>
<tr>
<td><span class='fas fa-info-circle'></span></td>
<td>{% trans "Category Description" %}</td>
<td>{{ category.description }}</td>
</tr>
{% if category.default_location %}
<tr>
<td><span class='fas fa-map-marker-alt'></span></td>
<td>{% trans "Default Location" %}</td>
<td><a href="{% url 'stock-location-detail' category.default_location.pk %}">{{ category.default_location.pathstring }}</a></td>
</tr>
{% endif %}
{% if category.default_keywords %}
<tr>
<td><span class='fas fa-key'></span></td>
<td>{% trans "Keywords" %}</td>
<td>{{ category.default_keywords }}</td>
</tr>
{% endif %}
<tr>
<td><span class='fas fa-sitemap'></span></td>
<td>{% trans "Subcategories" %}</td>
<td>{{ category.children.count }}</td>
</tr>
<tr>
<td><span class='fas fa-shapes'></span></td>
<td>{% trans "Parts (Including subcategories)" %}</td>
<td>{{ category.partcount }}</td>
</tr>
</table>
{% else %}
<h3>{% trans "Category Details" %}</h3>
<table class='table table-striped table-condensed'>
<col width='25'>
<tr>
<td><span class='fas fa-sitemap'></span></td>
<td>{% trans "Part Categories" %}</td>
<td>{{ category_count }}</td>
</tr>
<tr>
<td><span class='fas fa-shapes'></span></td>
<td>{% trans "Parts" %}</td>
<td>{{ part_count }}</td>
</tr>
</table>
{% endif %}
</div>
</div>
</div>
{% block page_content %}
<div class='panel panel-default panel-inventree panel-hidden' id='panel-parts'>
<div class='panel panel-hidden' id='panel-parts'>
<div class='panel-heading'>
<h4>{% trans "Parts" %}</h4>
<div class='d-flex flex-row'>
<h4>{% trans "Parts" %}</h4>
{% include "spacer.html" %}
<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 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>
</div>
</div>
<div id='part-button-toolbar'>
<div class='btn-group'>
<button class='btn btn-default' 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" %}'>
<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'>
<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>
<li><a class='dropdown-item' href='#' id='multi-part-category' title='{% trans "Set category" %}'>{% trans "Set Category" %}</a></li>
{% endif %}
<li><a href='#' id='multi-part-order' title='{% trans "Order parts" %}'>{% trans "Order Parts" %}</a></li>
<li><a href='#' id='multi-part-print-label' title='{% trans "Print Labels" %}'>{% trans "Print Labels" %}</a></li>
<li><a href='#' id='multi-part-export' title='{% trans "Export" %}'>{% trans "Export Data" %}</a></li>
<li><a class='dropdown-item' href='#' id='multi-part-order' title='{% trans "Order parts" %}'>{% trans "Order Parts" %}</a></li>
<li><a class='dropdown-item' href='#' id='multi-part-print-label' title='{% trans "Print Labels" %}'>{% trans "Print Labels" %}</a></li>
<li><a class='dropdown-item' href='#' id='multi-part-export' title='{% trans "Export" %}'>{% trans "Export Data" %}</a></li>
</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" %}'>
<span class='fas fa-th-list'></span>
</button>
<button id='view-grid' class='btn btn-default' type='button' title='{% trans "View grid display" %}'>
<span class='fas fa-th'></span>
</button>
<div class='filter-list' id='filter-list-parts'>
<!-- Empty div -->
</div>
@ -160,7 +157,7 @@
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-parameters'>
<div class='panel panel-hidden' id='panel-parameters'>
<div class='panel-heading'>
<h4>{% trans "Part Parameters" %}</h4>
</div>
@ -170,14 +167,13 @@
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-subcategories'>
<div class='panel panel-hidden' id='panel-subcategories'>
<div class='panel-heading'>
<h4>{% trans "Subcategories" %}</h4>
</div>
<div class='panel-content'>
<div id='subcategory-button-toolbar'>
<div class='button-toolbar container-fluid' style='float: right;'>
<div class='btn-group' role='group'>
<div class='filter-list' id='filter-list-category'>
<!-- An empty div in which the filter list will be constructed -->
</div>
@ -191,7 +187,6 @@
{% endblock %}
{% endblock %}
{% block js_load %}
{{ block.super }}
{% endblock %}
@ -199,16 +194,6 @@
{% block js_ready %}
{{ block.super }}
loadPartCategoryTable($('#subcategory-table'), {
params: {
{% if category %}
parent: {{ category.pk }}
{% else %}
parent: 'null'
{% endif %}
}
});
{% if category %}
loadParametricPartTable(
"#parametric-part-table",
@ -219,26 +204,19 @@
);
{% endif %}
enableNavbar({
label: 'category',
toggleId: '#category-menu-toggle',
});
enableSidebar('category');
$('#view-list').click(function() {
$('#view-list').hide();
$('#view-grid').show();
$('#part-table').bootstrapTable('toggleCustomView');
inventreeSave('part-grid-view', '');
});
$('#view-grid').click(function() {
$('#view-grid').hide();
$('#view-list').show();
$('#part-table').bootstrapTable('toggleCustomView');
inventreeSave('part-grid-view', 1);
});
loadPartCategoryTable(
$('#subcategory-table'), {
params: {
{% if category %}
parent: {{ category.pk }},
{% else %}
parent: null,
{% endif %}
}
}
);
$("#cat-create").click(function() {
@ -326,16 +304,4 @@
},
);
if (inventreeLoad("part-grid-view")) {
$('#view-grid').hide();
$('#part-table').bootstrapTable('toggleCustomView');
} else {
$('#view-list').hide();
}
attachNavCallbacks({
name: 'partcategory',
default: 'part-stock'
});
{% endblock %}

View File

@ -1,45 +0,0 @@
{% load i18n %}
{% load inventree_extras %}
{% settings_value 'PART_SHOW_IMPORT' as show_import %}
<ul class='list-group'>
<li class='list-group-item'>
<a href='#' id='category-menu-toggle'>
<span class='menu-tab-icon fas fa-expand-arrows-alt'></span>
</a>
</li>
<li class='list-group-item' title='{% trans "Subcategories" %}'>
<a href='#' id='select-subcategories' class='nav-toggle'>
<span class='fas fa-sitemap sidebar-icon'></span>
{% trans "Subcategories" %}
</a>
</li>
<li class='list-group-item' title='{% trans "Parts" %}'>
<a href='#' id='select-parts' class='nav-toggle'>
<span class='fas fa-shapes sidebar-icon'></span>
{% trans "Parts" %}
</a>
</li>
{% if show_import and user.is_staff and roles.part.add %}
<li class='list-group-item' title='{% trans "Import Parts" %}'>
<a href='{% url "part-import" %}'>
<span class='fas fa-file-upload sidebar-icon'></span>
{% trans "Import Parts" %}
</a>
</li>
{% endif %}
{% if category %}
<li class='list-group-item' title='{% trans "Parameters" %}'>
<a href='#' id='select-parameters' class='nav-toggle'>
<span class='fas fa-tasks sidebar-icon'></span>
{% trans "Parameters" %}
</a>
</li>
{% endif %}
</ul>

View File

@ -0,0 +1,15 @@
{% load i18n %}
{% load static %}
{% load inventree_extras %}
{% settings_value 'PART_SHOW_IMPORT' as show_import %}
{% include "sidebar_item.html" with label="subcategories" text="Subcategories" icon="fa-sitemap" %}
{% include "sidebar_item.html" with label="parts" text="Parts" icon="fa-shapes" %}
{% if show_import and user.is_staff and roles.part.add %}
{% url "part-import" as url %}
{% include "sidebar_link.html" with url=url text="Import Parts" icon="fa-file-upload" %}
{% endif %}
{% if category %}
{% include "sidebar_item.html" with label="parameters" text="Parameters" icon="fa-tasks" %}
{% endif %}

View File

@ -5,13 +5,95 @@
{% load crispy_forms_tags %}
{% load markdownify %}
{% block menubar %}
{% include 'part/navbar.html' %}
{% block sidebar %}
{% include 'part/part_sidebar.html' %}
{% endblock %}
{% block page_content %}
<div class='panel panel-default panel-inventree panel-hidden' id='panel-part-stock'>
<div class='panel panel-hidden' id='panel-part-details'>
<div class='panel-heading'>
<h4>{% trans "Part Details" %}</h4>
</div>
<div class='panel-content'>
<!-- Details Table -->
<table class="table table-striped table-condensed">
<col width='25'>
{% if part.IPN %}
<tr>
<td><span class='fas fa-tag'></span></td>
<td>{% trans "IPN" %}</td>
<td>{{ part.IPN }}{% include "clip.html"%}</td>
</tr>
{% endif %}
<tr>
<td><span class='fas fa-shapes'></span></td>
<td>{% trans "Name" %}</td>
<td>{{ part.name }}{% include "clip.html"%}</td>
</tr>
<tr>
<td><span class='fas fa-info-circle'></span></td>
<td>{% trans "Description" %}</td>
<td>{{ part.description }}{% include "clip.html"%}</td>
</tr>
{% if part.revision %}
<tr>
<td><span class='fas fa-code-branch'></span></td>
<td>{% trans "Revision" %}</td>
<td>{{ part.revision }}{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if part.keywords %}
<tr>
<td><span class='fas fa-key'></span></td>
<td>{% trans "Keywords" %}</td>
<td>{{ part.keywords }}{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if part.link %}
<tr>
<td><span class='fas fa-link'></span></td>
<td>{% trans "External Link" %}</td>
<td><a href="{{ part.link }}">{{ part.link }}</a>{% include "clip.html"%}</td>
</tr>
{% endif %}
<tr>
<td><span class='fas fa-calendar-alt'></span></td>
<td>{% trans "Creation Date" %}</td>
<td>
{{ part.creation_date }}
{% if part.creation_user %}
<span class='badge'>{{ part.creation_user }}</span>
{% endif %}
</td>
</tr>
{% if part.trackable and part.getLatestSerialNumber %}
<tr>
<td><span class='fas fa-hashtag'></span></td>
<td>{% trans "Latest Serial Number" %}</td>
<td>{{ part.getLatestSerialNumber }}{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if part.default_location %}
<tr>
<td><span class='fas fa-search-location'></span></td>
<td>{% trans "Default Location" %}</td>
<td>{{ part.default_location }}</td>
</tr>
{% endif %}
{% if part.default_supplier %}
<tr>
<td><span class='fas fa-building'></span></td>
<td>{% trans "Default Supplier" %}</td>
<td>{{ part.default_supplier }}</td>
</tr>
{% endif %}
</table>
</div>
</div>
<div class='panel panel-hidden' id='panel-part-stock'>
<div class='panel-heading'>
<h4>{% trans "Part Stock" %}</h4>
</div>
@ -25,16 +107,23 @@
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-test-templates'>
<div class='panel panel-hidden' id='panel-test-templates'>
<div class='panel-heading'>
<h4>{% trans "Part Test Templates" %}</h4>
<div class='d-flex flex-row'>
<h4>{% trans "Part Test Templates" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
<div class='btn-group' role='group'>
<button type='button' class='btn btn-success' id='add-test-template'>
<span class='fas fa-plus-circle'></span> {% trans "Add Test Template" %}
</button>
</div>
</div>
</div>
</div>
<div class='panel-content'>
<div id='test-button-toolbar'>
<div class='button-toolbar container-fluid' style="float: right;">
<div class='btn-group' role='group'>
<button type='button' class='btn btn-success' id='add-test-template'>{% trans "Add Test Template" %}</button>
</div>
<div class='filter-list' id='filter-list-parttests'>
<!-- Empty div -->
</div>
@ -45,16 +134,21 @@
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-purchase-orders'>
<div class='panel panel-hidden' id='panel-purchase-orders'>
<div class='panel-heading'>
<h4>{% trans "Purchase Orders" %}</h4>
<div class='d-flex flex-row'>
<h4>{% trans "Purchase Orders" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
<button class='btn btn-primary' type='button' id='part-order2' title='{% trans "Order part" %}'>
<span class='fas fa-shopping-cart'></span> {% trans "Order Part" %}
</button>
</div>
</div>
</div>
<div class='panel-content'>
<div id='po-button-bar'>
<div class='button-toolbar container-fluid' style='float: right;'>
<button class='btn btn-primary' type='button' id='part-order2' title='{% trans "Order part" %}'>
<span class='fas fa-shopping-cart'></span> {% trans "Order Part" %}
</button>
<div class='filter-list' id='filter-list-purchaseorder'>
<!-- An empty div in which the filter list will be constructed -->
</div>
@ -66,7 +160,7 @@
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-sales-orders'>
<div class='panel panel-hidden' id='panel-sales-orders'>
<div class='panel-heading'>
<h4>{% trans "Sales Orders" %}</h4>
</div>
@ -94,11 +188,11 @@
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-pricing'>
<div class='panel panel-hidden' id='panel-pricing'>
{% include "part/prices.html" %}
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-part-notes'>
<div class='panel panel-hidden' id='panel-part-notes'>
<div class='panel-heading'>
<div class='row'>
<div class='col-sm-6'>
@ -106,7 +200,7 @@
</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'>
<button type='button' id='edit-notes' title='{% trans "Edit Notes" %}' class='btn btn-outline-secondary'>
<span class='fas fa-edit'>
</span>
</button>
@ -121,23 +215,28 @@
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-pricing'>
<div class='panel panel-hidden' id='panel-pricing'>
<!-- TODO -->
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-variants'>
<div class='panel panel-hidden' id='panel-variants'>
<div class='panel-heading'>
<h4>{% trans "Part Variants" %}</h4>
<div class='d-flex flex-row'>
<h4>{% trans "Part Variants" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
{% if part.is_template and part.active %}
<button class='btn btn-success' id='new-variant' title='{% trans "Create new variant" %}'>
<span class='fas fa-plus-circle'></span> {% trans "New Variant" %}
</button>
{% endif %}
</div>
</div>
</div>
<div class='panel-content'>
<div id='variant-button-toolbar'>
<div class='button-toolbar container-fluid'>
<div class='btn-group' role='group'>
{% if part.is_template and part.active %}
<button class='btn btn-success' id='new-variant' title='{% trans "Create new variant" %}'>
<span class='fas fa-plus-circle'></span> {% trans "New Variant" %}
</button>
{% endif %}
</div>
<div class='filter-list' id='filter-list-variants'>
<!-- Empty div (will be filled out with available BOM filters) -->
@ -150,13 +249,12 @@
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-part-parameters'>
<div class='panel panel-hidden' id='panel-part-parameters'>
<div class='panel-heading'>
<h4>{% trans "Parameters" %}</h4>
</div>
<div class='panel-content'>
<div id='param-button-toolbar'>
<div class='button-toolbar container-fluid' style='float: right;'>
<div class='d-flex flex-row'>
<h4>{% trans "Parameters" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
{% if roles.part.add %}
<button title='{% trans "Add new parameter" %}' class='btn btn-success' id='param-create'>
<span class='fas fa-plus-circle'></span> {% trans "New Parameter" %}
@ -164,32 +262,51 @@
{% endif %}
</div>
</div>
</div>
<div class='panel-content'>
<div id='param-button-toolbar'>
<div class='button-toolbar container-fluid' style='float: right;'>
</div>
</div>
<table id='parameter-table' class='table table-condensed table-striped' data-toolbar="#param-button-toolbar"></table>
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-part-attachments'>
<div class='panel panel-hidden' id='panel-part-attachments'>
<div class='panel-heading'>
<h4>{% trans "Attachments" %}</h4>
<div class='d-flex flex-row'>
<h4>{% trans "Attachments" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
{% include "attachment_button.html" %}
</div>
</div>
</div>
<div class='panel-content'>
{% include "attachment_table.html" %}
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-related-parts'>
<div class='panel panel-hidden' id='panel-related-parts'>
<div class='panel-heading'>
<h4>{% trans "Related Parts" %}</h4>
<div class='d-flex flex-row'>
<h4>{% trans "Related Parts" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
{% if roles.part.change %}
<button class='btn btn-success' type='button' id='add-related-part' title='{% trans "Add Related" %}'>
<span class='fas fa-plus-circle'></span> {% trans "Add Related" %}
</button>
{% endif %}
</div>
</div>
</div>
<div class='panel-content'>
<div id='related-button-bar'>
<div class='button-toolbar container-fluid' style='float: left;'>
{% if roles.part.change %}
<button class='btn btn-success' type='button' id='add-related-part' title='{% trans "Add Related" %}'>{% trans "Add Related" %}</button>
<div class='filter-list' id='filter-list-related'>
<!-- An empty div in which the filter list will be constructed -->
</div>
{% endif %}
</div>
</div>
@ -211,7 +328,7 @@
<a href='/part/{{ part.id }}/'>{{ part }}</a>
<div class='btn-group' style='float: right;'>
{% if roles.part.change %}
<button title='{% trans "Delete" %}' class='btn btn-default btn-glyph delete-related-part' url="{% url 'part-related-delete' part_related.id %}" type='button'><span class='fas fa-trash-alt icon-red'/></button>
<button title='{% trans "Delete" %}' class='btn btn-outline-secondary delete-related-part' url="{% url 'part-related-delete' part_related.id %}" type='button'><span class='fas fa-trash-alt icon-red'/></button>
{% endif %}
</div>
</td>
@ -223,16 +340,52 @@
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-bom'>
<div class='panel panel-hidden' id='panel-bom'>
<div class='panel-heading'>
<h4>{% trans "Bill of Materials" %}</h4>
<div class='d-flex flex-row'>
<h4>{% trans "Bill of Materials" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
<!-- Export menu -->
<div class='btn-group'>
<button id='export-options' title='{% trans "Export actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'>
<span class='fas fa-download'></span> <span class='caret'></span>
</button>
<ul class='dropdown-menu' role='menu'>
<li><a class='dropdown-item' href='#' id='download-bom'><span class='fas fa-file-download'></span> {% trans "Export BOM" %}</a></li>
<li><a class='dropdown-item' href='#' id='print-bom-report'><span class='fas fa-file-pdf'></span> {% trans "Print BOM Report" %}</a></li>
</ul>
</div>
<!-- Actions menu -->
<div class='btn-group'>
<button id='bom-actions' title='{% trans "BOM actions" %}' class='btn btn-outline-secondary 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'>
<li><a class='dropdown-item' href='#' id='bom-upload'><span class='fas fa-file-upload'></span> {% trans "Upload BOM" %}</a></li>
{% if part.variant_of %}
<li><a class='dropdown-item' href='#' id='bom-duplicate'><span class='fas fa-clone'></span> {% trans "Copy BOM" %}</a></li>
{% endif %}
{% if not part.is_bom_valid %}
<li><a class='dropdown-item' href='#' id='validate-bom'><span class='fas fa-clipboard-check icon-green'></span> {% trans "Validate BOM" %}</a></li>
{% endif %}
</ul>
</div>
{% if roles.part.change %}
<button class='btn btn-success' type='button' title='{% trans "New BOM Item" %}' id='bom-item-new'>
<span class='fas fa-plus-circle'></span> {% trans "Add BOM Item" %}
</button>
{% endif %}
</div>
</div>
</div>
<div class='panel-content'>
{% include "part/bom.html" with part=part %}
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-used-in'>
<div class='panel panel-hidden' id='panel-used-in'>
<div class='panel-heading'>
<h4>{% trans "Assemblies" %}</h4>
</div>
@ -248,18 +401,25 @@
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-build-orders'>
<div class='panel panel-hidden' id='panel-build-orders'>
<div class='panel-heading'>
<h4>{% trans "Part Builds" %}</h4>
<div class='d-flex flex-row'>
<h4>{% trans "Part Builds" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
{% if part.active %}
{% if roles.build.add %}
<button class="btn btn-success" id='start-build'>
<span class='fas fa-tools'></span> {% trans "New Build Order" %}
</button>
{% endif %}
{% endif %}
</div>
</div>
</div>
<div class='panel-content'>
<div id='build-button-toolbar'>
<div class='button-toolbar container-fluid' style='float: right';>
{% if part.active %}
{% if roles.build.add %}
<button class="btn btn-success" id='start-build'><span class='fas fa-tools'></span> {% trans "Start New Build" %}</button>
{% endif %}
{% endif %}
<div class='filter-list' id='filter-list-build'>
<!-- Empty div for filters -->
</div>
@ -278,20 +438,25 @@
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-suppliers'>
<div class='panel panel-hidden' id='panel-suppliers'>
<div class='panel-heading'>
<h4>{% trans "Part Suppliers" %}</h4>
<div class='d-flex flex-row'>
<h4>{% trans "Part Suppliers" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
<button class="btn btn-success" id='supplier-create'>
<span class='fas fa-plus-circle'></span> {% trans "New Supplier Part" %}
</button>
</div>
</div>
</div>
<div class='panel-content'>
<div id='supplier-button-toolbar'>
<div class='btn-group'>
<button class="btn btn-success" id='supplier-create'>
<span class='fas fa-plus-circle'></span> {% trans "New Supplier Part" %}
</button>
<div id='opt-dropdown' class="btn-group">
<button id='supplier-part-options' class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">{% trans "Options" %} <span class="caret"></span></button>
<button id='supplier-part-options' class="btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown">{% trans "Options" %} <span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href='#' id='supplier-part-delete' title='{% trans "Delete supplier parts" %}'>{% trans "Delete" %}</a></li>
<li><a class='dropdown-item' href='#' id='supplier-part-delete' title='{% trans "Delete supplier parts" %}'>{% trans "Delete" %}</a></li>
</ul>
</div>
</div>
@ -302,19 +467,24 @@
</div>
<div class='panel-heading'>
<h4>{% trans "Part Manufacturers" %}</h4>
<div class='d-flex flex-row'>
<h4>{% trans "Part Manufacturers" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
<button class="btn btn-success" id='manufacturer-create'>
<span class='fas fa-plus-circle'></span> {% trans "New Manufacturer Part" %}
</button>
</div>
</div>
</div>
<div class='panel-content'>
<div class='panel-content'>
<div id='manufacturer-button-toolbar'>
<div class='btn-group'>
<button class="btn btn-success" id='manufacturer-create'>
<span class='fas fa-plus-circle'></span> {% trans "New Manufacturer Part" %}
</button>
<div id='opt-dropdown' class="btn-group">
<button id='manufacturer-part-options' class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">{% trans "Options" %} <span class="caret"></span></button>
<button id='manufacturer-part-options' class="btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown">{% trans "Options" %} <span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href='#' id='manufacturer-part-delete' title='{% trans "Delete manufacturer parts" %}'>{% trans "Delete" %}</a></li>
<li><a class='dropdown-item' href='#' id='manufacturer-part-delete' title='{% trans "Delete manufacturer parts" %}'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete" %}</a></li>
</ul>
</div>
</div>
@ -335,6 +505,7 @@
// Load the "suppliers" tab
onPanelLoad('suppliers', function() {
function reloadSupplierPartTable() {
$('#supplier-part-table').bootstrapTable('refresh');
}
@ -1031,9 +1202,6 @@
var SalePriceChart = loadSellPricingChart($('#SalePriceChart'), salepricedata)
{% endif %}
attachNavCallbacks({
name: 'part',
default: 'part-stock'
});
enableSidebar('part');
{% endblock %}

View File

@ -32,7 +32,7 @@
<div>
<input type='hidden' name='col_name_{{ forloop.counter0 }}' value='{{ col.name }}'/>
{{ col.name }}
<button class='btn btn-default btn-remove' onClick='removeColFromBomWizard()' id='del_col_{{ forloop.counter0 }}' style='display: inline; float: right;' title='{% trans "Remove column" %}'>
<button class='btn btn-outline-secondary btn-remove' onClick='removeColFromBomWizard()' id='del_col_{{ forloop.counter0 }}' style='display: inline; float: right;' title='{% trans "Remove column" %}'>
<span col_id='{{ forloop.counter0 }}' class='fas fa-trash-alt icon-red'></span>
</button>
</div>
@ -61,7 +61,7 @@
{% with forloop.counter as row_index %}
<tr>
<td style='width: 32px;'>
<button class='btn btn-default btn-remove' onClick='removeRowFromBomWizard()' id='del_row_{{ row_index }}' style='display: inline; float: left;' title='{% trans "Remove row" %}'>
<button class='btn btn-outline-secondary btn-remove' onClick='removeRowFromBomWizard()' id='del_row_{{ row_index }}' style='display: inline; float: left;' title='{% trans "Remove row" %}'>
<span row_id='{{ row_index }}' class='fas fa-trash-alt icon-red'></span>
</button>
</td>

View File

@ -38,7 +38,7 @@
{% for row in rows %}
<tr {% if row.errors %} style='background: #ffeaea;'{% endif %} part-select='#select_part_{{ row.index }}'>
<td>
<button class='btn btn-default btn-remove' onClick='removeRowFromBomWizard()' id='del_row_{{ row.index }}' style='display: inline; float: right;' title='{% trans "Remove row" %}'>
<button class='btn btn-outline-secondary btn-remove' onClick='removeRowFromBomWizard()' id='del_row_{{ row.index }}' style='display: inline; float: right;' title='{% trans "Remove row" %}'>
<span row_id='{{ row.index }}' class='fas fa-trash-alt icon-red'></span>
</button>
</td>

View File

@ -24,9 +24,9 @@
{% block form_buttons_top %}
{% if wizard.steps.prev %}
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}" class="save btn btn-default">{% trans "Previous Step" %}</button>
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}" class="save btn btn-outline-secondary">{% trans "Previous Step" %}</button>
{% endif %}
<button type="submit" class="save btn btn-default">{% trans "Submit Selections" %}</button>
<button type="submit" class="save btn btn-outline-secondary">{% trans "Submit Selections" %}</button>
{% endblock form_buttons_top %}
{% block form_content %}
@ -39,7 +39,7 @@
<div>
<input type='hidden' name='col_name_{{ forloop.counter0 }}' value='{{ col.name }}'/>
{{ col.name }}
<button class='btn btn-default btn-remove' onClick='removeColFromBomWizard()' id='del_col_{{ forloop.counter0 }}' style='display: inline; float: right;' title='{% trans "Remove column" %}'>
<button class='btn btn-outline-secondary btn-remove' onClick='removeColFromBomWizard()' id='del_col_{{ forloop.counter0 }}' style='display: inline; float: right;' title='{% trans "Remove column" %}'>
<span col_id='{{ forloop.counter0 }}' class='fas fa-trash-alt icon-red'></span>
</button>
</div>
@ -68,7 +68,7 @@
{% with forloop.counter as row_index %}
<tr>
<td style='width: 32px;'>
<button class='btn btn-default btn-remove' onClick='removeRowFromBomWizard()' id='del_row_{{ row_index }}' style='display: inline; float: left;' title='{% trans "Remove row" %}'>
<button class='btn btn-outline-secondary btn-remove' onClick='removeRowFromBomWizard()' id='del_row_{{ row_index }}' style='display: inline; float: left;' title='{% trans "Remove row" %}'>
<span row_id='{{ row_index }}' class='fas fa-trash-alt icon-red'></span>
</button>
</td>

View File

@ -16,9 +16,9 @@
{% block form_buttons_top %}
{% if wizard.steps.prev %}
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}" class="save btn btn-default">{% trans "Previous Step" %}</button>
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}" class="save btn btn-outline-secondary">{% trans "Previous Step" %}</button>
{% endif %}
<button type="submit" class="save btn btn-default">{% trans "Submit Selections" %}</button>
<button type="submit" class="save btn btn-outline-secondary">{% trans "Submit Selections" %}</button>
{% endblock form_buttons_top %}
{% block form_content %}
@ -45,7 +45,7 @@
{% for row in rows %}
<tr {% if row.errors %} style='background: #ffeaea;'{% endif %} part-select='#select_part_{{ row.index }}'>
<td>
<button class='btn btn-default btn-remove' onClick='removeRowFromBomWizard()' id='del_row_{{ row.index }}' style='display: inline; float: right;' title='{% trans "Remove row" %}'>
<button class='btn btn-outline-secondary btn-remove' onClick='removeRowFromBomWizard()' id='del_row_{{ row.index }}' style='display: inline; float: right;' title='{% trans "Remove row" %}'>
<span row_id='{{ row.index }}' class='fas fa-trash-alt icon-red'></span>
</button>
</td>

View File

@ -3,24 +3,13 @@
{% load i18n %}
{% load static %}
{% block menubar %}
<ul class='list-group'>
<li class='list-group-item'>
<a href='#' id='part-menu-toggle'>
<span class='menu-tab-icon fas fa-expand-arrows-alt'></span>
</a>
</li>
<li class='list-group-item' title='{% trans "Return To Parts" %}'>
<a href='{% url "part-index" %}' id='select-upload-file' class='nav-toggle'>
<span class='fas fa-undo side-icon'></span>
{% trans "Return To Parts" %}
</a>
</li>
</ul>
{% block sidebar %}
{% url 'part-index' as url %}
{% include "sidebar_link.html" with url=url text="Return to Parts" icon="fa-undo" %}
{% endblock %}
{% block content %}
<div class='panel panel-default panel-inventree'>
<div class='panel'>
<div class='panel-heading'>
<h4>
{% trans "Import Parts from File" %}
@ -52,9 +41,9 @@
{% block form_buttons_bottom %}
{% if wizard.steps.prev %}
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}" class="save btn btn-default">{% trans "Previous Step" %}</button>
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}" class="save btn btn-outline-secondary">{% trans "Previous Step" %}</button>
{% endif %}
<button type="submit" class="save btn btn-default">{% trans "Upload File" %}</button>
<button type="submit" class="save btn btn-outline-secondary">{% trans "Upload File" %}</button>
</form>
{% endblock form_buttons_bottom %}
@ -70,9 +59,6 @@
{% block js_ready %}
{{ block.super }}
enableNavbar({
label: 'part',
toggleId: '#part-menu-toggle',
});
enableSidebar('partupload');
{% endblock %}

View File

@ -1,114 +0,0 @@
{% load i18n %}
{% load static %}
{% load inventree_extras %}
{% settings_value "PART_INTERNAL_PRICE" as show_internal_price %}
{% settings_value 'PART_SHOW_RELATED' as show_related %}
<ul class='list-group'>
<li class='list-group-item'>
<a href='#' id='part-menu-toggle'>
<span class='menu-tab-icon fas fa-expand-arrows-alt'></span>
</a>
</li>
<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' title='{% trans "Part Variants" %}'>
<a href='#' id='select-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' 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.assembly %}
<li class='list-group-item' title='{% trans "Bill of Materials" %}'>
<a href='#' id='select-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 ' 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>
</li>
{% endif %}
{% endif %}
{% if part.component %}
<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' title='{% trans "Pricing Information" %}'>
<a href='#' id='select-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' title='{% trans "Suppliers" %}'>
<a href='#' id='select-suppliers' class='nav-toggle'>
<span class='menu-tab-icon fas fa-building sidebar-icon'></span>
{% trans "Suppliers" %}
</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 part.salable and roles.sales_order.view %}
<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' 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' 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>

View File

@ -1,4 +1,4 @@
{% extends "base.html" %}
{% extends "page_base.html" %}
{% load static %}
{% load i18n %}
{% load inventree_extras %}
@ -13,33 +13,10 @@
{% endif %}
{% endblock %}
{% block sidenav %}
<div id='part-tree'></div>
{% endblock %}
{% block pre_content %}
{% block breadcrumbs %}
{% if part %}
{% include "part/cat_link.html" with category=part.category %}
{% include "part/cat_link.html" with category=part.category part=part %}
{% else %}
{% include 'part/cat_link.html' with category=category %}
{% endif %}
{% endblock %}
{% block js_ready %}
{{ block.super }}
loadTree("{% url 'api-part-tree' %}",
"#part-tree",
{
name: 'part',
}
);
initNavTree({
label: 'part',
treeId: '#sidenav-left',
toggleId: '#toggle-part-tree',
});
{% endblock %}

View File

@ -4,311 +4,223 @@
{% load i18n %}
{% load inventree_extras %}
{% block menubar %}
{% include "part/navbar.html" %}
{% block sidebar %}
{% include "part/part_sidebar.html" %}
{% endblock %}
{% block content %}
{% block thumbnail %}
{% include "part/part_thumb.html" %}
{% endblock %}
<div class="panel panel-default panel-inventree">
<!-- Default panel contents -->
<div class="panel-heading"><h3>{{ part.full_name }}</h3></div>
<div class="panel-body">
<div class="row">
<div class="col-sm-6">
{% include "part/part_thumb.html" %}
<div class="media-body">
<p>
<h3>
<!-- Admin View -->
{% if user.is_staff and roles.part.change %}
<a href="{% url 'admin:part_part_change' part.pk %}"><span title="{% trans 'Admin view' %}" class='fas fa-user-shield'></span></a>&ensp;
{% endif %}
<!-- Properties -->
<div id='part-properties' class='btn-group' role='group'>
{% if part.is_template %}
<span class='fas fa-clone' title='{% trans "Part is a template part (variants can be made from this part)" %}'></span>
{% endif %}
{% if part.assembly %}
<span class='fas fa-tools' title='{% trans "Part can be assembled from other parts" %}'></span>
{% endif %}
{% if part.component %}
<span class='fas fa-th' title='{% trans "Part can be used in assemblies" %}'></span>
{% endif %}
{% if part.trackable %}
<span class='fas fa-directions' title='{% trans "Part stock is tracked by serial number" %}'></span>
{% endif %}
{% if part.purchaseable %}
<span class='fas fa-shopping-cart' title='{% trans "Part can be purchased from external suppliers" %}'></span>
{% endif %}
{% if part.salable %}
<span class='fas fa-dollar-sign' title='{% trans "Part can be sold to customers" %}'></span>
{% endif %}
</div>
<!-- Part active -->
{% if not part.active %}
&ensp;
<div class='label label-large label-large-red'>
<span class='fas fa-skull-crossbones' title='{% trans "Part is virtual (not a physical part)" %}'></span>
{% trans 'Inactive' %}
</div>
{% endif %}
<!-- Part virtual -->
{% if part.virtual and part.active %}
&ensp;
<div class='label label-large label-large-yellow'>
<span class='fas fa-ghost' title='{% trans "Part is virtual (not a physical part)" %}'></span>
{% trans 'Virtual' %}
</div>
{% endif %}
</h3>
</p>
{% block heading %}
{{ part.full_name }}
{% endblock %}
<div class='btn-group action-buttons' role='group'>
<button type='button' class='btn btn-default' id='toggle-starred' title='{% trans "Star this part" %}'>
<span id='part-star-icon' class='fas fa-star {% if starred %}icon-yellow{% endif %}'/>
</button>
{% block actions %}
<!-- Admin View -->
{% if user.is_staff and roles.part.change %}
{% url 'admin:part_part_change' part.pk as url %}
{% include "admin_button.html" with url=url %}
{% endif %}
{% 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'><span class='fas fa-qrcode'></span> <span class='caret'></span></button>
<ul class='dropdown-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>
</ul>
</div>
{% endif %}
{% if part.active %}
<button type='button' class='btn btn-default' id='price-button' title='{% trans "Show pricing information" %}'>
<span id='part-price-icon' class='fas fa-dollar-sign'/>
</button>
{% 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'>
<span class='fas fa-boxes'></span> <span class='caret'></span>
</button>
<ul class='dropdown-menu'>
<li>
<a href='#' id='part-count'>
<span class='fas fa-clipboard-list'></span>
{% trans "Count part stock" %}
</a>
</li>
<li>
<a href='#' id='part-move'>
<span class='fas fa-exchange-alt'></span>
{% trans "Transfer part stock" %}
</a>
</li>
</ul>
</div>
{% endif %}
{% if part.purchaseable and roles.purchase_order.add %}
<button type='button' class='btn btn-default' id='part-order' title='{% trans "Order part" %}'>
<span id='part-order-icon' class='fas fa-shopping-cart'/>
</button>
{% endif %}
{% endif %}
<!-- Part actions -->
{% if roles.part.add or roles.part.change or roles.part.delete %}
<div class='btn-group'>
<button id='part-actions' title='{% trans "Part actions" %}' class='btn btn-default dropdown-toggle' type='button' data-toggle='dropdown'> <span class='fas fa-shapes'></span> <span class='caret'></span></button>
<ul class='dropdown-menu'>
{% if roles.part.add %}
<li><a href='#' id='part-duplicate'><span class='fas fa-copy'></span> {% trans "Duplicate part" %}</a></li>
{% endif %}
{% if roles.part.change %}
<li><a href='#' id='part-edit'><span class='fas fa-edit icon-blue'></span> {% trans "Edit part" %}</a></li>
{% endif %}
{% if roles.part.delete %}
<li><a href='#' id='part-delete'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete part" %}</a></li>
{% endif %}
</ul>
</div>
{% endif %}
</div>
<button type='button' class='btn btn-outline-secondary' id='toggle-starred' title='{% trans "Star this part" %}'>
<span id='part-star-icon' class='fas fa-star {% if starred %}icon-yellow{% endif %}'/>
</button>
<p>
<!-- Details show/hide button -->
<button id="toggle-part-details" class="btn btn-primary" data-toggle="collapse" data-target="#collapsible-part-details" value="show">
<span class="fas fa-chevron-down"></span> {% trans "Show Part Details" %}
</button>
</p>
</div>
</div>
<div class='info-messages'>
{% if part.variant_of %}
<div class='alert alert-info alert-block' style='padding: 10px;'>
{% object_link 'part-detail' part.variant_of.id part.variant_of.full_name as link %}
{% blocktrans %}This part is a variant of {{link}}{% endblocktrans %}
</div>
{% endif %}
</div>
</div>
<div class="col-sm-6">
<table class='table table-condensed table-striped'>
<col width='25'>
<tr>
<td><h4><span class='fas fa-boxes'></span></h4></td>
<td><h4>{% trans "Available Stock" %}</h4></td>
<td><h4>{% decimal available %}{% if part.units %} {{ part.units }}{% endif %}</h4></td>
</tr>
<tr>
<td><span class='fas fa-map-marker-alt'></span></td>
<td>{% trans "In Stock" %}</td>
<td>{% include "part/stock_count.html" %}</td>
</tr>
{% if on_order > 0 %}
<tr>
<td><span class='fas fa-shopping-cart'></span></td>
<td>{% trans "On Order" %}</td>
<td>{% decimal on_order %}</td>
</tr>
{% endif %}
{% if required_build_order_quantity > 0 %}
<tr>
<td><span class='fas fa-clipboard-list'></span></td>
<td>{% trans "Required for Build Orders" %}</td>
<td>{% decimal required_build_order_quantity %}
</tr>
{% endif %}
{% if required_sales_order_quantity > 0 %}
<tr>
<td><span class='fas fa-clipboard-list'></span></td>
<td>{% trans "Required for Sales Orders" %}</td>
<td>{% decimal required_sales_order_quantity %}
</tr>
{% endif %}
{% if allocated > 0 %}
<tr>
<td><span class='fas fa-dolly'></span></td>
<td>{% trans "Allocated to Orders" %}</td>
<td>{% decimal allocated %}</td>
</tr>
{% endif %}
{% if barcodes %}
<!-- Barcode actions menu -->
<div class='btn-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>
</ul>
</div>
{% endif %}
{% if part.active %}
<button type='button' class='btn btn-outline-secondary' id='price-button' title='{% trans "Show pricing information" %}'>
<span id='part-price-icon' class='fas fa-dollar-sign'/>
</button>
{% if roles.stock.change %}
<div class='btn-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'>
<li>
<a class='dropdown-item' href='#' id='part-count'>
<span class='fas fa-clipboard-list'></span>
{% trans "Count part stock" %}
</a>
</li>
<li>
<a class='dropdown-item' href='#' id='part-move'>
<span class='fas fa-exchange-alt'></span>
{% trans "Transfer part stock" %}
</a>
</li>
</ul>
</div>
{% endif %}
{% if part.purchaseable and roles.purchase_order.add %}
<button type='button' class='btn btn-outline-secondary' id='part-order' title='{% trans "Order part" %}'>
<span id='part-order-icon' class='fas fa-shopping-cart'/>
</button>
{% endif %}
{% endif %}
<!-- Part actions -->
{% if roles.part.add or roles.part.change or roles.part.delete %}
<div class='btn-group'>
<button id='part-actions' title='{% trans "Part actions" %}' class='btn btn-outline-secondary dropdown-toggle' type='button' data-bs-toggle='dropdown'> <span class='fas fa-shapes'></span> <span class='caret'></span></button>
<ul class='dropdown-menu'>
{% if roles.part.add %}
<li><a class='dropdown-item' href='#' id='part-duplicate'><span class='fas fa-copy'></span> {% trans "Duplicate part" %}</a></li>
{% endif %}
{% if roles.part.change %}
<li><a class='dropdown-item' href='#' id='part-edit'><span class='fas fa-edit icon-blue'></span> {% trans "Edit part" %}</a></li>
{% endif %}
{% if roles.part.delete %}
<li><a class='dropdown-item' href='#' id='part-delete'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete part" %}</a></li>
{% endif %}
</ul>
</div>
{% endif %}
{% endblock %}
{% if not part.is_template %}
{% if part.assembly %}
<tr>
<td><h4><span class='fas fa-tools'></span></h4></td>
<td colspan='2'>
<h4>{% trans "Build Status" %}</h4>
</td>
</tr>
<tr>
<td></td>
<td>{% trans "Can Build" %}</td>
<td>{% decimal part.can_build %}</td>
</tr>
{% if quantity_being_built > 0 %}
<tr>
<td></td>
<td>{% trans "Building" %}</td>
<td>{% decimal quantity_being_built %}</td>
</tr>
{% endif %}
{% endif %}
{% endif %}
</table>
</div>
{% block details %}
</h4>
<!-- Properties -->
<h4>
<div id='part-properties' class='btn-group'>
{% if part.is_template %}
&ensp;
<span class='fas fa-clone' title='{% trans "Part is a template part (variants can be made from this part)" %}'></span>
{% endif %}
{% if part.assembly %}
&ensp;
<span class='fas fa-tools' title='{% trans "Part can be assembled from other parts" %}'></span>
{% endif %}
{% if part.component %}
&ensp;
<span class='fas fa-th' title='{% trans "Part can be used in assemblies" %}'></span>
{% endif %}
{% if part.trackable %}
&ensp;
<span class='fas fa-directions' title='{% trans "Part stock is tracked by serial number" %}'></span>
{% endif %}
{% if part.purchaseable %}
&ensp;
<span class='fas fa-shopping-cart' title='{% trans "Part can be purchased from external suppliers" %}'></span>
{% endif %}
{% if part.salable %}
&ensp;
<span class='fas fa-dollar-sign' title='{% trans "Part can be sold to customers" %}'></span>
{% endif %}
<!-- Part active -->
{% if not part.active %}
&ensp;
<div class='badge rounded-pill bg-danger'>
<span class='fas fa-skull-crossbones' title='{% trans "Part is virtual (not a physical part)" %}'></span>
{% trans 'Inactive' %}
</div>
</div>
<div class="collapse" id="collapsible-part-details">
<div class="card card-body">
<!-- Details Table -->
<table class="table table-striped">
<col width='25'>
{% if part.IPN %}
<tr>
<td><span class='fas fa-tag'></span></td>
<td>{% trans "IPN" %}</td>
<td>{{ part.IPN }}{% include "clip.html"%}</td>
</tr>
{% endif %}
<tr>
<td><span class='fas fa-shapes'></span></td>
<td>{% trans "Name" %}</td>
<td>{{ part.name }}{% include "clip.html"%}</td>
</tr>
<tr>
<td><span class='fas fa-info-circle'></span></td>
<td>{% trans "Description" %}</td>
<td>{{ part.description }}{% include "clip.html"%}</td>
</tr>
{% if part.revision %}
<tr>
<td><span class='fas fa-code-branch'></span></td>
<td>{% trans "Revision" %}</td>
<td>{{ part.revision }}{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if part.keywords %}
<tr>
<td><span class='fas fa-key'></span></td>
<td>{% trans "Keywords" %}</td>
<td>{{ part.keywords }}{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if part.link %}
<tr>
<td><span class='fas fa-link'></span></td>
<td>{% trans "External Link" %}</td>
<td><a href="{{ part.link }}">{{ part.link }}</a>{% include "clip.html"%}</td>
</tr>
{% endif %}
<tr>
<td><span class='fas fa-calendar-alt'></span></td>
<td>{% trans "Creation Date" %}</td>
<td>
{{ part.creation_date }}
{% if part.creation_user %}
<span class='badge'>{{ part.creation_user }}</span>
{% endif %}
</td>
</tr>
{% if part.trackable and part.getLatestSerialNumber %}
<tr>
<td><span class='fas fa-hashtag'></span></td>
<td>{% trans "Latest Serial Number" %}</td>
<td>{{ part.getLatestSerialNumber }}{% include "clip.html"%}</td>
</tr>
{% endif %}
{% if part.default_location %}
<tr>
<td><span class='fas fa-search-location'></span></td>
<td>{% trans "Default Location" %}</td>
<td>{{ part.default_location }}</td>
</tr>
{% endif %}
{% if part.default_supplier %}
<tr>
<td><span class='fas fa-building'></span></td>
<td>{% trans "Default Supplier" %}</td>
<td>{{ part.default_supplier }}</td>
</tr>
{% endif %}
</table>
{% endif %}
<!-- Part virtual -->
{% if part.virtual and part.active %}
&ensp;
<div class='badge rounded-pill bg-warning'>
<span class='fas fa-ghost' title='{% trans "Part is virtual (not a physical part)" %}'></span>
{% trans 'Virtual' %}
</div>
{% endif %}
</div>
</h4>
<!-- Part info messages -->
<div class='info-messages'>
{% if part.variant_of %}
<div class='alert alert-info alert-block' style='padding: 10px;'>
{% object_link 'part-detail' part.variant_of.id part.variant_of.full_name as link %}
{% blocktrans %}This part is a variant of {{link}}{% endblocktrans %}
</div>
{% endif %}
</div>
{% block page_content %}
{% endblock %}
{% block details_right %}
<table class='table table-condensed table-striped'>
<col width='25'>
<tr>
<td><h5><span class='fas fa-boxes'></span></h5></td>
<td><h5>{% trans "Available Stock" %}</h5></td>
<td><h5>{% decimal available %}{% if part.units %} {{ part.units }}{% endif %}</h5></td>
</tr>
<tr>
<td><span class='fas fa-map-marker-alt'></span></td>
<td>{% trans "In Stock" %}</td>
<td>{% include "part/stock_count.html" %}</td>
</tr>
{% if on_order > 0 %}
<tr>
<td><span class='fas fa-shopping-cart'></span></td>
<td>{% trans "On Order" %}</td>
<td>{% decimal on_order %}</td>
</tr>
{% endif %}
{% if required_build_order_quantity > 0 %}
<tr>
<td><span class='fas fa-clipboard-list'></span></td>
<td>{% trans "Required for Build Orders" %}</td>
<td>{% decimal required_build_order_quantity %}
</tr>
{% endif %}
{% if required_sales_order_quantity > 0 %}
<tr>
<td><span class='fas fa-clipboard-list'></span></td>
<td>{% trans "Required for Sales Orders" %}</td>
<td>{% decimal required_sales_order_quantity %}
</tr>
{% endif %}
{% if allocated > 0 %}
<tr>
<td><span class='fas fa-dolly'></span></td>
<td>{% trans "Allocated to Orders" %}</td>
<td>{% decimal allocated %}</td>
</tr>
{% endif %}
{% if not part.is_template %}
{% if part.assembly %}
<tr>
<td><h5><span class='fas fa-tools'></span></h5></td>
<td colspan='2'>
<h5>{% trans "Build Status" %}</h5>
</td>
</tr>
<tr>
<td></td>
<td>{% trans "Can Build" %}</td>
<td>{% decimal part.can_build %}</td>
</tr>
{% if quantity_being_built > 0 %}
<tr>
<td></td>
<td>{% trans "Building" %}</td>
<td>{% decimal quantity_being_built %}</td>
</tr>
{% endif %}
{% endif %}
{% endif %}
</table>
{% endblock %}
{% block js_ready %}
{{ block.super }}
enableNavbar({
label: 'part',
toggleId: '#part-menu-toggle',
});
{% if part.image %}
$('#part-thumb').click(function() {
showModalImage('{{ part.image.url }}');
@ -512,42 +424,4 @@
});
{% endif %}
$("#toggle-part-details").click(function() {
if (this.value == 'show') {
this.innerHTML = '<span class="fas fa-chevron-up"></span> {% trans "Hide Part Details" %}';
this.value = 'hide';
// Store state of part details section
localStorage.setItem("part-details-show", true);
} else {
this.innerHTML = '<span class="fas fa-chevron-down"></span> {% trans "Show Part Details" %}';
this.value = 'show';
// Store state of part details section
localStorage.setItem("part-details-show", false);
}
});
// Load part details section
window.onload = function() {
details_show = localStorage.getItem("part-details-show")
if (details_show === 'true') {
console.log(details_show)
// Get collapsible details section
details = document.getElementById('collapsible-part-details');
// Add "show" class
details.classList.add("in");
// Get toggle
toggle = document.getElementById('toggle-part-details');
// Change state of toggle
toggle.innerHTML = '<span class="fas fa-chevron-up"></span> {% trans "Hide Part Details" %}';
toggle.value = 'hide';
} else {
// Get toggle
toggle = document.getElementById('toggle-part-details');
// Change state of toggle
toggle.innerHTML = '<span class="fas fa-chevron-down"></span> {% trans "Show Part Details" %}';
toggle.value = 'show';
}
}
{% endblock %}

View File

@ -0,0 +1,38 @@
{% load i18n %}
{% load static %}
{% load inventree_extras %}
{% settings_value "PART_INTERNAL_PRICE" as show_internal_price %}
{% settings_value 'PART_SHOW_RELATED' as show_related %}
{% include "sidebar_item.html" with label="part-details" text="Details" icon="fa-shapes" %}
{% include "sidebar_item.html" with label="part-parameters" text="Parameters" icon="fa-th-list" %}
{% if part.is_template %}
{% include "sidebar_item.html" with label="variants" text="Variants" icon="fa-shapes" %}
{% endif %}
{% include "sidebar_item.html" with label="part-stock" text="Stock" icon="fa-boxes" %}
{% if part.assembly %}
{% include "sidebar_item.html" with label="bom" text="Bill of Materials" icon="fa-list" %}
{% if roles.build.view %}
{% include "sidebar_item.html" with label="build-orders" text="Build Orders" icon="fa-tools" %}
{% endif %}
{% endif %}
{% if part.component %}
{% include "sidebar_item.html" with label="used-in" text="Used In" icon="fa-layer-group" %}
{% endif %}
{% include "sidebar_item.html" with label="pricing" text="Pricing" icon="fa-dollar-sign" %}
{% if part.purchaseable and roles.purchase_order.view %}
{% include "sidebar_item.html" with label="suppliers" text="Suppliers" icon="fa-building" %}
{% include "sidebar_item.html" with label="purchase-orders" text="Purchase Orders" icon="fa-shopping-cart" %}
{% endif %}
{% if part.salable and roles.sales_order.view %}
{% include "sidebar_item.html" with label="sales-orders" text="Sales Orders" icon="fa-truck" %}
{% endif %}
{% if part.trackable %}
{% include "sidebar_item.html" with label="test-templates" text="Test Templates" icon="fa-vial" %}
{% endif %}
{% if show_related %}
{% include "sidebar_item.html" with label="related-parts" text="Related Parts" icon="fa-random" %}
{% endif %}
{% include "sidebar_item.html" with label="part-attachments" text="Attachments" icon="fa-paperclip" %}
{% include "sidebar_item.html" with label="part-notes" text="Notes" icon="fa-clipboard" %}

View File

@ -4,25 +4,22 @@
{% settings_value "INVENTREE_DOWNLOAD_FROM_URL" as allow_download %}
<div class="media">
<div class="media-left part-thumb-container">
<div class='dropzone' id='part-thumb'>
<img class="part-thumb" id='part-image'
{% if part.image %}
src="{{ part.image.url }}"
{% else %}
src="{% static 'img/blank_image.png' %}"
{% endif %}/>
</div>
{% if roles.part.change %}
<div class='btn-row part-thumb-overlay'>
<div class='btn-group'>
<button type='button' class='btn btn-default btn-glyph' title="{% trans 'Select from existing images' %}" id='part-image-select'><span class='fas fa-th'></span></button>
<button type='button' class='btn btn-default btn-glyph' title="{% trans 'Upload new image' %}" id='part-image-upload'><span class='fas fa-file-upload'></span></button>
{% if allow_download %}
<button type='button' class='btn btn-default btn-glyph' title="{% trans 'Download image from URL' %}" id='part-image-url'><span class='fas fa-cloud-download-alt'></span></button>
{% endif %}
</div>
</div>
{% endif %}
</div>
<div class='dropzone part-thumb-container' id='part-thumb'>
{% if roles.part.change %}
<div class='btn-row part-thumb-overlay'>
<div class='btn-group' role='group'>
<button type='button' class='btn btn-outline-secondary' title="{% trans 'Select from existing images' %}" id='part-image-select'><span class='fas fa-th'></span></button>
<button type='button' class='btn btn-outline-secondary' title="{% trans 'Upload new image' %}" id='part-image-upload'><span class='fas fa-file-upload'></span></button>
{% if allow_download %}
<button type='button' class='btn btn-outline-secondary' title="{% trans 'Download image from URL' %}" id='part-image-url'><span class='fas fa-cloud-download-alt'></span></button>
{% endif %}
</div>
</div>
{% endif %}
<img class="part-thumb" id='part-image'
{% if part.image %}
src="{{ part.image.url }}"
{% else %}
src="{% static 'img/blank_image.png' %}"
{% endif %}/>
</div>

View File

@ -29,7 +29,7 @@
{{ part.category.pathstring }}
</td>
<td>
<button class='btn btn-default btn-remove' onClick='removeRowFromModalForm()' title='{% trans "Remove part" %}' type='button'>
<button class='btn btn-outline-secondary btn-remove' onClick='removeRowFromModalForm()' title='{% trans "Remove part" %}' type='button'>
<span row='part_row_{{ part.id }}' class='fas fa-trash-alt icon-red'></span>
</button>
</td>

View File

@ -4,7 +4,7 @@
{% decimal total_stock %}
{% if total_stock == 0 %}
<span class='label label-danger label-right'>{% trans "No Stock" %}</span>
<span class='badge badge-right rounded-pill bg-danger'>{% trans "No Stock" %}</span>
{% elif total_stock < part.minimum_stock %}
<span class='label label-warning label-right'>{% trans "Low Stock" %}</span>
<span class='badge badge-right rounded-pill bg-warning'>{% trans "Low Stock" %}</span>
{% endif %}

View File

@ -245,6 +245,45 @@ def global_settings(*args, **kwargs):
return InvenTreeSetting.allValues()
@register.simple_tag()
def progress_bar(val, max, *args, **kwargs):
"""
Render a progress bar element
"""
id = kwargs.get('id', 'progress-bar')
if val > max:
style = 'progress-bar-over'
elif val < max:
style = 'progress-bar-under'
else:
style = ''
percent = float(val / max) * 100
if percent > 100:
percent = 100
elif percent < 0:
percent = 0
style_tags = []
max_width = kwargs.get('max_width', None)
if max_width:
style_tags.append(f'max-width: {max_width};')
html = f"""
<div id='{id}' class='progress' style='{" ".join(style_tags)}'>
<div class='progress-bar {style}' role='progressbar' aria-valuemin='0' aria-valuemax='100' style='width:{percent}%'></div>
<div class='progress-value'>{val} / {max}</div>
</div>
"""
return mark_safe(html)
@register.simple_tag()
def get_color_theme_css(username):
try: