{% extends 'layout.twig' %}

{% block body %}

    <div class="contenu clearfix">
        <h1>
        
            {{ 'Import devis' | trad }} 

            <button class="principal button" type="button" data-import-devis="{{ path('Panier.ImportDevis.ajaxImportFile') }}">{{ 'Importer' | trad }}</button>
        
        </h1>

        <div class="content">
        
            <form method="post" name="importDevis" id="importDevis">

                <div class="single">
                    <div class="row">
                        {{ inputAdvance('FILE', {
                            'name' : 'import',
                        }) }}
                    </div>
                </div>

            </form>
        
        </div>
    </div>
    <script>
        document.addEventListener('click',(event) => {
            var target = event.target;
            if (!(target instanceof HTMLElement) ) {
                return;
            }

            if (target.hasAttribute('data-import-devis')){

                $.ajax({
                    url: $(target).data('import-devis'),
                    type: 'POST',
                    dataType : 'html',
                    data: jForm,
                    mimeType: "multipart/form-data",
                    contentType: false,
                    cache: false,
                    processData: false,
                    success: function(data){
                        $("#modal-content").addClass("modal_small");
                        $("#modal-body").html(data);
                        activePopup();
                    }
                });
            }
        });
    </script>
{% endblock %}