2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-01 17:41:33 +00:00
Files
InvenTree/InvenTree/part/templates/part/bom.html
2019-05-12 16:27:50 +10:00

116 lines
3.3 KiB
HTML

{% extends "part/part_base.html" %}
{% load static %}
{% block css %}
{% endblock %}
{% block details %}
{% include 'part/tabs.html' with tab='bom' %}
<h3>Bill of Materials</h3>
{% if part.bom_checked_date %}
{% if part.is_bom_valid %}
<div class='alert alert-block alert-info'>
{% else %}
<div class='alert alert-block alert-danger'>
The BOM for <i>{{ part.full_name }}</i> has changed, and must be validated.<br>
{% endif %}
The BOM for <i>{{ part.full_name }}</i> was last checked by {{ part.bom_checked_by }} on {{ part.bom_checked_date }}
</div>
{% else %}
<div class='alert alert-danger alert-block'>
<b>The BOM for <i>{{ part.full_name }}</i> has not been validated.</b>
</div>
{% endif %}
<div id='button-toolbar'>
{% if editing_enabled %}
<div class='btn-group' style='float: right;'>
<button class='btn btn-info' type='button' id='bom-item-new'>New BOM Item</button>
<button class='btn btn-success' type='button' id='editing-finished'>Finish Editing</button>
</div>
{% else %}
<div class='dropdown' 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.is_bom_valid == False %}
<li><a href='#' id='validate-bom' title='Validate BOM'>Validate BOM</a></li>
{% endif %}
<li><a href='#' id='edit-bom' title='Edit BOM'>Edit BOM</a></li>
<li><a href='#' id='export-bom' title='Export BOM'>Export BOM</a></li>
</ul>
</div>
{% endif %}
</div>
<table class='table table-striped table-condensed' data-toolbar="#button-toolbar" id='bom-table'>
</table>
{% endblock %}
{% block js_load %}
{{ block.super }}
<script type='text/javascript' src="{% static 'script/inventree/api.js' %}"></script>
<script type='text/javascript' src="{% static 'script/inventree/part.js' %}"></script>
<script type='text/javascript' src="{% static 'script/inventree/bom.js' %}"></script>
{% endblock %}
{% block js_ready %}
{{ block.super }}
// Load the BOM table data
loadBomTable($("#bom-table"), {
editable: {{ editing_enabled }},
bom_url: "{% url 'api-bom-list' %}",
part_url: "{% url 'api-part-list' %}",
parent_id: {{ part.id }}
});
{% if editing_enabled %}
$("#editing-finished").click(function() {
location.href = "{% url 'part-bom' part.id %}";
});
$("#bom-item-new").click(function () {
launchModalForm(
"{% url 'bom-item-create' %}?parent={{ part.id }}",
{
success: function() {
$("#bom-table").bootstrapTable('refresh');
}
}
);
});
{% else %}
$("#validate-bom").click(function() {
launchModalForm(
"{% url 'bom-validate' part.id %}",
{
reload: true,
}
);
});
$("#edit-bom").click(function () {
location.href = "{% url 'part-bom' part.id %}?edit=True";
});
$("#export-bom").click(function () {
downloadBom({
modal: '#modal-form',
url: "{% url 'bom-export' part.id %}"
});
});
{% endif %}
{% endblock %}