(function($) {
    $('document').ready(function() {
        _init();
    });

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

    $(document).on("eldarion-ajax:complete", function(evnt, $el, data, textStatus, jqXHR) {
        if (data.form_validation !== undefined && data.form_validation == true) {
            $('#ajax-modal').modal('hide');
            $('#subject-list').append(data.subject_list);
        }

    });

    $(document).on('click', 'a.remove-item', function(ev) {
        $(ev.target).closest('tr').remove();
    });
})(jQuery);