{% extends 'layout.twig' %}

{% block body %}
    <!-- Modal content -->
    <div id="myModal" class="modal" tabindex="-1" role="dialog">

        <div class="modal-dialog" style="width:auto;height:auto;{% if application != 'Mobility' %}min-width:500px{% endif %}" role="document">
            <div id="modal-content" class="modal-content" style="z-index:99999;{% if application != 'Mobility' %}min-width: 600px;{% endif %}">
                <div class="modal-header">
                    <span class="modal-close">&times;</span>
                    <h3 id="modal-title"></h3>
                </div>
                <div id="modal-body" style="padding: 15px;z-index:99999">
                </div>
            </div>
        </div>
    </div>
	<div class="contenu clearfix">
        <h1>
            {{ title }}
        </h1>
        
        {{ ariane() }}
        
		<div id="groups_of_raters_import" class="padding15">
			<form method="POST" id='import_form' enctype="multipart/form-data" class="bg_form padding_form border_form clearfix">
				<div class="clearfix">
                    <div class="clearfix">
                        <div class="single">
                            {{ inputAdvance('FILE', {'name' : 'File', 'format' : 'excel'} ) }}
                        </div>
                    </div>
                    <center>
                        <h4>{{ 'Déposez votre fichier d\'import ci-dessus (fichiers supportés : xls, xlsx, csv).' | trad }}</h4>
                        <h4>{{ 'La première colonne de votre fichier doit correspondre aux libellés des groupes.' | trad }}</h4>
                    </center>
                    <hr>
                    <button class="button principal button_right" type='button' onclick="groupsImport('{{ path('Evaluation.Rater.import') }}');">
                        {{ 'Importer' | trad }}
                    </button>
                </div>
            </form>
        </div>
        <script>
            function groupsImport(path) {
                activeLoader();
                $.ajax({
                    url: path,
                    data: jForm,
                    type: 'POST',
                    contentType: false,
                    cache: false,
                    processData: false,
                    mimeType: "multipart/form-data",
                    success: function (data) {
                        desactiveLoader();
                        //console.log(data.path);
                        var data = jQuery.parseJSON(data);
                        if (data.postGestion) {
                            console.log('');
                        redirectJSWithPost(data.path, data.postGestion);
                        } else {
                        window.location.href = data.path;
                        }
                    },
                    error: function (data) {
                    }
                });
            };
        </script>
{% endblock %}
