InvenTree/InvenTree/part/templates/part/detail.html

209 lines
6.0 KiB
HTML

{% extends "part/part_base.html" %}
{% load static %}
{% block details %}
{% include 'part/tabs.html' with tab='detail' %}
<div class='row'>
<div class='col-sm-6'>
<h4>Part Details</h4>
</div>
<div class='col-sm-6'>
<div class="btn-group" style="float: right;">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Options
<span class="caret"></span></button>
<ul class="dropdown-menu">
{% if part.active %}
<li><a href="#" id='edit-part' title='Edit part'>Edit</a></li>
<li><a href='#' id='duplicate-part' title='Duplicate Part'>Duplicate</a></li>
<hr>
<li><a href="#" id='deactivate-part' title='Deactivate part'>Deactivate</a></li>
{% else %}
<li><a href="#" id='activate-part' title='Activate part'>Activate</a></li>
<li><a href='#' id='delete-part' title='Delete part'>Delete</a></li>
{% endif %}
</ul>
</div>
</div>
</div>
<hr>
<div class='row'>
<div class='col-sm-6'>
<table class='table table-striped'>
<tr>
<td>Part name</td>
<td>{{ part.full_name }}</td>
</tr>
{% if part.IPN %}
<tr>
<td>IPN</td>
<td>{{ part.IPN }}</td>
</tr>
{% endif %}
<tr>
<td>Description</td>
<td>{{ part.description }}</td>
</tr>
{% if part.keywords %}
<tr>
<td>Keywords</td>
<td>{{ part.keywords }}</td>
</tr>
{% endif %}
{% if part.URL %}
<tr>
<td>URL</td>
<td><a href="{{ part.URL }}">{{ part.URL }}</a></td>
</tr>
{% endif %}
<tr>
<td>Category</td>
<td>
{% if part.category %}
<a href="{% url 'category-detail' part.category.id %}">{{ part.category.pathstring }}</a>
{% endif %}
</td>
</tr>
{% if part.default_location %}
<tr>
<td>Default Location</td>
<td><a href="{% url 'stock-location-detail' part.default_location.id %}">{{ part.default_location.pathstring }}</a></td>
</tr>
{% endif %}
{% if part.default_supplier %}
<tr>
<td>Default Supplier</td>
<td><a href="{% url 'supplier-part-detail' part.default_supplier.id %}">
{{ part.default_supplier.supplier.name }} | {{ part.default_supplier.SKU }}
</a></td>
</tr>
{% endif %}
<tr>
<td>Units</td>
<td>{{ part.units }}</td>
</tr>
</table>
</div>
<div class='col-sm-6'>
<table class='table table-striped'>
<tr>
<td>Buildable</td>
<td>{% include "yesnolabel.html" with value=part.buildable %}</td>
</tr>
<tr>
<td>Consumable</td>
<td>{% include "yesnolabel.html" with value=part.consumable %}</td>
</tr>
<tr>
<td>Trackable</td>
<td>{% include "yesnolabel.html" with value=part.trackable %}</td>
</tr>
<tr>
<td>Purchaseable</td>
<td>{% include "yesnolabel.html" with value=part.purchaseable %}</td>
</tr>
<tr>
<td>Salable</td>
<td>{% include "yesnolabel.html" with value=part.salable %}</td>
</tr>
{% if part.minimum_stock > 0 %}
<tr>
<td>Minimum Stock</td>
<td>{{ part.minimum_stock }}</td>
</tr>
{% endif %}
</table>
</div>
</div>
{% if part.notes %}
<div class="panel panel-default">
<div class="panel-heading"><b>Notes</b></div>
<div class="panel-body">{{ part.notes }}</div>
</div>
{% endif %}
{% endblock %}
{% block js_load %}
{{ block.super }}
{% endblock %}
{% block js_ready %}
{{ block.super }}
$("#duplicate-part").click(function() {
launchModalForm(
"{% url 'part-duplicate' part.id %}",
{
follow: true,
}
);
});
$("#edit-part").click(function() {
launchModalForm(
"{% url 'part-edit' part.id %}",
{
reload: true,
});
});
$('#activate-part').click(function() {
showQuestionDialog(
'Activate Part?',
'Are you sure you wish to reactivate {{ part.full_name }}?',
{
accept_text: 'Activate',
accept: function() {
inventreePut(
"{% url 'api-part-detail' part.id %}",
{
active: true,
},
{
method: 'PATCH',
reloadOnSuccess: true,
}
);
}
},
);
});
$('#deactivate-part').click(function() {
showQuestionDialog(
'Deactivate Part?',
`Are you sure you wish to deactivate {{ part.full_name }}?<br>
`,
{
accept_text: 'Deactivate',
accept: function() {
inventreePut(
"{% url 'api-part-detail' part.id %}",
{
active: false,
},
{
method: 'PATCH',
reloadOnSuccess: true,
}
);
}
}
);
});
$('#delete-part').click(function() {
launchModalForm(
"{% url 'part-delete' part.id %}",
{
redirect: {% if part.category %}"{% url 'category-detail' part.category.id %}"{% else %}"{% url 'part-index' %}"{% endif %}
});
});
{% endblock %}