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

{% block content %}
<div class="container py-4">
    <h2>{% if is_create %}Create Research Study{% else %}Edit: {{ study.name }}{% endif %}</h2>
    <p class="text-muted">Configure randomisation and participant intake options. Packets are added on the study detail page.</p>

    <form method="post" class="card card-body bg-dark border-secondary">
        {% csrf_token %}
        {{ form|crispy }}
        <div class="mt-3 d-flex gap-2">
            <button class="btn btn-primary" type="submit">Save</button>
            {% if study %}
            <a class="btn btn-outline-secondary" href="{% url 'research:study_detail' study.pk %}">Cancel</a>
            {% else %}
            <a class="btn btn-outline-secondary" href="{% url 'research:study_list' %}">Cancel</a>
            {% endif %}
        </div>
    </form>
</div>
{% endblock %}
