Create 'tabs' for SupplierPart view

This commit is contained in:
Oliver Walters 2020-02-12 10:42:45 +11:00
parent 34c3320cd5
commit 63b70614b6
3 changed files with 91 additions and 44 deletions

View File

@ -1,4 +1,4 @@
{% extends "base.html" %} {% extends "company/supplier_part_base.html" %}
{% load static %} {% load static %}
{% load i18n %} {% load i18n %}
@ -6,33 +6,9 @@
InvenTree | {{ company.name }} - {% trans "Parts" %} InvenTree | {{ company.name }} - {% trans "Parts" %}
{% endblock %} {% endblock %}
{% block content %} {% block details %}
<div class='row'> {% include "company/supplier_part_tabs.html" with tab='details' %}
<div class='col-sm-6'>
<h3>{% trans "Supplier Part" %}</h3>
<div class='btn-row'>
<div class='btn-group'>
<button type='button' class='btn btn-default btn-glyph' id='edit-part' title='Edit supplier part'>
<span class='glyphicon glyphicon-edit'/>
</button>
<button type='button' class='btn btn-default btn-glyph' id='delete-part' title='Delete supplier part'>
<span class='glyphicon glyphicon-trash'/>
</button>
</div>
</div>
</div>
<div class='col-sm-6'>
<div class='media-left'>
<img class='part-thumb'
{% if part.part.image %}
src='{{ part.part.image.url }}'
{% else %}
src="{% static 'img/blank_image.png' %}"
{% endif %}/>
</div>
</div>
</div>
<hr> <hr>
@ -120,23 +96,7 @@ InvenTree | {{ company.name }} - {% trans "Parts" %}
{% block js_ready %} {% block js_ready %}
{{ block.super }} {{ block.super }}
$('#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-parts' part.supplier.id %}"
}
);
});
$('#new-price-break').click(function() { $('#new-price-break').click(function() {
launchModalForm("{% url 'price-break-create' %}", launchModalForm("{% url 'price-break-create' %}",

View File

@ -0,0 +1,68 @@
{% extends "base.html" %}
{% load static %}
{% load i18n %}
{% block page_title %}
InvenTree | {% trans "Supplier Part" %}
{% endblock %}
{% block content %}
<div class='row'>
<div class='col-sm-6'>
<h3>{% trans "Supplier Part" %}</h3>
<div class='btn-row'>
<div class='btn-group'>
<button type='button' class='btn btn-default btn-glyph' id='edit-part' title='Edit supplier part'>
<span class='glyphicon glyphicon-edit'/>
</button>
<button type='button' class='btn btn-default btn-glyph' id='delete-part' title='Delete supplier part'>
<span class='glyphicon glyphicon-trash'/>
</button>
</div>
</div>
</div>
<div class='col-sm-6'>
<div class='media-left'>
<img class='part-thumb'
{% if part.part.image %}
src='{{ part.part.image.url }}'
{% else %}
src="{% static 'img/blank_image.png' %}"
{% endif %}/>
</div>
</div>
</div>
<hr>
<div class='container-fluid'>
{% block details %}
<!-- Particular SupplierPart page goes here ... -->
{% endblock %}
</div>
{% endblock %}
{% block js_ready %}
{{ block.super }}
$('#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-parts' part.supplier.id %}"
}
);
});
{% endblock %}

View File

@ -0,0 +1,19 @@
{% load i18n %}
<ul class='nav nav-tabs'>
<li{% if tab == 'details' %} class='active'{% endif %}>
<a href="{% url 'supplier-part-detail' part.id %}">{% trans "Details" %}</a>
</li>
<li{% if tab == 'pricing' %} class='active'{% endif %}>
<a href="{% url 'supplier-part-detail' part.id %}">{% trans "Pricing" %}</a>
</li>
<li{% if tab == 'stock' %} class='active'{% endif %}>
<a href="{% url 'supplier-part-detail' part.id %}">{% trans "Stock" %}</a>
</li>
<li {% if tab == 'orders' %} class='active'{% endif %}>
<a href="{% url 'supplier-part-detail' part.id %}">{% trans "Orders" %}</a>
</li>
<li {% if tab == 'notes' %} class='active'{% endif %}>
<a href="{% url 'supplier-part-detail' part.id %}">{% trans "Notes" %}</a>
</li>
</ul>