diff --git a/InvenTree/company/templates/company/manufacturer_part_base.html b/InvenTree/company/templates/company/manufacturer_part_base.html index ed1612ea76..f68bf99122 100644 --- a/InvenTree/company/templates/company/manufacturer_part_base.html +++ b/InvenTree/company/templates/company/manufacturer_part_base.html @@ -62,7 +62,7 @@ src="{% static 'img/blank_image.png' %}" {% trans "Internal Part" %} {% if part.part %} - {{ part.part.full_name }}{% include "clip.html"%} + {{ part.part.full_name }}{% include "clip.html"%} {% endif %} diff --git a/InvenTree/company/templates/company/supplier_part_base.html b/InvenTree/company/templates/company/supplier_part_base.html index bf6d914f19..8b6a5d94cd 100644 --- a/InvenTree/company/templates/company/supplier_part_base.html +++ b/InvenTree/company/templates/company/supplier_part_base.html @@ -61,7 +61,7 @@ src="{% static 'img/blank_image.png' %}" {% trans "Internal Part" %} {% if part.part %} - {{ part.part.full_name }}{% include "clip.html"%} + {{ part.part.full_name }}{% include "clip.html"%} {% endif %} diff --git a/InvenTree/company/templates/company/supplier_part_detail.html b/InvenTree/company/templates/company/supplier_part_detail.html index fb73ca06f4..6ccfc43e3f 100644 --- a/InvenTree/company/templates/company/supplier_part_detail.html +++ b/InvenTree/company/templates/company/supplier_part_detail.html @@ -18,7 +18,7 @@ {% trans "Internal Part" %} {% if part.part %} - {{ part.part.full_name }} + {{ part.part.full_name }} {% endif %} diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index 5b377708f6..3eedc54798 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -134,6 +134,54 @@ +
+
+

{% trans "Part Suppliers" %}

+
+
+
+
+ +
+ + +
+
+
+ + +
+
+
+ +
+
+

{% trans "Part Manufacturers" %}

