{# @var insurance \AppBundle\Entity\TravelInsurance #}
<div class="radio">
    {{ form_widget(form) }}

    <label for="{{ form.vars.id }}">
        {{ insurance.name }}
        (<a href="#" data-toggle="modal" data-target="#st-insurance-{{ insurance.id }}-modal">Details</a>)
    </label>

    {% embed 'default/components/embed/modal.html.twig' with {
        id: 'insurance-' ~ insurance.id,
        title: insurance.name
    } %}
        {% block body %}
            <h3>Leistungen & Preisliste</h3>
            <ul>
                {% for item in insurance.included|split('\n') %}
                    <li>{{ item }}</li>
                {% endfor %}
            </ul>
            <table class="table">
                <thead>
                <tr>
                    <td>Reisepreis bis</td>
                    <td>je Person</td>
                </tr>
                </thead>
                <tbody>
                {% for insurance_price in insurance.prices %}
                    <tr>
                        <td>{{ insurance_price.border|number_format(2) }} €</td>
                        <td>
                            {% if insurance_price.price > 0 %}
                                {{ insurance_price.price|number_format(2) }} €
                            {% else %}
                                {{ insurance_price.percent|number_format }} % vom Reisepreis
                            {% endif %}
                        </td>
                    </tr>
                {% endfor %}
                </tbody>
            </table>
        {% endblock %}
    {% endembed %}
</div>