// Simple notification helper used by blade templates (fallback to Bootstrap alerts) window.growl = function(message, type) { var alertTypes = { success: 'alert-success', error: 'alert-danger', warning: 'alert-warning', info: 'alert-info' }; var cssClass = alertTypes[type] || alertTypes.info; var $container = $('#growl-container'); if (!$container.length) { $container = $('
'); $('body').append($container); } var $alert = $(''); $alert.append($('').text(message)); $alert.append(''); $container.append($alert); setTimeout(function() { $alert.alert('close'); }, 4000); }; // Prevent closing from click inside dropdown $(document).on('click', '.dropdown-menu', function (e) { e.stopPropagation(); }); // make it as accordion for smaller screens if ($(window).width() < 992) { $('.dropdown-menu a').click(function(e) { e.preventDefault(); if ($(this).next('.submenu').length) { $(this).next('.submenu').toggle(); } $('.dropdown').on('hide.bs.dropdown', function () { $(this).find('.submenu').hide(); }); }); }