{% extends 'base.html' %}

{% block content %}
<div class="container mt-5">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header"><h2>Track Your Mood</h2></div>
                <div class="card-body">
                    <form method="post" novalidate>
                        {% csrf_token %}
                        
                        <div class="mb-3">
                            <label for="id_mood_score" class="form-label">Mood Score (1-5)</label>
                            {{ form.mood_score }}
                            {% if form.mood_score.errors %}
                                <div class="invalid-feedback d-block">
                                    {{ form.mood_score.errors|striptags }}
                                </div>
                            {% endif %}
                        </div>

                        <div class="mb-3">
                            <label for="id_note" class="form-label">Notes</label>
                            {{ form.note }}
                            {% if form.note.errors %}
                                <div class="invalid-feedback d-block">
                                    {{ form.note.errors|striptags }}
                                </div>
                            {% endif %}
                        </div>

                        <div class="mb-3">
                            <label class="form-label">Activities</label>
                            <div id="id_activities">
                            {% for checkbox in form.activities %}
                                <div class="form-check">
                                    {{ checkbox.tag }}
                                    <label class="form-check-label" for="{{ checkbox.id_for_label }}">{{ checkbox.choice_label }}</label>
                                </div>
                            {% endfor %}
                            </div>
                            {% if form.activities.errors %}
                                <div class="invalid-feedback d-block">
                                    {{ form.activities.errors|striptags }}
                                </div>
                            {% endif %}
                        </div>

                        <button type="submit" class="btn btn-primary">Save Mood</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
