state button rework and warning if same state
This commit is contained in:
parent
92ce6d89b2
commit
d005d323f4
|
@ -5,24 +5,28 @@
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<h3>{{ object.shortid }}</h3>
|
<h3>{{ object.shortid }}
|
||||||
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="col text-end">
|
<div class="col text-end">
|
||||||
{% if state_definitions %}
|
{% if state_definitions %}
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<button class="btn btn-green-admin dropdown-toggle" type="button" id="addStateDropdown" data-bs-toggle="dropdown" aria-expanded="false">
|
<button class="btn btn-green-admin dropdown-toggle" type="button" id="addStateDropdown" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
{% trans "Action" %}
|
{% trans "Action" %}
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu" aria-labelledby="addStateDropdown">
|
<ul class="dropdown-menu" aria-labelledby="addStateDropdown">
|
||||||
{% for state in state_definitions %}
|
{% for state in state_definitions %}
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#addStateModal{{ state.id }}">
|
<a class="dropdown-item d-flex justify-content-between align-items-center" href="#" data-bs-toggle="modal" data-bs-target="#addStateModal{{ state.id }}">
|
||||||
{{ state.state }}
|
<span class="badge bg-secondary rounded-pill-sm">{{ forloop.counter }}
|
||||||
</a>
|
</span>
|
||||||
</li>
|
<span>{{ state.state }}
|
||||||
{% endfor %}
|
</span>
|
||||||
</ul>
|
</a>
|
||||||
</div>
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<button class="btn btn-green-admin" type="button" disabled>
|
<button class="btn btn-green-admin" type="button" disabled>
|
||||||
{% trans "Action" %}
|
{% trans "Action" %}
|
||||||
|
@ -89,15 +93,26 @@
|
||||||
<h5 class="modal-title" id="addStateModalLabel{{ state.id }}">{% trans "Summary of changes" %}</h5>
|
<h5 class="modal-title" id="addStateModalLabel{{ state.id }}">{% trans "Summary of changes" %}</h5>
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body m-2">
|
<div class="modal-body m-1">
|
||||||
|
{% if device_states and device_states.0.state == state.state %}
|
||||||
|
<div class="alert alert-warning d-flex align-items-center">
|
||||||
|
<i class="bi bi-exclamation-triangle-fill me-2"></i>
|
||||||
|
<span>{% trans "The device is already in the selected state." %}</span>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
<i class="bi bi-arrow-right-circle text-danger me-2"></i>
|
<i class="bi bi-arrow-right-circle text-danger me-2"></i>
|
||||||
|
|
||||||
<span class="text-danger fw-bold me-2">{% trans "From:" %}</span>
|
<span class="text-danger fw-bold me-2">{% trans "From:" %}</span>
|
||||||
<span class="text-danger fw-italic">state_placeholder</span>
|
<span class="text-danger fw-italic">
|
||||||
|
{% if device_states %}
|
||||||
|
{{device_states.0.state}}
|
||||||
|
{% else %}
|
||||||
|
{% trans 'None' %}
|
||||||
|
{% endif %}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex align-items-center mt-2">
|
<div class="d-flex align-items-center mt-2">
|
||||||
<i class="bi bi-arrow-right-circle text-success me-2"></i>
|
<i class="bi bi-arrow-right-circle text-success me-2"></i>
|
||||||
|
|
Loading…
Reference in a new issue