feat: Persist initial capex calculations and enhance navigation links in UI

This commit is contained in:
2025-11-12 23:52:06 +01:00
parent d9fd82b2e3
commit 1240b08740
7 changed files with 99 additions and 11 deletions

View File

@@ -19,7 +19,7 @@ request.url_for('auth.password_reset_request_form') if request else
"match_prefix": "/"}, {"href": projects_href, "label": "Projects",
"match_prefix": "/projects"}, {"href": project_create_href, "label": "New
Project", "match_prefix": "/projects/create"}, {"href": "/imports/ui", "label":
"Imports", "match_prefix": "/imports"} ] }, { "label": "Insights", "links": [
"Imports", "match_prefix": "/imports"}, {"href": request.url_for('calculations.profitability_form') if request else '/calculations/profitability', "label": "Profitability Calculator", "match_prefix": "/calculations/profitability"}, {"href": request.url_for('calculations.capex_form') if request else '/calculations/capex', "label": "Initial Capex Planner", "match_prefix": "/calculations/capex"} ] }, { "label": "Insights", "links": [
{"href": "/ui/simulations", "label": "Simulations"}, {"href": "/ui/reporting",
"label": "Reporting"} ] }, { "label": "Configuration", "links": [ { "href":
"/ui/settings", "label": "Settings", "children": [ {"href": "/theme-settings",

View File

@@ -10,7 +10,7 @@
{% if scenario %}
<a href="{{ url_for('scenarios.view_scenario', scenario_id=scenario.id) }}">{{ scenario.name }}</a>
{% endif %}
<span aria-current="page">Initial Capex</span>
<span aria-current="page">Initial Capex Planner</span>
</nav>
<header class="page-header">
@@ -249,13 +249,13 @@
</table>
{% endif %}
{% else %}
<p class="muted">Provide component details and calculate to see capex totals.</p>
<p class="muted">Provide component details and calculate to see initial capex totals.</p>
{% endif %}
</section>
<section class="report-section">
<header class="section-header">
<h2>Visualisations</h2>
<h2>Visualizations</h2>
<p class="section-subtitle">Charts render after calculations complete.</p>
</header>
<div id="capex-category-chart" class="chart-container"></div>

View File

@@ -13,12 +13,20 @@
</nav>
<header class="page-header">
{% set profitability_href = url_for('calculations.profitability_form') %}
{% set capex_href = url_for('calculations.capex_form') %}
{% if project and scenario %}
{% set profitability_href = profitability_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>
</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="{{ profitability_href }}">Profitability Calculator</a>
<a class="btn" href="{{ capex_href }}">Initial Capex Planner</a>
<a class="btn primary" href="{{ url_for('scenarios.edit_scenario_form', scenario_id=scenario.id) }}">Edit Scenario</a>
</div>
</header>

View File

@@ -8,9 +8,9 @@
<a href="{{ url_for('projects.view_project', project_id=project.id) }}">{{ project.name }}</a>
{% endif %}
{% if scenario %}
<a href="{{ url_for('scenarios.view_scenario', project_id=scenario.project_id, scenario_id=scenario.id) }}">{{ scenario.name }}</a>
<a href="{{ url_for('scenarios.view_scenario', scenario_id=scenario.id) }}">{{ scenario.name }}</a>
{% endif %}
<span aria-current="page">Profitability</span>
<span aria-current="page">Profitability Calculator</span>
</nav>
<header class="page-header">
@@ -323,7 +323,7 @@
</table>
{% endif %}
{% else %}
<p class="muted">Run a calculation to see profitability metrics.</p>
<p class="muted">Provide inputs and run the profitability calculator to see scenario metrics.</p>
{% endif %}
</section>