feat: Add currency and unit support across models, routes, and templates; enhance UI for consumption, costs, and production
This commit is contained in:
@@ -28,6 +28,26 @@ title %}Consumption · CalMiner{% endblock %} {% block content %}
|
||||
{{ select_field( "Scenario", "consumption-form-scenario",
|
||||
name="scenario_id", options=scenarios, required=True, placeholder="Select a
|
||||
scenario", placeholder_disabled=True ) }}
|
||||
<label for="consumption-form-unit">
|
||||
Unit
|
||||
<select
|
||||
id="consumption-form-unit"
|
||||
name="unit_name"
|
||||
required
|
||||
>
|
||||
<option value="" disabled selected>Select unit</option>
|
||||
{% for unit in unit_options %}
|
||||
<option value="{{ unit.name }}" data-symbol="{{ unit.symbol }}">
|
||||
{{ unit.name }} ({{ unit.symbol }})
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
<input
|
||||
id="consumption-form-unit-symbol"
|
||||
type="hidden"
|
||||
name="unit_symbol"
|
||||
/>
|
||||
<label for="consumption-form-amount">
|
||||
Amount
|
||||
<input
|
||||
@@ -58,7 +78,7 @@ title %}Consumption · CalMiner{% endblock %} {% block content %}
|
||||
|
||||
{% endblock %} {% block scripts %} {{ super() }}
|
||||
<script id="consumption-data" type="application/json">
|
||||
{{ {"scenarios": scenarios, "consumption": consumption_by_scenario} | tojson }}
|
||||
{{ {"scenarios": scenarios, "consumption": consumption_by_scenario, "unit_options": unit_options} | tojson }}
|
||||
</script>
|
||||
<script src="/static/js/consumption.js"></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -57,6 +57,17 @@ title %}Costs · CalMiner{% endblock %} {% block content %}
|
||||
{{ select_field( "Scenario", "capex-form-scenario", name="scenario_id",
|
||||
options=scenarios, required=True, placeholder="Select a scenario",
|
||||
placeholder_disabled=True ) }}
|
||||
{{ select_field(
|
||||
"Currency",
|
||||
"capex-form-currency",
|
||||
name="currency_code",
|
||||
options=currency_options,
|
||||
required=True,
|
||||
placeholder="Select currency",
|
||||
placeholder_disabled=True,
|
||||
value_attr="id",
|
||||
label_attr="name"
|
||||
) }}
|
||||
<label for="capex-form-amount">
|
||||
Amount
|
||||
<input
|
||||
@@ -90,6 +101,17 @@ title %}Costs · CalMiner{% endblock %} {% block content %}
|
||||
{{ select_field( "Scenario", "opex-form-scenario", name="scenario_id",
|
||||
options=scenarios, required=True, placeholder="Select a scenario",
|
||||
placeholder_disabled=True ) }}
|
||||
{{ select_field(
|
||||
"Currency",
|
||||
"opex-form-currency",
|
||||
name="currency_code",
|
||||
options=currency_options,
|
||||
required=True,
|
||||
placeholder="Select currency",
|
||||
placeholder_disabled=True,
|
||||
value_attr="id",
|
||||
label_attr="name"
|
||||
) }}
|
||||
<label for="opex-form-amount">
|
||||
Amount
|
||||
<input
|
||||
@@ -117,7 +139,7 @@ title %}Costs · CalMiner{% endblock %} {% block content %}
|
||||
|
||||
{% endblock %} {% block scripts %} {{ super() }}
|
||||
<script id="costs-payload" type="application/json">
|
||||
{{ {"capex": capex_by_scenario, "opex": opex_by_scenario} | tojson }}
|
||||
{{ {"capex": capex_by_scenario, "opex": opex_by_scenario, "currency_options": currency_options} | tojson }}
|
||||
</script>
|
||||
<script src="/static/js/costs.js"></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -46,6 +46,18 @@
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
<label for="production-form-unit">
|
||||
Unit
|
||||
<select id="production-form-unit" name="unit_name" required>
|
||||
<option value="" disabled selected>Select unit</option>
|
||||
{% for unit in unit_options %}
|
||||
<option value="{{ unit.name }}" data-symbol="{{ unit.symbol }}">
|
||||
{{ unit.name }} ({{ unit.symbol }})
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
<input id="production-form-unit-symbol" type="hidden" name="unit_symbol" />
|
||||
<label for="production-form-amount">
|
||||
Amount
|
||||
<input
|
||||
@@ -75,7 +87,7 @@
|
||||
|
||||
{% endblock %} {% block scripts %} {{ super() }}
|
||||
<script id="production-data" type="application/json">
|
||||
{{ {"scenarios": scenarios, "production": production_by_scenario} | tojson }}
|
||||
{{ {"scenarios": scenarios, "production": production_by_scenario, "unit_options": unit_options} | tojson }}
|
||||
</script>
|
||||
<script src="/static/js/production.js"></script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user