Refactor allocation page(s)

- Also perform null check on notes before displaying
This commit is contained in:
Oliver 2021-07-15 16:53:14 +10:00
parent e38d740bbc
commit df89008116
8 changed files with 36 additions and 59 deletions

View File

@ -31,8 +31,10 @@
{% else %} {% else %}
{% if build.notes %}
{{ build.notes | markdownify }} {{ build.notes | markdownify }}
{% endif %} {% endif %}
{% endif %}
{% endblock %} {% endblock %}

View File

@ -179,7 +179,9 @@
</div> </div>
</div> </div>
<div class='panel-content'> <div class='panel-content'>
{% if company.notes %}
{{ company.notes | markdownify }} {{ company.notes | markdownify }}
{% endif %}
</div> </div>
</div> </div>

View File

@ -65,7 +65,9 @@
</div> </div>
</div> </div>
<div class='panel-content'> <div class='panel-content'>
{% if order.notes %}
{{ order.notes | markdownify }} {{ order.notes | markdownify }}
{% endif %}
</div> </div>
</div> </div>

View File

@ -64,7 +64,9 @@
</div> </div>
</div> </div>
<div class='panel-content'> <div class='panel-content'>
{% if order.notes %}
{{ order.notes | markdownify }} {{ order.notes | markdownify }}
{% endif %}
</div> </div>
</div> </div>

View File

@ -1,50 +0,0 @@
{% extends "part/part_base.html" %}
{% load status_codes %}
{% load i18n %}
{% load inventree_extras %}
{% block menubar %}
{% include "part/navbar.html" with tab="allocation" %}
{% endblock %}
{% block heading %}
{% trans "Build Order Allocations" %}
{% endblock %}
{% block details %}
<table class='table table-striped table-condensed' id='build-order-table'></table>
{% endblock %}
{% block pre_content_panel %}
<div class='panel panel-default panel-inventree'>
<div class='panel-heading'>
<h4>{% trans "Sales Order Allocations" %}</h4>
</div>
<div class='panel-content'>
<table class='table table-striped table-condensed' id='sales-order-table'></table>
</div>
</div>
{% endblock %}
{% block js_ready %}
{{ block.super }}
loadSalesOrderAllocationTable("#sales-order-table", {
params: {
part: {{ part.id }},
}
});
loadBuildOrderAllocationTable("#build-order-table", {
params: {
part: {{ part.id }},
}
});
{% endblock %}

View File

@ -84,6 +84,13 @@
<table class='table table-striped table-condensed po-table' id='sales-order-table' data-toolbar='#so-button-bar'> <table class='table table-striped table-condensed po-table' id='sales-order-table' data-toolbar='#so-button-bar'>
</table> </table>
</div> </div>
<div class='panel-heading'>
<h4>{% trans "Sales Order Allocations" %}</h4>
</div>
<div class='panel-content'>
<table class='table table-striped table-condensed' id='sales-order-allocation-table'></table>
</div>
</div> </div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-part-notes'> <div class='panel panel-default panel-inventree panel-hidden' id='panel-part-notes'>
@ -103,7 +110,9 @@
</div> </div>
</div> </div>
<div class='panel-content'> <div class='panel-content'>
{% if part.notes %}
{{ part.notes | markdownify }} {{ part.notes | markdownify }}
{% endif %}
</div> </div>
</div> </div>
@ -275,6 +284,13 @@
<table class='table table-striped table-condensed' data-toolbar='#build-button-toolbar' id='build-table'> <table class='table table-striped table-condensed' data-toolbar='#build-button-toolbar' id='build-table'>
</table> </table>
</div> </div>
<div class='panel-heading'>
<h4>{% trans "Build Order Allocations" %}</h4>
</div>
<div class='panel-content'>
<table class='table table-striped table-condensed' id='build-order-allocation-table'></table>
</div>
</div> </div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-part-manufacturers'> <div class='panel panel-default panel-inventree panel-hidden' id='panel-part-manufacturers'>
@ -310,6 +326,18 @@
{% block js_ready %} {% block js_ready %}
{{ block.super }} {{ block.super }}
loadBuildOrderAllocationTable("#build-order-allocation-table", {
params: {
part: {{ part.id }},
}
});
loadSalesOrderAllocationTable("#sales-order-allocation-table", {
params: {
part: {{ part.id }},
}
});
loadPartTable('#used-table', loadPartTable('#used-table',
'{% url "api-part-list" %}', '{% url "api-part-list" %}',
{ {

View File

@ -31,14 +31,6 @@
{% trans "Stock" %} {% trans "Stock" %}
</a> </a>
</li> </li>
{% if part.component or part.salable %}
<li class='list-group-item' title='{% trans "Allocated Stock" %}'>
<a href='#' id='select-part-allocations' class='nav-toggle'>
<span class='menu-tab-icon fas fa-sign-out-alt sidebar-icon'></span>
{% trans "Allocations" %}
</a>
</li>
{% endif %}
{% if part.assembly %} {% if part.assembly %}
<li class='list-group-item' title='{% trans "Bill of Materials" %}'> <li class='list-group-item' title='{% trans "Bill of Materials" %}'>
<a href='#' id='select-bom' class='nav-toggle'> <a href='#' id='select-bom' class='nav-toggle'>

View File

@ -47,7 +47,6 @@ part_detail_urls = [
url(r'^bom-upload/?', views.BomUpload.as_view(), name='upload-bom'), url(r'^bom-upload/?', views.BomUpload.as_view(), name='upload-bom'),
url(r'^bom-duplicate/?', views.BomDuplicate.as_view(), name='duplicate-bom'), url(r'^bom-duplicate/?', views.BomDuplicate.as_view(), name='duplicate-bom'),
url(r'^allocation/?', views.PartDetail.as_view(template_name='part/allocation.html'), name='part-allocation'),
url(r'^prices/', views.PartPricingView.as_view(template_name='part/prices.html'), name='part-prices'), url(r'^prices/', views.PartPricingView.as_view(template_name='part/prices.html'), name='part-prices'),
url(r'^track/?', views.PartDetail.as_view(template_name='part/track.html'), name='part-track'), url(r'^track/?', views.PartDetail.as_view(template_name='part/track.html'), name='part-track'),