Simplify battery management: bulk add, device-level auto-install, mass operations
- Replace single-battery add form with bulk add (brand + count, auto-generated labels) - Add device-level install form: specify brand+qty pairs, system autoselects available batteries - Add bulk actions on dashboard: retire, delete, unassign, change brand (checkbox multi-select) - Keep per-battery assign route for special cases (e.g. known low-capacity battery) - Remove unique constraint on Battery.label (labels are now auto-generated) - Add *.snapshot to .gitignore for DB snapshot files - Rewrite tests: 35 passing (11 new tests for bulk-add, device-install, bulk-actions) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,17 +1,11 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Add Battery — Battery Tracker{% endblock %}
|
||||
{% block title %}Add Batteries — Battery Tracker{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Add Battery</h1>
|
||||
<h1>Add Batteries</h1>
|
||||
|
||||
<div class="card">
|
||||
<form method="post" action="{{ url_for('battery_add') }}">
|
||||
<div class="form-group">
|
||||
<label for="label">Label <span class="text-danger">*</span></label>
|
||||
<input type="text" id="label" name="label" value="{{ form_label|default('') }}"
|
||||
placeholder="e.g. ENL-17" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="brand">Brand <span class="text-danger">*</span></label>
|
||||
<input type="text" id="brand" name="brand" value="{{ form_brand|default('') }}"
|
||||
@@ -19,21 +13,18 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="status">Initial Status</label>
|
||||
<select id="status" name="status">
|
||||
<option value="available" {% if form_status|default('available') == 'available' %}selected{% endif %}>Available</option>
|
||||
<option value="installed" {% if form_status|default('') == 'installed' %}selected{% endif %}>Installed</option>
|
||||
<option value="retired" {% if form_status|default('') == 'retired' %}selected{% endif %}>Retired</option>
|
||||
</select>
|
||||
<label for="count">Quantity</label>
|
||||
<input type="number" id="count" name="count" value="{{ form_count|default(1) }}" min="1" max="50">
|
||||
<small class="text-muted">Labels are auto-generated (e.g. Eneloop 001, Eneloop 002)</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="notes">Notes</label>
|
||||
<textarea id="notes" name="notes" placeholder="Optional notes…">{{ form_notes|default('') }}</textarea>
|
||||
<textarea id="notes" name="notes" placeholder="Optional notes applied to all batteries…">{{ form_notes|default('') }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button class="btn btn-primary" type="submit">Add Battery</button>
|
||||
<button class="btn btn-primary" type="submit">Add Batteries</button>
|
||||
<a class="btn btn-secondary" href="{{ url_for('dashboard') }}">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user