mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +00:00 
			
		
		
		
	Merge pull request #1811 from SchrodingersGat/spa
Dynamically switch between navbar selections on pages
This commit is contained in:
		| @@ -1,38 +0,0 @@ | ||||
| {% extends "company/company_base.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
|  | ||||
| {% block menubar %} | ||||
| {% include "company/navbar.html" with tab="assigned" %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block heading %} | ||||
| {% trans "Assigned Stock" %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block details %} | ||||
|  | ||||
| <div id='button-toolbar'> | ||||
|     <div class='filter-list' id='filter-list-stock'> | ||||
|         <!-- An empty div in which the filter list will be constructed --> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| <table class='table table-striped table-condensed' id='stock-table' data-toolbar='#button-toolbar'></table> | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block js_ready %} | ||||
| {{ block.super }} | ||||
|  | ||||
| loadStockTable($("#stock-table"), { | ||||
|     params: { | ||||
|         customer: {{ company.id }}, | ||||
|         part_detail: true, | ||||
|         location_detail: true, | ||||
|     }, | ||||
|     url: "{% url 'api-stock-list' %}", | ||||
|     filterKey: "customerstock", | ||||
| }); | ||||
|  | ||||
| {% endblock %} | ||||
| @@ -71,6 +71,17 @@ | ||||
|     <td><a href="{{ company.website }}">{{ company.website }}</a>{% include "clip.html"%}</td> | ||||
| </tr> | ||||
| {% endif %} | ||||
| <tr> | ||||
|     <td><span class='fas fa-dollar-sign'></span></td> | ||||
|     <td>{% trans "Currency" %}</td> | ||||
|     <td> | ||||
|         {% if company.currency %} | ||||
|         {{ company.currency }} | ||||
|         {% else %} | ||||
|         <i>{% trans "Uses default currency" %}</i> | ||||
|         {% endif %} | ||||
|     </td> | ||||
| </tr> | ||||
| {% if company.address %} | ||||
| <tr> | ||||
|     <td><span class='fas fa-map-marked-alt'></span></td> | ||||
| @@ -99,6 +110,22 @@ | ||||
|     <td>{{ company.contact }}{% include "clip.html"%}</td> | ||||
| </tr> | ||||
| {% endif %} | ||||
|  | ||||
| <tr> | ||||
|     <td><span class='fas fa-industry'></span></td> | ||||
|     <td>{%trans "Manufacturer" %}</td> | ||||
|     <td>{% include "yesnolabel.html" with value=company.is_manufacturer %}</td> | ||||
| </tr> | ||||
| <tr> | ||||
|     <td><span class='fas fa-building'></span></td> | ||||
|     <td>{% trans "Supplier" %}</td> | ||||
|     <td>{% include 'yesnolabel.html' with value=company.is_supplier %}</td> | ||||
| </tr> | ||||
| <tr> | ||||
|     <td><span class='fas fa-user-tie'></span></td> | ||||
|     <td>{% trans "Customer" %}</td> | ||||
|     <td>{% include 'yesnolabel.html' with value=company.is_customer %}</td> | ||||
| </tr> | ||||
| </table> | ||||
| {% endblock %} | ||||
|  | ||||
|   | ||||
| @@ -1,79 +1,432 @@ | ||||
| {% extends "company/company_base.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
| {% load markdownify %} | ||||
|  | ||||
| {% block menubar %} | ||||
| {% include 'company/navbar.html' with tab='details' %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block heading %} | ||||
| {% trans "Company Details" %} | ||||
| {% endblock %} | ||||
| {% block page_content %} | ||||
|  | ||||
| {% block details %} | ||||
| <div class='row'> | ||||
|     <div class='col-sm-6'> | ||||
|         <table class='table table-striped'> | ||||
|             <col width='25'> | ||||
|             <col> | ||||
|             <tr> | ||||
|                 <td><span class='fas fa-font'></span></td> | ||||
|                 <td>{% trans "Company Name" %}</td> | ||||
|                 <td>{{ company.name }}{% include "clip.html"%}</td> | ||||
|             </tr> | ||||
|             {% if company.description %} | ||||
|             <tr> | ||||
|                 <td><span class='fas fa-info'></span></td> | ||||
|                 <td>{% trans "Description" %}</td> | ||||
|                 <td>{{ company.description }}{% include "clip.html"%}</td> | ||||
|             </tr> | ||||
|             {% endif %} | ||||
|             <tr> | ||||
|                 <td><span class='fas fa-globe'></span></td> | ||||
|                 <td>{% trans "Website" %}</td> | ||||
|                 <td> | ||||
|                     {% if company.website %}<a href='{{ company.website }}'>{{ company.website }}</a>{% include "clip.html"%} | ||||
|                     {% else %}<i>{% trans "No website specified" %}</i> | ||||
| <div class='panel panel-default panel-inventree panel-hidden' id='panel-supplier-parts'> | ||||
|     <div class='panel-heading'> | ||||
|         <h4>{% trans "Supplier Parts" %}</h4> | ||||
|     </div> | ||||
|     <div class='panel-content'> | ||||
|         {% if roles.purchase_order.change %} | ||||
|         <div id='supplier-part-button-toolbar'> | ||||
|             <div class='button-toolbar container-fluid'> | ||||
|                 <div class='btn-group' role='group'> | ||||
|                     {% if roles.purchase_order.add %} | ||||
|                         <button class="btn btn-success" id='supplier-part-create' title='{% trans "Create new supplier part" %}'> | ||||
|                             <span class='fas fa-plus-circle'></span> {% trans "New Supplier Part" %} | ||||
|                         </button> | ||||
|                     {% endif %} | ||||
|                 </td> | ||||
|             </tr> | ||||
|             <tr> | ||||
|                 <td><span class='fas fa-dollar-sign'></span></td> | ||||
|                 <td>{% trans "Currency" %}</td> | ||||
|                 <td> | ||||
|                     {% if company.currency %}{{ company.currency }} | ||||
|                     {% else %}<i>{% trans "Uses default currency" %}</i> | ||||
|                     {% endif %} | ||||
|                 </td> | ||||
|             </tr> | ||||
|                     <div class='btn-group'> | ||||
|                         <div class="dropdown" style="float: right;"> | ||||
|                             <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">{% trans "Options" %} | ||||
|                                 <span class="caret"></span> | ||||
|                             </button> | ||||
|                             <ul class="dropdown-menu"> | ||||
|                                 {% if roles.purchase_order.add %} | ||||
|                                 <li><a href='#' id='multi-part-order' title='{% trans "Order parts" %}'>{% trans "Order Parts" %}</a></li> | ||||
|                                 {% endif %} | ||||
|                                 {% if roles.purchase_order.delete %} | ||||
|                                 <li><a href='#' id='multi-part-delete' title='{% trans "Delete parts" %}'>{% trans "Delete Parts" %}</a></li> | ||||
|                                 {% endif %} | ||||
|                             </ul> | ||||
|                         </div>   | ||||
|                     </div> | ||||
|                 </div> | ||||
|                 <div class='filter-list' id='filter-list-supplier-part'> | ||||
|                     <!-- Empty div (will be filled out with available BOM filters) --> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|         {% endif %} | ||||
|  | ||||
|         <table class='table table-striped table-condensed' id='supplier-part-table' data-toolbar='#supplier-part-button-toolbar'> | ||||
|         </table> | ||||
|     </div> | ||||
|     <div class='col-sm-6'> | ||||
|         <table class='table table-striped'> | ||||
|             <col width='25'> | ||||
|             <col> | ||||
|             <tr> | ||||
|                 <td><span class='fas fa-industry'></span></td> | ||||
|                 <td>{% trans "Manufacturer" %}</td> | ||||
|                 <td>{% include "yesnolabel.html" with value=company.is_manufacturer %}</td> | ||||
|             </tr> | ||||
|             <tr> | ||||
|                 <td><span class='fas fa-building'></span></td> | ||||
|                 <td>{% trans "Supplier" %}</td> | ||||
|                 <td>{% include 'yesnolabel.html' with value=company.is_supplier %}</td> | ||||
|             </tr> | ||||
|             <tr> | ||||
|                 <td><span class='fas fa-user-tie'></span></td> | ||||
|                 <td>{% trans "Customer" %}</td> | ||||
|                 <td>{% include 'yesnolabel.html' with value=company.is_customer %}</td> | ||||
|             </tr> | ||||
|         </table> | ||||
| </div> | ||||
|  | ||||
| <div class='panel panel-default panel-inventree panel-hidden' id='panel-manufacturer-parts'> | ||||
|     <div class='panel-heading'> | ||||
|         <h4>{% trans "Manufacturer Parts" %}</h4> | ||||
|     </div> | ||||
|     <div class='panel-content'> | ||||
|         {% if roles.purchase_order.change %} | ||||
|         <div id='manufacturer-part-button-toolbar'> | ||||
|             <div class='button-toolbar container-fluid'> | ||||
|                 <div class='btn-group role='group'> | ||||
|                     {% if roles.purchase_order.add %} | ||||
|                         <button class="btn btn-success" id='manufacturer-part-create' title='{% trans "Create new manufacturer part" %}'> | ||||
|                             <span class='fas fa-plus-circle'></span> {% trans "New Manufacturer Part" %} | ||||
|                         </button> | ||||
|                     {% endif %} | ||||
|                     <div class='btn-group'> | ||||
|                         <div class="dropdown" style="float: right;"> | ||||
|                             <button class="btn btn-primary dropdown-toggle" id='table-options', type="button" data-toggle="dropdown">{% trans "Options" %} | ||||
|                                 <span class="caret"></span> | ||||
|                             </button> | ||||
|                             <ul class="dropdown-menu"> | ||||
|                                 {% if roles.purchase_order.add %} | ||||
|                                 <li><a href='#' id='multi-part-order' title='{% trans "Order parts" %}'>{% trans "Order Parts" %}</a></li> | ||||
|                                 {% endif %} | ||||
|                                 {% if roles.purchase_order.delete %} | ||||
|                                 <li><a href='#' id='multi-part-delete' title='{% trans "Delete parts" %}'>{% trans "Delete Parts" %}</a></li> | ||||
|                                 {% endif %} | ||||
|                             </ul> | ||||
|                         </div>   | ||||
|                     </div> | ||||
|                 </div> | ||||
|                 <div class='filter-list' id='filter-list-supplier-part'> | ||||
|                     <!-- Empty div (will be filled out with available BOM filters) --> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|         {% endif %} | ||||
|         <table class='table table-striped table-condensed' id='part-table' data-toolbar='#manufacturer-part-button-toolbar'> | ||||
|         </table> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| <div class='panel panel-default panel-inventree panel-hidden' id='panel-company-stock'> | ||||
|     <div class='panel-heading'> | ||||
|         <h4>{% trans "Supplier 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 "Purchase Orders" %}</h4> | ||||
|     </div> | ||||
|     <div class='panel-content'> | ||||
|         {% if roles.purchase_order.add %} | ||||
|         <div id='po-button-bar'> | ||||
|             <div class='button-toolbar container-fluid' style='float: right;'> | ||||
|                 <button class='btn btn-primary' type='button' id='company-order2' title='{% trans "Create new purchase order" %}'> | ||||
|                     <span class='fas fa-plus-circle'></span> {% trans "New Purchase Order" %}</button> | ||||
|                 <div class='filter-list' id='filter-list-purchaseorder'> | ||||
|                     <!-- Empty div --> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|         {% endif %} | ||||
|  | ||||
|         <table class='table table-striped table-condensed po-table' id='purchase-order-table' data-toolbar='#po-button-bar'> | ||||
|         </table> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| <div class='panel panel-default panel-inventree panel-hidden' id='panel-sales-orders'> | ||||
|     <div class='panel-heading'> | ||||
|         <h4>{% trans "Sales Orders" %}</h4> | ||||
|     </div> | ||||
|     <div class='panel-content'> | ||||
|         {% if roles.sales_order.add %} | ||||
|         <div id='so-button-bar'> | ||||
|             <div class='button-toolbar container-fluid' style='float: right;'> | ||||
|                 <button class='btn btn-primary' type='button' id='new-sales-order' title='{% trans "Create new sales order" %}'> | ||||
|                     <div class='fas fa-plus-circle'></div> {% trans "New Sales Order" %} | ||||
|                 </button> | ||||
|                 <div class='filter-list' id='filter-list-salesorder'> | ||||
|                     <!-- Empty div --> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|         {% endif %} | ||||
|  | ||||
|         <table class='table table-striped table-condensed po-table' id='sales-order-table' data-toolbar='#so-button-bar'> | ||||
|         </table> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| <div class='panel panel-default panel-inventree panel-hidden' id='panel-assigned-stock'> | ||||
|     <div class='panel-heading'> | ||||
|         <h4>{% trans "Assigned Stock" %}</h4> | ||||
|     </div> | ||||
|     <div class='panel-content'> | ||||
|         <div id='assigned-stock-button-toolbar'> | ||||
|             <div class='filter-list' id='filter-list-stock'> | ||||
|                 <!-- An empty div in which the filter list will be constructed --> | ||||
|             </div> | ||||
|         </div> | ||||
|          | ||||
|         <table class='table table-striped table-condensed' id='assigned-stock-table' data-toolbar='#bassigned-stock-utton-toolbar'></table> | ||||
|          | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| <div class='panel panel-default panel-inventree panel-hidden' id='panel-company-notes'> | ||||
|     <div class='panel-heading'> | ||||
|         <div class='row'> | ||||
|             <div class='col-sm-6'> | ||||
|                 <h4>{% trans "Company Notes" %}</h4> | ||||
|             </div> | ||||
|             <div class='col-sm-6'> | ||||
|                 <div class='btn-group float-right'> | ||||
|                     <button type='button' id='edit-notes' title='{% trans "Edit Notes" %}' class='btn btn-small btn-default'> | ||||
|                         <span class='fas fa-edit'>       | ||||
|                         </span> | ||||
|                     </button> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|     </div> | ||||
|     <div class='panel-content'> | ||||
|         {% if company.notes %} | ||||
|         {{ company.notes | markdownify }} | ||||
|         {% endif %} | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block js_ready %} | ||||
| {{ block.super }} | ||||
|  | ||||
|     $('#edit-notes').click(function() { | ||||
|         constructForm('{% url "api-company-detail" company.pk %}', { | ||||
|             fields: { | ||||
|                 notes: { | ||||
|                     multiline: true, | ||||
|                 } | ||||
|             }, | ||||
|             title: '{% trans "Edit Notes" %}', | ||||
|             reload: true, | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
|     loadStockTable($("#assigned-stock-table"), { | ||||
|         params: { | ||||
|             customer: {{ company.id }}, | ||||
|             part_detail: true, | ||||
|             location_detail: true, | ||||
|         }, | ||||
|         url: "{% url 'api-stock-list' %}", | ||||
|         filterKey: "customerstock", | ||||
|     }); | ||||
|  | ||||
|     {% if company.is_customer %} | ||||
|     loadSalesOrderTable("#sales-order-table", { | ||||
|         url: "{% url 'api-so-list' %}", | ||||
|         params: { | ||||
|             customer: {{ company.id }}, | ||||
|         } | ||||
|     }); | ||||
|  | ||||
|     $("#new-sales-order").click(function() { | ||||
|  | ||||
|         createSalesOrder({ | ||||
|             customer: {{ company.pk }}, | ||||
|         }); | ||||
|     }); | ||||
|     {% endif %} | ||||
|  | ||||
|     {% if company.is_supplier %} | ||||
|     loadPurchaseOrderTable("#purchase-order-table", { | ||||
|         url: "{% url 'api-po-list' %}", | ||||
|         params: { | ||||
|             supplier: {{ company.id }}, | ||||
|         } | ||||
|     }); | ||||
|  | ||||
|     function newOrder() { | ||||
|         createPurchaseOrder({ | ||||
|             supplier: {{ company.pk }}, | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     $("#company-order").click(function() { | ||||
|         newOrder(); | ||||
|     }); | ||||
|  | ||||
|     $("#company-order2").click(function() { | ||||
|         newOrder(); | ||||
|     }); | ||||
|  | ||||
|     {% endif %} | ||||
|  | ||||
|     loadStockTable($('#stock-table'), { | ||||
|         url: "{% url 'api-stock-list' %}", | ||||
|         params: { | ||||
|             company: {{ company.id }}, | ||||
|             part_detail: true, | ||||
|             supplier_part_detail: true, | ||||
|             location_detail: true, | ||||
|         }, | ||||
|         buttons: [ | ||||
|             '#stock-options', | ||||
|         ], | ||||
|         filterKey: "companystock", | ||||
|     }); | ||||
|  | ||||
|     $("#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 += "&supplier={{ company.id }}"; | ||||
|  | ||||
|                 location.href = url; | ||||
|             }, | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
|     {% if company.is_manufacturer %} | ||||
|  | ||||
|     $("#manufacturer-part-create").click(function () { | ||||
|  | ||||
|         constructForm('{% url "api-manufacturer-part-list" %}', { | ||||
|             fields: { | ||||
|                 part: {}, | ||||
|                 manufacturer: { | ||||
|                     value: {{ company.pk }}, | ||||
|                 }, | ||||
|                 MPN: { | ||||
|                     icon: 'fa-hashtag', | ||||
|                 }, | ||||
|                 description: {}, | ||||
|                 link: { | ||||
|                     icon: 'fa-link', | ||||
|                 }, | ||||
|             }, | ||||
|             method: 'POST', | ||||
|             title: '{% trans "Add Manufacturer Part" %}', | ||||
|             onSuccess: function() {  | ||||
|                 $("#part-table").bootstrapTable("refresh"); | ||||
|             } | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
|     loadManufacturerPartTable( | ||||
|         "#part-table", | ||||
|         "{% url 'api-manufacturer-part-list' %}", | ||||
|         { | ||||
|             params: { | ||||
|                 part_detail: true, | ||||
|                 manufacturer_detail: true, | ||||
|                 manufacturer: {{ company.id }}, | ||||
|             }, | ||||
|         } | ||||
|     ); | ||||
|  | ||||
|     linkButtonsToSelection($("#manufacturer-table"), ['#table-options']); | ||||
|  | ||||
|     $("#multi-part-delete").click(function() { | ||||
|         var selections = $("#part-table").bootstrapTable("getSelections"); | ||||
|  | ||||
|         deleteManufacturerParts(selections, { | ||||
|             onSuccess: function() {  | ||||
|                 $("#part-table").bootstrapTable("refresh"); | ||||
|             } | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
|     $("#multi-part-order").click(function() { | ||||
|         var selections = $("#part-table").bootstrapTable("getSelections"); | ||||
|  | ||||
|         var parts = []; | ||||
|  | ||||
|         selections.forEach(function(item) { | ||||
|             parts.push(item.part); | ||||
|         }); | ||||
|  | ||||
|         launchModalForm("/order/purchase-order/order-parts/", { | ||||
|             data: { | ||||
|                 parts: parts, | ||||
|             }, | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
|     {% endif %} | ||||
|  | ||||
|     {% if company.is_supplier %} | ||||
|  | ||||
|     $("#supplier-part-create").click(function () { | ||||
|         launchModalForm( | ||||
|             "{% url 'supplier-part-create' %}", | ||||
|             { | ||||
|                 data: { | ||||
|                     supplier: {{ company.id }}, | ||||
|                 }, | ||||
|                 reload: true, | ||||
|                 secondary: [ | ||||
|                     { | ||||
|                         field: 'part', | ||||
|                         label: '{% trans "New Part" %}', | ||||
|                         title: '{% trans "Create new Part" %}', | ||||
|                         url: "{% url 'part-create' %}" | ||||
|                     }, | ||||
|                     { | ||||
|                         field: 'supplier', | ||||
|                         label: "{% trans 'New Supplier' %}", | ||||
|                         title: "{% trans 'Create new Supplier' %}", | ||||
|                     }, | ||||
|                 ] | ||||
|             }); | ||||
|     }); | ||||
|  | ||||
|     loadSupplierPartTable( | ||||
|         "#supplier-part-table", | ||||
|         "{% url 'api-supplier-part-list' %}", | ||||
|         { | ||||
|             params: { | ||||
|                 part_detail: true, | ||||
|                 supplier_detail: true, | ||||
|                 manufacturer_detail: true, | ||||
|                 supplier: {{ company.id }}, | ||||
|             }, | ||||
|         } | ||||
|     ); | ||||
|  | ||||
|     {% endif %} | ||||
|  | ||||
|     $("#multi-part-delete").click(function() { | ||||
|         var selections = $("#part-table").bootstrapTable("getSelections"); | ||||
|  | ||||
|         var parts = []; | ||||
|  | ||||
|         selections.forEach(function(item) { | ||||
|             parts.push(item.pk); | ||||
|         }); | ||||
|  | ||||
|         var url = "{% url 'supplier-part-delete' %}" | ||||
|  | ||||
|         launchModalForm(url, { | ||||
|             data: { | ||||
|                 parts: parts, | ||||
|             }, | ||||
|             reload: true, | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
|     $("#multi-part-order").click(function() { | ||||
|         var selections = $("#part-table").bootstrapTable("getSelections"); | ||||
|  | ||||
|         var parts = []; | ||||
|  | ||||
|         selections.forEach(function(item) { | ||||
|             parts.push(item.part); | ||||
|         }); | ||||
|  | ||||
|         launchModalForm("/order/purchase-order/order-parts/", { | ||||
|             data: { | ||||
|                 parts: parts, | ||||
|             }, | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
|     attachNavCallbacks({ | ||||
|         name: 'company', | ||||
|         default: 'company-stock' | ||||
|     }); | ||||
|  | ||||
| {% endblock %} | ||||
| @@ -1,119 +0,0 @@ | ||||
| {% extends "company/company_base.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
| {% load inventree_extras %} | ||||
|  | ||||
| {% block menubar %} | ||||
| {% include 'company/navbar.html' with tab='manufacturer_parts' %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block heading %} | ||||
| {% trans "Manufacturer Parts" %} | ||||
| {% endblock %} | ||||
|  | ||||
|  | ||||
| {% block details %} | ||||
|  | ||||
| {% if roles.purchase_order.change %} | ||||
| <div id='button-toolbar'> | ||||
|     <div class='button-toolbar container-fluid'> | ||||
|         <div class='btn-group role='group'> | ||||
|             {% if roles.purchase_order.add %} | ||||
|                 <button class="btn btn-success" id='manufacturer-part-create' title='{% trans "Create new manufacturer part" %}'> | ||||
|                     <span class='fas fa-plus-circle'></span> {% trans "New Manufacturer Part" %} | ||||
|                 </button> | ||||
|             {% endif %} | ||||
|             <div class='btn-group'> | ||||
|                 <div class="dropdown" style="float: right;"> | ||||
|                     <button class="btn btn-primary dropdown-toggle" id='table-options', type="button" data-toggle="dropdown">{% trans "Options" %} | ||||
|                         <span class="caret"></span> | ||||
|                     </button> | ||||
|                     <ul class="dropdown-menu"> | ||||
|                         {% if roles.purchase_order.add %} | ||||
|                         <li><a href='#' id='multi-part-order' title='{% trans "Order parts" %}'>{% trans "Order Parts" %}</a></li> | ||||
|                         {% endif %} | ||||
|                         {% if roles.purchase_order.delete %} | ||||
|                         <li><a href='#' id='multi-part-delete' title='{% trans "Delete parts" %}'>{% trans "Delete Parts" %}</a></li> | ||||
|                         {% endif %} | ||||
|                     </ul> | ||||
|                 </div>   | ||||
|             </div> | ||||
|         </div> | ||||
|         <div class='filter-list' id='filter-list-supplier-part'> | ||||
|             <!-- Empty div (will be filled out with available BOM filters) --> | ||||
|         </div> | ||||
|     </div> | ||||
| </div> | ||||
| {% endif %} | ||||
| <table class='table table-striped table-condensed' id='part-table' data-toolbar='#button-toolbar'> | ||||
| </table> | ||||
|  | ||||
| {% endblock %} | ||||
| {% block js_ready %} | ||||
| {{ block.super }} | ||||
|  | ||||
|     $("#manufacturer-part-create").click(function () { | ||||
|  | ||||
|         constructForm('{% url "api-manufacturer-part-list" %}', { | ||||
|             fields: { | ||||
|                 part: {}, | ||||
|                 manufacturer: { | ||||
|                     value: {{ company.pk }}, | ||||
|                 }, | ||||
|                 MPN: { | ||||
|                     icon: 'fa-hashtag', | ||||
|                 }, | ||||
|                 description: {}, | ||||
|                 link: { | ||||
|                     icon: 'fa-link', | ||||
|                 }, | ||||
|             }, | ||||
|             method: 'POST', | ||||
|             title: '{% trans "Add Manufacturer Part" %}', | ||||
|             onSuccess: function() {  | ||||
|                 $("#part-table").bootstrapTable("refresh"); | ||||
|             } | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
|     loadManufacturerPartTable( | ||||
|         "#part-table", | ||||
|         "{% url 'api-manufacturer-part-list' %}", | ||||
|         { | ||||
|             params: { | ||||
|                 part_detail: true, | ||||
|                 manufacturer_detail: true, | ||||
|                 manufacturer: {{ company.id }}, | ||||
|             }, | ||||
|         } | ||||
|     ); | ||||
|  | ||||
|     linkButtonsToSelection($("#manufacturer-table"), ['#table-options']); | ||||
|  | ||||
|     $("#multi-part-delete").click(function() { | ||||
|         var selections = $("#part-table").bootstrapTable("getSelections"); | ||||
|  | ||||
|         deleteManufacturerParts(selections, { | ||||
|             onSuccess: function() {  | ||||
|                 $("#part-table").bootstrapTable("refresh"); | ||||
|             } | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
|     $("#multi-part-order").click(function() { | ||||
|         var selections = $("#part-table").bootstrapTable("getSelections"); | ||||
|  | ||||
|         var parts = []; | ||||
|  | ||||
|         selections.forEach(function(item) { | ||||
|             parts.push(item.part); | ||||
|         }); | ||||
|  | ||||
|         launchModalForm("/order/purchase-order/order-parts/", { | ||||
|             data: { | ||||
|                 parts: parts, | ||||
|             }, | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
| {% endblock %} | ||||
| @@ -1,49 +0,0 @@ | ||||
| {% extends "company/company_base.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
|  | ||||
| {% block menubar %} | ||||
| {% include "company/navbar.html" with tab='stock' %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block heading %} | ||||
| {% trans "Supplier Stock" %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block details %} | ||||
|  | ||||
| {% include "stock_table.html" %} | ||||
|  | ||||
| {% endblock %} | ||||
| {% block js_ready %} | ||||
| {{ block.super }} | ||||
|  | ||||
|     loadStockTable($('#stock-table'), { | ||||
|         url: "{% url 'api-stock-list' %}", | ||||
|         params: { | ||||
|             company: {{ company.id }}, | ||||
|             part_detail: true, | ||||
|             supplier_part_detail: true, | ||||
|             location_detail: true, | ||||
|         }, | ||||
|         buttons: [ | ||||
|             '#stock-options', | ||||
|         ], | ||||
|         filterKey: "companystock", | ||||
|     }); | ||||
|  | ||||
|     $("#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 += "&supplier={{ company.id }}"; | ||||
|  | ||||
|                 location.href = url; | ||||
|             }, | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
| {% endblock %} | ||||
| @@ -1,127 +0,0 @@ | ||||
| {% extends "company/company_base.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
| {% load inventree_extras %} | ||||
|  | ||||
| {% block menubar %} | ||||
| {% include 'company/navbar.html' with tab='supplier_parts' %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block heading %} | ||||
| {% trans "Supplier Parts" %} | ||||
| {% endblock %} | ||||
|  | ||||
|  | ||||
| {% block details %} | ||||
| {% if roles.purchase_order.change %} | ||||
| <div id='button-toolbar'> | ||||
|     <div class='button-toolbar container-fluid'> | ||||
|         <div class='btn-group' role='group'> | ||||
|             {% if roles.purchase_order.add %} | ||||
|                 <button class="btn btn-success" id='supplier-part-create' title='{% trans "Create new supplier part" %}'> | ||||
|                     <span class='fas fa-plus-circle'></span> {% trans "New Supplier Part" %} | ||||
|                 </button> | ||||
|             {% endif %} | ||||
|             <div class='btn-group'> | ||||
|                 <div class="dropdown" style="float: right;"> | ||||
|                     <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">{% trans "Options" %} | ||||
|                         <span class="caret"></span> | ||||
|                     </button> | ||||
|                     <ul class="dropdown-menu"> | ||||
|                         {% if roles.purchase_order.add %} | ||||
|                         <li><a href='#' id='multi-part-order' title='{% trans "Order parts" %}'>{% trans "Order Parts" %}</a></li> | ||||
|                         {% endif %} | ||||
|                         {% if roles.purchase_order.delete %} | ||||
|                         <li><a href='#' id='multi-part-delete' title='{% trans "Delete parts" %}'>{% trans "Delete Parts" %}</a></li> | ||||
|                         {% endif %} | ||||
|                     </ul> | ||||
|                 </div>   | ||||
|             </div> | ||||
|         </div> | ||||
|         <div class='filter-list' id='filter-list-supplier-part'> | ||||
|             <!-- Empty div (will be filled out with available BOM filters) --> | ||||
|         </div> | ||||
|     </div> | ||||
| </div> | ||||
| {% endif %} | ||||
|  | ||||
| <table class='table table-striped table-condensed' id='part-table' data-toolbar='#button-toolbar'> | ||||
| </table> | ||||
|  | ||||
| {% endblock %} | ||||
| {% block js_ready %} | ||||
| {{ block.super }} | ||||
|  | ||||
|     $("#supplier-part-create").click(function () { | ||||
|         launchModalForm( | ||||
|             "{% url 'supplier-part-create' %}", | ||||
|             { | ||||
|                 data: { | ||||
|                     supplier: {{ company.id }}, | ||||
|                 }, | ||||
|                 reload: true, | ||||
|                 secondary: [ | ||||
|                     { | ||||
|                         field: 'part', | ||||
|                         label: '{% trans "New Part" %}', | ||||
|                         title: '{% trans "Create new Part" %}', | ||||
|                         url: "{% url 'part-create' %}" | ||||
|                     }, | ||||
|                     { | ||||
|                         field: 'supplier', | ||||
|                         label: "{% trans 'New Supplier' %}", | ||||
|                         title: "{% trans 'Create new Supplier' %}", | ||||
|                     }, | ||||
|                 ] | ||||
|             }); | ||||
|     }); | ||||
|  | ||||
|     loadSupplierPartTable( | ||||
|         "#part-table", | ||||
|         "{% url 'api-supplier-part-list' %}", | ||||
|         { | ||||
|             params: { | ||||
|                 part_detail: true, | ||||
|                 supplier_detail: true, | ||||
|                 manufacturer_detail: true, | ||||
|                 supplier: {{ company.id }}, | ||||
|             }, | ||||
|         } | ||||
|     ); | ||||
|  | ||||
|     $("#multi-part-delete").click(function() { | ||||
|         var selections = $("#part-table").bootstrapTable("getSelections"); | ||||
|  | ||||
|         var parts = []; | ||||
|  | ||||
|         selections.forEach(function(item) { | ||||
|             parts.push(item.pk); | ||||
|         }); | ||||
|  | ||||
|         var url = "{% url 'supplier-part-delete' %}" | ||||
|  | ||||
|         launchModalForm(url, { | ||||
|             data: { | ||||
|                 parts: parts, | ||||
|             }, | ||||
|             reload: true, | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
|     $("#multi-part-order").click(function() { | ||||
|         var selections = $("#part-table").bootstrapTable("getSelections"); | ||||
|  | ||||
|         var parts = []; | ||||
|  | ||||
|         selections.forEach(function(item) { | ||||
|             parts.push(item.part); | ||||
|         }); | ||||
|  | ||||
|         launchModalForm("/order/purchase-order/order-parts/", { | ||||
|             data: { | ||||
|                 parts: parts, | ||||
|             }, | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
| {% endblock %} | ||||
							
								
								
									
										330
									
								
								InvenTree/company/templates/company/manufacturer_part.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										330
									
								
								InvenTree/company/templates/company/manufacturer_part.html
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,330 @@ | ||||
| {% extends "two_column.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
|  | ||||
| {% block page_title %} | ||||
| InvenTree | {% trans "Manufacturer Part" %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block menubar %} | ||||
| {% include "company/manufacturer_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 "Manufacturer 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.manufacturer.name }} - {{ part.MPN }}</p> | ||||
|  | ||||
| {% if roles.purchase_order.change %} | ||||
| <div class='btn-row'> | ||||
|     <div class='btn-group action-buttons' role='group'> | ||||
|         {% comment "for later" %} | ||||
|         {% 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 %} | ||||
|         {% endcomment %} | ||||
|         <button type='button' class='btn btn-default btn-glyph' id='edit-part' title='{% trans "Edit manufacturer 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 manufacturer part" %}'> | ||||
|             <span class='fas fa-trash-alt icon-red'/> | ||||
|         </button> | ||||
|         {% endif %} | ||||
|     </div> | ||||
| </div> | ||||
| {% endif %} | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block page_details %} | ||||
|  | ||||
| <h4>{% trans "Manufacturer 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-industry'></span></td> | ||||
|             <td>{% trans "Manufacturer" %}</td> | ||||
|             <td><a href="{% url 'company-detail' part.manufacturer.id %}">{{ part.manufacturer.name }}</a>{% include "clip.html"%}</td></tr> | ||||
|         <tr> | ||||
|             <td><span class='fas fa-hashtag'></span></td> | ||||
|             <td>{% trans "MPN" %}</td> | ||||
|             <td>{{ part.MPN }}{% include "clip.html"%}</td> | ||||
|         </tr> | ||||
| </table> | ||||
| {% endblock %} | ||||
|  | ||||
| {% block page_content %} | ||||
|  | ||||
| <div class='panel panel-default panel-inventree panel-hidden' id='panel-supplier-parts'> | ||||
|     <div class='panel-heading'> | ||||
|         <h4>{% trans "Suppliers" %}</h4> | ||||
|     </div> | ||||
|     <div class='panel-content'> | ||||
|         <div id='supplier-button-toolbar'> | ||||
|             <div class='btn-group'> | ||||
|                 <button class="btn btn-success" id='supplier-create'> | ||||
|                     <span class='fas fa-plus-circle'></span> {% trans "New Supplier Part" %} | ||||
|                 </button> | ||||
|                 <div id='opt-dropdown' class="btn-group"> | ||||
|                     <button id='supplier-part-options' class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">{% trans "Options" %}<span class="caret"></span></button> | ||||
|                     <ul class="dropdown-menu"> | ||||
|                         <li><a href='#' id='supplier-part-delete' title='{% trans "Delete supplier parts" %}'>{% trans "Delete" %}</a></li> | ||||
|                     </ul> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|          | ||||
|         <table class="table table-striped table-condensed" id='supplier-table' data-toolbar='#supplier-button-toolbar'> | ||||
|         </table> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| <div class='panel panel-default panel-inventree panel-hidden' id='panel-parameters'> | ||||
|     <div class='panel-heading'> | ||||
|         <h4>{% trans "Parameters" %}</h4> | ||||
|     </div> | ||||
|     <div class='panel-content'> | ||||
|         <div id='parameter-toolbar'> | ||||
|             <div class='btn-group'> | ||||
|                 <button class='btn btn-success' id='parameter-create'> | ||||
|                     <span class='fas fa-plus-circle'></span> {% trans "New Parameter" %} | ||||
|                 </button> | ||||
|                 <div id='opt-dropdown' class="btn-group"> | ||||
|                     <button id='parameter-options' class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">{% trans "Options" %}<span class="caret"></span></button> | ||||
|                     <ul class="dropdown-menu"> | ||||
|                         <li><a href='#' id='multi-parameter-delete' title='{% trans "Delete parameters" %}'>{% trans "Delete" %}</a></li> | ||||
|                     </ul> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|  | ||||
|         <table class='table table-striped table-condensed' id='parameter-table' data-toolbar='#parameter-toolbar'></table> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
|  | ||||
| {% block js_ready %} | ||||
| {{ block.super }} | ||||
|  | ||||
| enableNavbar({ | ||||
|     label: 'manufacturer-part', | ||||
|     toggleId: '#manufacturer-part-menu-toggle' | ||||
| }); | ||||
|  | ||||
| function reloadParameters() { | ||||
|     $("#parameter-table").bootstrapTable("refresh"); | ||||
| } | ||||
|  | ||||
| $('#parameter-create').click(function() { | ||||
|  | ||||
|     constructForm('{% url "api-manufacturer-part-parameter-list" %}', { | ||||
|         method: 'POST', | ||||
|         fields: { | ||||
|             name: {}, | ||||
|             value: {}, | ||||
|             units: {}, | ||||
|             manufacturer_part: { | ||||
|                 value: {{ part.pk }}, | ||||
|                 hidden: true, | ||||
|             } | ||||
|         }, | ||||
|         title: '{% trans "Add Parameter" %}', | ||||
|         onSuccess: reloadParameters | ||||
|     }); | ||||
| }); | ||||
|  | ||||
| $('#supplier-create').click(function () { | ||||
|     launchModalForm( | ||||
|         "{% url 'supplier-part-create' %}", | ||||
|         { | ||||
|             reload: true, | ||||
|             data: { | ||||
|                 manufacturer_part: {{ part.id }} | ||||
|             }, | ||||
|             secondary: [ | ||||
|                 { | ||||
|                     field: 'supplier', | ||||
|                     label: '{% trans "New Supplier" %}', | ||||
|                     title: '{% trans "Create new supplier" %}', | ||||
|                 }, | ||||
|             ] | ||||
|         }); | ||||
| }); | ||||
|  | ||||
| $("#supplier-part-delete").click(function() { | ||||
|  | ||||
|     var selections = $("#supplier-table").bootstrapTable("getSelections"); | ||||
|  | ||||
|     var parts = []; | ||||
|  | ||||
|     selections.forEach(function(item) { | ||||
|         parts.push(item.pk); | ||||
|     }); | ||||
|  | ||||
|     launchModalForm("{% url 'supplier-part-delete' %}", { | ||||
|         data: { | ||||
|             parts: parts, | ||||
|         }, | ||||
|         reload: true, | ||||
|     }); | ||||
| }); | ||||
|  | ||||
| $("#multi-parameter-delete").click(function() { | ||||
|  | ||||
|     var selections = $("#parameter-table").bootstrapTable("getSelections"); | ||||
|  | ||||
|     var text = ` | ||||
|     <div class ='alert alert-block alert-danger'> | ||||
|         <p>{% trans "Selected parameters will be deleted" %}:</p> | ||||
|         <ul>`; | ||||
|  | ||||
|     selections.forEach(function(item) { | ||||
|         text += `<li>${item.name} - <i>${item.value}</i></li>`; | ||||
|     }); | ||||
|  | ||||
|     text += ` | ||||
|         </ul> | ||||
|     </div>`; | ||||
|      | ||||
|     showQuestionDialog( | ||||
|         '{% trans "Delete Parameters" %}', | ||||
|         text, | ||||
|         { | ||||
|             accept_text: '{% trans "Delete" %}', | ||||
|             accept: function() { | ||||
|                 // Delete each parameter via the API | ||||
|                 var requests = []; | ||||
|  | ||||
|                 selections.forEach(function(item) { | ||||
|                     var url = `/api/company/part/manufacturer/parameter/${item.pk}/`; | ||||
|  | ||||
|                     requests.push(inventreeDelete(url)); | ||||
|                 }); | ||||
|  | ||||
|                 $.when.apply($, requests).then(function() { | ||||
|                     $('#parameter-table').bootstrapTable('refresh'); | ||||
|                 }); | ||||
|             } | ||||
|         } | ||||
|     ); | ||||
| }); | ||||
|  | ||||
| loadSupplierPartTable( | ||||
|     "#supplier-table", | ||||
|     "{% url 'api-supplier-part-list' %}", | ||||
|     { | ||||
|         params: { | ||||
|             part: {{ part.part.id }}, | ||||
|             manufacturer_part: {{ part.id }}, | ||||
|             part_detail: false, | ||||
|             supplier_detail: true, | ||||
|             manufacturer_detail: false, | ||||
|         }, | ||||
|     } | ||||
| ); | ||||
|  | ||||
| loadManufacturerPartParameterTable( | ||||
|     "#parameter-table", | ||||
|     "{% url 'api-manufacturer-part-parameter-list' %}", | ||||
|     { | ||||
|         params: { | ||||
|             manufacturer_part: {{ part.id }}, | ||||
|         } | ||||
|     } | ||||
| ); | ||||
|  | ||||
| linkButtonsToSelection($("#supplier-table"), ['#supplier-part-options']); | ||||
|  | ||||
| linkButtonsToSelection($("#parameter-table"), ['#parameter-options']); | ||||
|  | ||||
| $('#order-part, #order-part2').click(function() { | ||||
|     launchModalForm( | ||||
|         "{% url 'order-parts' %}", | ||||
|         { | ||||
|             data: { | ||||
|                 part: {{ part.part.id }}, | ||||
|             }, | ||||
|             reload: true, | ||||
|         }, | ||||
|     ); | ||||
| }); | ||||
|  | ||||
| $('#edit-part').click(function () { | ||||
|  | ||||
|     constructForm('{% url "api-manufacturer-part-detail" part.pk %}', { | ||||
|         fields: { | ||||
|             part: {}, | ||||
|             manufacturer: {}, | ||||
|             MPN: { | ||||
|                 icon: 'fa-hashtag', | ||||
|             }, | ||||
|             description: {}, | ||||
|             link: { | ||||
|                 icon: 'fa-link', | ||||
|             }, | ||||
|         }, | ||||
|         title: '{% trans "Edit Manufacturer Part" %}', | ||||
|         reload: true, | ||||
|     }); | ||||
| }); | ||||
|  | ||||
| $('#delete-part').click(function() { | ||||
|  | ||||
|     constructForm('{% url "api-manufacturer-part-detail" part.pk %}', { | ||||
|         method: 'DELETE', | ||||
|         title: '{% trans "Delete Manufacturer Part" %}', | ||||
|         redirect: "{% url 'company-detail' part.manufacturer.id %}", | ||||
|     }); | ||||
| }); | ||||
|  | ||||
| attachNavCallbacks({ | ||||
|     name: 'manufacturerpart', | ||||
|     default: 'parameters' | ||||
| }); | ||||
|  | ||||
| {% endblock %} | ||||
| @@ -1,143 +0,0 @@ | ||||
| {% extends "two_column.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
|  | ||||
| {% block page_title %} | ||||
| InvenTree | {% trans "Manufacturer 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 "Manufacturer 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.manufacturer.name }} - {{ part.MPN }}</p> | ||||
|  | ||||
| {% if roles.purchase_order.change %} | ||||
| <div class='btn-row'> | ||||
|     <div class='btn-group action-buttons' role='group'> | ||||
|         {% comment "for later" %} | ||||
|         {% 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 %} | ||||
|         {% endcomment %} | ||||
|         <button type='button' class='btn btn-default btn-glyph' id='edit-part' title='{% trans "Edit manufacturer 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 manufacturer part" %}'> | ||||
|             <span class='fas fa-trash-alt icon-red'/> | ||||
|         </button> | ||||
|         {% endif %} | ||||
|     </div> | ||||
| </div> | ||||
| {% endif %} | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block page_details %} | ||||
|  | ||||
| <h4>{% trans "Manufacturer 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-suppliers' part.part.id %}">{{ 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-industry'></span></td> | ||||
|             <td>{% trans "Manufacturer" %}</td> | ||||
|             <td><a href="{% url 'company-detail-manufacturer-parts' part.manufacturer.id %}">{{ part.manufacturer.name }}</a>{% include "clip.html"%}</td></tr> | ||||
|         <tr> | ||||
|             <td><span class='fas fa-hashtag'></span></td> | ||||
|             <td>{% trans "MPN" %}</td> | ||||
|             <td>{{ part.MPN }}{% include "clip.html"%}</td> | ||||
|         </tr> | ||||
| </table> | ||||
| {% endblock %} | ||||
|  | ||||
| {% block js_ready %} | ||||
| {{ block.super }} | ||||
|  | ||||
| enableNavbar({ | ||||
|     label: 'manufacturer-part', | ||||
|     toggleId: '#manufacturer-part-menu-toggle' | ||||
| }) | ||||
|  | ||||
| $('#order-part, #order-part2').click(function() { | ||||
|     launchModalForm( | ||||
|         "{% url 'order-parts' %}", | ||||
|         { | ||||
|             data: { | ||||
|                 part: {{ part.part.id }}, | ||||
|             }, | ||||
|             reload: true, | ||||
|         }, | ||||
|     ); | ||||
| }); | ||||
|  | ||||
| $('#edit-part').click(function () { | ||||
|  | ||||
|     constructForm('{% url "api-manufacturer-part-detail" part.pk %}', { | ||||
|         fields: { | ||||
|             part: {}, | ||||
|             manufacturer: {}, | ||||
|             MPN: { | ||||
|                 icon: 'fa-hashtag', | ||||
|             }, | ||||
|             description: {}, | ||||
|             link: { | ||||
|                 icon: 'fa-link', | ||||
|             }, | ||||
|         }, | ||||
|         title: '{% trans "Edit Manufacturer Part" %}', | ||||
|         reload: true, | ||||
|     }); | ||||
| }); | ||||
|  | ||||
| $('#delete-part').click(function() { | ||||
|  | ||||
|     constructForm('{% url "api-manufacturer-part-detail" part.pk %}', { | ||||
|         method: 'DELETE', | ||||
|         title: '{% trans "Delete Manufacturer Part" %}', | ||||
|         redirect: "{% url 'company-detail-manufacturer-parts' part.manufacturer.id %}", | ||||
|     }); | ||||
| }); | ||||
|  | ||||
| {% endblock %} | ||||
| @@ -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 %} | ||||
| @@ -1,38 +0,0 @@ | ||||
| {% extends "company/manufacturer_part_base.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
|  | ||||
| {% block menubar %} | ||||
| {% include "company/manufacturer_part_navbar.html" with tab='details' %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block heading %} | ||||
| {% trans "Manufacturer 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-suppliers' part.part.id %}">{{ part.part.full_name }}</a> | ||||
|             {% endif %} | ||||
|         </td> | ||||
|     </tr> | ||||
|     <tr><td>{% trans "Manufacturer" %}</td><td><a href="{% url 'company-detail-manufacturer-parts' part.manufacturer.id %}">{{ part.manufacturer.name }}</a></td></tr> | ||||
|     <tr><td>{% trans "MPN" %}</td><td>{{ part.MPN }}</tr></tr> | ||||
| {% if part.link %} | ||||
|     <tr><td>{% trans "External Link" %}</td><td><a href="{{ part.link }}">{{ part.link }}</a></td></tr> | ||||
| {% endif %} | ||||
| </table> | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block js_ready %} | ||||
| {{ block.super }} | ||||
|  | ||||
|  | ||||
| {% endblock %} | ||||
| @@ -8,8 +8,15 @@ | ||||
|         </a> | ||||
|     </li> | ||||
|  | ||||
|     <li class='list-group-item {% if tab == "suppliers" %}active{% endif %}' title='{% trans "Supplier Parts" %}'> | ||||
|         <a href='{% url "manufacturer-part-suppliers" part.id %}'> | ||||
|     <li class='list-group-item' title='{% trans "Parameters" %}'> | ||||
|         <a href='#' id='select-parameters' class='nav-toggle'> | ||||
|             <span class='fas fa-th-list sidebar-icon'></span> | ||||
|             {% trans "Parameters" %} | ||||
|         </a> | ||||
|     </li> | ||||
|  | ||||
|     <li class='list-group-item' title='{% trans "Supplier Parts" %}'> | ||||
|         <a href='#' id='select-supplier-parts' class='nav-toggle'> | ||||
|             <span class='fas fa-building sidebar-icon'></span> | ||||
|             {% trans "Suppliers" %} | ||||
|         </a> | ||||
| @@ -22,7 +29,7 @@ | ||||
|             {% trans "Stock" %} | ||||
|         </a> | ||||
|     </li> | ||||
|  | ||||
|      | ||||
|     <li class='list-group-item {% if tab == "orders" %}active{% endif %}' title='{% trans "Manufacturer Part Orders" %}'> | ||||
|         <a href='{% url "manufacturer-part-orders" part.id %}'> | ||||
|             <span class='fas fa-shopping-cart sidebar-icon'></span> | ||||
|   | ||||
| @@ -1,187 +0,0 @@ | ||||
| {% extends "company/manufacturer_part_base.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
|  | ||||
| {% block menubar %} | ||||
| {% include "company/manufacturer_part_navbar.html" with tab='suppliers' %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block heading %} | ||||
| {% trans "Suppliers" %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block details %} | ||||
| <div id='button-toolbar'> | ||||
|     <div class='btn-group'> | ||||
|         <button class="btn btn-success" id='supplier-create'> | ||||
|             <span class='fas fa-plus-circle'></span> {% trans "New Supplier Part" %} | ||||
|         </button> | ||||
|         <div id='opt-dropdown' class="btn-group"> | ||||
|             <button id='supplier-part-options' class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">{% trans "Options" %}<span class="caret"></span></button> | ||||
|             <ul class="dropdown-menu"> | ||||
|                 <li><a href='#' id='supplier-part-delete' title='{% trans "Delete supplier parts" %}'>{% trans "Delete" %}</a></li> | ||||
|             </ul> | ||||
|         </div> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| <table class="table table-striped table-condensed" id='supplier-table' data-toolbar='#button-toolbar'> | ||||
| </table> | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block post_content_panels %} | ||||
|  | ||||
| <div class='panel panel-default panel-inventree'> | ||||
|     <div class='panel-heading'> | ||||
|         <h4>{% trans "Parameters" %}</h4> | ||||
|     </div> | ||||
|     <div class='panel-content'> | ||||
|         <div id='parameter-toolbar'> | ||||
|             <div class='btn-group'> | ||||
|                 <button class='btn btn-success' id='parameter-create'> | ||||
|                     <span class='fas fa-plus-circle'></span> {% trans "New Parameter" %} | ||||
|                 </button> | ||||
|                 <div id='opt-dropdown' class="btn-group"> | ||||
|                     <button id='parameter-options' class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">{% trans "Options" %}<span class="caret"></span></button> | ||||
|                     <ul class="dropdown-menu"> | ||||
|                         <li><a href='#' id='multi-parameter-delete' title='{% trans "Delete parameters" %}'>{% trans "Delete" %}</a></li> | ||||
|                     </ul> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|  | ||||
|         <table class='table table-striped table-condensed' id='parameter-table' data-toolbar='#parameter-toolbar'></table> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block js_ready %} | ||||
| {{ block.super }} | ||||
|  | ||||
| function reloadParameters() { | ||||
|     $("#parameter-table").bootstrapTable("refresh"); | ||||
| } | ||||
|  | ||||
| $('#parameter-create').click(function() { | ||||
|  | ||||
|     constructForm('{% url "api-manufacturer-part-parameter-list" %}', { | ||||
|         method: 'POST', | ||||
|         fields: { | ||||
|             name: {}, | ||||
|             value: {}, | ||||
|             units: {}, | ||||
|             manufacturer_part: { | ||||
|                 value: {{ part.pk }}, | ||||
|                 hidden: true, | ||||
|             } | ||||
|         }, | ||||
|         title: '{% trans "Add Parameter" %}', | ||||
|         onSuccess: reloadParameters | ||||
|     }); | ||||
| }); | ||||
|  | ||||
| $('#supplier-create').click(function () { | ||||
|     launchModalForm( | ||||
|         "{% url 'supplier-part-create' %}", | ||||
|         { | ||||
|             reload: true, | ||||
|             data: { | ||||
|                 manufacturer_part: {{ part.id }} | ||||
|             }, | ||||
|             secondary: [ | ||||
|                 { | ||||
|                     field: 'supplier', | ||||
|                     label: '{% trans "New Supplier" %}', | ||||
|                     title: '{% trans "Create new supplier" %}', | ||||
|                 }, | ||||
|             ] | ||||
|         }); | ||||
| }); | ||||
|  | ||||
| $("#supplier-part-delete").click(function() { | ||||
|  | ||||
|     var selections = $("#supplier-table").bootstrapTable("getSelections"); | ||||
|  | ||||
|     var parts = []; | ||||
|  | ||||
|     selections.forEach(function(item) { | ||||
|         parts.push(item.pk); | ||||
|     }); | ||||
|  | ||||
|     launchModalForm("{% url 'supplier-part-delete' %}", { | ||||
|         data: { | ||||
|             parts: parts, | ||||
|         }, | ||||
|         reload: true, | ||||
|     }); | ||||
| }); | ||||
|  | ||||
| $("#multi-parameter-delete").click(function() { | ||||
|  | ||||
|     var selections = $("#parameter-table").bootstrapTable("getSelections"); | ||||
|  | ||||
|     var text = ` | ||||
|     <div class ='alert alert-block alert-danger'> | ||||
|         <p>{% trans "Selected parameters will be deleted" %}:</p> | ||||
|         <ul>`; | ||||
|  | ||||
|     selections.forEach(function(item) { | ||||
|         text += `<li>${item.name} - <i>${item.value}</i></li>`; | ||||
|     }); | ||||
|  | ||||
|     text += ` | ||||
|         </ul> | ||||
|     </div>`; | ||||
|      | ||||
|     showQuestionDialog( | ||||
|         '{% trans "Delete Parameters" %}', | ||||
|         text, | ||||
|         { | ||||
|             accept_text: '{% trans "Delete" %}', | ||||
|             accept: function() { | ||||
|                 // Delete each parameter via the API | ||||
|                 var requests = []; | ||||
|  | ||||
|                 selections.forEach(function(item) { | ||||
|                     var url = `/api/company/part/manufacturer/parameter/${item.pk}/`; | ||||
|  | ||||
|                     requests.push(inventreeDelete(url)); | ||||
|                 }); | ||||
|  | ||||
|                 $.when.apply($, requests).then(function() { | ||||
|                     $('#parameter-table').bootstrapTable('refresh'); | ||||
|                 }); | ||||
|             } | ||||
|         } | ||||
|     ); | ||||
| }); | ||||
|  | ||||
| loadSupplierPartTable( | ||||
|     "#supplier-table", | ||||
|     "{% url 'api-supplier-part-list' %}", | ||||
|     { | ||||
|         params: { | ||||
|             part: {{ part.part.id }}, | ||||
|             manufacturer_part: {{ part.id }}, | ||||
|             part_detail: false, | ||||
|             supplier_detail: true, | ||||
|             manufacturer_detail: false, | ||||
|         }, | ||||
|     } | ||||
| ); | ||||
|  | ||||
| loadManufacturerPartParameterTable( | ||||
|     "#parameter-table", | ||||
|     "{% url 'api-manufacturer-part-parameter-list' %}", | ||||
|     { | ||||
|         params: { | ||||
|             manufacturer_part: {{ part.id }}, | ||||
|         } | ||||
|     } | ||||
| ); | ||||
|  | ||||
| linkButtonsToSelection($("#supplier-table"), ['#supplier-part-options']) | ||||
| linkButtonsToSelection($("#parameter-table"), ['#parameter-options']) | ||||
| {% endblock %} | ||||
| @@ -9,16 +9,9 @@ | ||||
|         </a> | ||||
|     </li> | ||||
|  | ||||
|     <li class='list-group-item {% if tab == "details" %}active{% endif %}' title='{% trans "Company Details" %}'> | ||||
|         <a href='{% url "company-detail" company.id %}'> | ||||
|             <span class='fas fa-info-circle sidebar-icon'></span> | ||||
|             {% trans "Details" %} | ||||
|         </a> | ||||
|     </li> | ||||
|  | ||||
|     {% if company.is_manufacturer %} | ||||
|     <li class='list-group-item {% if tab == "manufacturer_parts" %}active{% endif %}' title='{% trans "Manufactured Parts" %}'> | ||||
|         <a href='{% url "company-detail-manufacturer-parts" company.id %}'> | ||||
|     <li class='list-group-item' title='{% trans "Manufactured Parts" %}'> | ||||
|         <a href='#' id='select-manufacturer-parts' class='nav-toggle'> | ||||
|             <span class='fas fa-industry sidebar-icon'></span> | ||||
|             {% trans "Manufactured Parts" %} | ||||
|         </a> | ||||
| @@ -26,8 +19,8 @@ | ||||
|     {% endif %} | ||||
|  | ||||
|     {% if company.is_supplier or company.is_manufacturer %} | ||||
|     <li class='list-group-item {% if tab == "supplier_parts" %}active{% endif %}' title='{% trans "Supplied Parts" %}'> | ||||
|         <a href='{% url "company-detail-supplier-parts" company.id %}'> | ||||
|     <li class='list-group-item' title='{% trans "Supplied Parts" %}'> | ||||
|         <a href='#' id='select-supplier-parts' class='nav-toggle'> | ||||
|             <span class='fas fa-building sidebar-icon'></span> | ||||
|             {% trans "Supplied Parts" %} | ||||
|         </a> | ||||
| @@ -35,8 +28,8 @@ | ||||
|     {% endif %} | ||||
|  | ||||
|     {% if company.is_manufacturer or company.is_supplier %} | ||||
|     <li class='list-group-item {% if tab == "stock" %}active{% endif %}' title='{% trans "Stock Items" %}'> | ||||
|         <a href='{% url "company-detail-stock" company.id %}'> | ||||
|     <li class='list-group-item' title='{% trans "Stock Items" %}'> | ||||
|         <a href='#' id='select-company-stock' class='nav-toggle'> | ||||
|             <span class='fas fa-boxes sidebar-icon'></span> | ||||
|             {% trans "Stock" %} | ||||
|         </a> | ||||
| @@ -44,8 +37,8 @@ | ||||
|     {% endif %} | ||||
|  | ||||
|     {% if company.is_supplier %} | ||||
|     <li class='list-group-item {% if tab == "po" %}active{% endif %}' title='{% trans "Sales Orders" %}'> | ||||
|         <a href='{% url "company-detail-purchase-orders" company.id %}'> | ||||
|     <li class='list-group-item' title='{% trans "Purchase Orders" %}'> | ||||
|         <a href='#' id='select-purchase-orders' class='nav-toggle'> | ||||
|             <span class='fas fa-shopping-cart sidebar-icon'></span> | ||||
|             {% trans "Purchase Orders" %} | ||||
|         </a> | ||||
| @@ -53,22 +46,22 @@ | ||||
|     {% endif %} | ||||
|  | ||||
|     {% if company.is_customer %} | ||||
|     <li class='list-group-item {% if tab == "so" %}active{% endif %}' title='{% trans "Sales Orders" %}'> | ||||
|         <a href='{% url "company-detail-sales-orders" company.id %}'> | ||||
|     <li class='list-group-item' title='{% trans "Sales Orders" %}'> | ||||
|         <a href='#' id='select-sales-orders' class='nav-toggle'> | ||||
|             <span class='fas fa-truck sidebar-icon'></span> | ||||
|             {% trans "Sales Orders" %} | ||||
|         </a> | ||||
|     </li> | ||||
|     <li class='list-group-item {% if tab == "assigned" %}active{% endif %}' title='{% trans "Assigned Stock" %}'> | ||||
|         <a href='{% url "company-detail-assigned-stock" company.id %}'> | ||||
|     <li class='list-group-item' title='{% trans "Assigned Stock" %}'> | ||||
|         <a href='#' id='select-assigned-stock' class='nav-toggle'> | ||||
|             <span class='fas fa-sign-out-alt sidebar-icon'></span> | ||||
|             {% trans "Assigned Stock" %} | ||||
|         </a> | ||||
|     </li> | ||||
|     {% endif %} | ||||
|  | ||||
|     <li class='list-group-item {% if tab == "notes" %}active{% endif %}' titl='{% trans "Notes" %}'> | ||||
|         <a href='{% url "company-notes" company.id %}'> | ||||
|     <li class='list-group-item' title='{% trans "Notes" %}'> | ||||
|         <a href='#' id='select-company-notes' class='nav-toggle'> | ||||
|             <span class='fas fa-clipboard sidebar-icon'></span> | ||||
|             {% trans "Notes" %} | ||||
|         </a> | ||||
|   | ||||
| @@ -1,47 +0,0 @@ | ||||
| {% extends "company/company_base.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
| {% load markdownify %} | ||||
|  | ||||
| {% block menubar %} | ||||
| {% include 'company/navbar.html' with tab='notes' %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block heading %} | ||||
| {% trans "Company Notes" %} | ||||
| {% if not editing %} | ||||
| <button title='{% trans "Edit notes" %}' class='btn btn-default' id='edit-notes'><span class='fas fa-edit'></span></button> | ||||
| {% endif %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block details %} | ||||
| {% if editing %} | ||||
| <form method='POST'> | ||||
|     {% csrf_token %} | ||||
|  | ||||
|     {{ form }} | ||||
|     <hr> | ||||
|     <button type="submit" class='btn btn-default'>{% trans "Save" %}</button> | ||||
|  | ||||
| </form> | ||||
|  | ||||
| {{ form.media }} | ||||
|  | ||||
| {% else %} | ||||
|  | ||||
| {{ company.notes | markdownify }} | ||||
| {% endif %} | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block js_ready %} | ||||
| {{ block.super }} | ||||
|  | ||||
| {% if editing %} | ||||
| {% else %} | ||||
| $("#edit-notes").click(function() { | ||||
|     location.href = "{% url 'company-notes' company.id %}?edit=1"; | ||||
| }); | ||||
| {% endif %} | ||||
|  | ||||
| {% endblock %} | ||||
| @@ -1,56 +0,0 @@ | ||||
| {% extends "company/company_base.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
|  | ||||
| {% block menubar %} | ||||
| {% include 'company/navbar.html' with tab='po' %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block heading %} | ||||
| {% trans "Purchase Orders" %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block details %} | ||||
|  | ||||
| {% if roles.purchase_order.add %} | ||||
| <div id='button-bar'> | ||||
|     <div class='button-toolbar container-fluid' style='float: right;'> | ||||
|         <button class='btn btn-primary' type='button' id='company-order2' title='{% trans "Create new purchase order" %}'> | ||||
|             <span class='fas fa-plus-circle'></span> {% trans "New Purchase Order" %}</button> | ||||
|         <div class='filter-list' id='filter-list-purchaseorder'> | ||||
|             <!-- Empty div --> | ||||
|         </div> | ||||
|     </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' %}", | ||||
|         params: { | ||||
|             supplier: {{ company.id }}, | ||||
|         } | ||||
|     }); | ||||
|  | ||||
|     function newOrder() { | ||||
|         createPurchaseOrder({ | ||||
|             supplier: {{ company.pk }}, | ||||
|         }); | ||||
|     } | ||||
|  | ||||
|     $("#company-order").click(function() { | ||||
|         newOrder(); | ||||
|     }); | ||||
|  | ||||
|     $("#company-order2").click(function() { | ||||
|         newOrder(); | ||||
|     }); | ||||
|  | ||||
| {% endblock %} | ||||
| @@ -1,51 +0,0 @@ | ||||
| {% extends "company/company_base.html" %} | ||||
| {% load static %} | ||||
| {% load i18n %} | ||||
|  | ||||
|  | ||||
| {% block menubar %} | ||||
| {% include 'company/navbar.html' with tab='so' %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block heading %} | ||||
| {% trans "Sales Orders" %} | ||||
| {% endblock %} | ||||
|  | ||||
| {% block details %} | ||||
|  | ||||
| {% if roles.sales_order.add %} | ||||
| <div id='button-bar'> | ||||
|     <div class='button-toolbar container-fluid' style='float: right;'> | ||||
|         <button class='btn btn-primary' type='button' id='new-sales-order' title='{% trans "Create new sales order" %}'> | ||||
|             <div class='fas fa-plus-circle'></div> {% trans "New Sales Order" %} | ||||
|         </button> | ||||
|         <div class='filter-list' id='filter-list-salesorder'> | ||||
|             <!-- Empty div --> | ||||
|         </div> | ||||
|     </div> | ||||
| </div> | ||||
| {% endif %} | ||||
|  | ||||
| <table class='table table-striped table-condensed po-table' id='sales-order-table' data-toolbar='#button-bar'> | ||||
| </table> | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
| {% block js_ready %} | ||||
| {{ block.super }} | ||||
|  | ||||
|     loadSalesOrderTable("#sales-order-table", { | ||||
|         url: "{% url 'api-so-list' %}", | ||||
|         params: { | ||||
|             customer: {{ company.id }}, | ||||
|         } | ||||
|     }); | ||||
|  | ||||
|     $("#new-sales-order").click(function() { | ||||
|  | ||||
|         createSalesOrder({ | ||||
|             customer: {{ company.pk }}, | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
| {% 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-suppliers' part.part.id %}">{{ 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-supplier-parts' 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-manufacturer-parts' 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-supplier-parts' 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-suppliers' part.part.id %}">{{ part.part.full_name }}</a> | ||||
|             {% endif %} | ||||
|         </td> | ||||
|     </tr> | ||||
|     <tr><td>{% trans "Supplier" %}</td><td><a href="{% url 'company-detail-supplier-parts' 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 %} | ||||
| @@ -8,15 +8,6 @@ from . import views | ||||
|  | ||||
|  | ||||
| company_detail_urls = [ | ||||
|     # url(r'orders/?', views.CompanyDetail.as_view(template_name='company/orders.html'), name='company-detail-orders'), | ||||
|  | ||||
|     url(r'^supplier-parts/', views.CompanyDetail.as_view(template_name='company/detail_supplier_part.html'), name='company-detail-supplier-parts'), | ||||
|     url(r'^manufacturer-parts/', views.CompanyDetail.as_view(template_name='company/detail_manufacturer_part.html'), name='company-detail-manufacturer-parts'), | ||||
|     url(r'^stock/', views.CompanyDetail.as_view(template_name='company/detail_stock.html'), name='company-detail-stock'), | ||||
|     url(r'^purchase-orders/', views.CompanyDetail.as_view(template_name='company/purchase_orders.html'), name='company-detail-purchase-orders'), | ||||
|     url(r'^assigned-stock/', views.CompanyDetail.as_view(template_name='company/assigned_stock.html'), name='company-detail-assigned-stock'), | ||||
|     url(r'^sales-orders/', views.CompanyDetail.as_view(template_name='company/sales_orders.html'), name='company-detail-sales-orders'), | ||||
|     url(r'^notes/', views.CompanyNotes.as_view(), name='company-notes'), | ||||
|  | ||||
|     url(r'^thumb-download/', views.CompanyImageDownloadFromURL.as_view(), name='company-image-download'), | ||||
|  | ||||
| @@ -40,20 +31,14 @@ company_urls = [ | ||||
| manufacturer_part_urls = [ | ||||
|      | ||||
|     url(r'^(?P<pk>\d+)/', include([ | ||||
|         url(r'^suppliers/', views.ManufacturerPartDetail.as_view(template_name='company/manufacturer_part_suppliers.html'), name='manufacturer-part-suppliers'), | ||||
|         url('^.*$', views.ManufacturerPartDetail.as_view(template_name='company/manufacturer_part_suppliers.html'), name='manufacturer-part-detail'), | ||||
|         url('^.*$', views.ManufacturerPartDetail.as_view(template_name='company/manufacturer_part.html'), name='manufacturer-part-detail'), | ||||
|     ])), | ||||
| ] | ||||
|  | ||||
| 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 = [ | ||||
|   | ||||
| @@ -7,7 +7,7 @@ Django views for interacting with Company app | ||||
| from __future__ import unicode_literals | ||||
|  | ||||
| from django.utils.translation import ugettext_lazy as _ | ||||
| from django.views.generic import DetailView, ListView, UpdateView | ||||
| from django.views.generic import DetailView, ListView | ||||
|  | ||||
| from django.urls import reverse | ||||
| from django.forms import HiddenInput | ||||
| @@ -113,28 +113,6 @@ class CompanyIndex(InvenTreeRoleMixin, ListView): | ||||
|         return queryset | ||||
|  | ||||
|  | ||||
| class CompanyNotes(UpdateView): | ||||
|     """ View for editing the 'notes' field of a Company object. | ||||
|     """ | ||||
|  | ||||
|     context_object_name = 'company' | ||||
|     template_name = 'company/notes.html' | ||||
|     model = Company | ||||
|     fields = ['notes'] | ||||
|     permission_required = 'company.view_company' | ||||
|  | ||||
|     def get_success_url(self): | ||||
|         return reverse('company-notes', kwargs={'pk': self.get_object().id}) | ||||
|  | ||||
|     def get_context_data(self, **kwargs): | ||||
|  | ||||
|         ctx = super().get_context_data(**kwargs) | ||||
|  | ||||
|         ctx['editing'] = str2bool(self.request.GET.get('edit', '')) | ||||
|  | ||||
|         return ctx | ||||
|  | ||||
|  | ||||
| class CompanyDetail(DetailView): | ||||
|     """ Detail view for Company object """ | ||||
|     context_obect_name = 'company' | ||||
|   | ||||
		Reference in New Issue
	
	Block a user