let attachment, attachment1
let filelist = []

let myDropzone = new Dropzone('#draganddrop', { 
    url: $('#cnctFrm-application').attr('action'),
    autoProcessQueue: false,
    disablePreviews: true,
    uploadMultiple: true,
    maxFilesize: 5242880,
    maxFiles: 3,
    paramName: 'ATTACHMENT',
    acceptedFiles: 'capture=camera,image/*,application/pdf,.png,.jpg,.jpeg',
});

const removefile = (e) => {
    myDropzone.removeFile(filelist[e])
    filelist.splice(e, 1)
    renderfilelist()
    resetddfield()
}

const renderfilelist = () => {
    $('#filelist').empty()
    $(filelist).each(e => {

        if (filelist[e].accepted) {
            $('#filelist').append(`<li><span style="max-width: 200px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: inline-block; vertical-align: bottom;">${filelist[e].name}</span> <small style="font-size: 0.75em; color: #cc0000; cursor: pointer; vertical-align: bottom; line-height: 1.2rem;" onclick="removefile(${e})">...entfernen</small></li>`)
        }
    })
}

const resetddfield = () => {
     $('#draganddrop > div.desc').text('Anhang: max. 3 Dateien, je. 2 MB');
     $('#draganddrop').css('background', 'lightyellow')
}

myDropzone.on("addedfiles", files => {
    resetddfield()

    $(files).each(e => {
        if (files[e].accepted) {
            filelist.push(files[e])
        }
    })

    renderfilelist()
});

myDropzone.on("maxfilesexceeded", res => {
    //console.log('maxfilesexceeded', res)
});

myDropzone.on("maxfilesreached", res => {
    //console.log('maxfilesreached', res)
});

myDropzone.on("error", (res, msg) => {
    //console.log('error', res)
    //console.log('error', msg)

    window.setTimeout(() => {
        $('#draganddrop > div.desc').text(msg);
    }, 666)
});

$('#draganddropoverlay').on('dragover', (e) => {
     e.preventDefault();
     e.stopPropagation();
     $('#draganddrop > div.desc').text('Dateien ablegen...');
     $('#draganddrop').css('background', 'lightgreen')
});

$('#draganddropoverlay').on('dragleave', (e) => {
     e.preventDefault();
     e.stopPropagation();
    resetddfield()
});

$('html').on('drop', (e) => { 
    e.preventDefault(); 
    e.stopPropagation(); 
    resetddfield()
});

$('#cnctFrm-application #SUBJECT').change((e) => {
    //console.log('SUBJECT change', $('#cnctFrm-application #SUBJECT').val())
    //console.log($('#cnctFrm-application #SUBJECT').val().replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, '-').toLowerCase())
})



$('#cnctFrm-application #SUBJECT option').each((e) => {
    $($('#cnctFrm-application #SUBJECT option')[e]).removeProp('selected')
    //console.log($($('#cnctFrm-application #SUBJECT option')[e]).val().match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.join('-').toLowerCase())

    if ($($('#cnctFrm-application #SUBJECT option')[e]).val()
         && (window.location.hash.replace(/^[#]+/g, '').toLowerCase() === $($('#cnctFrm-application #SUBJECT option')[e]).val().match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.join('-').toLowerCase()
             || $('#cnctFrm-application-preselect')?.val()?.toLowerCase() === $($('#cnctFrm-application #SUBJECT option')[e]).val().match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.join('-').toLowerCase())) {
        //console.log(typeof $('#cnctFrm-application-no-autofocus')[0], typeof $('#cnctFrm-application-no-autofocus')[0] === 'undefined')

        if (typeof $('#cnctFrm-application-no-autofocus')[0] === 'undefined') {
            $('#cnctFrm-application #FIRSTNAME').focus()
        }

        $($('#cnctFrm-application #SUBJECT option')[e]).prop('selected', 'selected')
        $('#cnctFrm-application #SUBJECT').parent().addClass('is-dirty')
    }
 })

if(window.location.hash.replace(/^[#]+/g, '').toLowerCase() === 'cnctfrm-application-autofocus') {
    $('#cnctFrm-application #FIRSTNAME').focus()
}

$('#cnctFrm-application').submit(function(e) {
    //console.log('cnctFrm-application submit', e)

    e.preventDefault()
    $('#resultmsg').removeClass('hide')
    $('#resultmsg').css('color', 'black');
    $('#resultmsg').css('font-width', '900');
    $('#resultmsg').text(`Warte kurz, deine Nachricht wird gerade verarbeitet`);

    $('#resultoverlay').removeClass('hide')
    $('#cnctFrm-application .wpcf7-validates-as-required').each(e => !$('#cnctFrm-application .wpcf7-validates-as-required')[e].value).removeClass('is-invalid', 'is-dirty')
    let formData = new FormData(this);
    //console.log('formData', formData)

    $(filelist).each(e => formData.append(`ATTACHMENT${e}`, filelist[e]))
    //console.log('formData', formData)

    let request = $.ajax({
        url: $('#cnctFrm-application').attr('action'),
        type: 'post',
        dataType: 'json',
        processData: false,
        contentType: false,
        data: formData,
        beforeSend: function(response) {
            //console.log('beforeSend', response)

            if ($('#cnctFrm-application .wpcf7-validates-as-required').filter(e => !$('#cnctFrm-application .wpcf7-validates-as-required')[e].value).length > 0) {
                $($('#cnctFrm-application .wpcf7-validates-as-required').filter(e => !$('#cnctFrm-application .wpcf7-validates-as-required')[e].value)[0]).parent().addClass('is-invalid', 'is-dirty')
                $($('#cnctFrm-application .wpcf7-validates-as-required').filter(e => !$('#cnctFrm-application .wpcf7-validates-as-required')[e].value)[0]).focus()
                $('#resultoverlay').addClass('hide')
                response.abort()
                //console.log('beforeSend ... abort')
            }
        },
        error: function(response) {
            //console.log('error', response)
        },
        success: function(response) {
            //console.log('success', response)
        },
        complete: function(response) {
            //console.log('complete', response)
            $('#resultmsg').addClass('hide')

            if (response.responseJSON.status !== 'mail_sent') {
                $('#resultoverlay').addClass('hide')
                $('#resultmsg').removeClass('hide')
                $('#resultmsg').css('color', 'red');
                $('#resultmsg').css('font-width', '900');
                $('#resultmsg').text(`Es ist ein Fehler aufgetreten. (${response.responseJSON.invalid_fields[0].message})`);
            }

            if (response.responseJSON.status === 'mail_sent') {
                $('#contact-dialog').html('Prima, deine Nachricht wurde erfolgreich versandt.');
            }
        }
    });

})