{% extends "atlas/base.html" %}
{% load crispy_forms_tags %}

{% block content %}
<h2>{{ study.name }}</h2>
<p class="text-muted">Participant ID: {{ participant.pseudo_id }}</p>

{% if assigned_packet and start_url %}
<div class="card card-body bg-dark border-secondary mb-3">
    <h5>Assignment Complete</h5>
    <p class="mb-1">You have been assigned to packet: <strong>{{ participant.assigned_arm.name }}</strong>.</p>
    <p class="text-muted small mb-3">Mark scheme: {{ participant.assigned_arm.marking_scheme_name|default:'Default collection scoring' }}</p>
    <a class="btn btn-primary" href="{{ start_url }}">Start Packet</a>
</div>
{% else %}
<div class="card card-body bg-dark border-secondary mb-3">
    <h5>Consent and Details</h5>
    <p class="text-muted">Complete this form to begin. Assignment to packet is performed automatically when you submit.</p>
    <form method="post">
        {% csrf_token %}
        {{ form|crispy }}
        <button class="btn btn-primary" type="submit">Submit and Start</button>
    </form>
</div>
{% endif %}

{% if study.description %}
<div class="card card-body bg-dark border-secondary">
    {{ study.description|linebreaks }}
</div>
{% endif %}
{% endblock %}
