{% extends '@Stock/Layout/parametrage_global_layout.twig' %}

{% block body_parametrage %}
    <form name="devise" class="" id="form_devise" method="POST" action="{{ path('Stock.Parametrage.devise') }}">
        <h2 class="mb-base">
            {{ 'Devise' | trad }}
            <button type="submit" class="principal button last button_right">
                {{ 'Enregistrer' | trad }}
            </button>
        </h2>
        <div class="bg_form border_form pr-base pl-base">
            <fieldset class="scheduler-border">
                <legend class="scheduler-border">{{ 'Devise : Pour information' | trad }}</legend>
                <div class="colonne2">
                    <div class="row">
                        {{ inputAdvance('SWITCH', {
                            'titre' : 'Gestion de l\'Euro active dans la gestion des stocks ?' | trad,
                            'name' : 'PARAMETR[STGSTEUR]',
                            'value' : parametre.STGSTEUR,
                        }) }}
                    </div>
                    <div class="row">
                        <p>{{ 'Devise de travail :' | trad }} <strong>{{ parametre.STDEVTRV }}</strong></p>
                    </div>
                </div>
                <div class="colonne2 last">
                    <div class="row">
                        {{ inputAdvance('TEXT', {
                            titre: 'Devise de stockage' | trad,
                            name: 'PARAMETR[STDEVSTK]',
                            value: parametre.STDEVSTK,
                            pathValidator: path('Ajax.validator.isStringSansEspace'),
                            paramsValidator : "{'sizeMin' : '0', 'sizeMax' : '10'}",
                        }) }}
                    </div>
                </div>
            </fieldset>
        </div>
    </form>
    <script type="application/javascript" src="{{ baseUrl('js/Modules/Stock/postAjaxForm.js') }}"></script>
    <script type="application/javascript">
        $('#form_devise').on('submit', (event) => {
            event.preventDefault();

            activeLoader();
            const form = $('#form_devise');

            submitForm(form, form.serializeArray());
        });
    </script>
{% endblock %}