mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 21:25:42 +00:00 
			
		
		
		
	Refactor SupplierPart page
This commit is contained in:
		| @@ -1,17 +0,0 @@ | ||||
| {% extends "modal_form.html" %} | ||||
|  | ||||
| {% load i18n %} | ||||
|  | ||||
| {% block pre_form_content %} | ||||
| {{ block.super }} | ||||
|  | ||||
| {% if part %} | ||||
| <div class='alert alert-block alert-info'> | ||||
|     {% include "hover_image.html" with image=part.image %} | ||||
|     {{ part.full_name}} | ||||
|     <br> | ||||
|     <i>{{ part.description }}</i> | ||||
| </div> | ||||
| {% endif %} | ||||
|  | ||||
| {% endblock %} | ||||
							
								
								
									
										352
									
								
								InvenTree/company/templates/company/supplier_part.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										352
									
								
								InvenTree/company/templates/company/supplier_part.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,352 @@ | ||||
| {% extends "two_column.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
| {% load inventree_extras %} | ||||
|  | ||||
| {% block page_title %} | ||||
| {% inventree_title %} | {% trans "Supplier Part" %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block menubar %} | ||||
| {% include "company/supplier_part_navbar.html" %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block thumbnail %} | ||||
| <img class='part-thumb' | ||||
| {% if part.part.image %} | ||||
| src='{{ part.part.image.url }}' | ||||
| {% else %} | ||||
| src="{% static 'img/blank_image.png' %}" | ||||
| {% endif %}/> | ||||
| {% endblock %} | ||||
|  | ||||
| {% block page_data %} | ||||
| <h3>{% trans "Supplier Part" %}</h3> | ||||
| <hr> | ||||
| <h4> | ||||
|     {{ part.part.full_name }} | ||||
|     {% if user.is_staff and perms.company.change_company %} | ||||
|     <a href="{% url 'admin:company_supplierpart_change' part.pk %}"> | ||||
|         <span title='{% trans "Admin view" %}' class='fas fa-user-shield'></span> | ||||
|     </a> | ||||
|     {% endif %} | ||||
| </h4> | ||||
| <p>{{ part.supplier.name }} - {{ part.SKU }}</p> | ||||
|  | ||||
| {% if roles.purchase_order.change %} | ||||
| <div class='btn-row'> | ||||
|     <div class='btn-group action-buttons' role='group'> | ||||
|         {% if roles.purchase_order.add %} | ||||
|         <button type='button' class='btn btn-default btn-glyph' id='order-part' title='{% trans "Order part" %}'> | ||||
|             <span class='fas fa-shopping-cart'></span> | ||||
|         </button> | ||||
|         {% endif %} | ||||
|         <button type='button' class='btn btn-default btn-glyph' id='edit-part' title='{% trans "Edit supplier part" %}'> | ||||
|             <span class='fas fa-edit icon-green'/> | ||||
|         </button> | ||||
|         {% if roles.purchase_order.delete %} | ||||
|         <button type='button' class='btn btn-default btn-glyph' id='delete-part' title='{% trans "Delete supplier part" %}'> | ||||
|             <span class='fas fa-trash-alt icon-red'/> | ||||
|         </button> | ||||
|         {% endif %} | ||||
|     </div> | ||||
| </div> | ||||
| {% endif %} | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block page_details %} | ||||
|  | ||||
| <h4>{% trans "Supplier Part Details" %}</h4> | ||||
| <table class="table table-striped table-condensed"> | ||||
|     <col width='25'> | ||||
|         <tr> | ||||
|             <td><span class='fas fa-shapes'></span></td> | ||||
|             <td>{% trans "Internal Part" %}</td> | ||||
|             <td> | ||||
|                 {% if part.part %} | ||||
|                 <a href="{% url 'part-detail' part.part.id %}?display=part-suppliers">{{ part.part.full_name }}</a>{% include "clip.html"%} | ||||
|                 {% endif %} | ||||
|             </td> | ||||
|         </tr> | ||||
|         {% if part.description %} | ||||
|         <tr> | ||||
|             <td></td> | ||||
|             <td>{% trans "Description" %}</td> | ||||
|             <td>{{ part.description }}{% include "clip.html"%}</td> | ||||
|         </tr> | ||||
|         {% endif %} | ||||
|         {% if part.link %} | ||||
|         <tr> | ||||
|             <td><span class='fas fa-link'></span></td> | ||||
|             <td>{% trans "External Link" %}</td> | ||||
|             <td><a href="{{ part.link }}">{{ part.link }}</a>{% include "clip.html"%}</td> | ||||
|         </tr> | ||||
|         {% endif %} | ||||
|         <tr> | ||||
|             <td><span class='fas fa-building'></span></td> | ||||
|             <td>{% trans "Supplier" %}</td> | ||||
|             <td><a href="{% url 'company-detail' part.supplier.id %}">{{ part.supplier.name }}</a>{% include "clip.html"%}</td></tr> | ||||
|         <tr> | ||||
|             <td><span class='fas fa-hashtag'></span></td> | ||||
|             <td>{% trans "SKU" %}</td> | ||||
|             <td>{{ part.SKU }}{% include "clip.html"%}</tr> | ||||
|         </tr> | ||||
|         {% if part.manufacturer_part.manufacturer %} | ||||
|         <tr> | ||||
|             <td><span class='fas fa-industry'></span></td> | ||||
|             <td>{% trans "Manufacturer" %}</td> | ||||
|             <td><a href="{% url 'company-detail' part.manufacturer_part.manufacturer.id %}"> | ||||
|             {{ part.manufacturer_part.manufacturer.name }}</a>{% include "clip.html"%}</td> | ||||
|         </tr> | ||||
|         {% endif %} | ||||
|         {% if part.manufacturer_part.MPN %} | ||||
|         <tr> | ||||
|             <td><span class='fas fa-hashtag'></span></td> | ||||
|             <td>{% trans "MPN" %}</td> | ||||
|             <td><a href="{% url 'manufacturer-part-detail' part.manufacturer_part.id %}">{{ part.manufacturer_part.MPN }}</a>{% include "clip.html"%}</td> | ||||
|         </tr> | ||||
|         {% endif %} | ||||
|         {% if part.packaging %} | ||||
|         <tr> | ||||
|             <td><span class='fas fa-cube'></span></td> | ||||
|             <td>{% trans "Packaging" %}</td> | ||||
|             <td>{{ part.packaging }}{% include "clip.html"%}</td> | ||||
|         </tr> | ||||
|         {% endif %} | ||||
|         {% if part.note %} | ||||
|         <tr> | ||||
|             <td><span class='fas fa-sticky-note'></span></td> | ||||
|             <td>{% trans "Note" %}</td> | ||||
|             <td>{{ part.note }}{% include "clip.html"%}</td> | ||||
|         </tr> | ||||
|         {% endif %} | ||||
| </table> | ||||
| {% endblock %} | ||||
|  | ||||
| {% block page_content %} | ||||
|  | ||||
| <div class='panel panel-default panel-inventree panel-hidden' id='panel-stock'> | ||||
|     <div class='panel-heading'> | ||||
|         <h4>{% trans "Supplier Part Stock" %}</h4> | ||||
|     </div> | ||||
|     <div class='panel-content'> | ||||
|         {% include "stock_table.html" %} | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| <div class='panel panel-default panel-inventree panel-hidden' id='panel-purchase-orders'> | ||||
|     <div class='panel-heading'> | ||||
|         <h4>{% trans "Supplier Part Orders" %}</h4> | ||||
|     </div> | ||||
|     <div class='panel-content'> | ||||
|         {% if roles.purchase_order.add %} | ||||
|         <div id='button-bar'> | ||||
|             <div class='btn-group'> | ||||
|                 <button class='btn btn-primary' type='button' id='order-part2' title='{% trans "Order part" %}'> | ||||
|                     <span class='fas fa-shopping-cart'></span> {% trans "Order Part" %}</button> | ||||
|             </div> | ||||
|         </div> | ||||
|         {% endif %}         | ||||
|         <table class='table table-striped table-condensed po-table' id='purchase-order-table' data-toolbar='#button-bar'> | ||||
|         </table> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| <div class='panel panel-default panel-inventree panel-hidden' id='panel-pricing'> | ||||
|     <div class='panel-heading'> | ||||
|         <h4>{% trans "Pricing Information" %}</h4> | ||||
|     </div> | ||||
|     <div class='panel-content'> | ||||
|         {% if roles.purchase_order.add %} | ||||
|         <div id='price-break-toolbar' class='btn-group'> | ||||
|             <button class='btn btn-primary' id='new-price-break' type='button'> | ||||
|                 <span class='fas fa-plus-circle'></span> {% trans "Add Price Break" %} | ||||
|             </button> | ||||
|         </div> | ||||
|         {% endif %} | ||||
|  | ||||
|         <table class='table table-striped table-condensed' id='price-break-table' data-toolbar='#price-break-toolbar'>     | ||||
|         </table> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block js_ready %} | ||||
| {{ block.super }} | ||||
|  | ||||
| function reloadPriceBreaks() { | ||||
|     $("#price-break-table").bootstrapTable("refresh"); | ||||
| } | ||||
|  | ||||
| $('#price-break-table').inventreeTable({ | ||||
|     name: 'buypricebreaks', | ||||
|     formatNoMatches: function() { return "{% trans "No price break information found" %}"; }, | ||||
|     queryParams: { | ||||
|         part: {{ part.id }}, | ||||
|     }, | ||||
|     url: "{% url 'api-part-supplier-price-list' %}", | ||||
|     onPostBody: function() { | ||||
|         var table = $('#price-break-table'); | ||||
|  | ||||
|         table.find('.button-price-break-delete').click(function() { | ||||
|             var pk = $(this).attr('pk'); | ||||
|  | ||||
|             constructForm(`/api/company/price-break/${pk}/`, { | ||||
|                 method: 'DELETE', | ||||
|                 onSuccess: reloadPriceBreaks, | ||||
|                 title: '{% trans "Delete Price Break" %}', | ||||
|             }); | ||||
|         }); | ||||
|  | ||||
|         table.find('.button-price-break-edit').click(function() { | ||||
|             var pk = $(this).attr('pk'); | ||||
|  | ||||
|             constructForm(`/api/company/price-break/${pk}/`, { | ||||
|                 fields: { | ||||
|                     quantity: {}, | ||||
|                     price: {}, | ||||
|                     price_currency: {}, | ||||
|                 }, | ||||
|                 onSuccess: reloadPriceBreaks, | ||||
|                 title: '{% trans "Edit Price Break" %}', | ||||
|             }); | ||||
|         }); | ||||
|     }, | ||||
|     columns: [ | ||||
|         { | ||||
|             field: 'pk', | ||||
|             title: 'ID', | ||||
|             visible: false, | ||||
|             switchable: false, | ||||
|         }, | ||||
|         { | ||||
|             field: 'quantity', | ||||
|             title: '{% trans "Quantity" %}', | ||||
|             sortable: true, | ||||
|         }, | ||||
|         { | ||||
|             field: 'price', | ||||
|             title: '{% trans "Price" %}', | ||||
|             sortable: true, | ||||
|             formatter: function(value, row, index) { | ||||
|                 var html = value; | ||||
|  | ||||
|                 html += `<div class='btn-group float-right' role='group'>` | ||||
|  | ||||
|                 html += makeIconButton('fa-edit icon-blue', 'button-price-break-edit', row.pk, '{% trans "Edit price break" %}'); | ||||
|                 html += makeIconButton('fa-trash-alt icon-red', 'button-price-break-delete', row.pk, '{% trans "Delete price break" %}'); | ||||
|  | ||||
|                 html += `</div>`; | ||||
|  | ||||
|                 return html; | ||||
|             } | ||||
|         }, | ||||
|     ] | ||||
| }); | ||||
|  | ||||
| $('#new-price-break').click(function() { | ||||
|  | ||||
|     constructForm( | ||||
|         '{% url "api-part-supplier-price-list" %}', | ||||
|         { | ||||
|             method: 'POST', | ||||
|             fields: { | ||||
|                 quantity: {}, | ||||
|                 part: { | ||||
|                     value: {{ part.pk }}, | ||||
|                     hidden: true, | ||||
|                 }, | ||||
|                 price: {}, | ||||
|                 price_currency: { | ||||
|                 }, | ||||
|             }, | ||||
|             title: '{% trans "Add Price Break" %}', | ||||
|             onSuccess: reloadPriceBreaks, | ||||
|         } | ||||
|     ); | ||||
| }); | ||||
|  | ||||
| loadPurchaseOrderTable($("#purchase-order-table"), { | ||||
|     url: "{% url 'api-po-list' %}?supplier_part={{ part.id }}", | ||||
| }); | ||||
|  | ||||
| loadStockTable($("#stock-table"), { | ||||
|     params: { | ||||
|         supplier_part: {{ part.id }}, | ||||
|         location_detail: true, | ||||
|         part_detail: false, | ||||
|     }, | ||||
|     groupByField: 'location', | ||||
|     buttons: ['#stock-options'], | ||||
|     url: "{% url 'api-stock-list' %}", | ||||
| }); | ||||
|  | ||||
| $("#stock-export").click(function() { | ||||
|     launchModalForm("{% url 'stock-export-options' %}", { | ||||
|         submit_text: '{% trans "Export" %}', | ||||
|         success: function(response) { | ||||
|             var url = "{% url 'stock-export' %}"; | ||||
|  | ||||
|             url += "?format=" + response.format; | ||||
|             url += "&cascade=" + response.cascade; | ||||
|             url += "&supplier_part={{ part.id }}"; | ||||
|  | ||||
|             location.href = url; | ||||
|         }, | ||||
|     }); | ||||
| }); | ||||
|  | ||||
| $("#item-create").click(function() { | ||||
|     createNewStockItem({ | ||||
|         data: { | ||||
|             part: {{ part.part.id }}, | ||||
|             supplier_part: {{ part.id }}, | ||||
|         }, | ||||
|         reload: true, | ||||
|     }); | ||||
| }); | ||||
|  | ||||
|  | ||||
| enableNavbar({ | ||||
|     label: 'supplier-part', | ||||
|     toggleId: '#supplier-part-menu-toggle' | ||||
| }) | ||||
|  | ||||
| $('#order-part, #order-part2').click(function() { | ||||
|     launchModalForm( | ||||
|         "{% url 'order-parts' %}", | ||||
|         { | ||||
|             data: { | ||||
|                 part: {{ part.part.id }}, | ||||
|             }, | ||||
|             reload: true, | ||||
|         }, | ||||
|     ); | ||||
| }); | ||||
|  | ||||
| $('#edit-part').click(function () { | ||||
|     launchModalForm( | ||||
|                     "{% url 'supplier-part-edit' part.id %}", | ||||
|                     { | ||||
|                         reload: true | ||||
|                     } | ||||
|     ); | ||||
| }); | ||||
|  | ||||
| $('#delete-part').click(function() { | ||||
|     launchModalForm( | ||||
|         "{% url 'supplier-part-delete' %}?part={{ part.id }}", | ||||
|         { | ||||
|             redirect: "{% url 'company-detail' part.supplier.id %}" | ||||
|         } | ||||
|     ); | ||||
| }); | ||||
|  | ||||
| attachNavCallbacks({ | ||||
|     name: 'supplierpart', | ||||
|     default: 'stock' | ||||
| }); | ||||
|  | ||||
| {% endblock %} | ||||
| @@ -1,161 +0,0 @@ | ||||
| {% extends "two_column.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
| {% load inventree_extras %} | ||||
|  | ||||
| {% block page_title %} | ||||
| {% inventree_title %} | {% trans "Supplier Part" %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block thumbnail %} | ||||
| <img class='part-thumb' | ||||
| {% if part.part.image %} | ||||
| src='{{ part.part.image.url }}' | ||||
| {% else %} | ||||
| src="{% static 'img/blank_image.png' %}" | ||||
| {% endif %}/> | ||||
| {% endblock %} | ||||
|  | ||||
| {% block page_data %} | ||||
| <h3>{% trans "Supplier Part" %}</h3> | ||||
| <hr> | ||||
| <h4> | ||||
|     {{ part.part.full_name }} | ||||
|     {% if user.is_staff and perms.company.change_company %} | ||||
|     <a href="{% url 'admin:company_supplierpart_change' part.pk %}"> | ||||
|         <span title='{% trans "Admin view" %}' class='fas fa-user-shield'></span> | ||||
|     </a> | ||||
|     {% endif %} | ||||
| </h4> | ||||
| <p>{{ part.supplier.name }} - {{ part.SKU }}</p> | ||||
|  | ||||
| {% if roles.purchase_order.change %} | ||||
| <div class='btn-row'> | ||||
|     <div class='btn-group action-buttons' role='group'> | ||||
|         {% if roles.purchase_order.add %} | ||||
|         <button type='button' class='btn btn-default btn-glyph' id='order-part' title='{% trans "Order part" %}'> | ||||
|             <span class='fas fa-shopping-cart'></span> | ||||
|         </button> | ||||
|         {% endif %} | ||||
|         <button type='button' class='btn btn-default btn-glyph' id='edit-part' title='{% trans "Edit supplier part" %}'> | ||||
|             <span class='fas fa-edit icon-green'/> | ||||
|         </button> | ||||
|         {% if roles.purchase_order.delete %} | ||||
|         <button type='button' class='btn btn-default btn-glyph' id='delete-part' title='{% trans "Delete supplier part" %}'> | ||||
|             <span class='fas fa-trash-alt icon-red'/> | ||||
|         </button> | ||||
|         {% endif %} | ||||
|     </div> | ||||
| </div> | ||||
| {% endif %} | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block page_details %} | ||||
|  | ||||
| <h4>{% trans "Supplier Part Details" %}</h4> | ||||
| <table class="table table-striped table-condensed"> | ||||
|     <col width='25'> | ||||
|         <tr> | ||||
|             <td><span class='fas fa-shapes'></span></td> | ||||
|             <td>{% trans "Internal Part" %}</td> | ||||
|             <td> | ||||
|                 {% if part.part %} | ||||
|                 <a href="{% url 'part-detail' part.part.id %}?display=part-suppliers">{{ part.part.full_name }}</a>{% include "clip.html"%} | ||||
|                 {% endif %} | ||||
|             </td> | ||||
|         </tr> | ||||
|         {% if part.description %} | ||||
|         <tr> | ||||
|             <td></td> | ||||
|             <td>{% trans "Description" %}</td> | ||||
|             <td>{{ part.description }}{% include "clip.html"%}</td> | ||||
|         </tr> | ||||
|         {% endif %} | ||||
|         {% if part.link %} | ||||
|         <tr> | ||||
|             <td><span class='fas fa-link'></span></td> | ||||
|             <td>{% trans "External Link" %}</td> | ||||
|             <td><a href="{{ part.link }}">{{ part.link }}</a>{% include "clip.html"%}</td> | ||||
|         </tr> | ||||
|         {% endif %} | ||||
|         <tr> | ||||
|             <td><span class='fas fa-building'></span></td> | ||||
|             <td>{% trans "Supplier" %}</td> | ||||
|             <td><a href="{% url 'company-detail' part.supplier.id %}">{{ part.supplier.name }}</a>{% include "clip.html"%}</td></tr> | ||||
|         <tr> | ||||
|             <td><span class='fas fa-hashtag'></span></td> | ||||
|             <td>{% trans "SKU" %}</td> | ||||
|             <td>{{ part.SKU }}{% include "clip.html"%}</tr> | ||||
|         </tr> | ||||
|         {% if part.manufacturer_part.manufacturer %} | ||||
|         <tr> | ||||
|             <td><span class='fas fa-industry'></span></td> | ||||
|             <td>{% trans "Manufacturer" %}</td> | ||||
|             <td><a href="{% url 'company-detail' part.manufacturer_part.manufacturer.id %}"> | ||||
|             {{ part.manufacturer_part.manufacturer.name }}</a>{% include "clip.html"%}</td> | ||||
|         </tr> | ||||
|         {% endif %} | ||||
|         {% if part.manufacturer_part.MPN %} | ||||
|         <tr> | ||||
|             <td><span class='fas fa-hashtag'></span></td> | ||||
|             <td>{% trans "MPN" %}</td> | ||||
|             <td><a href="{% url 'manufacturer-part-detail' part.manufacturer_part.id %}">{{ part.manufacturer_part.MPN }}</a>{% include "clip.html"%}</td> | ||||
|         </tr> | ||||
|         {% endif %} | ||||
|         {% if part.packaging %} | ||||
|         <tr> | ||||
|             <td><span class='fas fa-cube'></span></td> | ||||
|             <td>{% trans "Packaging" %}</td> | ||||
|             <td>{{ part.packaging }}{% include "clip.html"%}</td> | ||||
|         </tr> | ||||
|         {% endif %} | ||||
|         {% if part.note %} | ||||
|         <tr> | ||||
|             <td><span class='fas fa-sticky-note'></span></td> | ||||
|             <td>{% trans "Note" %}</td> | ||||
|             <td>{{ part.note }}{% include "clip.html"%}</td> | ||||
|         </tr> | ||||
|         {% endif %} | ||||
| </table> | ||||
| {% endblock %} | ||||
|  | ||||
| {% block js_ready %} | ||||
| {{ block.super }} | ||||
|  | ||||
| enableNavbar({ | ||||
|     label: 'supplier-part', | ||||
|     toggleId: '#supplier-part-menu-toggle' | ||||
| }) | ||||
|  | ||||
| $('#order-part, #order-part2').click(function() { | ||||
|     launchModalForm( | ||||
|         "{% url 'order-parts' %}", | ||||
|         { | ||||
|             data: { | ||||
|                 part: {{ part.part.id }}, | ||||
|             }, | ||||
|             reload: true, | ||||
|         }, | ||||
|     ); | ||||
| }); | ||||
|  | ||||
| $('#edit-part').click(function () { | ||||
|     launchModalForm( | ||||
|                     "{% url 'supplier-part-edit' part.id %}", | ||||
|                     { | ||||
|                         reload: true | ||||
|                     } | ||||
|     ); | ||||
| }); | ||||
|  | ||||
| $('#delete-part').click(function() { | ||||
|     launchModalForm( | ||||
|         "{% url 'supplier-part-delete' %}?part={{ part.id }}", | ||||
|         { | ||||
|             redirect: "{% url 'company-detail' part.supplier.id %}" | ||||
|         } | ||||
|     ); | ||||
| }); | ||||
|  | ||||
| {% endblock %} | ||||
| @@ -1,48 +0,0 @@ | ||||
| {% extends "company/supplier_part_base.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
|  | ||||
| {% block menubar %} | ||||
| {% include "company/supplier_part_navbar.html" with tab='details' %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block heading %} | ||||
| {% trans "Supplier Part Details" %} | ||||
| {% endblock %} | ||||
|  | ||||
|  | ||||
| {% block details %} | ||||
|  | ||||
| <table class="table table-striped table-condensed"> | ||||
|     <tr> | ||||
|         <td>{% trans "Internal Part" %}</td> | ||||
|         <td> | ||||
|             {% if part.part %} | ||||
|             <a href="{% url 'part-detail' part.part.id %}?display=part-suppliers">{{ part.part.full_name }}</a> | ||||
|             {% endif %} | ||||
|         </td> | ||||
|     </tr> | ||||
|     <tr><td>{% trans "Supplier" %}</td><td><a href="{% url 'company-detail' part.supplier.id %}">{{ part.supplier.name }}</a></td></tr> | ||||
|     <tr><td>{% trans "SKU" %}</td><td>{{ part.SKU }}</tr></tr> | ||||
| {% if part.link %} | ||||
|     <tr><td>{% trans "External Link" %}</td><td><a href="{{ part.link }}">{{ part.link }}</a></td></tr> | ||||
| {% endif %} | ||||
| {% if part.description %} | ||||
|     <tr><td>{% trans "Description" %}</td><td>{{ part.description }}{% include "clip.html"%}</td></tr> | ||||
| {% endif %} | ||||
| {% if part.manufacturer %} | ||||
|     <tr><td>{% trans "Manufacturer" %}</td><td>{{ part.manufacturer }}{% include "clip.html"%}</td></tr> | ||||
|     <tr><td>{% trans "MPN" %}</td><td>{{ part.MPN }}{% include "clip.html"%}</td></tr> | ||||
| {% endif %} | ||||
| {% if part.note %} | ||||
|     <tr><td>{% trans "Note" %}</td><td>{{ part.note }}{% include "clip.html"%}</td></tr> | ||||
| {% endif %} | ||||
| </table> | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block js_ready %} | ||||
| {{ block.super }} | ||||
|  | ||||
|  | ||||
| {% endblock %} | ||||
| @@ -9,22 +9,22 @@ | ||||
|         </a> | ||||
|     </li> | ||||
|  | ||||
|     <li class='list-group-item {% if tab == "stock" %}active{% endif %}' title='{% trans "Supplier Part Stock" %}'> | ||||
|         <a href='{% url "supplier-part-stock" part.id %}'> | ||||
|     <li class='list-group-item' title='{% trans "Supplier Part Stock" %}'> | ||||
|         <a href='#' id='select-stock' class='nav-toggle'> | ||||
|             <span class='fas fa-boxes sidebar-icon'></span> | ||||
|             {% trans "Stock" %} | ||||
|         </a> | ||||
|     </li> | ||||
|  | ||||
|     <li class='list-group-item {% if tab == "orders" %}active{% endif %}' title='{% trans "Supplier Part Orders" %}'> | ||||
|         <a href='{% url "supplier-part-orders" part.id %}'> | ||||
|     <li class='list-group-item' title='{% trans "Supplier Part Orders" %}'> | ||||
|         <a href='#' id='select-purchase-orders' class='nav-toggle'> | ||||
|             <span class='fas fa-shopping-cart sidebar-icon'></span> | ||||
|             {% trans "Orders" %} | ||||
|         </a> | ||||
|     </li> | ||||
|  | ||||
|     <li class='list-group-item {% if tab == "pricing" %}active{% endif %}' title='{% trans "Supplier Part Pricing" %}'> | ||||
|         <a href='{% url "supplier-part-pricing" part.id %}'> | ||||
|     <li class='list-group-item' title='{% trans "Supplier Part Pricing" %}'> | ||||
|         <a href='#' id='select-pricing' class='nav-toggle'> | ||||
|             <span class='fas fa-dollar-sign sidebar-icon'></span> | ||||
|             {% trans "Pricing" %} | ||||
|         </a> | ||||
|   | ||||
| @@ -1,35 +0,0 @@ | ||||
| {% extends "company/supplier_part_base.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
|  | ||||
| {% block menubar %} | ||||
| {% include "company/supplier_part_navbar.html" with tab='orders' %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block heading %} | ||||
| {% trans "Supplier Part Orders" %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block details %} | ||||
| {% if roles.purchase_order.add %} | ||||
| <div id='button-bar'> | ||||
|     <div class='btn-group'> | ||||
|         <button class='btn btn-primary' type='button' id='order-part2' title='{% trans "Order part" %}'> | ||||
|             <span class='fas fa-shopping-cart'></span> {% trans "Order Part" %}</button> | ||||
|     </div> | ||||
| </div> | ||||
| {% endif %} | ||||
|  | ||||
| <table class='table table-striped table-condensed po-table' id='purchase-order-table' data-toolbar='#button-bar'> | ||||
| </table> | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block js_ready %} | ||||
| {{ block.super }} | ||||
|  | ||||
| loadPurchaseOrderTable($("#purchase-order-table"), { | ||||
|     url: "{% url 'api-po-list' %}?supplier_part={{ part.id }}", | ||||
| }); | ||||
|  | ||||
| {% endblock %} | ||||
| @@ -1,124 +0,0 @@ | ||||
| {% extends "company/supplier_part_base.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
| {% load inventree_extras %} | ||||
|  | ||||
| {% block menubar %} | ||||
| {% include "company/supplier_part_navbar.html" with tab='pricing' %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block heading %} | ||||
| {% trans "Pricing Information" %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block details %} | ||||
|  | ||||
| {% if roles.purchase_order.add %} | ||||
| <div id='price-break-toolbar' class='btn-group'> | ||||
|     <button class='btn btn-primary' id='new-price-break' type='button'> | ||||
|         <span class='fas fa-plus-circle'></span> {% trans "Add Price Break" %} | ||||
|     </button> | ||||
| </div> | ||||
| {% endif %} | ||||
|  | ||||
| <table class='table table-striped table-condensed' id='price-break-table' data-toolbar='#price-break-toolbar'>     | ||||
| </table> | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block js_ready %} | ||||
| {{ block.super }} | ||||
|  | ||||
| function reloadPriceBreaks() { | ||||
|     $("#price-break-table").bootstrapTable("refresh"); | ||||
| } | ||||
|  | ||||
| $('#price-break-table').inventreeTable({ | ||||
|     name: 'buypricebreaks', | ||||
|     formatNoMatches: function() { return "{% trans "No price break information found" %}"; }, | ||||
|     queryParams: { | ||||
|         part: {{ part.id }}, | ||||
|     }, | ||||
|     url: "{% url 'api-part-supplier-price-list' %}", | ||||
|     onPostBody: function() { | ||||
|         var table = $('#price-break-table'); | ||||
|  | ||||
|         table.find('.button-price-break-delete').click(function() { | ||||
|             var pk = $(this).attr('pk'); | ||||
|  | ||||
|             constructForm(`/api/company/price-break/${pk}/`, { | ||||
|                 method: 'DELETE', | ||||
|                 onSuccess: reloadPriceBreaks, | ||||
|                 title: '{% trans "Delete Price Break" %}', | ||||
|             }); | ||||
|         }); | ||||
|  | ||||
|         table.find('.button-price-break-edit').click(function() { | ||||
|             var pk = $(this).attr('pk'); | ||||
|  | ||||
|             constructForm(`/api/company/price-break/${pk}/`, { | ||||
|                 fields: { | ||||
|                     quantity: {}, | ||||
|                     price: {}, | ||||
|                     price_currency: {}, | ||||
|                 }, | ||||
|                 onSuccess: reloadPriceBreaks, | ||||
|                 title: '{% trans "Edit Price Break" %}', | ||||
|             }); | ||||
|         }); | ||||
|     }, | ||||
|     columns: [ | ||||
|         { | ||||
|             field: 'pk', | ||||
|             title: 'ID', | ||||
|             visible: false, | ||||
|             switchable: false, | ||||
|         }, | ||||
|         { | ||||
|             field: 'quantity', | ||||
|             title: '{% trans "Quantity" %}', | ||||
|             sortable: true, | ||||
|         }, | ||||
|         { | ||||
|             field: 'price', | ||||
|             title: '{% trans "Price" %}', | ||||
|             sortable: true, | ||||
|             formatter: function(value, row, index) { | ||||
|                 var html = value; | ||||
|  | ||||
|                 html += `<div class='btn-group float-right' role='group'>` | ||||
|  | ||||
|                 html += makeIconButton('fa-edit icon-blue', 'button-price-break-edit', row.pk, '{% trans "Edit price break" %}'); | ||||
|                 html += makeIconButton('fa-trash-alt icon-red', 'button-price-break-delete', row.pk, '{% trans "Delete price break" %}'); | ||||
|  | ||||
|                 html += `</div>`; | ||||
|  | ||||
|                 return html; | ||||
|             } | ||||
|         }, | ||||
|     ] | ||||
| }); | ||||
|  | ||||
| $('#new-price-break').click(function() { | ||||
|  | ||||
|     constructForm( | ||||
|         '{% url "api-part-supplier-price-list" %}', | ||||
|         { | ||||
|             method: 'POST', | ||||
|             fields: { | ||||
|                 quantity: {}, | ||||
|                 part: { | ||||
|                     value: {{ part.pk }}, | ||||
|                     hidden: true, | ||||
|                 }, | ||||
|                 price: {}, | ||||
|                 price_currency: { | ||||
|                 }, | ||||
|             }, | ||||
|             title: '{% trans "Add Price Break" %}', | ||||
|             onSuccess: reloadPriceBreaks, | ||||
|         } | ||||
|     ); | ||||
| }); | ||||
|  | ||||
| {% endblock %} | ||||
| @@ -1,58 +0,0 @@ | ||||
| {% extends "company/supplier_part_base.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
|  | ||||
| {% block menubar %} | ||||
| {% include "company/supplier_part_navbar.html" with tab='stock' %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block heading %} | ||||
| {% trans "Supplier Part Stock" %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block details %} | ||||
| {% include "stock_table.html" %} | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block js_ready %} | ||||
| {{ block.super }} | ||||
|  | ||||
|     loadStockTable($("#stock-table"), { | ||||
|         params: { | ||||
|             supplier_part: {{ part.id }}, | ||||
|             location_detail: true, | ||||
|             part_detail: false, | ||||
|         }, | ||||
|         groupByField: 'location', | ||||
|         buttons: ['#stock-options'], | ||||
|         url: "{% url 'api-stock-list' %}", | ||||
|     }); | ||||
|  | ||||
|     $("#stock-export").click(function() { | ||||
|         launchModalForm("{% url 'stock-export-options' %}", { | ||||
|             submit_text: '{% trans "Export" %}', | ||||
|             success: function(response) { | ||||
|                 var url = "{% url 'stock-export' %}"; | ||||
|  | ||||
|                 url += "?format=" + response.format; | ||||
|                 url += "&cascade=" + response.cascade; | ||||
|                 url += "&supplier_part={{ part.id }}"; | ||||
|  | ||||
|                 location.href = url; | ||||
|             }, | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
|     $("#item-create").click(function() { | ||||
|         createNewStockItem({ | ||||
|             data: { | ||||
|                 part: {{ part.part.id }}, | ||||
|                 supplier_part: {{ part.id }}, | ||||
|             }, | ||||
|             reload: true, | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
|  | ||||
| {% endblock %} | ||||
| @@ -39,12 +39,7 @@ manufacturer_part_urls = [ | ||||
| supplier_part_detail_urls = [ | ||||
|     url(r'^edit/?', views.SupplierPartEdit.as_view(), name='supplier-part-edit'), | ||||
|  | ||||
|     url(r'^manufacturers/', views.SupplierPartDetail.as_view(template_name='company/supplier_part_manufacturers.html'), name='supplier-part-manufacturers'), | ||||
|     url(r'^pricing/', views.SupplierPartDetail.as_view(template_name='company/supplier_part_pricing.html'), name='supplier-part-pricing'), | ||||
|     url(r'^orders/', views.SupplierPartDetail.as_view(template_name='company/supplier_part_orders.html'), name='supplier-part-orders'), | ||||
|     url(r'^stock/', views.SupplierPartDetail.as_view(template_name='company/supplier_part_stock.html'), name='supplier-part-stock'), | ||||
|  | ||||
|     url('^.*$', views.SupplierPartDetail.as_view(template_name='company/supplier_part_pricing.html'), name='supplier-part-detail'), | ||||
|     url('^.*$', views.SupplierPartDetail.as_view(template_name='company/supplier_part.html'), name='supplier-part-detail'), | ||||
| ] | ||||
|  | ||||
| supplier_part_urls = [ | ||||
|   | ||||
| @@ -244,11 +244,11 @@ | ||||
|             "{% url 'category-create' %}", | ||||
|             { | ||||
|                 follow: true, | ||||
|                 {% if category %} | ||||
|                 data: { | ||||
|                     {% if category %} | ||||
|                     category: {{ category.id }} | ||||
|                 }, | ||||
|                     {% endif %} | ||||
|                 }, | ||||
|                 secondary: [ | ||||
|                     { | ||||
|                         field: 'default_location', | ||||
|   | ||||
		Reference in New Issue
	
	Block a user