Implement edit componant form and adapt UI

This commit is contained in:
2021-11-11 20:51:02 +01:00
parent e2aba765d4
commit 69ed1092e0
15 changed files with 276 additions and 41 deletions

View File

@@ -36,17 +36,37 @@
</thead>
<tbody>
<tr>
<th scope="row">{{component.name}}</th>
<th>{% if component.package %}<a href="{% url 'parts-packages-detail' uuid=component.package.id %}" class="link-primary text-decoration-none">{{component.package.name}}</a>{% endif %}</th>
<th>{% if component.manufacturer %}{{component.manufacturer.name}}{% endif %}</th>
<th>{% if component.component_type %}{{component.component_type.class_name}}{% endif %}
<th>{{component.get_total_amount}}</th>
<td class="align-middle" scope="row">
{{component.name}}
</td>
<td class="align-middle" >
{% if component.package %}
<a href="{% url 'parts-packages-detail' uuid=component.package.id %}" class="link-primary text-decoration-none">{{component.package.name}}</a>
{% if component.package.image %}
<img src="{{component.package.image.url}}" class="component-img-small">
{% endif %}
{% endif %}
</td>
<td class="align-middle" >
{% if component.manufacturer %}
{{component.manufacturer.name}}
{% if component.manufacturer.image %}
<img src="{{component.manufacturer.image.url}}" class="component-img-small">
{% endif %}
{% endif %}
</td>
<td class="align-middle">
{% if component.component_type %}{{component.component_type.class_name}}{% endif %}
</td>
<td class="align-middle">
{{component.get_total_amount}}
</td>
</tr>
</tbody>
</table>
<h2>Description</h2>
{% if component.description %}
{{component.description}}
{{component.description|linebreaks}}
{% else %}
<div class="alert alert-secondary" role="alert">
No description available
@@ -80,7 +100,7 @@
</div>
</div>
{% endif %}
{% include 'parts/modals/edit-component-modal.html' with heading="Edit "|add:component.name edit_form=edit_form %}
{% include 'parts/modals/edit-component-modal.html' with heading="Edit "|add:component.name form=edit_form %}
{% endblock content %}
{% block custom_scripts %}