Add device charge-all route, last-charged column, and CSRF fix for quick-assign
This commit is contained in:
@@ -166,7 +166,7 @@ function addInstallRow() {
|
||||
<div class="table-wrap">
|
||||
<table class="responsive-table">
|
||||
<thead>
|
||||
<tr><th>Label</th><th>Brand</th>{% if ha_enabled %}<th>Bat %</th>{% endif %}<th>Notes</th><th>Actions</th></tr>
|
||||
<tr><th>Label</th><th>Brand</th>{% if ha_enabled %}<th>Bat %</th>{% endif %}<th>Last Charged</th><th>Notes</th><th>Actions</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for b in installed %}
|
||||
@@ -182,6 +182,7 @@ function addInstallRow() {
|
||||
{% else %}—{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
<td data-label="Last Charged" class="text-muted">{{ b.charge_logs[-1].charged_date if b.charge_logs else '—' }}</td>
|
||||
<td data-label="Notes" class="text-muted">{{ b.notes or '—' }}</td>
|
||||
<td data-label="Actions">
|
||||
<form class="inline" method="post" action="{{ url_for('battery_unassign', battery_id=b.id) }}">
|
||||
@@ -209,6 +210,32 @@ function addInstallRow() {
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if installed %}
|
||||
<div class="card">
|
||||
<h2>Charge All Installed Batteries</h2>
|
||||
<form method="post" action="{{ url_for('device_charge_all', device_id=device.id) }}"
|
||||
style="display:flex;gap:0.5rem;flex-wrap:wrap;align-items:flex-end;">
|
||||
<div class="form-group" style="margin:0;flex:1;min-width:140px;">
|
||||
<label>Date</label>
|
||||
<input type="date" name="charged_date" required>
|
||||
</div>
|
||||
<div class="form-group" style="margin:0;align-self:flex-end;padding-bottom:1rem;">
|
||||
<label style="display:flex;align-items:center;gap:0.4rem;font-weight:normal;cursor:pointer;">
|
||||
<input type="checkbox" name="increment_cycles" value="1" checked>
|
||||
Increment charge cycles
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group" style="margin:0;flex:2;min-width:160px;">
|
||||
<label>Notes (optional)</label>
|
||||
<input type="text" name="notes" placeholder="e.g. overnight charge">
|
||||
</div>
|
||||
<div style="padding-bottom:1rem;">
|
||||
<button class="btn btn-primary" type="submit">Log Charge for All</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="card">
|
||||
<h2>Install Specific Batteries{% if device.battery_size %} <small class="text-muted" style="font-weight:normal;font-size:0.8rem;">({{ device.battery_size }} only)</small>{% endif %}</h2>
|
||||
{% if available_batteries %}
|
||||
|
||||
Reference in New Issue
Block a user