
const theme = localStorage.getItem("theme");

if (theme == null) {
    $("#themeIcon").html(`<i class="ph-moon fs-3"></i>`);
    localStorage.setItem("borderColorValidated", "#d1d5db");
} else {
    if (theme == "light") {
        $("#themeIcon").html(`<i class="ph-moon fs-3"></i>`);
        localStorage.setItem("borderColorValidated", "#d1d5db");
    } else {
        $("#themeIcon").html(`<i class="ph-sun fs-3"></i>`);
        localStorage.setItem("borderColorValidated", "#4d4d51");
    }
}


// Phone #
const us_mask_phone = document.querySelector('.us_mask_phone');

if (us_mask_phone) {
    const maskPhone = IMask(us_mask_phone, {
        mask: '+{1}(000)000-00-00'
    });
}


function checkconnection() {
    var status = navigator.onLine;
    if (status) {
        $(".no-internet").hide();
    } else {
        $(".no-internet").show();
    }
}

setInterval(function () {
    checkconnection();
}, 1000)

// DataTable search focus
if (document.querySelector('.dataTablesSearchFilter')) {
    document.querySelector('.dataTablesSearchFilter').focus();
}