{% extends '@kohinos/block/block_collapse.html.twig' %}

{% block blocktitle %}
	<i class="fa fa-shopping-basket mr-4"></i> {{'Payer ma cotisation'|trans }}
{% endblock blocktitle %}
{% block blockcontent %}
    {% set form = getPayerCotisationTAVForm(app.user) %}
    {% set formRecurrentPayment = getPaiementRecurrentCotisationTAVForm(app.user) %}

    {% if form.montant.vars.value == false and not household_based_allowance %}
        <p>{{ 'Vous n\'avez pas de profil de cotisation associé, vous ne pouvez donc pas payer de cotisation.'|trans }}</p>
        <p>{{ 'Veuillez contacter un•e administrateur•rice.'|trans }}</p>
    {% elseif form.montant.vars.value == false and household_based_allowance %}
        <p>{{ 'Vous n\'avez pas de montant de cotisation renseigné dans votre profil, vous ne pouvez donc pas payer de cotisation.'|trans }}</p>
        <p>{{ 'Veuillez contacter un•e administrateur•rice.'|trans }}</p>
    {% else %}
        <p>
            {{ 'Montant de la cotisation à payer'|trans }} : <span class="paiement_cotisation_montant">{{ form.montant.vars.value }} €</span>
        </p>
        <select name="tav-cotisation-payment-type" id="tav-cotisation-payment-type" class="form-control" autocomplete="off">
            <option value="">Choisir une option de paiement</option>
            <option value="instant-payment">Paiement immédiat</option>
            <option value="recurrent-payment">Paiement récurrent</option>
        </select>
        <div id="tav-cotisation-instant-payment-container" class="tav-cotisation-payment-form">
            {{form_start(form)}}
                {% if form.don is defined %}
                    {% include '@kohinos/tav/block/adherent_payer_cotisation_don.html.twig' with {'parentForm': form} %}
                    <hr/>
                    <p><b>{{ 'TOTAL A PAYER'|trans }} : <span class="achat_monnaie_montant_total">{{ form.montant.vars.value }} €</span></b></p>
                {% endif %}
                {% if form.save is defined %}
                    {{ form_widget(form.save)  }}
                {% endif %}
                {% if form.saveHelloAsso is defined %}
                    {{ form_widget(form.saveHelloAsso)  }}
                {% endif %}
            {{form_end(form)}}
        </div>
        <div id="tav-cotisation-recurrent-payment-container" class="tav-cotisation-payment-form">
            {{form_start(formRecurrentPayment)}}
                {{ form_row(formRecurrentPayment.nombreMois)  }}
                {{ form_row(formRecurrentPayment.jourPrelevement)  }}
                {% if formRecurrentPayment.don is defined %}
                    {% include '@kohinos/tav/block/adherent_payer_cotisation_don.html.twig' with {'parentForm': formRecurrentPayment} %}
                    <hr/>
                    <p><b>{{ 'TOTAL PREMIER PAIEMENT'|trans }} : <span class="achat_monnaie_premier_montant_total">{{ formRecurrentPayment.montant.vars.value }} €</span></b></p>
                    <p><b>{{ 'ÉCHÉANCES SUIVANTES'|trans }} : <span class="achat_monnaie_montant_total">{{ formRecurrentPayment.montant.vars.value }} €</span></b></p>
                {% endif %}
                {% if formRecurrentPayment.save is defined %}
                    {{ form_widget(formRecurrentPayment.save)  }}
                {% endif %}
            {{form_end(formRecurrentPayment)}}
        </div>
    {% endif %}


{% endblock blockcontent %}