export const prevent = ($) => {
    let preventModal = $('#preventModal');
    let confirmationLink = $('.preventModalConfirmationLink');
    let preventModalLabel = $('#preventModalLabel');

    // Show modal & populate link
    $('.prevent').on('click', function (e) {
        e.preventDefault();
        confirmationLink.attr('href', $(this).attr('href'));
        confirmationLink.text($(this).text());
        var preventContent = $(this).data('preventContent');
        if (preventContent) {
            preventModalLabel.text(preventContent);
        }
        preventModal.modal('show');
    });

    // Link inside modal
    preventModal.on('hide.bs.modal', function() {
        confirmationLink.attr('href', $(this).attr('#'));
        confirmationLink.text('Continuer');
        preventModalLabel.text('Etes vous sur de vouloir effectuer cette action ?');
    });
};