function triggerMessage(message, header, color = "danger", selector = "message") {
    const container = document.getElementById(selector);
    container.innerHTML = '';
    /* Template message_tmp */
    var node = /* html */`
    <article class="alert alert-${color} alert-dismissible fade show" role="alert" id="alert-color">
    <h4 class="alert-heading"><span class="ing-${(color !== 'success') ? 'importante' : 'aceptar'}"></span> ${header}</h4>
    <span id="message-alert">${message}</span>
        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
            <span aria-hidden="true">&times;</span>
        </button>
    </article>
    `
    setTimeout(function () {
        container.innerHTML = node;
    }, 100);


    /* setTimeout(function () {
        container.innerHTML = '';
    }, 5000); */
}

function messageMissingInputs(required) {
    var message = 'Faltan los siguientes campos: ';
    required.forEach(function (item, index) {
        let last = required.length - 1;
        if (index == last)
            message += item;
        else if (index == last - 1)
            message += item + ' y ';
        else
            message += item + ', ';
    });
    triggerMessage(message, 'Error', 'danger');
}