2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-14 15:41:10 +00:00

Fix issues for AjaxUdpateView

- Works properly now!
- Can edit BOM item inline
- Can add BOM item inline too
This commit is contained in:
Oliver
2018-04-26 09:26:43 +10:00
parent 55e7f365df
commit e395d89a7f
7 changed files with 50 additions and 23 deletions

View File

@@ -1,9 +1,16 @@
{% extends "part/part_base.html" %}
{% load static %}
{% block details %}
{% include 'part/tabs.html' with tab='bom' %}
<div class='modal fade' id='modal-form'>
<div class='modal-dialog'>
<div class='modal-content'>
</div>
</div>
</div>
<h3>Bill of Materials</h3>
<table class="table table-striped">
@@ -18,9 +25,9 @@
<tr>
<td><a href="{% url 'part-detail' sub_part.id %}">{{ sub_part.name }}</a></td>
<td>{{ sub_part.description }}</td>
<td>{{ bom_item.quantity }}</span></td>
<td>{{ bom_item.quantity }}</td>
<td>
<button type='button' class='btn btn-success'>Edit</button>
<button type='button' url="{% url 'bom-item-edit' bom_item.id %}" class='btn btn-success edit-row-button'>Edit</button>
</td>
</tr>
{% endwith %}
@@ -28,9 +35,7 @@
</table>
<div class='container-fluid'>
<a href="{% url 'bom-item-create' %}?parent={{ part.id }}">
<button class='btn btn-success'>Add BOM Item</button>
</a>
<button type='button' class='btn btn-success' id='new-bom-item'>Add BOM Item</button>
</div>
{% endblock %}
@@ -39,4 +44,19 @@
<script type='text/javascript' src="{% static 'script/modal_form.js' %}"></script>
<script type='text/javascript'>
$(".edit-row-button").click(function () {
var button = $(this);
launchModalForm("#modal-form",
button.attr('url'));
});
$("#new-bom-item").click(function () {
launchModalForm("#modal-form",
"{% url 'bom-item-create' %}/?parent={{ part.id }}");
});
</script>
{% endblock %}

View File

@@ -54,10 +54,12 @@
<script type='text/javascript'>
bindModalForm('#modal-cat',
'.js-create-cat',
"{% url 'category-create' %}",
{category: {{ category.id }} });
$(".js-create-cat").click(function() {
launchModalForm("#modal-cat",
"{% url 'category-create' %}",
{category: {{ category.id }} });
});
</script>

View File

@@ -40,8 +40,6 @@ $(document).ready(function () {
$(".js-create-cat").click(function() {
launchModalForm("#modal-cat", "{% url 'category-create' %}");
});
//bindModalForm('#modal-cat', '.js-create-cat', "{% url 'category-create' %}");
});
</script>