Implement distributor numbers

This commit is contained in:
2022-01-02 16:23:49 +01:00
parent f520b22dd0
commit 494aded95b
4 changed files with 102 additions and 16 deletions

View File

@@ -98,8 +98,29 @@
<h3>Parameters</h3>
</div>
<div class="col">
<h3>Distributor Part Numbers</h3>
<h3>Distributor Part Numbers <button class="btn btn-success" data-bs-toggle="modal" data-bs-target="#new-distributor-number-modal"><i class="bi bi-plus-circle"></i></button></h3>
<table class="table">
<thead>
<th scope="col">Distributor</th>
<th scope="col">Part Number</th>
<th scope="col"></th>
</thead>
<tbody>
{% for num in distri_nums %}
<tr>
<td><a class="link-primary text-decoration-none" href="{% url 'parts-distributors-detail' uuid=num.distributor.id %}">{{num.distributor.name}}</a></td>
<td>{{num.distributor_part_number}}</td>
<td>
<form method="post">
{% csrf_token %}
<input type="hidden" value="{{num.id}}" name="distributor_num">
<button class="btn btn-danger" name="submit-delete-distributor-num">X</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="row mt-2">
@@ -181,6 +202,7 @@
</div>
</div>
{% include 'parts/modals/new-distributor-number-modal.html' with component_name=component.name form=new_distri_num_form %}
{% include 'parts/modals/edit-component-modal.html' with heading="Edit "|add:component.name form=comp_form %}
{% endblock content %}
@@ -193,6 +215,9 @@ bootstrap.Modal.getOrCreateInstance(document.getElementById('comp-edit-modal')).
{% if delete_error %}
bootstrap.Modal.getOrCreateInstance(document.getElementById('component-delete-modal')).show();
{% endif %}
{% if new_distri_num_form.errors %}
bootstrap.Modal.getOrCreateInstance(document.getElementById('new-distributor-number-modal')).show();
{% endif %}
</script>
{% endblock custom_scripts %}