Files
calminer/templates/scenarios/form.html

84 lines
3.2 KiB
HTML

{% extends "base.html" %}
{% block title %}{% if scenario %}Edit {{ scenario.name }}{% else %}New Scenario{% endif %} · 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=project.id) }}">{{ project.name }}</a>
{% if scenario %}
<span aria-current="page">Edit Scenario</span>
{% else %}
<span aria-current="page">New Scenario</span>
{% endif %}
</nav>
<header class="page-header">
<div>
<h1>{% if scenario %}Edit Scenario{% else %}Create Scenario{% endif %}</h1>
<p class="text-muted">Configure assumptions and metadata for this scenario.</p>
</div>
</header>
{% if error %}
<div class="alert alert-error">{{ error }}</div>
{% endif %}
<form class="form" method="post" action="{{ form_action }}">
<div class="form-grid">
<div class="form-group">
<label for="name">Name</label>
<input id="name" name="name" type="text" required value="{{ scenario.name if scenario else '' }}" />
</div>
<div class="form-group">
<label for="status">Status</label>
<select id="status" name="status">
{% for value, label in scenario_statuses %}
<option value="{{ value }}" {% if scenario and scenario.status.value == value %}selected{% endif %}>{{ label }}</option>
{% endfor %}
</select>
</div>
<div class="form-group">
<label for="currency">Currency</label>
<input id="currency" name="currency" type="text" maxlength="3" value="{{ scenario.currency if scenario else '' }}" />
</div>
<div class="form-group">
<label for="primary_resource">Primary Resource</label>
<select id="primary_resource" name="primary_resource">
<option value=""></option>
{% for value, label in resource_types %}
<option value="{{ value }}" {% if scenario and scenario.primary_resource and scenario.primary_resource.value == value %}selected{% endif %}>{{ label }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-grid">
<div class="form-group">
<label for="start_date">Start Date</label>
<input id="start_date" name="start_date" type="date" value="{{ scenario.start_date if scenario else '' }}" />
</div>
<div class="form-group">
<label for="end_date">End Date</label>
<input id="end_date" name="end_date" type="date" value="{{ scenario.end_date if scenario else '' }}" />
</div>
<div class="form-group">
<label for="discount_rate">Discount Rate (%)</label>
<input id="discount_rate" name="discount_rate" type="number" step="0.01" value="{{ scenario.discount_rate if scenario else '' }}" />
</div>
</div>
<div class="form-group">
<label for="description">Description</label>
<textarea id="description" name="description" rows="4">{{ scenario.description if scenario else '' }}</textarea>
</div>
<div class="form-actions">
<a class="btn btn-secondary" href="{{ cancel_url }}">Cancel</a>
<button class="btn btn-primary" type="submit">Save</button>
</div>
</form>
{% endblock %}