import '../scss/admin.scss'; import 'eonasdan-bootstrap-datetimepicker'; import 'typeahead.js'; import Bloodhound from "bloodhound-js"; import 'bootstrap-tagsinput'; $(function() { // Datetime picker initialization. // See https://eonasdan.github.io/bootstrap-datetimepicker/ $('[data-toggle="datetimepicker"]').datetimepicker({ icons: { time: 'fa fa-clock-o', date: 'fa fa-calendar', up: 'fa fa-chevron-up', down: 'fa fa-chevron-down', previous: 'fa fa-chevron-left', next: 'fa fa-chevron-right', today: 'fa fa-check-circle-o', clear: 'fa fa-trash', close: 'fa fa-remove' } }); // Bootstrap-tagsinput initialization // https://bootstrap-tagsinput.github.io/bootstrap-tagsinput/examples/ var $input = $('input[data-toggle="tagsinput"]'); if ($input.length) { var source = new Bloodhound({ local: $input.data('tags'), queryTokenizer: Bloodhound.tokenizers.whitespace, datumTokenizer: Bloodhound.tokenizers.whitespace }); source.initialize(); $input.tagsinput({ trimValue: true, focusClass: 'focus', typeaheadjs: { name: 'tags', source: source.ttAdapter() } }); } }); // Handling the modal confirmation message. $(document).on('submit', 'form[data-confirmation]', function (event) { var $form = $(this), $confirm = $('#confirmationModal'); if ($confirm.data('result') !== 'yes') { //cancel submit event event.preventDefault(); $confirm .off('click', '#btnYes') .on('click', '#btnYes', function () { $confirm.data('result', 'yes'); $form.find('input[type="submit"]').attr('disabled', 'disabled'); $form.submit(); }) .modal('show'); } });