{# @var insurance \AppBundle\Entity\TravelInsurance #}

<style>
    .c1.c1b li:before {
        top:-20px;
    }
</style>

<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>


    <div class="accordion-toggle-2">
        <div class="panel-group booking_insurance_toogle" id="accordion_in_{{ form.vars.id }}" style="margin-left: 5px;margin-top: 5px;">
            <a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion_in_{{ form.vars.id }}" href="#collapse_in_{{ form.vars.id }}" aria-expanded="false">
                <h5 style="font-size: 0.9em;font-weight: 600;"><span>Leistungen einblenden</span><i class="indicator pull-right icon-plus"></i></h5>
            </a>
            <div id="collapse_in_{{ form.vars.id }}" class="panel-collapse collapse" aria-expanded="false" style="height: 0px;">
                <div class="panel-body">
                    {% if insurance.insuranceName != "" %}

                        <p><strong>Versicherung:</strong>  {{ insurance.insuranceName }} </p>
                    {% endif %}
                    <ul class="c1 c1b">
                        {% if insurance.text != "" %}
                            {% for textli in insurance.text|split('\n') %}
                                <li>{{ textli|raw }}</li>
                            {% endfor %}
                        {% endif %}
                    </ul>
                    {% if insurance.insurancePdf != "" %}
                        <br>
                        <p><a href="/uploads/{{ insurance.insurancePdf }} " target="_blank"> Informationsblatt zur Versicherung <i class="fa fa-file-pdf-o"></i></a>  </p>
                    {% endif %}

                </div>
            </div>
        </div>
    </div>
    {% embed 'default/components/embed/modal.html.twig' with {
        id: 'insurance-' ~ insurance.id,
        title: insurance.name
    } %}
        {% block body %}
            <h3>Leistungen & Preisliste</h3>

            <ul class="c1 c1b">
                {% 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>


