2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-06 03:51:34 +00:00
Files
InvenTree/InvenTree/part/templates/part/part_base.html
2019-06-07 08:37:25 +10:00

172 lines
4.6 KiB
HTML

{% extends "part/part_app_base.html" %}
{% load static %}
{% block content %}
{% if part.active == False %}
<div class='alert alert-danger alert-block'>
This part is not active:
</div>
{% endif %}
{% if part.is_template %}
<div class='alert alert-info alert-block'>
This part is a <i>template part</i>.<br>
It is not a <i>real</i> part, but real parts can be based on this template.
</div>
{% endif %}
{% if part.variant_of %}
<div class='alert alert-info alert-block'>
This part is a variant of <b><a href="{% url 'part-detail' part.variant_of.id %}">{{ part.variant_of.full_name }}</a></b>
</div>
{% endif %}
<div class="row">
<div class="col-sm-6">
<div class="media">
<div class="media-left">
<div class='dropzone' id='part-thumb'>
<img class="part-thumb"
{% if part.image %}
src="{{ part.image.url }}"
{% else %}
src="{% static 'img/blank_image.png' %}"
{% endif %}/>
</div>
</div>
<div class="media-body">
<h4>
{{ part.full_name }}
</h4>
<p><i>{{ part.description }}</i></p>
<p>
<div class='btn-group'>
<button type='button' class='btn btn-default btn-glyph' id='toggle-starred' title='Star this part'>
<span id='part-star-icon' class='starred-part glyphicon {% if starred %}glyphicon-star{% else %}glyphicon-star-empty{% endif %}'/>
</button>
{% if part.is_template == False %}
{% include "qr_button.html" %}
<button type='button' class='btn btn-default btn-glyph' id='price-button' title='Show pricing information'>
<span id='part-price-icon' class='part-price glyphicon glyphicon-usd'/>
</button>
{% endif %}
</div>
</p>
<table class='table table-condensed'>
{% if part.IPN %}
<tr>
<td>IPN</td>
<td>{{ part.IPN }}</td>
</tr>
{% endif %}
{% if part.URL %}
<tr>
<td>URL</td>
<td><a href="{{ part.URL }}">{{ part.URL }}</a></td>
</tr>
{% endif %}
<tr>
</tr>
</table>
</div>
</div>
</div>
<div class="col-sm-6">
<h4>Stock Status - {{ part.available_stock }}{% if part.units %} {{ part.units }} {% endif%} available</h4>
<table class="table table-striped">
<tr>
<td>In Stock</td>
<td>{{ part.total_stock }}</td>
</tr>
{% if part.assembly %}
<tr>
<td>Can Build</td>
<td>{{ part.can_build }}</td>
</tr>
{% if part.quantity_being_built > 0 %}
<tr>
<td>Underway</td>
<td>{{ part.quantity_being_built }}</td>
</tr>
{% endif %}
{% endif %}
{% if part.allocation_count > 0 %}
<tr>
<td>Allocated</td>
<td>{{ part.allocation_count }}</td>
</tr>
{% endif %}
{% if part.on_order > 0 %}
<tr>
<td>On Order</td>
<td>{{ part.on_order }}</td>
</tr>
{% endif %}
</table>
</div>
</div>
<hr>
<div class='container-fluid'>
{% block details %}
<!-- Specific part details go here... -->
{% endblock %}
</div>
{% endblock %}
{% block js_ready %}
{{ block.super }}
enableDragAndDrop(
'#part-thumb',
"{% url 'part-image' part.id %}",
{
label: 'image',
success: function(data, status, xhr) {
location.reload();
}
}
);
$("#show-qr-code").click(function() {
launchModalForm(
"{% url 'part-qr' part.id %}",
{
no_post: true,
}
);
});
$("#price-button").click(function() {
launchModalForm(
"{% url 'part-pricing' part.id %}",
{
submit_text: 'Calculate',
}
);
});
$("#toggle-starred").click(function() {
toggleStar({
part: {{ part.id }},
user: {{ user.id }},
button: '#part-star-icon'
});
});
$('#toggle-starred').click(function() {
});
$("#part-thumb").click(function() {
launchModalForm(
"{% url 'part-image' part.id %}",
{
reload: true
}
);
});
{% endblock %}