Add component parameter forms
This commit is contained in:
@@ -95,7 +95,29 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h3>Parameters</h3>
|
||||
<h3>Parameters <button class="btn btn-success" data-bs-toggle="modal" data-bs-target="#new-component-parameter-modal"><i class="bi bi-plus-circle"></i></button></h3>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th scope="col">Parameter</th>
|
||||
<th scope="col">Value</th>
|
||||
<th scope="col"></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for param in parameters %}
|
||||
<tr>
|
||||
<td>{{param.parameter_type.parameter_name}}</td>
|
||||
<td>{{param.resolved_value_as_string}}</td>
|
||||
<td>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" value="{{param.id}}" name="param_num">
|
||||
<button class="btn btn-danger" name="submit-delete-param">X</button>
|
||||
</form>
|
||||
<td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col">
|
||||
<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>
|
||||
@@ -204,6 +226,7 @@
|
||||
|
||||
{% 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 %}
|
||||
{% include 'parts/modals/new-component-parameter-modal.html' with component_name=component.name form=new_param_form %}
|
||||
{% endblock content %}
|
||||
|
||||
{% block custom_scripts %}
|
||||
@@ -218,6 +241,9 @@ bootstrap.Modal.getOrCreateInstance(document.getElementById('component-delete-mo
|
||||
{% if new_distri_num_form.errors %}
|
||||
bootstrap.Modal.getOrCreateInstance(document.getElementById('new-distributor-number-modal')).show();
|
||||
{% endif %}
|
||||
{% if new_param_form.errors %}
|
||||
bootstrap.Modal.getOrCreateInstance(document.getElementById('new-component-parameter-modal')).show();
|
||||
{% endif %}
|
||||
</script>
|
||||
{% endblock custom_scripts %}
|
||||
|
||||
|
@@ -0,0 +1,26 @@
|
||||
{% comment "" %}
|
||||
Needs:
|
||||
- form : ComponentParameterCreateForm
|
||||
- component_name: Component's name
|
||||
|
||||
{% endcomment %}
|
||||
{% load crispy_forms_tags %}
|
||||
<div class="modal fade" id="new-component-parameter-modal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Add Parameter for {{component_name}}</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
<div class="modal-body">
|
||||
{{form|crispy}}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<input type="submit" class="btn btn-primary" value="Add Number" name="submit-create-new-param">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user