mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
More tweaking
This commit is contained in:
parent
25a5d8de78
commit
57240865e8
@ -94,6 +94,9 @@
|
||||
width: 100%;
|
||||
margin-bottom: 0px;
|
||||
background: #eeeef5;
|
||||
font-size: 75%;
|
||||
height: 1.25rem;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
|
@ -146,7 +146,7 @@ src="{% static 'img/blank_image.png' %}"
|
||||
<tr>
|
||||
<td><span class='fas fa-check-circle'></span></td>
|
||||
<td>{% trans "Completed" %}</td>
|
||||
<td> {{ build.completed }} / {{ build.quantity }}</td>
|
||||
<td>{% progress_bar build.completed build.quantity id='build-completed' max_width='150px' %}</td>
|
||||
</tr>
|
||||
{% if build.parent %}
|
||||
<tr>
|
||||
|
@ -1,6 +1,7 @@
|
||||
{% extends "build/build_base.html" %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
{% load inventree_extras %}
|
||||
{% load status_codes %}
|
||||
{% load markdownify %}
|
||||
|
||||
@ -65,7 +66,7 @@
|
||||
<tr>
|
||||
<td><span class='fas fa-check-circle'></span></td>
|
||||
<td>{% trans "Completed" %}</td>
|
||||
<td>{{ build.completed }} / {{ build.quantity }}</td>
|
||||
<td>{% progress_bar build.completed build.quantity id='build-completed-2' max_width='150px' %}</td>
|
||||
</tr>
|
||||
{% if build.active and build.has_untracked_bom_items %}
|
||||
<tr>
|
||||
|
@ -44,7 +44,7 @@
|
||||
src="{% static 'img/blank_image.png' %}"
|
||||
{% endif %}/>
|
||||
<div class='btn-row part-thumb-overlay'>
|
||||
<div class='btn-group'>
|
||||
<div class='btn-group' role='group'>
|
||||
<button type='button' class='btn btn-outline-secondary' title='{% trans "Upload new image" %}' id='company-image-upload'><span class='fas fa-file-upload'></span></button>
|
||||
{% settings_value "INVENTREE_DOWNLOAD_FROM_URL" as allow_download %}
|
||||
{% if allow_download %}
|
||||
|
@ -60,18 +60,23 @@
|
||||
|
||||
<div class='panel panel-hidden' id='panel-manufacturer-parts'>
|
||||
<div class='panel-heading'>
|
||||
<h4>{% trans "Manufacturer Parts" %}</h4>
|
||||
<div class='d-flex flex-row'>
|
||||
<h4>{% trans "Manufacturer Parts" %}</h4>
|
||||
{% include "spacer.html" %}
|
||||
<div class='btn-group' role='group'>
|
||||
{% if roles.purchase_order.add %}
|
||||
<button type="button" class="btn btn-success" id='manufacturer-part-create' title='{% trans "Create new manufacturer part" %}'>
|
||||
<span class='fas fa-plus-circle'></span> {% trans "New Manufacturer Part" %}
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='panel-content'>
|
||||
{% if roles.purchase_order.change %}
|
||||
<div id='manufacturer-part-button-toolbar'>
|
||||
<div class='button-toolbar container-fluid'>
|
||||
<div class='btn-group' role='group'>
|
||||
{% if roles.purchase_order.add %}
|
||||
<button type="button" class="btn btn-success" id='manufacturer-part-create' title='{% trans "Create new manufacturer part" %}'>
|
||||
<span class='fas fa-plus-circle'></span> {% trans "New Manufacturer Part" %}
|
||||
</button>
|
||||
{% endif %}
|
||||
<div class='btn-group' role='group'>
|
||||
<button class="btn btn-primary dropdown-toggle" id='manufacturer-table-options' type="button" data-bs-toggle="dropdown">{% trans "Options" %}
|
||||
<span class="caret"></span>
|
||||
|
@ -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):
|
||||
|
@ -34,8 +34,8 @@ function buildFormFields() {
|
||||
reference: {
|
||||
prefix: global_settings.BUILDORDER_REFERENCE_PREFIX,
|
||||
},
|
||||
title: {},
|
||||
part: {},
|
||||
title: {},
|
||||
quantity: {},
|
||||
parent: {
|
||||
filters: {
|
||||
@ -937,7 +937,10 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
|
||||
|
||||
var progress = makeProgressBar(
|
||||
allocatedLines,
|
||||
totalLines
|
||||
totalLines,
|
||||
{
|
||||
max_width: '150px',
|
||||
}
|
||||
);
|
||||
|
||||
build_progress.html(progress);
|
||||
|
@ -182,8 +182,14 @@ function makeProgressBar(value, maximum, opts={}) {
|
||||
|
||||
var id = options.id || 'progress-bar';
|
||||
|
||||
var style = '';
|
||||
|
||||
if (opts.max_width) {
|
||||
style += `max-width: ${options.max_width}; `;
|
||||
}
|
||||
|
||||
return `
|
||||
<div id='${id}' class='progress'>
|
||||
<div id='${id}' class='progress' style='${style}'>
|
||||
<div class='progress-bar ${extraclass}' role='progressbar' aria-valuenow='${percent}' aria-valuemin='0' aria-valuemax='100' style='width:${percent}%'></div>
|
||||
<div class='progress-value'>${text}</div>
|
||||
</div>
|
||||
|
@ -943,20 +943,20 @@ function loadPartTable(table, url, options={}) {
|
||||
|
||||
// Is stock "low" (below the 'minimum_stock' quantity)?
|
||||
if (row.minimum_stock && row.minimum_stock > value) {
|
||||
value += `<span class='badge rounded-pill bg-warning'>{% trans "Low stock" %}</span>`;
|
||||
value += `<span class='badge badge-right rounded-pill bg-warning'>{% trans "Low stock" %}</span>`;
|
||||
}
|
||||
|
||||
} else if (row.on_order) {
|
||||
// There is no stock available, but stock is on order
|
||||
value = `0<span class='badge rounded-pill bg-info'>{% trans "On Order" %}: ${row.on_order}</span>`;
|
||||
value = `0<span class='badge badge-right rounded-pill bg-info'>{% trans "On Order" %}: ${row.on_order}</span>`;
|
||||
link = '?display=purchase-orders';
|
||||
} else if (row.building) {
|
||||
// There is no stock available, but stock is being built
|
||||
value = `0<span class='badge rounded-pill bg-info'>{% trans "Building" %}: ${row.building}</span>`;
|
||||
value = `0<span class='badge badge-right rounded-pill bg-info'>{% trans "Building" %}: ${row.building}</span>`;
|
||||
link = '?display=build-orders';
|
||||
} else {
|
||||
// There is no stock available
|
||||
value = `0<span class='badge rounded-pill bg-danger'>{% trans "No Stock" %}</span>`;
|
||||
value = `0<span class='badge badge-right rounded-pill bg-danger'>{% trans "No Stock" %}</span>`;
|
||||
}
|
||||
|
||||
return renderLink(value, `/part/${row.pk}/${link}`);
|
||||
|
Loading…
Reference in New Issue
Block a user