74 lines
3.3 KiB
HTML
74 lines
3.3 KiB
HTML
|
{% extends 'base.html' %}
|
||
|
{% load static %}
|
||
|
{% load crispy_forms_tags %}
|
||
|
|
||
|
{% block content %}
|
||
|
<div class="container">
|
||
|
<div class="row">
|
||
|
<div class="col-md">
|
||
|
<h2>Manufacturers</h2>
|
||
|
<form action="" method="get">
|
||
|
<div class="input-group mb-3">
|
||
|
<input class="form-control" name="search" type="search" placeholder="Search Manufacturer..." {% if search_string %}value="{{search_string}}"{% endif %}>
|
||
|
<button type="submit" class="btn btn-primary">
|
||
|
<i class="bi bi-search"></i>
|
||
|
</button>
|
||
|
<button class="btn btn-success" type="button" data-bs-toggle="modal" data-bs-target="#add-manufacturer-modal"><i class="bi bi-plus-circle"></i> Add Manufacturer</button>
|
||
|
</div>
|
||
|
</form>
|
||
|
<div class="mb-3">
|
||
|
{% include 'paginator.html' with paginator=manufacturers get_param='page' aria_label='Manufacturer Page Navigation' %}
|
||
|
</div>
|
||
|
<div class="list-group mb-3">
|
||
|
{% for manufacturer in manufacturers %}
|
||
|
<a href="{% url 'parts-manufacturers-detail' uuid=manufacturer.id %}" class="text-decoration-none">
|
||
|
<li class="list-group-item list-group-item-action d-flex align-items-center">
|
||
|
<div class="flex-shrink-0">
|
||
|
{% if manufacturer.image %}
|
||
|
<img src="{{manufacturer.image.url}}" class="component-img-small" alt="{{ manufacturer.name }}" class="mr-3">
|
||
|
{% else %}
|
||
|
<img src="{% static 'css/icons/card-image.svg' %}" class="component-img-def-small" alt="{{ manufacturer.name }}" class="mr-3">
|
||
|
{% endif %}
|
||
|
</div>
|
||
|
<div class="flex-grow-1 ms-3">
|
||
|
<h6 class="mt-0 text-primary">{{ manufacturer.name }}</h6>
|
||
|
{{manufacturer.website|default_if_none:"No website specified"}}
|
||
|
</div>
|
||
|
</li>
|
||
|
</a>
|
||
|
{% endfor %}
|
||
|
</div>
|
||
|
{% include 'paginator.html' with paginator=manufacturers get_param='page' aria_label='Manufacturer Page Navigation' %}
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="modal fade" id="add-manufacturer-modal" tabindex="-1" aria-labelledby="Add Manufacturer Modal" aria-hidden="true">
|
||
|
<div class="modal-dialog">
|
||
|
<div class="modal-content">
|
||
|
<div class="modal-header">
|
||
|
<h5 class="modal-title">Add New Manufacturer</h5>
|
||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||
|
</div>
|
||
|
<form method="post" enctype="multipart/form-data">
|
||
|
{% csrf_token %}
|
||
|
<div class="modal-body">
|
||
|
{{new_manufacturer_form|crispy}}
|
||
|
</div>
|
||
|
<div class="modal-footer">
|
||
|
<input type="submit" class="btn btn-primary" name="submit-manufacturer-add-new" value="Add Manufacturer">
|
||
|
</div>
|
||
|
</form>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
{% endblock content %}
|
||
|
|
||
|
{% block custom_scripts %}
|
||
|
<script type="text/javascript">
|
||
|
{% if new_manufacturer_form.errors %}
|
||
|
bootstrap.Modal.getOrCreateInstance(document.getElementById('add-manufacturer-modal')).show()
|
||
|
{% endif %}
|
||
|
</script>
|
||
|
{% endblock custom_scripts %}
|