mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	Merge pull request #550 from SchrodingersGat/table-improvements
Table improvements
This commit is contained in:
		| @@ -136,4 +136,53 @@ function imageHoverIcon(url) { | |||||||
|         `; |         `; | ||||||
|  |  | ||||||
|     return html; |     return html; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function inventreeSave(name, value) { | ||||||
|  |     /* | ||||||
|  |      * Save a key:value pair to local storage | ||||||
|  |      */ | ||||||
|  |  | ||||||
|  |     var key = "inventree-" + name; | ||||||
|  |     localStorage.setItem(key, value); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function inventreeLoad(name, defaultValue) { | ||||||
|  |     /*  | ||||||
|  |      * Retrieve a key:value pair from local storage | ||||||
|  |      */ | ||||||
|  |  | ||||||
|  |     var key = "inventree-" + name; | ||||||
|  |  | ||||||
|  |     var value = localStorage.getItem(key); | ||||||
|  |  | ||||||
|  |     if (value == null) { | ||||||
|  |         return defaultValue; | ||||||
|  |     } else { | ||||||
|  |         return value; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function inventreeLoadInt(name) { | ||||||
|  |     /* | ||||||
|  |      * Retrieve a value from local storage, and attempt to cast to integer | ||||||
|  |      */ | ||||||
|  |  | ||||||
|  |     var data = inventreeLoad(name); | ||||||
|  |  | ||||||
|  |     return parseInt(data, 10); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function inventreeLoadFloat(name) { | ||||||
|  |  | ||||||
|  |     var data = inventreeLoad(name); | ||||||
|  |  | ||||||
|  |     return parseFloat(data); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function inventreeDel(name) { | ||||||
|  |  | ||||||
|  |     var key = 'inventree-' + name; | ||||||
|  |  | ||||||
|  |     localStorage.removeItem(key); | ||||||
| } | } | ||||||
| @@ -191,15 +191,10 @@ function loadPartTable(table, url, options={}) { | |||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $(table).bootstrapTable({ |     $(table).inventreeTable({ | ||||||
|         url: url, |         url: url, | ||||||
|         sortable: true, |  | ||||||
|         search: true, |  | ||||||
|         sortName: 'name', |         sortName: 'name', | ||||||
|         method: 'get', |         method: 'get', | ||||||
|         pagination: true, |  | ||||||
|         pageSize: 25, |  | ||||||
|         rememberOrder: true, |  | ||||||
|         formatNoMatches: function() { return "No parts found"; }, |         formatNoMatches: function() { return "No parts found"; }, | ||||||
|         queryParams: function(p) { |         queryParams: function(p) { | ||||||
|             return  query; |             return  query; | ||||||
|   | |||||||
| @@ -42,13 +42,10 @@ function loadStockTable(table, options) { | |||||||
|      |      | ||||||
|     var params = options.params || {}; |     var params = options.params || {}; | ||||||
|  |  | ||||||
|     table.bootstrapTable({ |     console.log('load stock table'); | ||||||
|         sortable: true, |  | ||||||
|         search: true, |     table.inventreeTable({ | ||||||
|         method: 'get', |         method: 'get', | ||||||
|         pagination: true, |  | ||||||
|         pageSize: 25, |  | ||||||
|         rememberOrder: true, |  | ||||||
|         formatNoMatches: function() { |         formatNoMatches: function() { | ||||||
|             return 'No stock items matching query'; |             return 'No stock items matching query'; | ||||||
|         }, |         }, | ||||||
| @@ -386,15 +383,10 @@ function loadStockTrackingTable(table, options) { | |||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     table.bootstrapTable({ |     table.inventreeTable({ | ||||||
|         sortable: true, |  | ||||||
|         search: true, |  | ||||||
|         method: 'get', |         method: 'get', | ||||||
|         rememberOrder: true, |  | ||||||
|         queryParams: options.params, |         queryParams: options.params, | ||||||
|         columns: cols, |         columns: cols, | ||||||
|         pagination: true, |  | ||||||
|         pageSize: 50, |  | ||||||
|         url: options.url, |         url: options.url, | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -44,6 +44,31 @@ function isNumeric(n) { | |||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* Wrapper function for bootstrapTable. | ||||||
|  |  * Sets some useful defaults, and manage persistent settings. | ||||||
|  |  */ | ||||||
|  | $.fn.inventreeTable = function(options) { | ||||||
|  |  | ||||||
|  |     var tableName = options.name || 'table'; | ||||||
|  |  | ||||||
|  |     var varName = tableName + '-pagesize'; | ||||||
|  |  | ||||||
|  |     options.pagination = true; | ||||||
|  |     options.pageSize = inventreeLoad(varName, 25); | ||||||
|  |     options.pageList = [25, 50, 100, 250, 'all']; | ||||||
|  |     options.rememberOrder = true; | ||||||
|  |     options.sortable = true; | ||||||
|  |     options.search = true; | ||||||
|  |  | ||||||
|  |     // Callback to save pagination data | ||||||
|  |     options.onPageChange = function(number, size) { | ||||||
|  |         inventreeSave(varName, size); | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     // Standard options for all tables | ||||||
|  |     this.bootstrapTable(options); | ||||||
|  | } | ||||||
|  |  | ||||||
| function customGroupSorter(sortName, sortOrder, sortData) { | function customGroupSorter(sortName, sortOrder, sortData) { | ||||||
|  |  | ||||||
|     console.log('got here'); |     console.log('got here'); | ||||||
|   | |||||||
| @@ -62,9 +62,7 @@ InvenTree | Allocate Parts | |||||||
|  |  | ||||||
|     {% else %} |     {% else %} | ||||||
|  |  | ||||||
|     $("#build-list").bootstrapTable({ |     $("#build-list").inventreeTable({ | ||||||
|         search: true, |  | ||||||
|         sortable: true, |  | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $("#btn-allocate").click(function() { |     $("#btn-allocate").click(function() { | ||||||
|   | |||||||
| @@ -44,9 +44,7 @@ InvenTree | Build List | |||||||
|                         }); |                         }); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $(".build-table").bootstrapTable({ |     $(".build-table").inventreeTable({ | ||||||
|         sortable: true, |  | ||||||
|         search: true, |  | ||||||
|         formatNoMatches: function() { return 'No builds found'; }, |         formatNoMatches: function() { return 'No builds found'; }, | ||||||
|         columns: [ |         columns: [ | ||||||
|             { |             { | ||||||
|   | |||||||
| @@ -45,11 +45,7 @@ | |||||||
|                         }); |                         }); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $("#part-table").bootstrapTable({ |     $("#part-table").inventreeTable({ | ||||||
|         sortable: true, |  | ||||||
|         search: true, |  | ||||||
|         pagination: true, |  | ||||||
|         pageSize: 50, |  | ||||||
|         formatNoMatches: function() { return "No supplier parts found for {{ company.name }}"; }, |         formatNoMatches: function() { return "No supplier parts found for {{ company.name }}"; }, | ||||||
|         queryParams: function(p) { |         queryParams: function(p) { | ||||||
|             return { |             return { | ||||||
|   | |||||||
| @@ -42,9 +42,7 @@ | |||||||
|         newOrder(); |         newOrder(); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $("#po-table").bootstrapTable({ |     $(".po-table").inventreeTable({ | ||||||
|         search: true, |  | ||||||
|         sortable: true, |  | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
| {% endblock %} | {% endblock %} | ||||||
|   | |||||||
| @@ -32,11 +32,7 @@ InvenTree | Supplier List | |||||||
|                         }); |                         }); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $("#company-table").bootstrapTable({ |     $("#company-table").inventreeTable({ | ||||||
|         sortable: true, |  | ||||||
|         search: true, |  | ||||||
|         pagination: true, |  | ||||||
|         pageSize: 50, |  | ||||||
|         formatNoMatches: function() { return "No company information found"; }, |         formatNoMatches: function() { return "No company information found"; }, | ||||||
|         columns: [ |         columns: [ | ||||||
|             { |             { | ||||||
|   | |||||||
| @@ -6,6 +6,7 @@ Django Forms for interacting with Order objects | |||||||
| from __future__ import unicode_literals | from __future__ import unicode_literals | ||||||
|  |  | ||||||
| from django import forms | from django import forms | ||||||
|  | from django.utils.translation import ugettext as _ | ||||||
|  |  | ||||||
| from InvenTree.forms import HelperForm | from InvenTree.forms import HelperForm | ||||||
|  |  | ||||||
| @@ -14,7 +15,7 @@ from .models import PurchaseOrder, PurchaseOrderLineItem | |||||||
|  |  | ||||||
| class IssuePurchaseOrderForm(HelperForm): | class IssuePurchaseOrderForm(HelperForm): | ||||||
|  |  | ||||||
|     confirm = forms.BooleanField(required=False, help_text='Place order') |     confirm = forms.BooleanField(required=False, help_text=_('Place order')) | ||||||
|  |  | ||||||
|     class Meta: |     class Meta: | ||||||
|         model = PurchaseOrder |         model = PurchaseOrder | ||||||
| @@ -23,6 +24,17 @@ class IssuePurchaseOrderForm(HelperForm): | |||||||
|         ] |         ] | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class CancelPurchaseOrderForm(HelperForm): | ||||||
|  |  | ||||||
|  |     confirm = forms.BooleanField(required=False, help_text=_('Cancel order')) | ||||||
|  |  | ||||||
|  |     class Meta: | ||||||
|  |         model = PurchaseOrder | ||||||
|  |         fields = [ | ||||||
|  |             'confirm', | ||||||
|  |         ] | ||||||
|  |          | ||||||
|  |  | ||||||
| class EditPurchaseOrderForm(HelperForm): | class EditPurchaseOrderForm(HelperForm): | ||||||
|     """ Form for editing a PurchaseOrder object """ |     """ Form for editing a PurchaseOrder object """ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -98,6 +98,13 @@ class Order(models.Model): | |||||||
|             self.complete_date = datetime.now().date() |             self.complete_date = datetime.now().date() | ||||||
|             self.save() |             self.save() | ||||||
|  |  | ||||||
|  |     def cancel_order(self): | ||||||
|  |         """ Marks the order as CANCELLED. """ | ||||||
|  |  | ||||||
|  |         if self.status in [OrderStatus.PLACED, OrderStatus.PENDING]: | ||||||
|  |             self.status = OrderStatus.CANCELLED | ||||||
|  |             self.save() | ||||||
|  |  | ||||||
|  |  | ||||||
| class PurchaseOrder(Order): | class PurchaseOrder(Order): | ||||||
|     """ A PurchaseOrder represents goods shipped inwards from an external supplier. |     """ A PurchaseOrder represents goods shipped inwards from an external supplier. | ||||||
|   | |||||||
							
								
								
									
										7
									
								
								InvenTree/order/templates/order/order_cancel.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								InvenTree/order/templates/order/order_cancel.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | |||||||
|  | {% extends "modal_form.html" %} | ||||||
|  |  | ||||||
|  | {% block pre_form_content %} | ||||||
|  |  | ||||||
|  | Cancelling this order means that the order will no longer be editable. | ||||||
|  |  | ||||||
|  | {% endblock %} | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| <table class='table table-striped table-condensed' id='po-table' {% if toolbar %}data-toolbar='{{ toolbar }}'{% endif %}> | <table class='table table-striped table-condensed po-table' id='po-table' {% if toolbar %}data-toolbar='{{ toolbar }}'{% endif %}> | ||||||
|     <thead> |     <thead> | ||||||
|     <tr> |     <tr> | ||||||
|         <th data-field='company' data-sortable='true' data-searchable='true'>Company</th> |         <th data-field='company' data-sortable='true' data-searchable='true'>Company</th> | ||||||
|   | |||||||
| @@ -43,6 +43,11 @@ InvenTree | {{ order }} | |||||||
|                                 <span class='glyphicon glyphicon-check'></span> |                                 <span class='glyphicon glyphicon-check'></span> | ||||||
|                             </button> |                             </button> | ||||||
|                             {% endif %} |                             {% endif %} | ||||||
|  |                             {% if order.status == OrderStatus.PENDING or order.status == OrderStatus.PLACED %} | ||||||
|  |                             <button type='button' class='btn btn-default btn-glyph' id='cancel-order' title='Cancel order'> | ||||||
|  |                                 <span class='glyphicon glyphicon-remove'></span> | ||||||
|  |                             </button> | ||||||
|  |                             {% endif %} | ||||||
|                         </div> |                         </div> | ||||||
|                     </div> |                     </div> | ||||||
|                 </p> |                 </p> | ||||||
| @@ -176,6 +181,12 @@ $("#edit-order").click(function() { | |||||||
|     ); |     ); | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  | $("#cancel-order").click(function() { | ||||||
|  |     launchModalForm("{% url 'purchase-order-cancel' order.id %}", { | ||||||
|  |         reload: true, | ||||||
|  |     }); | ||||||
|  | }); | ||||||
|  |  | ||||||
| $("#receive-order").click(function() { | $("#receive-order").click(function() { | ||||||
|     launchModalForm("{% url 'purchase-order-receive' order.id %}", { |     launchModalForm("{% url 'purchase-order-receive' order.id %}", { | ||||||
|         reload: true, |         reload: true, | ||||||
| @@ -210,9 +221,7 @@ $('#new-po-line').click(function() { | |||||||
| }); | }); | ||||||
| {% endif %} | {% endif %} | ||||||
|  |  | ||||||
| $("#po-lines-table").bootstrapTable({ | $("#po-lines-table").inventreeTable({ | ||||||
|     search: true, |  | ||||||
|     sortable: true, |  | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -32,8 +32,7 @@ $("#po-create").click(function() { | |||||||
|     ); |     ); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| $("#po-table").bootstrapTable({ | $("#po-table").inventreeTable({ | ||||||
|     search: true, |  | ||||||
| }); | }); | ||||||
|  |  | ||||||
| {% endblock %} | {% endblock %} | ||||||
| @@ -11,6 +11,7 @@ from . import views | |||||||
|  |  | ||||||
| purchase_order_detail_urls = [ | purchase_order_detail_urls = [ | ||||||
|  |  | ||||||
|  |     url(r'^cancel/?', views.PurchaseOrderCancel.as_view(), name='purchase-order-cancel'), | ||||||
|     url(r'^edit/?', views.PurchaseOrderEdit.as_view(), name='purchase-order-edit'), |     url(r'^edit/?', views.PurchaseOrderEdit.as_view(), name='purchase-order-edit'), | ||||||
|     url(r'^issue/?', views.PurchaseOrderIssue.as_view(), name='purchase-order-issue'), |     url(r'^issue/?', views.PurchaseOrderIssue.as_view(), name='purchase-order-issue'), | ||||||
|     url(r'^receive/?', views.PurchaseOrderReceive.as_view(), name='purchase-order-receive'), |     url(r'^receive/?', views.PurchaseOrderReceive.as_view(), name='purchase-order-receive'), | ||||||
|   | |||||||
| @@ -112,6 +112,39 @@ class PurchaseOrderEdit(AjaxUpdateView): | |||||||
|         return form |         return form | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class PurchaseOrderCancel(AjaxUpdateView): | ||||||
|  |     """ View for cancelling a purchase order """ | ||||||
|  |  | ||||||
|  |     model = PurchaseOrder | ||||||
|  |     ajax_form_title = 'Cancel Order' | ||||||
|  |     ajax_template_name = 'order/order_cancel.html' | ||||||
|  |     form_class = order_forms.CancelPurchaseOrderForm | ||||||
|  |  | ||||||
|  |     def post(self, request, *args, **kwargs): | ||||||
|  |         """ Mark the PO as 'CANCELLED' """ | ||||||
|  |  | ||||||
|  |         order = self.get_object() | ||||||
|  |         form = self.get_form() | ||||||
|  |  | ||||||
|  |         confirm = str2bool(request.POST.get('confirm', False)) | ||||||
|  |  | ||||||
|  |         valid = False | ||||||
|  |  | ||||||
|  |         if not confirm: | ||||||
|  |             form.errors['confirm'] = [_('Confirm order cancellation')] | ||||||
|  |         else: | ||||||
|  |             valid = True | ||||||
|  |  | ||||||
|  |         data = { | ||||||
|  |             'form_valid': valid | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         if valid: | ||||||
|  |             order.cancel_order() | ||||||
|  |  | ||||||
|  |         return self.renderJsonResponse(request, form, data) | ||||||
|  |  | ||||||
|  |  | ||||||
| class PurchaseOrderIssue(AjaxUpdateView): | class PurchaseOrderIssue(AjaxUpdateView): | ||||||
|     """ View for changing a purchase order from 'PENDING' to 'ISSUED' """ |     """ View for changing a purchase order from 'PENDING' to 'ISSUED' """ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -29,9 +29,7 @@ | |||||||
|  |  | ||||||
| {% block js_ready %} | {% block js_ready %} | ||||||
|  |  | ||||||
|     $("#build-table").bootstrapTable({ |     $("#build-table").inventreeTable({ | ||||||
|         search: true, |  | ||||||
|         sortable: true, |  | ||||||
|         columns: [ |         columns: [ | ||||||
|             { |             { | ||||||
|                 title: 'Build', |                 title: 'Build', | ||||||
|   | |||||||
| @@ -89,9 +89,7 @@ | |||||||
|         }); |         }); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $("#attachment-table").bootstrapTable({ |     $("#attachment-table").inventreeTable({ | ||||||
|         search: true, |  | ||||||
|         sortable: true, |  | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
| {% endblock %} | {% endblock %} | ||||||
| @@ -31,11 +31,7 @@ | |||||||
|                         }); |                         }); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $("#build-table").bootstrapTable({ |     $("#build-table").inventreeTable({ | ||||||
|         sortable: true, |  | ||||||
|         search: true, |  | ||||||
|         pagination: true, |  | ||||||
|         pageSize: 50, |  | ||||||
|         queryParams: function(p) { |         queryParams: function(p) { | ||||||
|             return { |             return { | ||||||
|                 part: {{ part.id }}, |                 part: {{ part.id }}, | ||||||
|   | |||||||
| @@ -8,9 +8,6 @@ | |||||||
|         {% if category %} |         {% if category %} | ||||||
|         <h3>{{ category.name }}</h3> |         <h3>{{ category.name }}</h3> | ||||||
|         <p>{{ category.description }}</p> |         <p>{{ category.description }}</p> | ||||||
|         {% if category.default_location %} |  | ||||||
|         <p>Default Location: <a href="{% url 'stock-location-detail' category.default-location.id }%">{{ category.default_location }}</a></p> |  | ||||||
|         {% endif %} |  | ||||||
|         {% else %} |         {% else %} | ||||||
|         <h3>Part Categories</h3> |         <h3>Part Categories</h3> | ||||||
|         <p>All parts</p> |         <p>All parts</p> | ||||||
| @@ -32,6 +29,39 @@ | |||||||
|         </p> |         </p> | ||||||
|     </div> |     </div> | ||||||
|     <div class='col-sm-6'> |     <div class='col-sm-6'> | ||||||
|  |         {% if category %} | ||||||
|  |         <h3>Category Details</h3> | ||||||
|  |         <table class='table table-condensed table-striped'> | ||||||
|  |             <tr> | ||||||
|  |                 <td>Category Path</td> | ||||||
|  |                 <td>{{ category.pathstring }}</td> | ||||||
|  |             </tr> | ||||||
|  |             <tr> | ||||||
|  |                 <td>Category Description</td> | ||||||
|  |                 <td>{{ category.description }}</td> | ||||||
|  |             </tr> | ||||||
|  |             {% if category.default_location %} | ||||||
|  |             <tr> | ||||||
|  |                 <td>Default Location</td> | ||||||
|  |                 <td><a href="{% url 'stock-location-detail' category.default_location.pk %}">{{ category.default_location.pathstring }}</a></td> | ||||||
|  |             </tr> | ||||||
|  |             {% endif %} | ||||||
|  |             {% if category.default_keywords %} | ||||||
|  |             <tr> | ||||||
|  |                 <td>Keywords</td> | ||||||
|  |                 <td>{{ category.default_keywords }}</td> | ||||||
|  |             </tr> | ||||||
|  |             {% endif %} | ||||||
|  |             <tr> | ||||||
|  |                 <td>Subcategories</td> | ||||||
|  |                 <td>{{ category.children.count }}</td> | ||||||
|  |             </tr> | ||||||
|  |             <tr> | ||||||
|  |                 <td>Parts (Including subcategories)</td> | ||||||
|  |                 <td>{{ category.partcount }}</td> | ||||||
|  |             </tr> | ||||||
|  |         </table> | ||||||
|  |         {% endif %} | ||||||
|     </div> |     </div> | ||||||
| </div> | </div> | ||||||
|  |  | ||||||
| @@ -67,16 +97,16 @@ | |||||||
| {% block js_ready %} | {% block js_ready %} | ||||||
| {{ block.super }} | {{ block.super }} | ||||||
|  |  | ||||||
|     if (sessionStorage.getItem("inventree-show-part-categories")) { |     if (inventreeLoadInt("show-part-cats") == 1) { | ||||||
|         $("#collapse-item-categories").collapse('show'); |         $("#collapse-item-categories").collapse('show'); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     $("#collapse-item-categories").on('shown.bs.collapse', function() { |     $("#collapse-item-categories").on('shown.bs.collapse', function() { | ||||||
|         sessionStorage.setItem('inventree-show-part-categories', 1); |         inventreeSave('show-part-cats', 1); | ||||||
|     }); |     }); | ||||||
|      |      | ||||||
|     $("#collapse-item-categories").on('hidden.bs.collapse', function() { |     $("#collapse-item-categories").on('hidden.bs.collapse', function() { | ||||||
|         sessionStorage.removeItem('inventree-show-part-categories'); |         inventreeDel('show-part-cats'); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $("#cat-create").click(function() { |     $("#cat-create").click(function() { | ||||||
|   | |||||||
| @@ -26,9 +26,7 @@ | |||||||
| {% block js_ready %} | {% block js_ready %} | ||||||
| {{ block.super }} | {{ block.super }} | ||||||
|  |  | ||||||
| $("#po-table").bootstrapTable({ | $("#po-table").inventreeTable({ | ||||||
|     search: true, |  | ||||||
|     sortable: true, |  | ||||||
| }); | }); | ||||||
|  |  | ||||||
| $("#part-order2").click(function() { | $("#part-order2").click(function() { | ||||||
|   | |||||||
| @@ -44,9 +44,7 @@ | |||||||
| {% block js_ready %} | {% block js_ready %} | ||||||
| {{ block.super }} | {{ block.super }} | ||||||
|  |  | ||||||
|     $('#param-table').bootstrapTable({ |     $('#param-table').inventreeTable({ | ||||||
|         search: true, |  | ||||||
|         sortable: true, |  | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $('#param-create').click(function() { |     $('#param-create').click(function() { | ||||||
|   | |||||||
| @@ -12,7 +12,9 @@ | |||||||
|     {% if child.description %} |     {% if child.description %} | ||||||
|     <i> - {{ child.description }}</i> |     <i> - {{ child.description }}</i> | ||||||
|     {% endif %} |     {% endif %} | ||||||
|     <span class='badge'>{{ child.partcount }}</span> |     {% if child.partcount > 0 %} | ||||||
|  |     <span class='badge'>{{ child.partcount }} Part{% if child.partcount > 1 %}s{% endif %}</span> | ||||||
|  |     {% endif %} | ||||||
| </li> | </li> | ||||||
| {% endfor %} | {% endfor %} | ||||||
| </ul> | </ul> | ||||||
|   | |||||||
| @@ -50,9 +50,7 @@ | |||||||
|             }); |             }); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $("#supplier-table").bootstrapTable({ |     $("#supplier-table").inventreeTable({ | ||||||
|         sortable: true, |  | ||||||
|         search: true, |  | ||||||
|         formatNoMatches: function() { return "No supplier parts available for {{ part.full_name }}"; }, |         formatNoMatches: function() { return "No supplier parts available for {{ part.full_name }}"; }, | ||||||
|         queryParams: function(p) { |         queryParams: function(p) { | ||||||
|             return { |             return { | ||||||
|   | |||||||
| @@ -16,9 +16,7 @@ | |||||||
| {% block js_ready %} | {% block js_ready %} | ||||||
| {{ block.super }} | {{ block.super }} | ||||||
|  |  | ||||||
|     $("#used-table").bootstrapTable({ |     $("#used-table").inventreeTable({ | ||||||
|         sortable: true, |  | ||||||
|         search: true, |  | ||||||
|         formatNoMatches: function() { return "{{ part.full_name }} is not used to make any other parts"; }, |         formatNoMatches: function() { return "{{ part.full_name }} is not used to make any other parts"; }, | ||||||
|         queryParams: function(p) { |         queryParams: function(p) { | ||||||
|             return { |             return { | ||||||
|   | |||||||
| @@ -53,9 +53,7 @@ | |||||||
| {{ block.super }} | {{ block.super }} | ||||||
|  |  | ||||||
|  |  | ||||||
|     $('#variant-table').bootstrapTable({ |     $('#variant-table').inventreeTable({ | ||||||
|         search: true, |  | ||||||
|         sortable: true, |  | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $('#new-variant').click(function() { |     $('#new-variant').click(function() { | ||||||
|   | |||||||
| @@ -32,6 +32,27 @@ | |||||||
|     </p> |     </p> | ||||||
| </div> | </div> | ||||||
| <div class='col-sm-6'> | <div class='col-sm-6'> | ||||||
|  |     {% if location %} | ||||||
|  |     <h3>Location Details</h3> | ||||||
|  |     <table class='table table-striped table-condensed'> | ||||||
|  |         <tr> | ||||||
|  |             <td>Location Path</td> | ||||||
|  |             <td>{{ location.pathstring }}</td> | ||||||
|  |         </tr> | ||||||
|  |         <tr> | ||||||
|  |             <td>Location Description</td> | ||||||
|  |             <td>{{ location.description }}</td> | ||||||
|  |         </tr> | ||||||
|  |         <tr> | ||||||
|  |             <td>Sublocations</td> | ||||||
|  |             <td>{{ location.children.count }}</td> | ||||||
|  |         </tr> | ||||||
|  |         <tr> | ||||||
|  |             <td>Stock Items</td> | ||||||
|  |             <td>{{ location.item_count }}</td> | ||||||
|  |         </tr> | ||||||
|  |     </table> | ||||||
|  |     {% endif %} | ||||||
| </div> | </div> | ||||||
| </h3> | </h3> | ||||||
| </div> | </div> | ||||||
| @@ -55,16 +76,16 @@ | |||||||
| {% block js_ready %} | {% block js_ready %} | ||||||
| {{ block.super }} | {{ block.super }} | ||||||
|  |  | ||||||
|     if (sessionStorage.getItem("inventree-show-part-locations")) { |     if (inventreeLoadInt("show-part-locs") == 1) { | ||||||
|         $("#collapse-item-locations").collapse('show'); |         $("#collapse-item-locations").collapse('show'); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     $("#collapse-item-locations").on('shown.bs.collapse', function() { |     $("#collapse-item-locations").on('shown.bs.collapse', function() { | ||||||
|         sessionStorage.setItem('inventree-show-part-locations', 1); |         inventreeSave('show-part-locs', 1); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $("#collapse-item-locations").on('hidden.bs.collapse', function() { |     $("#collapse-item-locations").on('hidden.bs.collapse', function() { | ||||||
|         sessionStorage.removeItem('inventree-show-part-locations'); |         inventreeDel('show-part-locs'); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $("#stock-export").click(function() { |     $("#stock-export").click(function() { | ||||||
|   | |||||||
| @@ -8,7 +8,9 @@ Sub-Locations<span class='badge'>{{ children|length }}</span> | |||||||
| <ul class="list-group"> | <ul class="list-group"> | ||||||
| {% for child in children %} | {% for child in children %} | ||||||
| <li class="list-group-item"><a href="{% url 'stock-location-detail' child.id %}">{{ child.name }}</a> - <i>{{ child.description }}</i> | <li class="list-group-item"><a href="{% url 'stock-location-detail' child.id %}">{{ child.name }}</a> - <i>{{ child.description }}</i> | ||||||
|     <span class='badge'>{{ child.item_count }}</span> |     {% if child.item_count > 0 %} | ||||||
|  |     <span class='badge'>{{ child.item_count }} Item{% if child.item_count > 1 %}s{% endif %}</span> | ||||||
|  |     {% endif %} | ||||||
| </li> | </li> | ||||||
| {% endfor %} | {% endfor %} | ||||||
| </ul> | </ul> | ||||||
|   | |||||||
| @@ -83,7 +83,7 @@ InvenTree | Search Results | |||||||
|      |      | ||||||
|     onSearchResults('#supplier-part-results-table', '#supplier-part-result-count'); |     onSearchResults('#supplier-part-results-table', '#supplier-part-result-count'); | ||||||
|  |  | ||||||
|     $("#category-results-table").bootstrapTable({ |     $("#category-results-table").inventreeTable({ | ||||||
|         url: "{% url 'api-part-category-list' %}", |         url: "{% url 'api-part-category-list' %}", | ||||||
|         queryParams: { |         queryParams: { | ||||||
|             search: "{{ query }}", |             search: "{{ query }}", | ||||||
| @@ -103,7 +103,7 @@ InvenTree | Search Results | |||||||
|         ], |         ], | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $("#location-results-table").bootstrapTable({ |     $("#location-results-table").inventreeTable({ | ||||||
|         url: "{% url 'api-location-list' %}", |         url: "{% url 'api-location-list' %}", | ||||||
|         queryParams: { |         queryParams: { | ||||||
|             search: "{{ query }}", |             search: "{{ query }}", | ||||||
| @@ -134,14 +134,11 @@ InvenTree | Search Results | |||||||
|         } |         } | ||||||
|     ); |     ); | ||||||
|  |  | ||||||
|     $("#company-results-table").bootstrapTable({ |     $("#company-results-table").inventreeTable({ | ||||||
|         url: "{% url 'api-company-list' %}", |         url: "{% url 'api-company-list' %}", | ||||||
|         queryParams: { |         queryParams: { | ||||||
|             search: "{{ query }}", |             search: "{{ query }}", | ||||||
|         }, |         }, | ||||||
|         pagination: true, |  | ||||||
|         pageSize: 25, |  | ||||||
|         search: true, |  | ||||||
|         columns: [ |         columns: [ | ||||||
|             { |             { | ||||||
|                 field: 'name', |                 field: 'name', | ||||||
| @@ -157,14 +154,11 @@ InvenTree | Search Results | |||||||
|         ] |         ] | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     $("#supplier-part-results-table").bootstrapTable({ |     $("#supplier-part-results-table").inventreeTable({ | ||||||
|         url: "{% url 'api-part-supplier-list' %}", |         url: "{% url 'api-part-supplier-list' %}", | ||||||
|         queryParams: { |         queryParams: { | ||||||
|             search: "{{ query }}", |             search: "{{ query }}", | ||||||
|         }, |         }, | ||||||
|         pagination: true, |  | ||||||
|         pageSize: 25, |  | ||||||
|         search: true, |  | ||||||
|         columns: [ |         columns: [ | ||||||
|             { |             { | ||||||
|                 field: 'supplier_name', |                 field: 'supplier_name', | ||||||
|   | |||||||
| @@ -19,15 +19,11 @@ | |||||||
| {% block js_ready %} | {% block js_ready %} | ||||||
| {{ block.super }} | {{ block.super }} | ||||||
|  |  | ||||||
|     $("#currency-table").bootstrapTable({ |     $("#currency-table").inventreeTable({ | ||||||
|         url: "{% url 'api-currency-list' %}", |         url: "{% url 'api-currency-list' %}", | ||||||
|         queryParams: { |         queryParams: { | ||||||
|             ordering: 'suffix' |             ordering: 'suffix' | ||||||
|         }, |         }, | ||||||
|         sortable: true, |  | ||||||
|         search: true, |  | ||||||
|         pagination: true, |  | ||||||
|         pageSize: 25, |  | ||||||
|         formatNoMatches: function() { return "No currencies found"; }, |         formatNoMatches: function() { return "No currencies found"; }, | ||||||
|         rowStyle: function(row, index) { |         rowStyle: function(row, index) { | ||||||
|             if (row.base) { |             if (row.base) { | ||||||
|   | |||||||
| @@ -19,15 +19,11 @@ | |||||||
| {% block js_ready %} | {% block js_ready %} | ||||||
| {{ block.super }} | {{ block.super }} | ||||||
|  |  | ||||||
|     $("#param-table").bootstrapTable({ |     $("#param-table").inventreeTable({ | ||||||
|         url: "{% url 'api-part-param-template-list' %}", |         url: "{% url 'api-part-param-template-list' %}", | ||||||
|         queryParams: { |         queryParams: { | ||||||
|             ordering: 'name', |             ordering: 'name', | ||||||
|         }, |         }, | ||||||
|         sortable: true, |  | ||||||
|         search: true, |  | ||||||
|         pagination: true, |  | ||||||
|         pageSize: 25, |  | ||||||
|         formatNoMatches: function() { return "No part parameter templates found"; }, |         formatNoMatches: function() { return "No part parameter templates found"; }, | ||||||
|         columns: [ |         columns: [ | ||||||
|             { |             { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user