Make low battery summary card clickable to reveal which batteries
This commit is contained in:
@@ -29,10 +29,14 @@
|
|||||||
{% if ha_enabled %}
|
{% if ha_enabled %}
|
||||||
{% set low_pct = batteries | selectattr('battery_percentage', 'ne', none) | selectattr('battery_percentage', 'lt', 20) | list %}
|
{% set low_pct = batteries | selectattr('battery_percentage', 'ne', none) | selectattr('battery_percentage', 'lt', 20) | list %}
|
||||||
{% if low_pct %}
|
{% if low_pct %}
|
||||||
<div class="card" style="flex:1;min-width:120px;text-align:center;border:2px solid #f59e0b;">
|
<a href="#needs-attention"
|
||||||
|
onclick="var d=document.getElementById('needs-attention');d.open=true;"
|
||||||
|
style="flex:1;min-width:120px;text-decoration:none;">
|
||||||
|
<div class="card" style="text-align:center;border:2px solid #f59e0b;cursor:pointer;">
|
||||||
<div style="font-size:1.8rem;font-weight:700;color:#f59e0b;">{{ low_pct|length }}</div>
|
<div style="font-size:1.8rem;font-weight:700;color:#f59e0b;">{{ low_pct|length }}</div>
|
||||||
<div class="text-muted">Low Battery</div>
|
<div class="text-muted">Low Battery</div>
|
||||||
</div>
|
</div>
|
||||||
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
@@ -47,7 +51,7 @@
|
|||||||
{% set na_low_cap = needs_attention.low_capacity %}
|
{% set na_low_cap = needs_attention.low_capacity %}
|
||||||
{% set na_low_pct = needs_attention.low_pct %}
|
{% set na_low_pct = needs_attention.low_pct %}
|
||||||
{% if na_low_cap or na_low_pct %}
|
{% if na_low_cap or na_low_pct %}
|
||||||
<details class="card" style="margin-bottom:1rem;">
|
<details id="needs-attention" class="card" style="margin-bottom:1rem;">
|
||||||
<summary style="cursor:pointer;font-weight:600;color:var(--text-warning);list-style:none;display:flex;align-items:center;gap:0.5rem;">
|
<summary style="cursor:pointer;font-weight:600;color:var(--text-warning);list-style:none;display:flex;align-items:center;gap:0.5rem;">
|
||||||
<span>⚠</span>
|
<span>⚠</span>
|
||||||
<span>Needs Attention <span class="badge badge-warning">{{ (na_low_cap|length) + (na_low_pct|length) }}</span></span>
|
<span>Needs Attention <span class="badge badge-warning">{{ (na_low_cap|length) + (na_low_pct|length) }}</span></span>
|
||||||
|
|||||||
Reference in New Issue
Block a user