feat: add project and scenario templates for detailed views and forms

This commit is contained in:
2025-11-09 17:27:46 +01:00
parent 61b42b3041
commit 191500aeb7
5 changed files with 363 additions and 0 deletions

View File

@@ -0,0 +1,112 @@
{% extends "base.html" %}
{% block title %}{{ scenario.name }} · Scenario · CalMiner{% endblock %}
{% block content %}
<nav class="breadcrumb">
<a href="{{ url_for('projects.project_list_page') }}">Projects</a>
<a href="{{ url_for('projects.view_project', project_id=scenario.project_id) }}">{{ project.name }}</a>
<span aria-current="page">{{ scenario.name }}</span>
</nav>
<header class="page-header">
<div>
<h1>{{ scenario.name }}</h1>
<p class="text-muted">Status: {{ scenario.status.value.title() }}</p>
</div>
<a class="btn btn-secondary" href="{{ url_for('scenarios.edit_scenario_form', scenario_id=scenario.id) }}">Edit</a>
</header>
<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>
{% if scenario.start_date %}
{{ scenario.start_date }}
{% else %}
{% endif %}
{% if scenario.end_date %}
{{ scenario.end_date }}
{% else %}
{% endif %}
</dd>
</div>
<div>
<dt>Discount Rate</dt>
<dd>{{ scenario.discount_rate or '—' }}</dd>
</div>
<div>
<dt>Currency</dt>
<dd>{{ scenario.currency or '—' }}</dd>
</div>
<div>
<dt>Primary Resource</dt>
<dd>{{ scenario.primary_resource.value.replace('_', ' ') | title if scenario.primary_resource else '—' }}</dd>
</div>
</dl>
</section>
<section class="card">
<h2>Financial Inputs</h2>
{% if financial_inputs %}
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Category</th>
<th>Amount</th>
<th>Currency</th>
</tr>
</thead>
<tbody>
{% for item in financial_inputs %}
<tr>
<td>{{ item.name }}</td>
<td>{{ item.category.value.title() }}</td>
<td>{{ '{:,.2f}'.format(item.amount) }}</td>
<td>{{ item.currency or '—' }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No financial inputs recorded.</p>
{% endif %}
</section>
<section class="card">
<h2>Simulation Parameters</h2>
{% if simulation_parameters %}
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Distribution</th>
<th>Variable</th>
<th>Resource</th>
</tr>
</thead>
<tbody>
{% for param in simulation_parameters %}
<tr>
<td>{{ param.name }}</td>
<td>{{ param.distribution.value.title() }}</td>
<td>{{ param.variable.value.replace('_', ' ') | title if param.variable else '—' }}</td>
<td>{{ param.resource_type.value.replace('_', ' ') | title if param.resource_type else '—' }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No simulation parameters defined.</p>
{% endif %}
</section>
{% endblock %}