mirror of
https://github.com/inventree/InvenTree.git
synced 2025-08-06 03:51:34 +00:00
93 lines
2.7 KiB
HTML
93 lines
2.7 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% load static %}
|
|
|
|
{% block content %}
|
|
|
|
{% include "part/cat_link.html" with category=category %}
|
|
|
|
<p>
|
|
<b>{{ category.name }}</b><br>
|
|
<i>{{ category.description }}</i>
|
|
</p>
|
|
|
|
{% if category.has_children %}
|
|
<h4>Subcategories</h4>
|
|
{% include "part/category_subcategories.html" with children=category.children.all %}
|
|
{% endif %}
|
|
|
|
{% if category.has_parts %}
|
|
<table class='table table-striped table-condensed' id='part-table'>
|
|
</table>
|
|
{% endif %}
|
|
|
|
<div class='container-fluid'>
|
|
<button type='button' class='btn btn-primary' id='create-cat'>
|
|
New Category
|
|
</button>
|
|
<button class="btn btn-info" id='edit-category'>Edit Category</button>
|
|
<button class="btn btn-success" id='create-part'>New Part</button>
|
|
<button class="btn btn-danger" id='delete-category'>Delete Category</button>
|
|
|
|
<button class='btn btn-primary' id='get-rows'>Do thing</button>
|
|
</div>
|
|
|
|
{% include 'modals.html' %}
|
|
|
|
{% endblock %}
|
|
|
|
{% block js_load %}
|
|
<script type='text/javascript' src="{% static 'script/modal_form.js' %}"></script>
|
|
{% endblock %}
|
|
{% block js_ready %}
|
|
|
|
$("#edit-category").click(function () {
|
|
launchModalForm("#modal-form",
|
|
"{% url 'category-edit' category.id %}",
|
|
{reload: true},
|
|
);
|
|
});
|
|
|
|
{% if category.parent %}
|
|
var categoryRedirect = "{% url 'category-detail' category.parent.id %}";
|
|
{% else %}
|
|
var categoryRedirect = "{% url 'part-index' %}";
|
|
{% endif %}
|
|
|
|
$("#delete-category").click(function() {
|
|
launchDeleteForm("#modal-delete",
|
|
"{% url 'category-delete' category.id %}",
|
|
{
|
|
redirect: categoryRedirect
|
|
});
|
|
});
|
|
|
|
$("#create-cat").click(function() {
|
|
launchModalForm("#modal-form",
|
|
"{% url 'category-create' %}",
|
|
{
|
|
follow: true,
|
|
data: {
|
|
category: {{ category.id }}
|
|
}
|
|
});
|
|
});
|
|
|
|
$("#create-part").click( function() {
|
|
launchModalForm("#modal-form",
|
|
"{% url 'part-create' %}",
|
|
{
|
|
data: {
|
|
category: {{ category.id }}
|
|
},
|
|
follow: true
|
|
});
|
|
});
|
|
|
|
{% include "part/category_parts.html" with category=category %}
|
|
|
|
$("#get-rows").click( function() {
|
|
alert($("#part-table").bootstrapTable('getSelections'));
|
|
});
|
|
|
|
{% endblock %} |