{% extends "base.html" %}

{% block content %}
<div class="recipe-dashboard">

    {% for recipe in recipes %}
        <div class="card blue-grey darken-1">
            <div class="card-header white-text">
                <span class="card-title">{{ recipe.name }}</span>
                <div>{{ recipe.style.name }} by {{ recipe.brewer }}
                    {% if not recipe.steps %}
                        <i class="material-icons tooltipped right" data-position="bottom" data-delay="50" data-tooltip="There are no mashing steps for this recipe. Not synced with PicoBrew.">error</i>
                    {% endif %}
                </div>
            </div>
            <div class="card-content white-text">
                <ul>
                    <li class="glass">IBU {{ format_float(recipe.ibu, 0) }}</li>
                    <li class="glass">OG {{ format_float(recipe.og, 3) }} / FG {{ format_float(recipe.fg, 3) }}</li>
                    <li class="glass">Batch Size {{ format_volume(recipe.batch_size) }}</li>
                </ul>
                <ul>
                    {% for fermentable in recipe.fermentables %}
                        <li class="grain">{{ format_weight(fermentable.amount) }} {{ fermentable.name }}</li>
                    {% endfor %}
                </ul>
                <ul>
                    {% for hop in recipe.hops %}
                        <li class="hop">{{ format_weight(hop.amount, "g") }} {{ hop.name }} ({{ hop.alpha }}AA @ {{ format_time(hop.time) }})</li>
                    {% endfor %}
                </ul>
            </div>
            <div class="card-action">
                <ul class="collapsible" data-collapsible="accordion">
                    <li>
                        <div class="collapsible-header"><i class="material-icons left">view_list</i> See Mash Schedule</div>
                        <div class="collapsible-body">
                        {% if recipe.steps %}
                            <ol>
                                {% for step in recipe.steps %}
                                    <li>
                                        {{ step.name }} ({{ format_float(step.temp, 0) }}C @ {{ format_time(step.time) }})
                                    </li>
                                {% endfor %}
                            </ol>
                        {% else %}
                            <p>This recipe contains no mashing program. It will not be synced to your PicoBrew machine.</p>
                        {% endif %}
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    {% endfor %}

</div>
{% endblock %}
