
<form method="post" class="form-default" 
    action="{{ path('Utilisateur.KpiDashboard.renderKpiInput', {kpiId: kpiId, uid: uid}) }}"
    data-onsuccess="addKpiItem"
    onsubmit="return ajaxSubmit(event);"
>
    <div class="bs-row gutter-x-base">
        <input type="hidden" name="PERIODES" value="{{ periode }}" />
        {% for input in form %}
        <div class="bs-col-half">
            {# Prefix input id to avoid confusion with other inputs from other forms #}
            {{ inputAdvance(
                input._type, 
                input | merge({
                    inputAttr: {id: uid ~ '_' ~ input.name}
                }) 
            ) }}
        </div>
        {% endfor %}

        {% if isEditMode %}
        <div class="bs-col-full text-right">
            <button type="button" class="button secondaire" 
                data-action-click="cancelKpiEdit"
            >
                {{- 'Annuler' | trad -}}
            </button>
            <button type="submit" class="button principal">
                {{- 'Modifier' | trad -}}
            </button>
        </div>
        {% else %}
        <div class="bs-col-full text-right">
            <button type="button" class="button secondaire" 
                data-action-click="removeKpiItem"
            >
                {{- 'Annuler' | trad -}}
            </button>
            <button type="submit" class="button principal">
                {{- 'Ajouter' | trad -}}
            </button>
        </div>
        {% endif %}


    </div>
</form>