Improve build base rendering

- Consolidate style
- Fix rendering of part pricing
This commit is contained in:
Oliver Walters 2020-04-12 00:31:59 +10:00
parent a65c80dbf3
commit fd8273e3e2
3 changed files with 71 additions and 52 deletions

View File

@ -24,8 +24,7 @@ InvenTree | Build - {{ build }}
</div>
</div>
<div class='media-body'>
<h4>Build Details</h4>
<p>
<h4>{% trans "Build" %}</h4>
<div class='btn-row'>
<div class='btn-group'>
<button type='button' class='btn btn-default btn-glyph' id='build-edit' title='Edit Build'>
@ -46,23 +45,35 @@ InvenTree | Build - {{ build }}
{% endif %}
</div>
</div>
</p>
</div>
</div>
</div>
<div class='col-sm-6'>
<h4>{% trans "Build Details" %}</h4>
<table class='table table-striped table-condensed'>
<tr>
<td></td>
<td>{% trans "Build Title" %}</td>
<td>{{ build.title }}</td>
<td>{% build_status build.status %}</td>
</tr>
<tr>
<td><span class='fas fa-shapes'></span></td>
<td>Part</td>
<td><a href="{% url 'part-detail' build.part.id %}">{{ build.part.full_name }}</a></td>
</tr>
<tr>
<td>Quantity</td>
<td></td>
<td>{% trans "Quantity" %}</td>
<td>{{ build.quantity }}</td>
</tr>
<tr>
<td>BOM Price</td>
<td><span class='fas fa-info'></span></td>
<td>{% trans "Status" %}</td>
<td>{% build_status build.status %}</td>
</tr>
<tr>
<td><span class='fas fa-dollar-sign'></span></td>
<td>{% trans "BOM Price" %}</td>
<td>
{% if bom_price %}
{{ bom_price }}
@ -77,7 +88,6 @@ InvenTree | Build - {{ build }}
</table>
</div>
</div>
</div>
</div>
<hr>

View File

@ -781,6 +781,9 @@ class Part(models.Model):
if min_price == max_price:
return min_price
min_price = min_price.normalize()
max_price = max_price.normalize()
return "{a} - {b}".format(a=min_price, b=max_price)
def get_supplier_price_range(self, quantity=1):
@ -804,6 +807,9 @@ class Part(models.Model):
if min_price is None or max_price is None:
return None
min_price = min_price.normalize()
max_price = max_price.normalize()
return (min_price, max_price)
def get_bom_price_range(self, quantity=1):
@ -837,6 +843,9 @@ class Part(models.Model):
if min_price is None or max_price is None:
return None
min_price = min_price.normalize()
max_price = max_price.normalize()
return (min_price, max_price)
def get_price_range(self, quantity=1, buy=True, bom=True):

View File

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