{% extends 'babybuddy/page.html' %}
{% load datetime i18n %}

{% block title %}
    {% if request.resolver_match.url_name == 'sleep-update' %}
        {% trans "Update a Sleep Entry" %}
    {% else %}
        {% trans "Add a Sleep Entry" %}
    {% endif %}
{% endblock %}

{% block breadcrumbs %}
    <li class="breadcrumb-item"><a href="{% url 'core:sleep-list' %}">{% trans "Sleep" %}</a></li>
    {% if object %}
        <li class="breadcrumb-item active" aria-current="page">{% trans "Update" %}</li>
    {% else %}
        <li class="breadcrumb-item active" aria-current="page">{% trans "Add" %}</li>
    {% endif %}
{% endblock %}

{% block content %}
    {% if object %}
        {% blocktrans trimmed %}
            <h1>Update <span class="text-info">{{ object }}</span></h1>
        {% endblocktrans %}
    {% else %}
        <h1>{% trans "Add a Sleep Entry" %}</h1>
    {% endif %}
    {% include 'babybuddy/form.html' %}
{% endblock %}

{% block javascript %}
    <script type="text/javascript">
        BabyBuddy.DatetimePicker.init($('#datetimepicker_start'), {
            defaultDate: false,
            format: '{% datetimepicker_format %}'
        });
        BabyBuddy.DatetimePicker.init($('#datetimepicker_end'), {
            format: '{% datetimepicker_format %}'
        });
    </script>
{% endblock %}