mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +00:00 
			
		
		
		
	Merge pull request #207 from SchrodingersGat/build-list
Split build list display
This commit is contained in:
		| @@ -133,6 +133,9 @@ class Build(models.Model): | |||||||
|         for item in self.allocated_stock.all(): |         for item in self.allocated_stock.all(): | ||||||
|             item.delete() |             item.delete() | ||||||
|  |  | ||||||
|  |         # Date of 'completion' is the date the build was cancelled | ||||||
|  |         self.completion_date = datetime.now().date() | ||||||
|  |  | ||||||
|         self.status = self.CANCELLED |         self.status = self.CANCELLED | ||||||
|         self.save() |         self.save() | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,20 @@ | |||||||
|  | {% extends "collapse.html" %} | ||||||
|  |  | ||||||
|  | {% block collapse_title %} | ||||||
|  | <b>{{ title }}</b> - {{ builds | length }} | ||||||
|  | {% endblock %} | ||||||
|  |  | ||||||
|  | {% block collapse_content %} | ||||||
|  | <table class='table table-striped table-condensed build-table' id='build-table-{{collapse_id}}' data-toolbar='#button-toolbar'> | ||||||
|  |         <thead> | ||||||
|  |         <tr> | ||||||
|  |             <th>Build</th> | ||||||
|  |             <th>Part</th> | ||||||
|  |             <th>Quantity</th> | ||||||
|  |             <th>Status</th> | ||||||
|  |         </tr> | ||||||
|  |         </thead> | ||||||
|  |         <tbody> | ||||||
| {% for build in builds %} | {% for build in builds %} | ||||||
| <tr> | <tr> | ||||||
|     <td><a href="{% url 'build-detail' build.id %}">{{ build.title }}</a></td> |     <td><a href="{% url 'build-detail' build.id %}">{{ build.title }}</a></td> | ||||||
| @@ -7,3 +23,6 @@ | |||||||
|     <td>{% include "build_status.html" with build=build %} |     <td>{% include "build_status.html" with build=build %} | ||||||
| </tr> | </tr> | ||||||
| {% endfor %} | {% endfor %} | ||||||
|  | </tbody> | ||||||
|  | </table> | ||||||
|  | {% endblock %} | ||||||
| @@ -2,28 +2,40 @@ | |||||||
| {% load static %} | {% load static %} | ||||||
| {% block content %} | {% block content %} | ||||||
|  |  | ||||||
| <h3>Part Builds</h3> |  | ||||||
|  |  | ||||||
| <div id='button-toolbar'> | <h4>Active Builds</h4> | ||||||
|  |  | ||||||
|  | <div id='active-build-toolbar'> | ||||||
|  |     <div class='btn-group'> | ||||||
|         <button class="btn btn-success" id='new-build'>Start New Build</button> |         <button class="btn btn-success" id='new-build'>Start New Build</button> | ||||||
|  |     </div> | ||||||
| </div> | </div> | ||||||
|  |  | ||||||
| <table class='table table-striped table-condensed' id='build-table' data-toolbar='#button-toolbar'> | <table class='table table-striped table-condensed build-table' id='build-table-{{collapse_id}}' data-toolbar='#active-build-toolbar'> | ||||||
| <thead> |         <thead> | ||||||
| <tr> |         <tr> | ||||||
|             <th>Build</th> |             <th>Build</th> | ||||||
|             <th>Part</th> |             <th>Part</th> | ||||||
|             <th>Quantity</th> |             <th>Quantity</th> | ||||||
|             <th>Status</th> |             <th>Status</th> | ||||||
|  |         </tr> | ||||||
|  |         </thead> | ||||||
|  |         <tbody> | ||||||
|  | {% for build in active %} | ||||||
|  | <tr> | ||||||
|  |     <td><a href="{% url 'build-detail' build.id %}">{{ build.title }}</a></td> | ||||||
|  |     <td><a href="{% url 'part-build' build.part.id %}">{{ build.part.name }}</a></td> | ||||||
|  |     <td>{{ build.quantity }}</td> | ||||||
|  |     <td>{% include "build_status.html" with build=build %} | ||||||
| </tr> | </tr> | ||||||
| </thead> | {% endfor %} | ||||||
| <tbody> |  | ||||||
|  |  | ||||||
| {% include "build/build_list.html" with builds=builds %} |  | ||||||
|  |  | ||||||
| </tbody> | </tbody> | ||||||
| </table> | </table> | ||||||
|  |  | ||||||
|  | <p></p> | ||||||
|  | {% include "build/build_list.html" with builds=completed title="Completed Builds" collapse_id="complete" %} | ||||||
|  | <p></p> | ||||||
|  | {% include "build/build_list.html" with builds=cancelled title="Cancelled Builds" collapse_id="cancelled" %} | ||||||
|  |  | ||||||
| {% include 'modals.html' %} | {% include 'modals.html' %} | ||||||
|  |  | ||||||
| @@ -39,9 +51,10 @@ | |||||||
|                         }); |                         }); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $("#build-table").bootstrapTable({ |     $(".build-table").bootstrapTable({ | ||||||
|         sortable: true, |         sortable: true, | ||||||
|         search: true, |         search: true, | ||||||
|  |         formatNoMatches: function() { return 'No builds found'; }, | ||||||
|         columns: [ |         columns: [ | ||||||
|             { |             { | ||||||
|                 field: 'name', |                 field: 'name', | ||||||
|   | |||||||
| @@ -33,12 +33,10 @@ class BuildIndex(ListView): | |||||||
|  |  | ||||||
|         context = super(BuildIndex, self).get_context_data(**kwargs).copy() |         context = super(BuildIndex, self).get_context_data(**kwargs).copy() | ||||||
|  |  | ||||||
|         """ |         context['active'] = self.get_queryset().filter(status__in=[Build.PENDING, ]) | ||||||
|         context['active'] = self.get_queryset().filter(status__in=[Build.PENDING, Build.HOLDING]) |  | ||||||
|  |  | ||||||
|         context['complete'] = self.get_queryset().filter(status=Build.COMPLETE) |         context['completed'] = self.get_queryset().filter(status=Build.COMPLETE) | ||||||
|         context['cancelled'] = self.get_queryset().filter(status=Build.CANCELLED) |         context['cancelled'] = self.get_queryset().filter(status=Build.CANCELLED) | ||||||
|         """ |  | ||||||
|  |  | ||||||
|         return context |         return context | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user