2021-08-07 17:37:36 +02:00
{% extends 'base.html' %}
{% load qr_code %}
{% block content %}
< div class = "container" >
2021-08-14 00:25:19 +02:00
< nav aria-label = "breadcrumb" class = "fs-4" >
< ol class = "breadcrumb" >
< li class = "breadcrumb-item" > < / li >
{% for crumb in breadcrumbs %}
< li class = "breadcrumb-item" > < a href = "{% url 'parts-stocks-detail' uuid=crumb.id %}" > {{crumb.name}}< / a > < / li >
{% endfor %}
< li class = "breadcrumb-item active" aria-current = "page" > {{object.name}}< / li >
< / ol >
< / nav >
2021-08-07 17:37:36 +02:00
2021-08-14 00:25:19 +02:00
< div class = "row" >
< div class = "col-md" >
{% qr_from_text object.get_qr_code size="m" image_format="svg" %}
< / div >
< div class = "col-md" >
{% if object.parent_storage %}
2021-08-14 02:35:09 +02:00
< h1 > Sub-Storages < a class = "btn btn-secondary" href = "{% url 'parts-stocks-detail' uuid=object.parent_storage.id %}" > Parent Storage< / a > {% else %}
< h1 > Sub-Storages < a class = "btn btn-secondary" href = "{% url 'parts-stocks'%}" > Stock Overview< / a >
2021-08-14 00:25:19 +02:00
{% endif %}
2021-08-14 02:35:09 +02:00
< button type = "button" class = "btn btn-primary" data-bs-toggle = "modal" data-bs-target = "#add-sub-modal" > < i class = "bi bi-plus-circle" > < / i > < / button >
< / h1 >
2021-08-14 00:25:19 +02:00
< div class = "list-group" >
{% for storage in storages %}
< a href = "{% url 'parts-stocks-detail' uuid=storage.id %}" class = "text-decoration-none" >
< li class = "list-group-item list-group-item-action justify-content-between align-items-center d-flex" >
< div >
< h5 > {{storage.name}}< / h5 >
Responsible: {{ storage.responsible }}
< / div >
< span class = "badge bg-primary rounded-pill" > {{storage.get_total_stock_amount}}< / span >
< / li >
< / a >
{% endfor %}
< / div >
2021-08-14 02:20:45 +02:00
{% include 'paginator.html' with paginator=storages get_param='storage_page' aria_label='Storage Page Navigation' %}
2021-08-14 00:25:19 +02:00
< / div >
< / div >
2021-08-14 02:35:09 +02:00
<!-- Modal for adding a substorage -->
2021-10-24 21:14:11 +02:00
{% with add_storage_form as form %}
2021-08-14 02:35:09 +02:00
< div class = "modal fade" id = "add-sub-modal" >
< div class = "modal-dialog" >
< div class = "modal-content" >
< div class = "modal-header" >
< h5 class = "modal-title" id = "staticBackdropLabel" > Add Storage< / 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" >
2021-10-24 21:14:11 +02:00
< label for = "add-storage-name" class = "form-label" > Storage Name< / label >
< div class = "input-group has-validation" >
< input value = "{{form.storage_name.value}}" class = "form-control{% if form.storage_name.errors or form.non_field_errors %} is-invalid{% endif %}" id = "add-storage-name" name = "{{form.storage_name.name}}" type = "text" aria-describedby = "validationStorageName" required >
< div id = "validationStorageName" class = "invalid-feedback" >
{% for msg in form.storage_name.errors %}
{{msg}}
{% endfor %}
< / div >
< / div >
< label for = "{{form.responsible.id_for_label}}" > Responsible< / label >
< div class = "input-group has-validation" >
< span class = "input-group-text" id = "add_storage_username_prepend" > @< / span > < input type = "text" value = "{{form.responsible.value}}" class = "form-control{% if form.responsible.errors or form.non_field_errors %} is-invalid{% endif %}" id = "{{form.responsible.id_for_label}}" name = "{{form.responsible.name}}" aria-describedby = "add_storage_username_prepend validationServerUsernameFeedback" required >
< div id = "validationServerUsernameFeedback" class = "invalid-feedback" >
{% for msg in form.responsible.errors %}
{{msg}}
{% endfor %}
< / div >
< / div >
2021-08-14 02:35:09 +02:00
< / div >
< div class = "modal-footer" >
< button type = "button" class = "btn btn-secondary" data-bs-dismiss = "modal" > Close< / button >
< input type = "submit" class = "btn btn-primary" value = "Add Storage" name = "submit-add-storage" >
2021-10-24 21:14:11 +02:00
{% if form.non_field_errors %}
{% for error in form.non_field_errors %}
< p class = "text-danger text-center" > {{ error }}< / p >
{% endfor %}
{% endif %}
2021-08-14 02:35:09 +02:00
< / div >
< / form >
< / div >
2021-10-24 21:14:11 +02:00
{% endwith %}
2021-08-14 02:35:09 +02:00
< / div >
2021-08-07 17:37:36 +02:00
< / div >
2021-10-24 21:14:11 +02:00
{% endblock content %}
{% block custom_scripts %}
{% if add_storage_form.errors %}
< script type = "text/javascript" >
var addSubStorageModal = document.querySelector('#add-sub-modal');
var modal = bootstrap.Modal.getOrCreateInstance(addSubStorageModal);
modal.show();
< / script >
{% endif %}
{% endblock custom_scripts %}