{# One job card (spec Jobs panel). card_mode: "main" (default) or "dismissed" (Undo section — View + Undo only, no apply/tailor verbs). The parent loop passes `uid` — loop vars are not visible inside includes. #} {% set card_mode = card_mode or "main" %} {% set uid = uid | default(card_mode ~ "-0") %}
{% if job.score_error %} score failed {% elif job.fit_score is not none %} {{ job.fit_score }}/10 {% endif %} {% if job.apply_status %}{{ job.apply_status }}{% endif %} {% if job.apply_conflict %}conflict{% endif %}

{{ job.title or "(untitled)" }}

{{ job.site or "Unknown site" }} {% if job.location %} · {{ job.location }}{% endif %} {% if job.is_remote %}Remote{% endif %}

{{ job.salary or "Pay not listed" }} {% if job.discovered_at %}{{ job.discovered_at | age }}{% endif %}

{% set verb = busy.get(job.url) if busy else none %} {% if card_mode == "dismissed" %}
View
{% include "partials/board_view_params.html" %}
{% elif verb %} {# A single-job tailor/apply run for this card is executing; the SSE board feed refreshes the board when the run finishes. #}
{{ "Tailoring documents…" if verb == "tailor" else "Submitting your application…" }}

This runs in the background — the card updates automatically when it finishes.

{% elif job.apply_status == "in_progress" %} {# Writer coordination (fix 3): a run owns this job even though no portal run row is executing (a cancelled/lost run leaves the lock until the stale cutoff). Apply would exit "Queue empty" doing nothing — show a disabled state instead of a verb that can't work. #}
Application in progress…

A run owns this job — Apply unlocks when it finishes{% if job.last_attempted_at %} (or after an hour, if the run was lost){% endif %}.

{% else %}
View {% if job.tailored_resume_path %} {# Confirmation card first: say exactly what will be submitted. #} {% else %}
{% include "partials/board_view_params.html" %}
{% endif %}
{% include "partials/board_view_params.html" %}
{% endif %}