80 lines
2.4 KiB
HTML
80 lines
2.4 KiB
HTML
{% extends "base.html" %} {% block title %}Consumption · CalMiner{% endblock %}
|
|
{% block content %}
|
|
<section class="panel">
|
|
<h2>Consumption Tracking</h2>
|
|
<div class="form-grid">
|
|
<label for="consumption-scenario-filter">
|
|
Scenario filter
|
|
<select id="consumption-scenario-filter">
|
|
<option value="">Select a scenario</option>
|
|
{% for scenario in scenarios %}
|
|
<option value="{{ scenario.id }}">{{ scenario.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</label>
|
|
</div>
|
|
<div id="consumption-empty" class="empty-state">
|
|
Choose a scenario to review its consumption records.
|
|
</div>
|
|
<div id="consumption-table-wrapper" class="table-container hidden">
|
|
<table aria-label="Scenario consumption records">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Amount</th>
|
|
<th scope="col">Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="consumption-table-body"></tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
|
|
<section class="panel">
|
|
<h2>Add Consumption Record</h2>
|
|
{% if scenarios %}
|
|
<form id="consumption-form" class="form-grid">
|
|
<label for="consumption-form-scenario">
|
|
Scenario
|
|
<select id="consumption-form-scenario" name="scenario_id" required>
|
|
<option value="" disabled selected>Select a scenario</option>
|
|
{% for scenario in scenarios %}
|
|
<option value="{{ scenario.id }}">{{ scenario.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</label>
|
|
<label for="consumption-form-amount">
|
|
Amount
|
|
<input
|
|
id="consumption-form-amount"
|
|
type="number"
|
|
name="amount"
|
|
min="0"
|
|
step="0.01"
|
|
required
|
|
/>
|
|
</label>
|
|
<label for="consumption-form-description">
|
|
Description (optional)
|
|
<textarea
|
|
id="consumption-form-description"
|
|
name="description"
|
|
rows="3"
|
|
></textarea>
|
|
</label>
|
|
<button type="submit" class="btn primary">Add Record</button>
|
|
</form>
|
|
<p id="consumption-feedback" class="feedback hidden" role="status"></p>
|
|
{% else %}
|
|
<p class="empty-state">
|
|
Create a scenario before adding consumption records.
|
|
</p>
|
|
{% endif %}
|
|
</section>
|
|
|
|
{% endblock %} {% block scripts %} {{ super() }}
|
|
<script id="consumption-data" type="application/json">
|
|
{{ {"scenarios": scenarios, "consumption": consumption_by_scenario} | tojson }}
|
|
</script>
|
|
<script src="/static/js/consumption.js"></script>
|
|
{% endblock %}
|