+
+
+
+
+
+ +
+ + +
+
+
+
+
+
+
+ {% endblock %} {% block js_load %} @@ -426,4 +474,106 @@ default: 'part-stock' }); + $('#supplier-create').click(function () { + launchModalForm( + "{% url 'supplier-part-create' %}", + { + reload: true, + data: { + part: {{ part.id }} + }, + secondary: [ + { + field: 'supplier', + label: '{% trans "New Supplier" %}', + title: '{% trans "Create new supplier" %}', + }, + { + field: 'manufacturer', + label: '{% trans "New Manufacturer" %}', + title: '{% trans "Create new manufacturer" %}', + } + ] + }); + }); + + $("#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, + }); + }); + + loadSupplierPartTable( + "#supplier-table", + "{% url 'api-supplier-part-list' %}", + { + params: { + part: {{ part.id }}, + part_detail: false, + supplier_detail: true, + manufacturer_detail: true, + }, + } + ); + + linkButtonsToSelection($("#supplier-table"), ['#supplier-part-options']); + + loadManufacturerPartTable( + '#manufacturer-table', + "{% url 'api-manufacturer-part-list' %}", + { + params: { + part: {{ part.id }}, + part_detail: true, + manufacturer_detail: true, + }, + } + ); + + linkButtonsToSelection($("#manufacturer-table"), ['#manufacturer-part-options']); + + $("#manufacturer-part-delete").click(function() { + + var selections = $("#manufacturer-table").bootstrapTable("getSelections"); + + deleteManufacturerParts(selections, { + onSuccess: function() { + $("#manufacturer-table").bootstrapTable("refresh"); + } + }); + }); + + $('#manufacturer-create').click(function () { + + constructForm('{% url "api-manufacturer-part-list" %}', { + fields: { + part: { + value: {{ part.pk }}, + hidden: true, + }, + manufacturer: {}, + MPN: {}, + description: {}, + link: {}, + }, + method: 'POST', + title: '{% trans "Add Manufacturer Part" %}', + onSuccess: function() { + $("#manufacturer-table").bootstrapTable("refresh"); + } + }); + }); + {% endblock %} diff --git a/InvenTree/part/templates/part/supplier.html b/InvenTree/part/templates/part/supplier.html deleted file mode 100644 index 8ae73cd07c..0000000000 --- a/InvenTree/part/templates/part/supplier.html +++ /dev/null @@ -1,171 +0,0 @@ -{% extends "part/part_base.html" %} -{% load static %} -{% load i18n %} - -{% block menubar %} -{% include 'part/navbar.html' with tab='suppliers' %} -{% endblock %} - - -{% block heading %} -{% trans "Part Suppliers" %} -{% endblock %} - -{% block details %} -
-
- -
- - -
-
-
- - -
- -{% endblock %} - -{% block post_content_panel %} - -
-
-

- {% trans "Part Manufacturers" %} -

-
- -
-
-
- -
- - -
-
-
-
-
-
- -{% endblock %} - -{% block js_load %} -{{ block.super }} -{% endblock %} -{% block js_ready %} - {{ block.super }} - - $('#supplier-create').click(function () { - launchModalForm( - "{% url 'supplier-part-create' %}", - { - reload: true, - data: { - part: {{ part.id }} - }, - secondary: [ - { - field: 'supplier', - label: '{% trans "New Supplier" %}', - title: '{% trans "Create new supplier" %}', - }, - { - field: 'manufacturer', - label: '{% trans "New Manufacturer" %}', - title: '{% trans "Create new manufacturer" %}', - } - ] - }); - }); - - $("#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, - }); - }); - - loadSupplierPartTable( - "#supplier-table", - "{% url 'api-supplier-part-list' %}", - { - params: { - part: {{ part.id }}, - part_detail: false, - supplier_detail: true, - manufacturer_detail: true, - }, - } - ); - - linkButtonsToSelection($("#supplier-table"), ['#supplier-part-options']); - - loadManufacturerPartTable( - '#manufacturer-table', - "{% url 'api-manufacturer-part-list' %}", - { - params: { - part: {{ part.id }}, - part_detail: true, - manufacturer_detail: true, - }, - } - ); - - linkButtonsToSelection($("#manufacturer-table"), ['#manufacturer-part-options']); - - $("#manufacturer-part-delete").click(function() { - - var selections = $("#manufacturer-table").bootstrapTable("getSelections"); - - deleteManufacturerParts(selections, { - onSuccess: function() { - $("#manufacturer-table").bootstrapTable("refresh"); - } - }); - }); - - $('#manufacturer-create').click(function () { - - constructForm('{% url "api-manufacturer-part-list" %}', { - fields: { - part: { - value: {{ part.pk }}, - hidden: true, - }, - manufacturer: {}, - MPN: {}, - description: {}, - link: {}, - }, - method: 'POST', - title: '{% trans "Add Manufacturer Part" %}', - onSuccess: function() { - $("#manufacturer-table").bootstrapTable("refresh"); - } - }); - }); - -{% endblock %} \ No newline at end of file diff --git a/InvenTree/part/urls.py b/InvenTree/part/urls.py index 7ea4ca4eff..1ab9a44c4b 100644 --- a/InvenTree/part/urls.py +++ b/InvenTree/part/urls.py @@ -53,7 +53,6 @@ part_detail_urls = [ url(r'^build/?', views.PartDetail.as_view(template_name='part/build.html'), name='part-build'), url(r'^used/?', views.PartDetail.as_view(template_name='part/used_in.html'), name='part-used-in'), url(r'^prices/', views.PartPricingView.as_view(template_name='part/prices.html'), name='part-prices'), - url(r'^suppliers/?', views.PartDetail.as_view(template_name='part/supplier.html'), name='part-suppliers'), url(r'^track/?', views.PartDetail.as_view(template_name='part/track.html'), name='part-track'), url(r'^related-parts/?', views.PartDetail.as_view(template_name='part/related.html'), name='part-related'),