Added 'tabs' to company view

This commit is contained in:
Oliver 2018-04-22 22:38:35 +10:00
parent ee2f262e19
commit d44a4e174b
8 changed files with 31 additions and 16 deletions

View File

@ -67,11 +67,3 @@ class Company(models.Model):
def has_parts(self):
return self.part_count > 0
@property
def order_count(self):
return self.orders.count()
@property
def has_orders(self):
return self.order_count > 0

View File

@ -55,8 +55,14 @@
</div>
</div>
<hr>
<div class='container-fluid'>
{% block details %}
{% endblock %}
</div>
{% endblock %}

View File

@ -2,4 +2,6 @@
{% block details %}
{% include 'company/tabs.html' with tab='details' %}
{% endblock %}

View File

@ -6,7 +6,7 @@
<table class="table">
<tr><td>SKU</td><td>{{ part.SKU }}</tr></tr>
<tr><td>Supplier</td><td><a href="{% url 'supplier-detail' part.supplier.id %}">{{ part.supplier.name }}</a></td></tr>
<tr><td>Supplier</td><td><a href="{% url 'company-detail' part.supplier.id %}">{{ part.supplier.name }}</a></td></tr>
<tr>
<td>Parent Part</td>
<td>

View File

@ -1,6 +1,18 @@
<ul class='nav nav-tabs'>
<li{% if tab == 'parts' %} class='active'{% endif %}>
<a href="{% url 'supplier-detail' supplier.id %}">Parts <span class='badge'>{{ supplier.part_count }}</span></a></li>
<li{% if tab == 'order' %} class='active'{% endif %}>
<a href="{% url 'supplier-detail-orders' supplier.id %}">Orders <span class="badge">{{ supplier.order_count }}</span></a></li>
<li{% if tab == 'details' %} class='active'{% endif %}>
<a href="{% url 'company-detail' company.id %}">Details</a>
</li>
{% if company.is_supplier %}
<li{% if tab == 'parts' %} class='active'{% endif %}>
<a href="{% url 'company-detail' company.id %}">Supplier Parts <span class='badge'>{{ company.part_count }}</span></a>
</li>
<li{% if tab == 'po' %} class='active'{% endif %}>
<a href="#">Purchase Orders</a>
</li>
{% endif %}
{% if company.is_customer %}
<li{% if tab == 'co' %} class='active'{% endif %}>
<a href="#">Sales Orders</a>
</li>
{% endif %}
</ul>

View File

@ -353,6 +353,7 @@ class BomItem(models.Model):
child=self.sub_part.name,
n=self.quantity)
class SupplierPart(models.Model):
""" Represents a unique part as provided by a Supplier
Each SupplierPart is identified by a MPN (Manufacturer Part Number)

View File

@ -26,13 +26,15 @@
{% if part.default_location %}
<tr>
<td>Default Location</td>
<td>{{ part.default_location.pathstring }}</td>
<td><a href="{% url 'stock-location-detail' part.default_location.id %}">{{ part.default_location.pathstring }}</a></td>
</tr>
{% endif %}
{% if part.default_supplier %}
<tr>
<td>Default Supplier</td>
<td>{{ part.default_supplier.supplier.name }} | {{ part.default_supplier.SKU }}</td>
<td><a href="{% url 'supplier-part-detail' part.default_supplier.id %}">
{{ part.default_supplier.supplier.name }} | {{ part.default_supplier.SKU }}
</a></td>
</tr>
{% endif %}
<tr>

View File

@ -16,7 +16,7 @@
{% for spart in part.supplier_parts.all %}
<tr>
<td><a href="{% url 'supplier-part-detail' spart.id %}">{{ spart.SKU }}</a></td>
<td><a href="{% url 'supplier-detail' spart.supplier.id %}">{{ spart.supplier.name }}</a></td>
<td><a href="{% url 'company-detail' spart.supplier.id %}">{{ spart.supplier.name }}</a></td>
<td>
{% if spart.manufacturer %}{{ spart.manufacturer.name }}{% endif %}
{% if spart.MPN %} | {{ spart.MPN }}{% endif %}