delete lot summary rework
This commit is contained in:
parent
bae34903cb
commit
f7507f1e53
|
@ -3,48 +3,94 @@
|
|||
{% load django_bootstrap5 %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="d-flex justify-content-center">
|
||||
<div class="col-md-8 mb-3">
|
||||
<div class="card border-0">
|
||||
<div class="card-body text-start">
|
||||
<p class="lead mb-4">
|
||||
<p class="lead text-center mb-4">
|
||||
{% trans "Are you sure you want to delete the following lot/s?" %}
|
||||
</p>
|
||||
|
||||
<ul class="list-group list-group-flush mb-5">
|
||||
{% for lot in lots %}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||
<span class="fw-bold">{{ lot.name }}</span>
|
||||
<span class="badge {% if lot.devices.count > 0 %} bg-warning {% else %} bg-secondary {% endif %} rounded-pill">
|
||||
<div class="card shadow-sm mb-3">
|
||||
<span class="badge {% if lot.devices.count > 0 %} bg-danger {% else %} bg-secondary {% endif %} rounded-pill">
|
||||
{{ lot.devices.count }} {% trans "device/s" %}
|
||||
</span>
|
||||
|
||||
<div class="card-header bg-light d-flex justify-content-between align-items-center">
|
||||
|
||||
<div class="d-flex align-items-center">
|
||||
<span class="me-2 badge {% if lot.archived %}bg-warning{% else %}bg-success{% endif %}">
|
||||
{% if lot.archived %}{% trans "Archived" %}{% else %}{% trans "Open" %}{% endif %}
|
||||
</span>
|
||||
|
||||
<h5 class="card-title mb-0 me-2">{{ lot.name }}</h5>
|
||||
</div>
|
||||
<button class="btn btn-link p-0" type="button" data-bs-toggle="collapse" data-bs-target="#lotDetails{{ forloop.counter }}" aria-expanded="false" aria-controls="lotDetails{{ forloop.counter }}">
|
||||
<i class="bi bi-chevron-down"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="collapse" id="lotDetails{{ forloop.counter }}">
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item">
|
||||
<strong>{% trans "Code" %}:</strong> {{ lot.code|default:"N/A" }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
<li class="list-group-item">
|
||||
<strong>{% trans "Description" %}:</strong> <span class="text-muted">{{ lot.description|default:"N/A" }}</span>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>{% trans "Owner" %}:</strong> {{ lot.owner.name }}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>{% trans "Created by" %}:</strong> {{ lot.user|default:"N/A" }}
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item">
|
||||
<strong>{% trans "Lot Group" %}:</strong> {{ lot.type.name }}
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<strong>{% trans "Created" %}:</strong> {{ lot.created|date:"Y-m-d H:i" }}
|
||||
</li>
|
||||
|
||||
<li class="list-group-item">
|
||||
<strong>{% trans "Last Updated" %}:</strong> {{ lot.updated|date:"Y-m-d H:i" }}
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% if lots_with_devices %}
|
||||
<div class="alert alert-danger d-flex align-items-center" role="alert">
|
||||
<div class="alert alert-danger d-flex align-items-center justify-content-center" role="alert">
|
||||
<i class="bi bi-exclamation-circle-fill me-2"></i>
|
||||
{% trans "All associated devices will be deassigned." %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="alert alert-info d-flex align-items-center" role="alert">
|
||||
<div class="alert alert-info d-flex align-items-center justify-content-center" role="alert">
|
||||
<i class="bi bi-info-circle-fill me-2"></i>
|
||||
{% trans "No devices are associated with these lots." %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form role="form" method="post" action="{% url 'lot:delete' %}" class="mt-4">
|
||||
{% csrf_token %}
|
||||
{% for selected_id in selected_ids %}
|
||||
<input type="hidden" name="selected_ids" value="{{ selected_id }}">
|
||||
{% endfor %}
|
||||
|
||||
<div class="d-grid gap-2 d-md-flex justify-content-md-center">
|
||||
<a class="btn btn-outline-secondary me-md-2" href="{{ request.META.HTTP_REFERER }}">
|
||||
<div class="d-grid gap-3 d-md-flex justify-content-md-center">
|
||||
<a class="btn btn-outline-secondary" href="{{ request.META.HTTP_REFERER }}">
|
||||
<i class="bi bi-x-circle me-1"></i>
|
||||
{% translate "Cancel" %}
|
||||
</a>
|
||||
|
@ -55,4 +101,5 @@
|
|||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in a new issue