Small improvements for build display

Working toward build management
This commit is contained in:
Oliver 2018-05-09 22:02:56 +10:00
parent 690ec83265
commit 07f16d8891
2 changed files with 49 additions and 31 deletions

View File

@ -9,26 +9,27 @@
<hr>
<table class='table table-striped' id='part-table'>
<thead>
<tr>
<th>Part</th>
<th>Source</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
{% for item in build.part.bom_items.all %}
<tr>
<td colspan='3'><b><i>{{ item.sub_part.name }}</b></i></td>
</tr>
<tr>
<td></td>
<td><i>Select...</i></td>
<td></td>
</tr>
{% endfor %}
</tbody>
<table class='table table-striped' id='build-table'>
</table>
{% endblock %}
{% block js_ready %}
{{ block.super }}
$('#build-table').bootstrapTable({
sortable: true,
columns: [
{
title: 'Part',
},
{
title: 'Source',
},
{
title: 'Quantity',
}
]
});
{% endblock %}

View File

@ -2,7 +2,32 @@
{% load static %}
{% block content %}
<h3>Build Details</h3>
<div class='row'>
<div class='col-sm-6'>
<h3>Build Details</h3>
<p><b>{{ build.title }}</b>{% include "build_status.html" with build=build %}</p>
<p>Building {{ build.quantity }} &times {{ build.part.name }}</p>
</div>
<div class='col-sm-6'>
<h3>
<div style='float: right;'>
<div class="dropdown" style="float: right;">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Options
<span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a href='#' id='build-edit' title='Edit build'>Edit build</a></li>
{% if build.is_active %}
<li><a href="{% url 'build-allocate' build.id %}" title='Allocate parts'>Allocate Parts</a></li>
<li><a href='#' id='build-cancel' title='Cancel build'>Cancel build</a></li>
{% endif %}
</ul>
</div>
</div>
</h3>
</div>
</div>
<table class='table table-striped'>
<tr>
<td>Title</td><td>{{ build.title }}</td>
@ -68,28 +93,20 @@
</tbody>
</table>
<div class='container-fluid'>
<button class="btn btn-info" id='edit-build'>Edit Build</button>
{% if build.is_active %}
<a href="{% url 'build-allocate' build.id %}"><button class='btn btn-primary' id='allocate-build'>Allocate Parts</button></a>
<button class='btn btn-warning' id='cancel-build'>Cancel Build</button>
{% endif %}
</div>
{% include 'modals.html' %}
{% endblock %}
{% block js_ready %}
{{ block.super }}
$("#edit-build").click(function () {
$("#build-edit").click(function () {
launchModalForm("{% url 'build-edit' build.id %}",
{
reload: true
});
});
$("#cancel-build").click(function() {
$("#build-cancel").click(function() {
launchModalForm("{% url 'build-cancel' build.id %}",
{
reload: true