var LANGUAGE_CODE = document.getElementsByTagName("html")[0].getAttribute("lang");
moment.locale(LANGUAGE_CODE);
$(document).ready(function() {
    
    if(LANGUAGE_CODE == 'pt-br'){
        $.fn.selectpicker.defaults = {
            noneSelectedText: 'Nada selecionado',
            noneResultsText: 'Nada encontrado contendo {0}',
            countSelectedText: 'Selecionado {0} de {1}',
            maxOptionsText: ['Limite excedido (máx. {n} {var})', 'Limite do grupo excedido (máx. {n} {var})', ['itens', 'item']],
            multipleSeparator: ', ',
            selectAllText: 'Selecionar Todos',
            deselectAllText: 'Desmarcar Todos',
            selectTime: 'Selecionar Horário'
        };
    }
    $(document).on('click', '.alert-report', function(e){
        $.ajax( {
            type: "GET",
            url: '/inbox/notifications/mark-as-read/' + $(this).data('slug') + '/'
        });
    });


    $(function () {
      $('[data-toggle="tooltip"]').tooltip()
    });
});

function getCookie(name) {
    let cookieValue = null;
    if (document.cookie && document.cookie !== '') {
        const cookies = document.cookie.split(';');
        for (let i = 0; i < cookies.length; i++) {
            const cookie = cookies[i].trim();
            // Does this cookie string begin with the name we want?
            if (cookie.substring(0, name.length + 1) === (name + '=')) {
                cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                break;
            }
        }
    }
    return cookieValue;
}