{% extends "part/part_base.html" %} {% load static %} {% block css %} {% endblock %} {% block details %} {% include 'part/tabs.html' with tab='bom' %}

Bill of Materials

{% endblock %} {% block js_load %} {% endblock %} {% block js_ready %} function reloadBom() { $("#bom-table").bootstrapTable('refresh'); } $('#bom-table').on('click', '.delete-button', function () { var button = $(this); launchDeleteForm("#modal-delete", button.attr('url'), { success: reloadBom }); }); $("#bom-table").on('click', '.edit-button', function () { var button = $(this); launchModalForm("#modal-form", button.attr('url'), { success: reloadBom }); }); $("#new-bom-item").click(function () { launchModalForm("#modal-form", "{% url 'bom-item-create' %}", { reload: true, data: { parent: {{ part.id }} } }); }); $("#bom-table").bootstrapTable({ sortable: true, search: true, queryParams: function(p) { return { part: {{ part.id }} } }, columns: [ { field: 'pk', title: 'ID', visible: false, }, { field: 'sub_part', title: 'Part', sortable: true, formatter: function(value, row, index, field) { return renderLink(value.name, value.url); } }, { field: 'sub_part.description', title: 'Description', }, { field: 'quantity', title: 'Quantity', searchable: false, sortable: true }, { formatter: function(value, row, index, field) { return editButton(row.url + 'edit') + ' ' + deleteButton(row.url + 'delete'); } } ], url: "{% url 'api-bom-list' %}" }); {% endblock %}