<script>
    $(function () {
        let myDropzone = new Dropzone("#my-element",{
          //  url:"{{route("login",['type_entrepot' => "magasin"])}}",
            autoProcessQueue: false,
        });
       // console.log(myDropzone);
        Dropzone.options.importForm = { // The camelized version of the ID of the form element

            // The configuration we've talked about above
            autoProcessQueue: false,
            uploadMultiple: true,
            parallelUploads: 100,
            maxFiles: 100,
            addRemoveLinks:true,
            dictCancelUpload: "Cancel upload",
            dictCancelUploadConfirmation: "{{__('Êtes-vous sûr de vouloir annuler ce téléchargement ?')}}",
            dictDefaultMessage: "{{__('Glissez et Deposez les fichiers Ici pour Téléchager')}}",
            dictFallbackMessage: "Your browser does not support drag'n'drop file uploads.",
            dictFallbackText: "Please use the fallback form below to upload your files like in the olden days.",
            dictFileSizeUnits: {tb: 'TB', gb: 'GB', mb: 'MB', kb: 'KB', b: 'b'},
            dictFileTooBig: "",
            dictInvalidFileType: "{{__('Vous ne pouvez pas télécharger des fichiers de ce type.')}}",
            dictMaxFilesExceeded: "{{__('Vous ne pouvez plus télécharger de fichiers.')}}",
            dictRemoveFile: "Remove file",
            dictRemoveFileConfirmation: null,
            dictResponseError: "Server responded with code.",
            dictUploadCanceled: "Upload canceled.",
            // The setting up of the dropzone
            init: function() {
                var myDropzone = this;

                $("#submit-btn").on('click',(e) => {
                    // Make sure that the form isn't actually being sent.
                    e.preventDefault();
                    e.stopPropagation();
                    myDropzone.processQueue();
                    alert("ddddd");
                });

                // Listen to the sendingmultiple event. In this case, it's the sendingmultiple event instead
                // of the sending event because uploadMultiple is set to true.
                this.on("sendingmultiple", function() {
                    // Gets triggered when the form is actually being sent.
                    // Hide the success button or the complete form.
                });
                this.on("successmultiple", function(files, response) {
                    // Gets triggered when the files have successfully been sent.
                    // Redirect user or notify of success.
                });
                this.on("errormultiple", function(files, response) {
                    // Gets triggered when there was an error sending the files.
                    // Maybe show form again, and notify user of error
                });
            }

        }
    })
</script>

<div id="import-form-upload-file">
{{--    <div class="col-lg-12 text-left">--}}
{{--        <div class="card">--}}
{{--            <img class="card-img" src="{{url("images/importations/screen-import-magasin.png")}}"--}}
{{--                 alt="{{__("Screenshoot import")}}">--}}
{{--        </div>--}}
{{--    </div>--}}

    <div class="col-lg-12 text-center mb-3">
        <span class="text-success text-underline cursor-pointer"
              role="tooltip"
              data-html ="true"
              data-toggle ="popover"
              data-placement ="top"
              data-html ="true"
              data-content="{{ view("admin.stocks.management.sections.importation.blocs.screenshoot-fichier-import")->render() }}">
            {{__("Aperçu du format de fichier à importer")}}
          <i class="mdi mdi-image"></i>
        </span>
    </div>

    <input type="hidden" name="id_model" value="{{$id_model}}" id="import-input-id-model">
    <input type="hidden" name="type_model" value="{{$type_model}}" id="import-input-type-model">
    <div class="col-lg-12 text-left">
        {!! FormAdmin::file("fichier",__('Selectionner un fichier')." ($extensions)",
            ["id"=>"import-input-file-to-upload",'required'=>true,"accept"=>$accepts]) !!}
    </div>

    <div class="col-lg-12 text-left">
        {!! FormAdmin::textarea("commentaire",__('Commentaire par défaut'),__("Après inventaire de fin du mois."),
                      ["id"=>"commentaire",'required'=>true,'rows'=> 4,'resize'=>false])
       !!}

    </div>

    <div class="col-lg-12 text-left">
        {!! FormAdmin::select('id_type_importation',__('Type par défaut'),null,$types_importations,
                             ['data-plugin-multiselect ','required'=>true,
                             "data-plugin-options" => '{ "enableCaseInsensitiveFiltering": false}']) !!}
    </div>
    <div class="col-lg-12 text-left">
        <label class="custom-control custom-checkbox custom-control-inline">
            <input type="checkbox" name="has_headers" id="import-check-if-has-headers"
                   value="1"
                   checked
                   class="custom-control-input cursor-pointer">
            <span class="custom-control-label">
                {{__("Télécharger la première ligne")}}
           </span>
        </label>
    </div>
</div>
