You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. window.addEventListener('load', (event) => {
  2. // @TODO : cela met le focus sur le premier select2 du document
  3. /*$(document).on('select2:open', () => {
  4. document.querySelector('.select2-search__field').focus();
  5. });*/
  6. SovNotification.init();
  7. SovWidgets.setDateRange();
  8. $('.btn-confirm-js, .action-confirm').click(function () {
  9. return confirm('Êtes-vous sûr de vouloir réaliser cette action ?');
  10. });
  11. /* Tooltip */
  12. $('[data-toggle="tooltip"]').tooltip();
  13. if ($('.form-select, .select2, select.form-control').length) {
  14. $('form .form-widget>select.form-control, .select2, .form-select').each(function (i, elm) {
  15. if (!$(this).hasClass('disable-select2')) {
  16. SovWidgets.setSelect2($(elm));
  17. }
  18. });
  19. $('form select.form-control').each(function (i, elm) {
  20. if (!$(this).hasClass('disable-select2')) {
  21. SovWidgets.setSelect2($(elm));
  22. }
  23. });
  24. }
  25. $('.action-delete').on('click', function (e) {
  26. e.preventDefault();
  27. const formAction = $(this).attr('formaction');
  28. $('#modal-delete').modal({backdrop: true, keyboard: true})
  29. .off('click', '#modal-delete-button')
  30. .on('click', '#modal-delete-button', function () {
  31. let deleteForm = $('#delete-form');
  32. deleteForm.attr('action', formAction);
  33. deleteForm.submit();
  34. });
  35. });
  36. var elements = $('.lc-ckeditor');
  37. if (elements.length) {
  38. for (var i = 0; i < elements.length; ++i) {
  39. if ($(elements[i]).data('config') === 'simple_config') {
  40. CKEDITOR.replace(elements[i], {
  41. "toolbar": [
  42. {
  43. items: ['Bold', 'Italic', 'Underline', 'Strike']
  44. },
  45. {
  46. items: ["TextColor"]
  47. }
  48. ],
  49. "language": "fr",
  50. 'height': 100
  51. });
  52. } else {
  53. CKEDITOR.replace(elements[i], {
  54. "toolbar": [
  55. {
  56. name: "styles",
  57. items: ["Format", 'Bold', 'Italic', 'Underline', 'Strike', "Link", "BulletedList"]
  58. },
  59. {
  60. items: ["TextColor"]
  61. },
  62. {name: 'paragraph', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock']},
  63. {name: 'insert', items: ['Image', 'SpecialChar']},
  64. {name: "document", items: ["Source"]},
  65. ],
  66. "language": "fr"
  67. });
  68. }
  69. }
  70. }
  71. SovWidgets.setAutoCompleteField();
  72. });