mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-19 21:45:39 +00:00
More tweaking
This commit is contained in:
@ -51,9 +51,6 @@
|
||||
<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'>
|
||||
|
@ -109,14 +109,21 @@
|
||||
|
||||
<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>
|
||||
@ -214,17 +221,22 @@
|
||||
|
||||
<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) -->
|
||||
@ -330,7 +342,17 @@
|
||||
|
||||
<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'>
|
||||
{% 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 %}
|
||||
@ -355,16 +377,23 @@
|
||||
|
||||
<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>
|
||||
|
@ -4,22 +4,22 @@
|
||||
|
||||
{% settings_value "INVENTREE_DOWNLOAD_FROM_URL" as allow_download %}
|
||||
|
||||
<div class='dropzone' id='part-thumb'>
|
||||
<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>
|
||||
{% if roles.part.change %}
|
||||
<div class='btn-row part-thumb-overlay'>
|
||||
<div class='btn-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 %}
|
||||
</div>
|
@ -244,6 +244,44 @@ 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):
|
||||
|
Reference in New Issue
Block a user