$(document).ready( function(){

    console.log('loaded');

    // getAllLeadCount();


})

function getAllLeadCount(){

    $.ajax({
        type: 'GET',
        url: 'classes/DashboardController.php', // Replace with the URL of your server-side script
        data: {'GET_COUNS_LEAD_COUNT':1},
        dataType: 'json', // Assuming the response is in JSON format
        success: function(response) {

            console.log(response);

            return false;
            if(response.status == 1){

                response.message.forEach( function(option, i){
                    var optionEle = $('<option></option>').attr('value', option.education_type_id).text(option.education_type);
                    $('#edu_type_select').append(optionEle);
                });
            }
            
        },
        error: function() {
            unsuccessPopup('Failed Request!');
        }
    });

}

function successPopup(msg, customURL){
    Swal.fire({
        title: 'SUCCESS',
        text: msg,
        allowOutsideClick:false,
        allowEscapeKey:false,
        customClass: {
            popup: 'suc-pop',
            title: 'suc-pop-title',
            content: 'suc-pop-content',
            confirmButton: 'suc-pop-btn-ok'
        }
    }).then(okay => {
        if (okay) {
            if(customURL){
                window.location.href = customURL;
            }else{
                location.reload();
            }
        }
    });
}

function unsuccessPopup(msg, customURL){
    Swal.fire({
        title: 'UNSUCCESS',
        html: msg,
        allowOutsideClick:false,
        allowEscapeKey:false,
        customClass: {
            popup: 'unsuc-pop',
            title: 'unsuc-pop-title',
            confirmButton: 'unsuc-pop-btn-ok'
        }
    }).then(okay => {
        if (okay) {
            if(customURL){
                window.location.href = customURL;
            }
        }
    });
}