feat: add scenarios list page with metrics and quick actions
- 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:
@@ -13,28 +13,36 @@
|
||||
</nav>
|
||||
|
||||
<header class="page-header">
|
||||
{% set profitability_href = url_for('calculations.profitability_form') %}
|
||||
{% set processing_opex_href = url_for('calculations.processing_opex_form') %}
|
||||
{% set profitability_href = '/calculations/profitability' %}
|
||||
{% set opex_href = url_for('calculations.opex_form') %}
|
||||
{% set capex_href = url_for('calculations.capex_form') %}
|
||||
{% set scenario_list_href = url_for('scenarios.project_scenario_list', project_id=project.id) %}
|
||||
{% if project and scenario %}
|
||||
{% set profitability_href = profitability_href ~ '?project_id=' ~ project.id ~ '&scenario_id=' ~ scenario.id %}
|
||||
{% set processing_opex_href = processing_opex_href ~ '?project_id=' ~ project.id ~ '&scenario_id=' ~ scenario.id %}
|
||||
{% set profitability_href = url_for('calculations.profitability_form', project_id=project.id, scenario_id=scenario.id) %}
|
||||
{% set opex_href = opex_href ~ '?project_id=' ~ project.id ~ '&scenario_id=' ~ scenario.id %}
|
||||
{% set capex_href = capex_href ~ '?project_id=' ~ project.id ~ '&scenario_id=' ~ scenario.id %}
|
||||
{% endif %}
|
||||
<div>
|
||||
<h1>{{ scenario.name }}</h1>
|
||||
<p class="text-muted">Status: {{ scenario.status.value.title() }}</p>
|
||||
<p class="text-muted">
|
||||
Part of <a href="{{ url_for('projects.view_project', project_id=project.id) }}">{{ project.name }}</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<a class="btn" href="{{ url_for('projects.view_project', project_id=project.id) }}">Back to Project</a>
|
||||
<a class="btn" href="{{ scenario_list_href }}">Scenario Portfolio</a>
|
||||
<a class="btn" href="{{ profitability_href }}">Profitability Calculator</a>
|
||||
<a class="btn" href="{{ processing_opex_href }}">Processing Opex Planner</a>
|
||||
<a class="btn" href="{{ capex_href }}">Initial Capex Planner</a>
|
||||
<a class="btn" href="{{ opex_href }}">Opex Planner</a>
|
||||
<a class="btn" href="{{ capex_href }}">Capex Planner</a>
|
||||
<a class="btn primary" href="{{ url_for('scenarios.edit_scenario_form', scenario_id=scenario.id) }}">Edit Scenario</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="scenario-metrics">
|
||||
<article class="metric-card">
|
||||
<h2>Status</h2>
|
||||
<p class="metric-value status-pill status-pill--{{ scenario.status.value }}">{{ scenario.status.value.title() }}</p>
|
||||
<span class="metric-caption">Lifecycle state</span>
|
||||
</article>
|
||||
<article class="metric-card">
|
||||
<h2>Financial Inputs</h2>
|
||||
<p class="metric-value">{{ scenario_metrics.financial_count }}</p>
|
||||
@@ -50,37 +58,54 @@
|
||||
<p class="metric-value">{{ scenario_metrics.currency or '—' }}</p>
|
||||
<span class="metric-caption">Financial reporting</span>
|
||||
</article>
|
||||
<article class="metric-card">
|
||||
<h2>Primary Resource</h2>
|
||||
<p class="metric-value">{{ scenario_metrics.primary_resource or '—' }}</p>
|
||||
<span class="metric-caption">Scenario focus</span>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<div class="scenario-layout">
|
||||
<section class="card">
|
||||
<h2>Scenario Details</h2>
|
||||
<dl class="definition-list">
|
||||
<div>
|
||||
<dt>Description</dt>
|
||||
<dd>{{ scenario.description or 'No description provided.' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Timeline</dt>
|
||||
<dd>
|
||||
{{ scenario.start_date or '—' }} → {{ scenario.end_date or '—' }}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Discount Rate</dt>
|
||||
<dd>{{ scenario.discount_rate or '—' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Last Updated</dt>
|
||||
<dd>{{ scenario.updated_at.strftime('%Y-%m-%d %H:%M') if scenario.updated_at else '—' }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</section>
|
||||
<div class="scenario-column">
|
||||
<section class="card">
|
||||
<h2>Scenario Overview</h2>
|
||||
<dl class="definition-list">
|
||||
<div>
|
||||
<dt>Description</dt>
|
||||
<dd>{{ scenario.description or 'No description provided.' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Timeline</dt>
|
||||
<dd>{{ scenario.start_date or '—' }} → {{ scenario.end_date or '—' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Discount Rate</dt>
|
||||
<dd>{{ scenario.discount_rate or '—' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Primary Resource</dt>
|
||||
<dd>{{ scenario_metrics.primary_resource or '—' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Last Updated</dt>
|
||||
<dd>{{ scenario.updated_at.strftime('%Y-%m-%d %H:%M') if scenario.updated_at else '—' }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<section class="card quick-actions-card">
|
||||
<h2>Next Steps</h2>
|
||||
<ul class="quick-link-list">
|
||||
<li>
|
||||
<a href="{{ profitability_href }}">Run profitability analysis</a>
|
||||
<p>Uses this scenario’s assumptions as defaults.</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ scenario_list_href }}">Browse all project scenarios</a>
|
||||
<p>Compare assumption sets and launch calculators in context.</p>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ url_for('scenarios.edit_scenario_form', scenario_id=scenario.id) }}">Update scenario assumptions</a>
|
||||
<p>Adjust dates, status, or drivers before recalculations.</p>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section class="card">
|
||||
<h2>Financial Inputs</h2>
|
||||
|
||||
Reference in New Issue
Block a user