target-revenue/src/target_revenue/service/control_plane_templates/phase_detail.html
tegwick d894599647 Implement WP-0015-T03: Control Plane reference-rendering routes
New service/reference_docs.py renders specs/policies/*.md and
specs/profiles/*.md read-only at request time via a small markdown
library (added markdown + PyYAML to the service extras) -- not a
static-build pipeline, matching the WP-0012-T03 decision to skip
state-hub's heavier Observable Framework pattern.

One parameterized route, GET /reference/{kind}/{slug}, covers both
addendum URL shapes. Discovered phase_detail.html's Status table never
displayed the degeneration_policy id at all -- added that row (with
the reference link) rather than wiring a link with nothing to attach
it to. phase_new.html gets a plain link next to the field.

Deliberately did not wire extension-id links into the UI in this task
-- extension ids don't appear anywhere in the Control Plane today
(that's WP-0014's gap, not this one's to expand).

6 new Docker-gated tests. Full suite: 94 passing offline, 164 passing
with Docker (up from 158).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-03 23:45:59 +02:00

81 lines
3.3 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ manifest.phase.id }} — Target Revenue Control Plane{% endblock %}
{% block content %}
<wn-page-header>
<span slot="title">{{ manifest.phase.milestone_release.name }}</span>
</wn-page-header>
<p><wn-tag>{{ manifest.phase.id }}</wn-tag></p>
<details style="margin-bottom:1rem;color:#888;font-size:0.9rem;">
<summary style="cursor:pointer;">Ledger reference (internal — not this Phase's ledger entries, see below)</summary>
<p>
Raw reference: <code>{{ manifest.phase.ledger }}</code>
{% if manifest.phase.ledger.startswith('/phases/') %}
&middot; <a href="{{ manifest.phase.ledger }}">view live JSON</a>
{% endif %}
</p>
</details>
<h3>Status</h3>
<table class="wn-plain">
<tr><td>Initial Target</td><td>{{ manifest.phase.initial_target.amount }} {{ manifest.phase.initial_target.currency }}</td></tr>
<tr><td>Cumulative Development Credit</td><td>{{ metrics.facts.cumulative_development_credit }}</td></tr>
<tr><td>Cumulative Remission Credit</td><td>{{ metrics.facts.cumulative_remission_credit }}</td></tr>
<tr><td>Outstanding Target</td><td>{{ metrics.facts.outstanding_target }}</td></tr>
<tr><td>Target satisfaction</td><td>{{ metrics.calculations.target_satisfaction_percentage }}%</td></tr>
<tr><td>Converted</td><td>{{ metrics.facts.is_converted }}</td></tr>
<tr>
<td>Degeneration policy</td>
<td>
{{ manifest.phase.degeneration_policy }}
&middot; <a href="/reference/policies/{{ policy_slug(manifest.phase.degeneration_policy) }}">view spec</a>
</td>
</tr>
</table>
<h3>Ledger ({{ ledger | length }} entries)</h3>
{% if ledger %}
<table class="wn-plain">
<thead><tr><th>id</th><th>type</th><th>amount</th><th>recognized_at</th></tr></thead>
<tbody>
{% for entry in ledger %}
<tr><td>{{ entry.id }}</td><td>{{ entry.type }}</td><td>{{ entry.amount }}</td><td>{{ entry.recognized_at }}</td></tr>
{% endfor %}
</tbody>
</table>
{% else %}
<wn-empty-state>No ledger entries yet.</wn-empty-state>
{% endif %}
{% if session_rights in ("contributor", "operator", "admin") %}
<h3>
{% if session_rights == "contributor" %}Propose a Development Credit entry{% else %}Add a Development Credit entry{% endif %}
</h3>
<form class="wn-form" method="post" action="/phases/{{ manifest.phase.id }}/ledger">
<wn-field-row label="Entry id (trsl:entry:...)">
<wn-input name="entry_id" required></wn-input>
</wn-field-row>
<wn-field-row label="Amount">
<wn-input type="number" step="0.01" name="amount" required></wn-input>
</wn-field-row>
<wn-field-row label="Currency">
<wn-input name="currency" value="{{ manifest.phase.initial_target.currency }}" required></wn-input>
</wn-field-row>
<wn-field-row label="Recognized at (ISO 8601)">
<wn-input name="recognized_at" required></wn-input>
</wn-field-row>
<wn-field-row label="Evidence reference">
<wn-input name="evidence_reference" required></wn-input>
</wn-field-row>
<wn-field-row label="Extension id (trsl:extension:...)">
<wn-input name="extension_id" required></wn-input>
</wn-field-row>
<wn-field-row label="Extension version">
<wn-input name="extension_version" required></wn-input>
</wn-field-row>
<wn-button type="submit" variant="primary">
{% if session_rights == "contributor" %}Submit for review{% else %}Append{% endif %}
</wn-button>
</form>
{% endif %}
{% endblock %}