2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-30 16:41:35 +00:00
Files
InvenTree/InvenTree/part/templates/part/detail.html
2020-05-26 11:34:11 +10:00

279 lines
9.2 KiB
HTML

{% extends "part/part_base.html" %}
{% load static %}
{% load i18n %}
{% block details %}
{% include 'part/tabs.html' with tab='detail' %}
<h4>{% trans "Part Details" %}</h4>
<hr>
<div class='row'>
<div class='col-sm-6'>
<table class='table table-striped'>
<col width='25'>
<tr>
<td></td>
<td><b>{% trans "Part name" %}</b></td>
<td>{{ part.name }}</td>
</tr>
{% if part.IPN %}
<tr>
<td></td>
<td><b>{% trans "IPN" %}</b></td>
<td>{{ part.IPN }}</td>
</tr>
{% endif %}
{% if part.revision %}
<tr>
<td></td>
<td><b>{% trans "Revision" %}</b></td>
<td>{{ part.revision }}</td>
</tr>
{% endif %}
{% if part.trackable %}
<tr>
<td><span class='fas fa-hashtag'></span></td>
<td><b>{% trans "Next Serial Number" %}</b></td>
<td>{{ part.getNextSerialNumber }}</td>
</tr>
{% endif %}
<tr>
<td><span class='fas fa-info-circle'></span></td>
<td><b>{% trans "Description" %}</b></td>
<td>{{ part.description }}</td>
</tr>
{% if part.variant_of %}
<tr>
<td></td>
<td><b>{% trans "Variant Of" %}</b></td>
<td><a href="{% url 'part-detail' part.variant_of.id %}">{{ part.variant_of.full_name }}</a></td>
</tr>
{% endif %}
{% if part.keywords %}
<tr>
<td><span class='fas fa-key'></span></td>
<td><b>{% trans "Keywords" %}</b></td>
<td>{{ part.keywords }}</td>
</tr>
{% endif %}
<tr>
<td><span class='fas fa-sitemap'></span></td>
<td><b>{% trans "Category" %}</b></td>
<td>
{% if part.category %}
<a href="{% url 'category-detail' part.category.id %}">{{ part.category.pathstring }}</a>
{% endif %}
</td>
</tr>
{% if part.link %}
<tr>
<td><span class='fas fa-link'></span></td>
<td><b>{% trans "External Link" %}</b></td>
<td><a href="{{ part.link }}">{{ part.link }}</a></td>
</tr>
{% endif %}
{% if part.default_location %}
<tr>
<td><span class='fas fa-map-marker-alt'></span></td>
<td><b>{% trans "Default Location" %}</b></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></td>
<td><b>{% trans "Default Supplier" %}</b></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></td>
<td><b>{% trans "Units" %}</b></td>
<td>{{ part.units }}</td>
</tr>
{% if part.minimum_stock > 0 %}
<tr>
<td><span class='fas fa-greater-than-equal'></span></td>
<td><b>{% trans "Minimum Stock" %}</b></td>
<td>{{ part.minimum_stock }}</td>
</tr>
{% endif %}
<tr>
<td><span class='fas fa-calendar-alt'></span></td>
<td><b>{% trans "Creation Date" %}</b></td>
<td>{{ part.creation_date }}</td>
</tr>
{% if part.creation_user %}
<tr>
<td><span class='fas fa-user'></span></td>
<td><b>{% trans "Created By" %}</b></td>
<td>{{ part.creation_user }}</td>
</tr>
{% endif %}
{% if part.responsible %}
<tr>
<td><span class='fas fa-user'>d</span></td>
<td><b>{% trans "Responsible User" %}</b></td>
<td>{{ part.responsible }}</td>
</tr>
{% endif %}
</table>
</div>
<div class='col-sm-6'>
<table class='table table-striped'>
<tr>
<td><b>{% trans "Virtual" %}</b></td>
<td>{% include "slide.html" with state=part.virtual field='virtual' %}</td>
{% if part.virtual %}
<td>{% trans "Part is virtual (not a physical part)" %}</td>
{% else %}
<td><i>{% trans "Part is not a virtual part" %}</i></td>
{% endif %}
</tr>
<tr>
<td><b>{% trans "Template" %}</b></td>
<td>{% include "slide.html" with state=part.is_template field='is_template' %}</td>
{% if part.is_template %}
<td>{% trans "Part is a template part (variants can be made from this part)" %}</td>
{% else %}
<td><i>{% trans "Part is not a template part" %}</i></td>
{% endif %}
</tr>
<tr>
<td><b>{% trans "Assembly" %}</b></td>
<td>{% include "slide.html" with state=part.assembly field='assembly' %}</td>
{% if part.assembly %}
<td>{% trans "Part can be assembled from other parts" %}</td>
{% else %}
<td><i>{% trans "Part cannot be assembled from other parts" %}</i></td>
{% endif %}
</tr>
<tr>
<td><b>{% trans "Component" %}</b></td>
<td>{% include "slide.html" with state=part.component field='component' %}</td>
{% if part.component %}
<td>{% trans "Part can be used in assemblies" %}</td>
{% else %}
<td><i>{% trans "Part cannot be used in assemblies" %}</i></td>
{% endif %}
</tr>
<tr>
<td><b>{% trans "Trackable" %}</b></td>
<td>{% include "slide.html" with state=part.trackable field='trackable' %}</td>
{% if part.trackable %}
<td>{% trans "Part stock is tracked by serial number" %}</td>
{% else %}
<td><i>{% trans "Part stock is not tracked by serial number" %}</i></td>
{% endif %}
</tr>
<tr>
<td><b>{% trans "Purchaseable" %}</b></td>
<td>{% include "slide.html" with state=part.purchaseable field='purchaseable' %}</td>
{% if part.purchaseable %}
<td>{% trans "Part can be purchased from external suppliers" %}</td>
{% else %}
<td><i>{% trans "Part can be purchased from external suppliers" %}</i></td>
{% endif %}
</tr>
<tr>
<td><b>{% trans "Salable" %}</b></td>
<td>{% include "slide.html" with state=part.salable field='salable' %}</td>
{% if part.salable %}
<td>{% trans "Part can be sold to customers" %}</td>
{% else %}
<td><i>{% trans "Part cannot be sold to customers" %}</i></td>
{% endif %}
</tr>
<tr>
<td><b>{% trans "Active" %}</b></td>
<td>{% include "slide.html" with state=part.active field='active' %}</td>
{% if part.active %}
<td>{% trans "Part is active" %}</td>
{% else %}
<td><i>{% trans "Part is not active" %}</i></td>
{% endif %}
</tr>
</table>
</div>
</div>
{% endblock %}
{% block js_load %}
{{ block.super }}
{% endblock %}
{% block js_ready %}
{{ block.super }}
$(".slidey").change(function() {
var field = $(this).attr('field');
var checked = $(this).prop('checked');
var data = {};
data[field] = checked;
// Update the particular field
inventreePut("{% url 'api-part-detail' part.id %}",
data,
{
method: 'PATCH',
reloadOnSuccess: 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,
}
);
}
}
);
});
{% endblock %}