ECM_Control/templates/partials/button_list.html

39 lines
1.4 KiB
HTML

<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>GPIO Pin</th>
<th>Recipe</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for button in buttons %}
<tr>
<td>{{ button.name }}</td>
<td>GPIO {{ button.gpio_pin }}</td>
<td>
<select class="form-select form-select-sm"
hx-put="/buttons/{{ button.id }}"
hx-trigger="change"
name="recipe_id">
<option value="">No Recipe</option>
{% for recipe in recipes %}
<option value="{{ recipe.id }}"
{% if button.recipe_id == recipe.id %}selected{% endif %}>
{{ recipe.name }}
</option>
{% endfor %}
</select>
</td>
<td>
<span class="badge bg-{{ 'success' if button.recipe_name else 'warning' }}">
{{ 'Configured' if button.recipe_name else 'Not Configured' }}
</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>