Add storage location field to battery with dynamic dropdown
Dropdown populated from existing distinct storage locations, with 'New location...' option revealing a text input.
This commit is contained in:
@@ -66,6 +66,7 @@
|
||||
{% endif %}
|
||||
{{ meta_row("Charge Cycles", battery.charge_cycles) }}
|
||||
{{ meta_row("Purchase Date", battery.purchase_date) }}
|
||||
{{ meta_row("Storage", battery.storage_location) }}
|
||||
{% if battery.notes %}
|
||||
<tr>
|
||||
<td style="padding:0.3rem 1rem 0.3rem 0;font-weight:600;color:#64748b;border:none;">Notes</td>
|
||||
@@ -142,6 +143,21 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Storage Location</label>
|
||||
<select id="storage-select" onchange="metaSelectChanged(this,'storage_location')">
|
||||
<option value="">— none —</option>
|
||||
{% for loc in storage_locations|default([]) %}
|
||||
<option value="{{ loc }}" {% if battery.storage_location == loc %}selected{% endif %}>{{ loc }}</option>
|
||||
{% endfor %}
|
||||
<option value="__new__" {% if battery.storage_location and battery.storage_location not in storage_locations|default([]) %}selected{% endif %}>➕ New location…</option>
|
||||
</select>
|
||||
<input type="text" id="storage_location" name="storage_location"
|
||||
value="{{ battery.storage_location or '' }}"
|
||||
placeholder="e.g. Drawer 2, Toolbox, Shelf A"
|
||||
style="display:{% if battery.storage_location and battery.storage_location not in storage_locations|default([]) %}''{% else %}none{% endif %};margin-top:0.4rem;">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="notes">Notes</label>
|
||||
<textarea id="notes" name="notes" placeholder="No notes yet…">{{ battery.notes or '' }}</textarea>
|
||||
|
||||
Reference in New Issue
Block a user