<button
        type="button"
        class="principal voirCumulsConso button_right last"
        data-path="{{ path('Stock.Statistics.cumulsConso', { site: 'SITE', codeArt: 'CODE_ART' }) }}"
>
    {{ 'Cumuls consommation' | trad }}
</button>
<script type="application/javascript">
    $('.voirCumulsConso').on('click', (event) => {
        const siteInput = $('#' + CSS.escape('input_SSTOCKLO[SITE]'));
        const codeArtInput = $('#' + CSS.escape('input_SSTOCKLO[CODE_ART]'));

        if (siteInput.val() === '' || codeArtInput.val() === '') {
            return;
        }

        activeLoader();
        const url = $(event.target).attr('data-path')
            .replace('SITE', siteInput.val())
            .replace('CODE_ART', codeArtInput.val())
        ;

        $.ajax({ type: "GET", url: url, success: (response) => {
            const popuptitle = $(response).find('#popupTitle').attr('data-value');

            activePopup(popuptitle, response, 'modal_large');
            desactiveLoader();
        }});
    });
</script>
