Refactor "used in" page

This commit is contained in:
Oliver 2021-07-15 16:44:46 +10:00
parent e7c7bdcd00
commit e38d740bbc
3 changed files with 26 additions and 41 deletions

View File

@ -238,6 +238,22 @@
</div> </div>
</div> </div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-used-in'>
<div class='panel-heading'>
<h4>{% trans "Assemblies" %}</h4>
</div>
<div class='panel-content'>
<div id='assembly-button-toolbar'>
<div class='filter-list' id='filter-list-usedin'>
<!-- Empty div (will be filled out with avilable BOM filters) -->
</div>
</div>
<table class="table table-striped table-condensed" id='used-table' data-toolbar='#assembly-button-toolbar'>
</table>
</div>
</div>
<div class='panel panel-default panel-inventree panel-hidden' id='panel-build-orders'> <div class='panel panel-default panel-inventree panel-hidden' id='panel-build-orders'>
<div class='panel-heading'> <div class='panel-heading'>
<h4>{% trans "Part Builds" %}</h4> <h4>{% trans "Part Builds" %}</h4>
@ -294,6 +310,16 @@
{% block js_ready %} {% block js_ready %}
{{ block.super }} {{ block.super }}
loadPartTable('#used-table',
'{% url "api-part-list" %}',
{
params: {
uses: {{ part.pk }},
},
filterTarget: '#filter-list-usedin',
}
);
// Load the BOM table data // Load the BOM table data
loadBomTable($("#bom-table"), { loadBomTable($("#bom-table"), {
editable: {{ editing_enabled }}, editable: {{ editing_enabled }},

View File

@ -1,39 +0,0 @@
{% extends "part/part_base.html" %}
{% load i18n %}
{% block menubar %}
{% include 'part/navbar.html' with tab='used' %}
{% endblock %}
{% block heading %}
{% trans "Assemblies" %}
{% endblock %}
{% block details %}
<div id='button-toolbar'>
<div class='filter-list' id='filter-list-usedin'>
<!-- Empty div (will be filled out with avilable BOM filters) -->
</div>
</div>
<table class="table table-striped table-condensed" id='used-table' data-toolbar='#button-toolbar'>
</table>
{% endblock %}
{% block js_ready %}
{{ block.super }}
loadPartTable('#used-table',
'{% url "api-part-list" %}',
{
params: {
uses: {{ part.pk }},
},
filterTarget: '#filter-list-usedin',
}
);
{% endblock %}

View File

@ -48,8 +48,6 @@ part_detail_urls = [
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'^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'^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'^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'),