{% extends "InvenTree/settings/settings.html" %} {% load i18n %} {% block tabs %} {% include "InvenTree/settings/tabs.html" with tab='category' %} {% endblock %} {% block subtitle %} {% trans "Category Settings" %} {% endblock %} {% block settings %}
{% csrf_token %} {% load crispy_forms_tags %}
{% crispy form %}
{% if category %}

{% trans "Category Parameter Templates" %}

{% endif %} {% endblock %} {% block js_ready %} {{ block.super }} {# Convert dropdown to select2 format #} $(document).ready(function() { attachSelect('#category-select'); }); {% if category %} $("#param-table").inventreeTable({ url: "{% url 'api-part-category-parameters' category.pk %}", queryParams: { ordering: 'name', }, formatNoMatches: function() { return '{% trans "No category parameter templates found" %}'; }, columns: [ { field: 'pk', title: 'ID', visible: false, switchable: false, }, { field: 'parameter_template_detail.name', title: '{% trans "Parameter Template" %}', sortable: 'true', }, { field: 'default_value', title: '{% trans "Default Value" %}', sortable: 'true', formatter: function(value, row, index, field) { var bEdit = ""; var bDel = ""; var html = value html += "
" + bEdit + bDel + "
"; return html; } } ] }); $("#new-param").click(function() { launchModalForm("{% url 'category-param-template-create' category.pk %}", { success: function() { $("#param-table").bootstrapTable('refresh'); }, }); }); $("#param-table").on('click', '.template-edit', function() { var button = $(this); var url = "/part/category/{{ category.pk }}/parameters/" + button.attr('pk') + "/edit/"; launchModalForm(url, { success: function() { $("#param-table").bootstrapTable('refresh'); } }); }); $("#param-table").on('click', '.template-delete', function() { var button = $(this); var url = "/part/category/{{ category.pk }}/parameters/" + button.attr('pk') + "/delete/"; launchModalForm(url, { success: function() { $("#param-table").bootstrapTable('refresh'); } }); }); {% endif %} {% endblock %}