Refactor build orders display

This commit is contained in:
Oliver 2021-07-15 16:36:20 +10:00
parent c8c7f78ce9
commit 57851b0eaf
5 changed files with 38 additions and 51 deletions

View File

@ -126,7 +126,7 @@ src="{% static 'img/blank_image.png' %}"
<tr>
<td><span class='fas fa-shapes'></span></td>
<td>{% trans "Part" %}</td>
<td><a href="{% url 'part-detail' build.part.id %}">{{ build.part.full_name }}</a></td>
<td><a href="{% url 'part-detail' build.part.id %}?display=build-orders">{{ build.part.full_name }}</a></td>
</tr>
<tr>
<td></td>

View File

@ -24,7 +24,7 @@
<tr>
<td><span class='fas fa-shapes'></span></td>
<td>{% trans "Part" %}</td>
<td><a href="{% url 'part-build' build.part.id %}">{{ build.part.full_name }}</a>{% include "clip.html"%}</td>
<td><a href="{% url 'part-detail' build.part.id %}?display=build-orders">{{ build.part.full_name }}</a>{% include "clip.html"%}</td>
</tr>
<tr>
<td></td>

View File

@ -1,48 +0,0 @@
{% extends "part/part_base.html" %}
{% load static %}
{% load i18n %}
{% block menubar %}
{% include 'part/navbar.html' with tab='build' %}
{% endblock %}
{% block heading %}
{% trans "Part Builds" %}
{% endblock %}
{% block details %}
<div id='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>
</div>
</div>
<table class='table table-striped table-condensed' data-toolbar='#button-toolbar' id='build-table'>
</table>
{% endblock %}
{% block js_ready %}
{{ block.super }}
$("#start-build").click(function() {
newBuildOrder({
part: {{ part.pk }},
});
});
loadBuildTable($("#build-table"), {
url: "{% url 'api-build-list' %}",
params: {
part: {{ part.id }},
}
});
{% endblock %}

View File

@ -229,6 +229,29 @@
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-build-orders'>
<div class='panel-heading'>
<h4>{% trans "Part Builds" %}</h4>
</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>
</div>
</div>
<table class='table table-striped table-condensed' data-toolbar='#build-button-toolbar' id='build-table'>
</table>
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-part-manufacturers'>
<div class='panel-heading'>
<h4>{% trans "Part Manufacturers" %}</h4>
@ -262,6 +285,19 @@
{% block js_ready %}
{{ block.super }}
$("#start-build").click(function() {
newBuildOrder({
part: {{ part.pk }},
});
});
loadBuildTable($("#build-table"), {
url: "{% url 'api-build-list' %}",
params: {
part: {{ part.id }},
}
});
$('#table-related-part').inventreeTable({
});

View File

@ -49,7 +49,6 @@ part_detail_urls = [
url(r'^allocation/?', views.PartDetail.as_view(template_name='part/allocation.html'), name='part-allocation'),
url(r'^bom/?', views.PartDetail.as_view(template_name='part/bom.html'), name='part-bom'),
url(r'^build/?', views.PartDetail.as_view(template_name='part/build.html'), name='part-build'),
url(r'^used/?', views.PartDetail.as_view(template_name='part/used_in.html'), name='part-used-in'),
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'),