diff --git a/InvenTree/company/templates/company/manufacturer_part_create.html b/InvenTree/company/templates/company/manufacturer_part_create.html deleted file mode 100644 index 21c23f9075..0000000000 --- a/InvenTree/company/templates/company/manufacturer_part_create.html +++ /dev/null @@ -1,17 +0,0 @@ -{% extends "modal_form.html" %} - -{% load i18n %} - -{% block pre_form_content %} -{{ block.super }} - -{% if part %} -
- {% include "hover_image.html" with image=part.image %} - {{ part.full_name}} -
- {{ part.description }} -
-{% endif %} - -{% endblock %} \ No newline at end of file diff --git a/InvenTree/company/templates/company/supplier_part.html b/InvenTree/company/templates/company/supplier_part.html new file mode 100644 index 0000000000..c3c2f89aa7 --- /dev/null +++ b/InvenTree/company/templates/company/supplier_part.html @@ -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 %} + +{% endblock %} + +{% block page_data %} +

{% trans "Supplier Part" %}

+
+

+ {{ part.part.full_name }} + {% if user.is_staff and perms.company.change_company %} + + + + {% endif %} +

+

{{ part.supplier.name }} - {{ part.SKU }}

+ +{% if roles.purchase_order.change %} +
+
+ {% if roles.purchase_order.add %} + + {% endif %} + + {% if roles.purchase_order.delete %} + + {% endif %} +
+
+{% endif %} + +{% endblock %} + +{% block page_details %} + +

{% trans "Supplier Part Details" %}

+ + + + + + + + {% if part.description %} + + + + + + {% endif %} + {% if part.link %} + + + + + + {% endif %} + + + + + + + + + + {% if part.manufacturer_part.manufacturer %} + + + + + + {% endif %} + {% if part.manufacturer_part.MPN %} + + + + + + {% endif %} + {% if part.packaging %} + + + + + + {% endif %} + {% if part.note %} + + + + + + {% endif %} +
{% trans "Internal Part" %} + {% if part.part %} + {{ part.part.full_name }}{% include "clip.html"%} + {% endif %} +
{% trans "Description" %}{{ part.description }}{% include "clip.html"%}
{% trans "External Link" %}{{ part.link }}{% include "clip.html"%}
{% trans "Supplier" %}{{ part.supplier.name }}{% include "clip.html"%}
{% trans "SKU" %}{{ part.SKU }}{% include "clip.html"%}
{% trans "Manufacturer" %} + {{ part.manufacturer_part.manufacturer.name }}{% include "clip.html"%}
{% trans "MPN" %}{{ part.manufacturer_part.MPN }}{% include "clip.html"%}
{% trans "Packaging" %}{{ part.packaging }}{% include "clip.html"%}
{% trans "Note" %}{{ part.note }}{% include "clip.html"%}
+{% endblock %} + +{% block page_content %} + +
+
+

{% trans "Supplier Part Stock" %}

+
+
+ {% include "stock_table.html" %} +
+
+ +
+
+

{% trans "Supplier Part Orders" %}

+
+
+ {% if roles.purchase_order.add %} +
+
+ +
+
+ {% endif %} + +
+
+
+ +
+
+

{% trans "Pricing Information" %}

+
+
+ {% if roles.purchase_order.add %} +
+ +
+ {% endif %} + + +
+
+
+ +{% 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 += `
` + + 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 += `
`; + + 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 %} \ No newline at end of file diff --git a/InvenTree/company/templates/company/supplier_part_base.html b/InvenTree/company/templates/company/supplier_part_base.html deleted file mode 100644 index 900e0750cc..0000000000 --- a/InvenTree/company/templates/company/supplier_part_base.html +++ /dev/null @@ -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 %} - -{% endblock %} - -{% block page_data %} -

{% trans "Supplier Part" %}

-
-

- {{ part.part.full_name }} - {% if user.is_staff and perms.company.change_company %} - - - - {% endif %} -

-

{{ part.supplier.name }} - {{ part.SKU }}

- -{% if roles.purchase_order.change %} -
-
- {% if roles.purchase_order.add %} - - {% endif %} - - {% if roles.purchase_order.delete %} - - {% endif %} -
-
-{% endif %} - -{% endblock %} - -{% block page_details %} - -

{% trans "Supplier Part Details" %}

