mirror of
https://github.com/inventree/InvenTree.git
synced 2025-08-14 07:31:10 +00:00
Added pages for editing categories
- category-detail - category-delete - category-edit - category-new
This commit is contained in:
50
InvenTree/part/templates/part/category_delete.html
Normal file
50
InvenTree/part/templates/part/category_delete.html
Normal file
@@ -0,0 +1,50 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="panel panel-danger">
|
||||
<div class="panel-heading">Are you sure you want to delete category '{{ category.name }}'?</div>
|
||||
<div class='panel-body'>
|
||||
|
||||
<p><b>Deleting this category is a permanent action and cannot be undone.</b></p>
|
||||
|
||||
{% if category.children.all|length > 0 %}
|
||||
<p>This category contains {{ category.children.all|length }} child categories.<br>
|
||||
If this category is deleted, these child categories will be moved to
|
||||
{% if category.parent %}
|
||||
the '{{ category.parent.name }}' category.
|
||||
{% else %}
|
||||
the top level 'Parts' category.
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<ul class='list-group'>
|
||||
{% for cat in category.children.all %}
|
||||
<li class='list-group-item'>{{ cat.name }} - {{ cat.description }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if category.parts.all|length > 0 %}
|
||||
<p>This category contains {{ category.parts.all|length }} parts.<br>
|
||||
{% if category.parent %}
|
||||
If this category is deleted, these parts will be moved to the parent category '{{ category.parent.pathstring }}'
|
||||
{% else %}
|
||||
If this category is deleted, these parts will be moved to the top-level category 'Parts'
|
||||
{% endif %}
|
||||
</p>
|
||||
<ul class='list-group'>
|
||||
{% for part in category.parts.all %}
|
||||
<li class='list-group-item'>{{ part.name }} - {{ part.description }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<form action="" method="post">{% csrf_token %}
|
||||
<input type="submit" name='confirm' value="Confirm" />
|
||||
<input type="submit" name="cancel" value="Cancel" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
31
InvenTree/part/templates/part/category_detail.html
Normal file
31
InvenTree/part/templates/part/category_detail.html
Normal file
@@ -0,0 +1,31 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load static %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% include "part/cat_link.html" with category=category %}
|
||||
|
||||
{% include "part/category_subcategories.html" with children=category.children.all %}
|
||||
|
||||
{% include "part/category_parts.html" with parts=category.parts.all %}
|
||||
|
||||
<div class='container-fluid'>
|
||||
<a href="{% url 'category-create' %}?category={{ category.id }}">
|
||||
<button class="btn btn-default">New Category</button>
|
||||
</a>
|
||||
<a href="{% url 'part-create' %}?category={{ category.id }}">
|
||||
<button class="btn btn-default">New Part</button>
|
||||
</a>
|
||||
|
||||
<a href="{% url 'category-edit' category.id %}">
|
||||
<button class="btn btn-info">Edit Category</button>
|
||||
</a>
|
||||
|
||||
<a href="{% url 'category-delete' category.id %}">
|
||||
<button class="button btn-danger">Delete Category</button>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
16
InvenTree/part/templates/part/category_edit.html
Normal file
16
InvenTree/part/templates/part/category_edit.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% include "part/cat_link.html" with category=category %}
|
||||
|
||||
<div class='panel panel-primary'>
|
||||
<div class='panel-heading'>Edit details for category '{{ category.name }}'</div>
|
||||
<div class='panel-body'>
|
||||
{% load crispy_forms_tags %}
|
||||
|
||||
{% crispy form %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
16
InvenTree/part/templates/part/category_new.html
Normal file
16
InvenTree/part/templates/part/category_new.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load static %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% include "part/cat_link.html" with category=category %}
|
||||
|
||||
<div class='panel panel-primary'>
|
||||
<div class='panel-heading'>Create a new part category{% if category %} in category '{{ category.name }}'{% endif %}</div>
|
||||
<div class='panel-body'>
|
||||
|
||||
{% load crispy_forms_tags %}
|
||||
{% crispy form %}
|
||||
|
||||
{% endblock %}
|
10
InvenTree/part/templates/part/category_parts.html
Normal file
10
InvenTree/part/templates/part/category_parts.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{% if parts|length > 0 %}
|
||||
Parts:
|
||||
<ul class="list-group">
|
||||
{% for part in parts %}
|
||||
<li class="list-group-item">
|
||||
<a href="{% url 'part-detail' part.id %}">{{ part.name }}</a> - {{ part.description }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
11
InvenTree/part/templates/part/category_subcategories.html
Normal file
11
InvenTree/part/templates/part/category_subcategories.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{% if children|length > 0 %}
|
||||
Subcategories:
|
||||
<ul class="list-group">
|
||||
{% for child in children %}
|
||||
<li class="list-group-item">
|
||||
<a href="{% url 'category-detail' child.id %}">{{ child.name }}</a> - {{ child.description }}
|
||||
<span class='badge'>{{ child.partcount }}</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
@@ -2,10 +2,14 @@
|
||||
|
||||
{% block details %}
|
||||
|
||||
Edit part information:
|
||||
<div class='panel panel-primary'>
|
||||
<div class='panel-heading'>Edit details for part '{{ part.name }}'</div>
|
||||
<div class='panel-body'>
|
||||
|
||||
{% load crispy_forms_tags %}
|
||||
|
||||
{% crispy form %}
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
@@ -5,31 +5,17 @@
|
||||
|
||||
{% include "part/cat_link.html" with category=category %}
|
||||
|
||||
{% if children|length > 0 %}
|
||||
Subcategories:
|
||||
<ul class="list-group">
|
||||
{% for child in children %}
|
||||
<li class="list-group-item">
|
||||
<a href="/part/list/?category={{ child.id }}">{{ child.name }}</a> - {{ child.description }}
|
||||
<span class='badge'>{{ child.partcount }}</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% include "part/category_subcategories.html" with children=children %}
|
||||
|
||||
{% if parts|length > 0 %}
|
||||
Parts:
|
||||
<ul class="list-group">
|
||||
{% for part in parts %}
|
||||
<li class="list-group-item">
|
||||
<a href="{% url 'part-detail' part.id %}">{{ part.name }}</a> - {{ part.description }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% include "part/category_parts.html" with parts=parts %}
|
||||
|
||||
<a href="/part/create/{% if category %}?category={{ category.id }}{% endif %}">
|
||||
<div class='container-fluid'>
|
||||
<a href="{% url 'category-create' %}">
|
||||
<button class="btn btn-default">New Category</button>
|
||||
</a>
|
||||
<a href="{% url 'part-create' %}">
|
||||
<button class="btn btn-default">New Part</button>
|
||||
</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
Reference in New Issue
Block a user