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['new_distri_num_form'] = DistributorNumberCreateForm()
|
||||
context['new_param_form'] = ComponentParameterCreateForm()
|
||||
context['distri_nums'] = DistributorNum.objects.filter(component=self.object)
|
||||
context['parameters'] = ComponentParameter.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).order_by('parameter_type__parameter_name')
|
||||
|
||||
return context
|
||||
|
||||
|
@ -93,10 +93,26 @@
|
||||
{% endif %}
|
||||
</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="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>
|
||||
<table class="table">
|
||||
<table class="table align-middle mb-3">
|
||||
<thead>
|
||||
<th scope="col">Parameter</th>
|
||||
<th scope="col">Value</th>
|
||||
@ -105,23 +121,38 @@
|
||||
<tbody>
|
||||
{% for param in parameters %}
|
||||
<tr>
|
||||
<td>{{param.parameter_type.parameter_name}}</td>
|
||||
<td>{{param.resolved_value_as_string}}</td>
|
||||
<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>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</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 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>
|
||||
<table class="table">
|
||||
<table class="table align-middle">
|
||||
<thead>
|
||||
<th scope="col">Distributor</th>
|
||||
<th scope="col">Part Number</th>
|
||||
@ -145,22 +176,6 @@
|
||||
</table>
|
||||
</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>
|
||||
|
Loading…
Reference in New Issue
Block a user