mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Use collapse template in allocation page
This commit is contained in:
parent
18c5ad7a6e
commit
fbb120da53
@ -11,7 +11,7 @@
|
|||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
{% for bom_item in bom_items.all %}
|
{% for bom_item in bom_items.all %}
|
||||||
{% include "build/allocation_item.html" with item=bom_item build=build %}
|
{% include "build/allocation_item.html" with item=bom_item build=build collapse_id=bom_item.id %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<table class='table table-striped' id='build-table'>
|
<table class='table table-striped' id='build-table'>
|
||||||
|
@ -1,38 +1,32 @@
|
|||||||
|
{% extends "collapse.html" %}
|
||||||
|
|
||||||
{% load inventree_extras %}
|
{% load inventree_extras %}
|
||||||
|
|
||||||
<div class='panel-group'>
|
{% block collapse_title %}
|
||||||
<div class='panel pane-default'>
|
{{ item.sub_part.name }}
|
||||||
<div class='panel panel-heading'>
|
{% endblock %}
|
||||||
<div class='row'>
|
|
||||||
<div class='col-sm-6'>
|
{% block collapse_heading %}
|
||||||
<div class='panel-title'>
|
<div class='col-sm-1' align='right'>
|
||||||
<a data-toggle='collapse' href='#collapse-item-{{ item.id }}'>{{ item.sub_part.name }}</a>
|
Required:
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class='col-sm-1' align='right'>
|
|
||||||
Required:
|
|
||||||
</div>
|
|
||||||
<div class='col-sm-1'>
|
|
||||||
<b>{% multiply build.quantity item.quantity %}</b>
|
|
||||||
</div>
|
|
||||||
<div class='col-sm-1' align='right'>
|
|
||||||
Allocated:
|
|
||||||
</div>
|
|
||||||
<div class='col-sm-1' id='allocation-panel-{{ item.sub_part.id }}'>
|
|
||||||
<b><span id='allocation-total-{{ item.sub_part.id }}'>0</span></b>
|
|
||||||
</div>
|
|
||||||
<div class='col-sm-2'>
|
|
||||||
<div class='btn-group' style='float: right;'>
|
|
||||||
<button class='btn btn-success btn-sm' id='new-item-{{ item.sub_part.id }}' url="{% url 'build-item-create' %}?part={{ item.sub_part.id }}&build={{ build.id }}">Allocate Parts</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id='collapse-item-{{ item.id }}' class='panel-collapse collapse'>
|
|
||||||
<div class='panel-body'>
|
|
||||||
<table class='table table-striped table-condensed' id='allocate-table-id-{{ item.sub_part.id }}'>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class='col-sm-1'>
|
||||||
|
<b>{% multiply build.quantity item.quantity %}</b>
|
||||||
|
</div>
|
||||||
|
<div class='col-sm-1' align='right'>
|
||||||
|
Allocated:
|
||||||
|
</div>
|
||||||
|
<div class='col-sm-1' id='allocation-panel-{{ item.sub_part.id }}'>
|
||||||
|
<b><span id='allocation-total-{{ item.sub_part.id }}'>0</span></b>
|
||||||
|
</div>
|
||||||
|
<div class='col-sm-2'>
|
||||||
|
<div class='btn-group' style='float: right;'>
|
||||||
|
<button class='btn btn-success btn-sm' id='new-item-{{ item.sub_part.id }}' url="{% url 'build-item-create' %}?part={{ item.sub_part.id }}&build={{ build.id }}">Allocate Parts</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block collapse_content %}
|
||||||
|
<table class='table table-striped table-condensed' id='allocate-table-id-{{ item.sub_part.id }}'>
|
||||||
|
</table>
|
||||||
|
{% endblock %}
|
@ -307,6 +307,12 @@ class Part(models.Model):
|
|||||||
def used_in_count(self):
|
def used_in_count(self):
|
||||||
return self.used_in.count()
|
return self.used_in.count()
|
||||||
|
|
||||||
|
def required_parts(self):
|
||||||
|
parts = []
|
||||||
|
for bom in self.bom_items.all():
|
||||||
|
parts.append(bom.sub_part)
|
||||||
|
return parts
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def supplier_count(self):
|
def supplier_count(self):
|
||||||
# Return the number of supplier parts available for this part
|
# Return the number of supplier parts available for this part
|
||||||
|
Loading…
Reference in New Issue
Block a user