- - - - - - - - {% if part.description %} - - - - - - {% endif %} - {% if part.link %} - - - - - - {% endif %} - - - - - - - - - - {% if part.manufacturer_part.manufacturer %} - - - - - - {% endif %} - {% if part.manufacturer_part.MPN %} - - - - - - {% endif %} - {% if part.packaging %} - - - - - - {% endif %} - {% if part.note %} - - - - - - {% endif %} -
{% trans "Internal Part" %} - {% if part.part %} - {{ part.part.full_name }}{% include "clip.html"%} - {% endif %} -
{% trans "Description" %}{{ part.description }}{% include "clip.html"%}
{% trans "External Link" %}{{ part.link }}{% include "clip.html"%}
{% trans "Supplier" %}{{ part.supplier.name }}{% include "clip.html"%}
{% trans "SKU" %}{{ part.SKU }}{% include "clip.html"%}
{% trans "Manufacturer" %} - {{ part.manufacturer_part.manufacturer.name }}{% include "clip.html"%}
{% trans "MPN" %}{{ part.manufacturer_part.MPN }}{% include "clip.html"%}
{% trans "Packaging" %}{{ part.packaging }}{% include "clip.html"%}
{% trans "Note" %}{{ part.note }}{% include "clip.html"%}
-{% endblock %} - -{% block js_ready %} -{{ block.super }} - -enableNavbar({ - label: 'supplier-part', - toggleId: '#supplier-part-menu-toggle' -}) - -$('#order-part, #order-part2').click(function() { - launchModalForm( - "{% url 'order-parts' %}", - { - data: { - part: {{ part.part.id }}, - }, - reload: true, - }, - ); -}); - -$('#edit-part').click(function () { - launchModalForm( - "{% url 'supplier-part-edit' part.id %}", - { - reload: true - } - ); -}); - -$('#delete-part').click(function() { - launchModalForm( - "{% url 'supplier-part-delete' %}?part={{ part.id }}", - { - redirect: "{% url 'company-detail' part.supplier.id %}" - } - ); -}); - -{% endblock %} \ No newline at end of file diff --git a/InvenTree/company/templates/company/supplier_part_detail.html b/InvenTree/company/templates/company/supplier_part_detail.html deleted file mode 100644 index 708885043a..0000000000 --- a/InvenTree/company/templates/company/supplier_part_detail.html +++ /dev/null @@ -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 %} - - - - - - - - -{% if part.link %} - -{% endif %} -{% if part.description %} - -{% endif %} -{% if part.manufacturer %} - - -{% endif %} -{% if part.note %} - -{% endif %} -
{% trans "Internal Part" %} - {% if part.part %} - {{ part.part.full_name }} - {% endif %} -
{% trans "Supplier" %}{{ part.supplier.name }}
{% trans "SKU" %}{{ part.SKU }}
{% trans "External Link" %}{{ part.link }}
{% trans "Description" %}{{ part.description }}{% include "clip.html"%}
{% trans "Manufacturer" %}{{ part.manufacturer }}{% include "clip.html"%}
{% trans "MPN" %}{{ part.MPN }}{% include "clip.html"%}
{% trans "Note" %}{{ part.note }}{% include "clip.html"%}
- -{% endblock %} - -{% block js_ready %} -{{ block.super }} - - -{% endblock %} \ No newline at end of file diff --git a/InvenTree/company/templates/company/supplier_part_navbar.html b/InvenTree/company/templates/company/supplier_part_navbar.html index e52c1798ba..4f7783701a 100644 --- a/InvenTree/company/templates/company/supplier_part_navbar.html +++ b/InvenTree/company/templates/company/supplier_part_navbar.html @@ -9,22 +9,22 @@ -
  • - +
  • + {% trans "Stock" %}
  • -
  • - +
  • + {% trans "Orders" %}
  • -
  • - +
  • + {% trans "Pricing" %} diff --git a/InvenTree/company/templates/company/supplier_part_orders.html b/InvenTree/company/templates/company/supplier_part_orders.html deleted file mode 100644 index 05e425fc97..0000000000 --- a/InvenTree/company/templates/company/supplier_part_orders.html +++ /dev/null @@ -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 %} -
    -
    - -
    -
    -{% endif %} - - -
    - -{% endblock %} - -{% block js_ready %} -{{ block.super }} - -loadPurchaseOrderTable($("#purchase-order-table"), { - url: "{% url 'api-po-list' %}?supplier_part={{ part.id }}", -}); - -{% endblock %} \ No newline at end of file diff --git a/InvenTree/company/templates/company/supplier_part_pricing.html b/InvenTree/company/templates/company/supplier_part_pricing.html deleted file mode 100644 index a476b53a13..0000000000 --- a/InvenTree/company/templates/company/supplier_part_pricing.html +++ /dev/null @@ -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 %} -
    - -
    -{% endif %} - - -
    - -{% 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 += `
    ` - - 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 += `
    `; - - 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 %} \ No newline at end of file diff --git a/InvenTree/company/templates/company/supplier_part_stock.html b/InvenTree/company/templates/company/supplier_part_stock.html deleted file mode 100644 index 1187b95bca..0000000000 --- a/InvenTree/company/templates/company/supplier_part_stock.html +++ /dev/null @@ -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 %} \ No newline at end of file diff --git a/InvenTree/company/urls.py b/InvenTree/company/urls.py index 4f844176ee..817ee27988 100644 --- a/InvenTree/company/urls.py +++ b/InvenTree/company/urls.py @@ -39,12 +39,7 @@ manufacturer_part_urls = [ supplier_part_detail_urls = [ url(r'^edit/?', views.SupplierPartEdit.as_view(), name='supplier-part-edit'), - url(r'^manufacturers/', views.SupplierPartDetail.as_view(template_name='company/supplier_part_manufacturers.html'), name='supplier-part-manufacturers'), - url(r'^pricing/', views.SupplierPartDetail.as_view(template_name='company/supplier_part_pricing.html'), name='supplier-part-pricing'), - url(r'^orders/', views.SupplierPartDetail.as_view(template_name='company/supplier_part_orders.html'), name='supplier-part-orders'), - url(r'^stock/', views.SupplierPartDetail.as_view(template_name='company/supplier_part_stock.html'), name='supplier-part-stock'), - - url('^.*$', views.SupplierPartDetail.as_view(template_name='company/supplier_part_pricing.html'), name='supplier-part-detail'), + url('^.*$', views.SupplierPartDetail.as_view(template_name='company/supplier_part.html'), name='supplier-part-detail'), ] supplier_part_urls = [ diff --git a/InvenTree/part/templates/part/category.html b/InvenTree/part/templates/part/category.html index 224d855aa3..0aee97a5e3 100644 --- a/InvenTree/part/templates/part/category.html +++ b/InvenTree/part/templates/part/category.html @@ -244,11 +244,11 @@ "{% url 'category-create' %}", { follow: true, - {% if category %} data: { + {% if category %} category: {{ category.id }} + {% endif %} }, - {% endif %} secondary: [ { field: 'default_location',