feat: add scenarios list page with metrics and quick actions
Some checks failed
CI / test (push) Has been skipped
CI / build (push) Has been skipped
CI / lint (push) Failing after 15s
CI / deploy (push) Has been skipped

- Introduced a new template for listing scenarios associated with a project.
- Added metrics for total, active, draft, and archived scenarios.
- Implemented quick actions for creating new scenarios and reviewing project overview.
- Enhanced navigation with breadcrumbs for better user experience.

refactor: update Opex and Profitability templates for consistency

- Changed titles and button labels for clarity in Opex and Profitability templates.
- Updated form IDs and action URLs for better alignment with new naming conventions.
- Improved navigation links to include scenario and project overviews.

test: add integration tests for Opex calculations

- Created new tests for Opex calculation HTML and JSON flows.
- Validated successful calculations and ensured correct data persistence.
- Implemented tests for currency mismatch and unsupported frequency scenarios.

test: enhance project and scenario route tests

- Added tests to verify scenario list rendering and calculator shortcuts.
- Ensured scenario detail pages link back to the portfolio correctly.
- Validated project detail pages show associated scenarios accurately.
This commit is contained in:
2025-11-13 16:21:36 +01:00
parent 4f00bf0d3c
commit 522b1e4105
54 changed files with 3419 additions and 700 deletions

View File

@@ -19,8 +19,15 @@
<p class="text-muted">Evaluate revenue, costs, and key financial metrics for a scenario.</p>
</div>
<div class="header-actions">
{% if cancel_url %}
<a class="btn" href="{{ cancel_url }}">Cancel</a>
{% if scenario_url %}
<a class="btn" href="{{ scenario_url }}">Scenario Overview</a>
{% elif project_url %}
<a class="btn" href="{{ project_url }}">Project Overview</a>
{% elif cancel_url %}
<a class="btn" href="{{ cancel_url }}">Back</a>
{% endif %}
{% if scenario_portfolio_url %}
<a class="btn" href="{{ scenario_portfolio_url }}">Scenario Portfolio</a>
{% endif %}
<button class="btn primary" type="submit" form="profitability-form">Run Calculation</button>
</div>
@@ -104,8 +111,8 @@
<input id="smelting_charge" name="smelting_charge" type="number" min="0" step="0.01" value="{{ data.smelting_charge }}" />
</div>
<div class="form-group">
<label for="processing_opex">Processing Opex (per period)</label>
<input id="processing_opex" name="processing_opex" type="number" min="0" step="0.01" value="{{ data.processing_opex }}" />
<label for="opex">Opex (per period)</label>
<input id="opex" name="opex" type="number" min="0" step="0.01" value="{{ data.opex }}" />
</div>
</div>
</fieldset>
@@ -172,8 +179,8 @@
<legend>Capital &amp; Discounting</legend>
<div class="form-grid">
<div class="form-group">
<label for="initial_capex">Initial Capex</label>
<input id="initial_capex" name="initial_capex" type="number" min="0" step="0.01" value="{{ data.initial_capex }}" />
<label for="capex">Capex</label>
<input id="capex" name="capex" type="number" min="0" step="0.01" value="{{ data.capex }}" />
</div>
<div class="form-group">
<label for="sustaining_capex">Sustaining Capex (per period)</label>
@@ -261,16 +268,16 @@
<h3>Cost Breakdown</h3>
<ul class="metric-list">
<li>
<span>Processing Opex</span>
<strong>{{ result.costs.processing_opex_total | currency_display(result.currency) }}</strong>
<span>Opex</span>
<strong>{{ result.costs.opex_total | currency_display(result.currency) }}</strong>
</li>
<li>
<span>Sustaining Capex</span>
<strong>{{ result.costs.sustaining_capex_total | currency_display(result.currency) }}</strong>
</li>
<li>
<span>Initial Capex</span>
<strong>{{ result.costs.initial_capex | currency_display(result.currency) }}</strong>
<span>Capex</span>
<strong>{{ result.costs.capex | currency_display(result.currency) }}</strong>
</li>
</ul>
</article>
@@ -304,7 +311,7 @@
<tr>
<th scope="col">Period</th>
<th scope="col">Revenue</th>
<th scope="col">Processing Opex</th>
<th scope="col">Opex</th>
<th scope="col">Sustaining Capex</th>
<th scope="col">Net Cash Flow</th>
</tr>
@@ -314,7 +321,7 @@
<tr>
<th scope="row">{{ entry.period }}</th>
<td>{{ entry.revenue | currency_display(result.currency) }}</td>
<td>{{ entry.processing_opex | currency_display(result.currency) }}</td>
<td>{{ entry.opex | currency_display(result.currency) }}</td>
<td>{{ entry.sustaining_capex | currency_display(result.currency) }}</td>
<td>{{ entry.net | currency_display(result.currency) }}</td>
</tr>