{# src/net_alpha/web/templates/_data_hygiene.html
Phase 3 (I1, I2) restructure: missing-basis rows get one shared explanation
card + compact inline forms (via `missing_basis_rows`). All other issue
categories (unpriced, orphan_sell, dup_key, tax_config_missing) continue to
render in the legacy "Data quality" panel below. #}
{% set other_issues = issues | selectattr("category", "ne", "basis_unknown") | list %}
{% if missing_basis_rows %}
Missing cost basis
{# I1: single explanation card — appears once regardless of row count #}
{{ missing_basis_rows|length }} item{% if missing_basis_rows|length != 1 %}s{% endif %} need attention
—
until basis is set, realized P/L can’t be computed for these lots.
Set a cost basis for each row below.
{# I2: per-row inline forms #}
{% for row in missing_basis_rows %}
{% include "_data_hygiene_row.html" %}
{% endfor %}
{% endif %}
{% if other_issues %}
Data quality
{{ other_issues|length }} item{{ "s" if other_issues|length != 1 else "" }} need attention from your imports.
{% set _first_open = namespace(done=false) %}
{% for key, label in [("missing_basis", "Missing basis"), ("no_quote", "No price quote"), ("missing_dates", "Missing dates")] %}
{% if dq_groups is defined %}
{% set group = dq_groups[key] %}
{% else %}
{% set group = other_issues | selectattr("category", "equalto", key) | list %}
{% endif %}
{% if group %}
{{ group|length }}{{ label }}
{% for issue in group %}
{{ issue.severity }}
{{ issue.summary }}
{{ issue.detail }}
{% if issue.fix_url %}
go fix →
{% endif %}
{% if issue.fix_form %}
{% endif %}