From 5162c1d11fdb7a95e58df42a76ad48b56595d2eb Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 27 Apr 2018 00:54:01 +1000 Subject: [PATCH] Inline deletion for BOM items --- InvenTree/part/templates/part/bom-delete.html | 22 ++-- InvenTree/part/templates/part/bom.html | 11 +- .../part/templates/part/category_detail.html | 7 +- .../part/templates/part/category_parts.html | 102 ++++-------------- InvenTree/part/templates/part/index.html | 2 + .../part/templates/part/partial_delete.html | 2 + InvenTree/part/templates/part/tabs.html | 2 +- InvenTree/part/views.py | 8 +- InvenTree/static/script/modal_form.js | 16 ++- wip/ajax_request.js | 71 ++++++++++++ 10 files changed, 134 insertions(+), 109 deletions(-) create mode 100644 wip/ajax_request.js diff --git a/InvenTree/part/templates/part/bom-delete.html b/InvenTree/part/templates/part/bom-delete.html index 4cf9c8524e..d0f36d9b71 100644 --- a/InvenTree/part/templates/part/bom-delete.html +++ b/InvenTree/part/templates/part/bom-delete.html @@ -1,15 +1,9 @@ -{% extends "delete_obj.html" %} +Are you sure you want to delete this BOM item? +
+Deleting this entry will remove the BOM row from the following part: -{% block del_title %} - Are you sure you want to delete this BOM item? -{% endblock %} - -{% block del_body %} - Deleting this entry will remove the BOM row from the following part: - - -{% endblock %} \ No newline at end of file + diff --git a/InvenTree/part/templates/part/bom.html b/InvenTree/part/templates/part/bom.html index 559b9a5af4..bb1b5c7eed 100644 --- a/InvenTree/part/templates/part/bom.html +++ b/InvenTree/part/templates/part/bom.html @@ -12,6 +12,7 @@ {% include 'part/tabs.html' with tab='bom' %} {% include 'modal.html' %} +{% include 'modal_delete.html' %}

Bill of Materials

@@ -21,7 +22,7 @@ Part Description Quantity - Edit + @@ -33,6 +34,7 @@ {{ bom_item.quantity }} + {% endwith %} @@ -55,6 +57,13 @@ $(document).ready(function(){ $('#bom-table').footable(); + $('#bom-table').on('click', '.delete-row-button', function () { + var button = $(this); + + launchDeleteForm("#modal-delete", + button.attr('url')); + }); + $('#bom-table').on('click', '.edit-row-button', function () { var button = $(this); diff --git a/InvenTree/part/templates/part/category_detail.html b/InvenTree/part/templates/part/category_detail.html index 1c6212f6f4..88325bc82f 100644 --- a/InvenTree/part/templates/part/category_detail.html +++ b/InvenTree/part/templates/part/category_detail.html @@ -42,10 +42,12 @@ {% endblock %} {% block javascript %} - +`` {% endblock %} \ No newline at end of file diff --git a/InvenTree/part/templates/part/category_parts.html b/InvenTree/part/templates/part/category_parts.html index a878d8ed4f..97dc1da910 100644 --- a/InvenTree/part/templates/part/category_parts.html +++ b/InvenTree/part/templates/part/category_parts.html @@ -1,90 +1,24 @@ -
-
- - - - -
- - +
+ + + + +{% for part in parts %} + + + + + + +{% endfor %} +
Part Description CategoryStock
{{ part.name }}{{ part.description }} + {% if part.category %} + {{ part.category_path }} + {% endif %} + {{ part.total_stock }}
- -
- -{% load static %} - - - - \ No newline at end of file diff --git a/InvenTree/part/templates/part/index.html b/InvenTree/part/templates/part/index.html index 202c553956..fb6ac2da57 100644 --- a/InvenTree/part/templates/part/index.html +++ b/InvenTree/part/templates/part/index.html @@ -25,10 +25,12 @@ {% block javascript %} + + + \ No newline at end of file