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

@@ -17,48 +17,61 @@
class="form-control"
placeholder="Filter projects..."
data-project-filter
aria-label="Filter projects"
/>
<a class="btn btn-primary" href="{{ url_for('projects.create_project_form') }}">New Project</a>
</div>
</section>
{% if projects %}
<table class="projects-table" data-project-table>
<thead>
<tr>
<th>Name</th>
<th>Location</th>
<th>Type</th>
<th>Scenarios</th>
<th></th>
</tr>
</thead>
<tbody>
{% for project in projects %}
<tr>
<td class="table-cell-actions">
{{ project.name }}
<button
class="btn btn-ghost"
data-export-trigger
data-export-target="projects"
title="Export projects dataset"
>
<span aria-hidden="true"></span>
<span class="sr-only">Export</span>
</button>
</td>
<td>{{ project.location or '—' }}</td>
<td>{{ project.operation_type.value.replace('_', ' ') | title }}</td>
<td>{{ project.scenario_count }}</td>
<td class="text-right">
<a class="btn btn-link" href="{{ url_for('projects.view_project', project_id=project.id) }}">View</a>
<section class="projects-grid" data-project-table>
{% for project in projects %}
<article class="project-card" data-project-entry>
<header class="project-card__header">
<h2 class="project-card__title">
<a href="{{ url_for('projects.view_project', project_id=project.id) }}">{{ project.name }}</a>
</h2>
<span class="project-card__type badge">{{ project.operation_type.value.replace('_', ' ') | title }}</span>
</header>
<p class="project-card__description">
{{ project.description or 'No description provided yet.' }}
</p>
<dl class="project-card__meta">
<div>
<dt>Scenarios</dt>
<dd><span class="badge badge-pill">{{ project.scenario_count }}</span></dd>
</div>
<div>
<dt>Location</dt>
<dd>{{ project.location or '—' }}</dd>
</div>
<div>
<dt>Updated</dt>
<dd>{{ project.updated_at.strftime('%Y-%m-%d') if project.updated_at else '—' }}</dd>
</div>
</dl>
<footer class="project-card__footer">
<div class="project-card__links">
<a class="btn btn-link" href="{{ url_for('projects.view_project', project_id=project.id) }}">View Project</a>
<a class="btn btn-link" href="{{ url_for('scenarios.create_scenario_form', project_id=project.id) }}">Add Scenario</a>
<a class="btn btn-link" href="{{ url_for('projects.edit_project_form', project_id=project.id) }}">Edit</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<button
class="btn btn-ghost"
data-export-trigger
data-export-target="projects"
title="Export projects dataset"
>
<span aria-hidden="true"></span>
<span class="sr-only">Export</span>
</button>
</footer>
</article>
{% endfor %}
</section>
{% else %}
<p>No projects yet. <a href="{{ url_for('projects.create_project_form') }}">Create your first project.</a></p>
{% endif %}