Implement sorting of component parameters ind distri nums and add description collapse for parameters
This commit is contained in:
parent
f092977b2a
commit
a3fc0e8447
@ -623,8 +623,8 @@ class ComponentDetailView(LoginRequiredMixin, BaseTemplateMixin, DetailView):
|
|||||||
context['comp_form'] = ComponentForm(instance=self.object)
|
context['comp_form'] = ComponentForm(instance=self.object)
|
||||||
context['new_distri_num_form'] = DistributorNumberCreateForm()
|
context['new_distri_num_form'] = DistributorNumberCreateForm()
|
||||||
context['new_param_form'] = ComponentParameterCreateForm()
|
context['new_param_form'] = ComponentParameterCreateForm()
|
||||||
context['distri_nums'] = DistributorNum.objects.filter(component=self.object)
|
context['distri_nums'] = DistributorNum.objects.filter(component=self.object).order_by('distributor__name')
|
||||||
context['parameters'] = ComponentParameter.objects.filter(component=self.object)
|
context['parameters'] = ComponentParameter.objects.filter(component=self.object).order_by('parameter_type__parameter_name')
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
@ -93,10 +93,26 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row mt-2">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<th scope="col">Storage</th>
|
||||||
|
<th scope="col">Amount</th>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for stock in stocks %}
|
||||||
|
<tr>
|
||||||
|
<td><a class="text-decoration-none text-primary" href="{% url 'parts-stocks-detail' uuid=stock.storage.id %}">{{stock.storage.get_full_path}}</a></td>
|
||||||
|
<td>{{stock.amount}}</td>
|
||||||
|
<tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<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>
|
<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">
|
<table class="table align-middle mb-3">
|
||||||
<thead>
|
<thead>
|
||||||
<th scope="col">Parameter</th>
|
<th scope="col">Parameter</th>
|
||||||
<th scope="col">Value</th>
|
<th scope="col">Value</th>
|
||||||
@ -105,23 +121,38 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
{% for param in parameters %}
|
{% for param in parameters %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{param.parameter_type.parameter_name}}</td>
|
<td>
|
||||||
<td>{{param.resolved_value_as_string}}</td>
|
<h6 {% if param.parameter_type.parameter_description %} class="accordion-header" data-bs-toggle="collapse" data-bs-target="#collapse-parameter-desc-{{forloop.counter}}"{% endif %}>
|
||||||
|
{{param.parameter_type.parameter_name}}
|
||||||
|
</h6>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{param.resolved_value_as_string}}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" value="{{param.id}}" name="param_num">
|
<input type="hidden" value="{{param.id}}" name="param_num">
|
||||||
<button class="btn btn-danger" name="submit-delete-param">X</button>
|
<button class="btn btn-danger" name="submit-delete-param">X</button>
|
||||||
</form>
|
</form>
|
||||||
<td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<div class="accordion" id="accordion-param-desc">
|
||||||
|
{% for param in parameters %}
|
||||||
|
{% if param.parameter_type.parameter_description %}
|
||||||
|
<div class="collapse accordion-collapse" id="collapse-parameter-desc-{{forloop.counter}}" data-bs-parent="#accordion-param-desc">
|
||||||
|
{{param.parameter_type.parameter_description}}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
<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>
|
<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">
|
<table class="table align-middle">
|
||||||
<thead>
|
<thead>
|
||||||
<th scope="col">Distributor</th>
|
<th scope="col">Distributor</th>
|
||||||
<th scope="col">Part Number</th>
|
<th scope="col">Part Number</th>
|
||||||
@ -145,22 +176,6 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mt-2">
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<th scope="col">Storage</th>
|
|
||||||
<th scope="col">Amount</th>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{% for stock in stocks %}
|
|
||||||
<tr>
|
|
||||||
<td><a class="text-decoration-none text-primary" href="{% url 'parts-stocks-detail' uuid=stock.storage.id %}">{{stock.storage.get_full_path}}</a></td>
|
|
||||||
<td>{{stock.amount}}</td>
|
|
||||||
<tr>
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user