From 8f610d826f0ef5432f99ab620569392eb8ef98cf Mon Sep 17 00:00:00 2001 From: eeintech Date: Tue, 23 Mar 2021 17:16:29 -0400 Subject: [PATCH] Added URLs and templates --- .../company/manufacturer_part_base.html | 131 ++++++++++++++++++ .../company/manufacturer_part_create.html | 17 +++ .../company/manufacturer_part_detail.html | 38 +++++ InvenTree/company/urls.py | 12 ++ 4 files changed, 198 insertions(+) create mode 100644 InvenTree/company/templates/company/manufacturer_part_base.html create mode 100644 InvenTree/company/templates/company/manufacturer_part_create.html create mode 100644 InvenTree/company/templates/company/manufacturer_part_detail.html diff --git a/InvenTree/company/templates/company/manufacturer_part_base.html b/InvenTree/company/templates/company/manufacturer_part_base.html new file mode 100644 index 0000000000..7b0b579d1d --- /dev/null +++ b/InvenTree/company/templates/company/manufacturer_part_base.html @@ -0,0 +1,131 @@ +{% extends "two_column.html" %} +{% load static %} +{% load i18n %} + +{% block page_title %} +InvenTree | {% trans "Manufacturer Part" %} +{% endblock %} + +{% block thumbnail %} + +{% endblock %} + +{% block page_data %} +

{% trans "Manufacturer Part" %}

+
+

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

+

{{ part.manufacturer.name }} - {{ part.MPN }}

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

{% trans "Manufacturer Part Details" %}

+ + + + + + + + {% if part.description %} + + + + + + {% endif %} + {% if part.link %} + + + + + + {% endif %} + + + + + + + + + +
{% trans "Internal Part" %} + {% if part.part %} + {{ part.part.full_name }} + {% endif %} +
{% trans "Description" %}{{ part.description }}
{% trans "External Link" %}{{ part.link }}
{% trans "Manufacturer" %}{{ part.manufacturer.name }}
{% trans "MPN" %}{{ part.MPN }}
+{% 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 () { + launchModalForm( + "{% url 'manufacturer-part-edit' part.id %}", + { + reload: true + } + ); +}); + +$('#delete-part').click(function() { + launchModalForm( + "{% url 'manufacturer-part-delete' %}?part={{ part.id }}", + { + redirect: "{% url 'company-detail-parts' part.manufacturer.id %}" + } + ); +}); + +{% endblock %} \ No newline at end of file diff --git a/InvenTree/company/templates/company/manufacturer_part_create.html b/InvenTree/company/templates/company/manufacturer_part_create.html new file mode 100644 index 0000000000..21c23f9075 --- /dev/null +++ b/InvenTree/company/templates/company/manufacturer_part_create.html @@ -0,0 +1,17 @@ +{% 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/manufacturer_part_detail.html b/InvenTree/company/templates/company/manufacturer_part_detail.html new file mode 100644 index 0000000000..f2bcfea963 --- /dev/null +++ b/InvenTree/company/templates/company/manufacturer_part_detail.html @@ -0,0 +1,38 @@ +{% extends "company/manufacturer_part_base.html" %} +{% load static %} +{% load i18n %} + +{% block menubar %} +{% include "company/part_navbar.html" with tab='details' %} +{% endblock %} + +{% block heading %} +{% trans "Manufacturer Part Details" %} +{% endblock %} + + +{% block details %} + + + + + + + + +{% if part.link %} + +{% endif %} +
{% trans "Internal Part" %} + {% if part.part %} + {{ part.part.full_name }} + {% endif %} +
{% trans "Manufacturer" %}{{ part.manufacturer.name }}
{% trans "MPN" %}{{ part.MPN }}
{% trans "External Link" %}{{ part.link }}
+ +{% endblock %} + +{% block js_ready %} +{{ block.super }} + + +{% endblock %} \ No newline at end of file diff --git a/InvenTree/company/urls.py b/InvenTree/company/urls.py index b5ad06019b..682b74841d 100644 --- a/InvenTree/company/urls.py +++ b/InvenTree/company/urls.py @@ -52,6 +52,18 @@ price_break_urls = [ url(r'^(?P\d+)/delete/', views.PriceBreakDelete.as_view(), name='price-break-delete'), ] +manufacturer_part_detail_urls = [ + url(r'^edit/?', views.ManufacturerPartEdit.as_view(), name='supplier-part-edit'), +] + +manufacturer_part_urls = [ + url(r'^new/?', views.ManufacturerPartCreate.as_view(), name='manufacturer-part-create'), + + url(r'delete/', views.ManufacturerPartDelete.as_view(), name='manufacturer-part-delete'), + + url(r'^(?P\d+)/', include(manufacturer_part_detail_urls)), +] + supplier_part_detail_urls = [ url(r'^edit/?', views.SupplierPartEdit.as_view(), name='supplier-part-edit'),