Ei kuvausta
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.

modal-add-role.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * Add new role Modal JS
  3. */
  4. 'use strict';
  5. document.addEventListener('DOMContentLoaded', function (e) {
  6. (function () {
  7. // add role form validation
  8. FormValidation.formValidation(document.getElementById('addRoleForm'), {
  9. fields: {
  10. modalRoleName: {
  11. validators: {
  12. notEmpty: {
  13. message: 'Please enter role name'
  14. }
  15. }
  16. }
  17. },
  18. plugins: {
  19. trigger: new FormValidation.plugins.Trigger(),
  20. bootstrap5: new FormValidation.plugins.Bootstrap5({
  21. // Use this for enabling/changing valid/invalid class
  22. // eleInvalidClass: '',
  23. eleValidClass: '',
  24. rowSelector: '.form-control-validation'
  25. }),
  26. submitButton: new FormValidation.plugins.SubmitButton(),
  27. // Submit the form when all fields are valid
  28. // defaultSubmit: new FormValidation.plugins.DefaultSubmit(),
  29. autoFocus: new FormValidation.plugins.AutoFocus()
  30. }
  31. });
  32. // Select All checkbox click
  33. const selectAll = document.querySelector('#selectAll'),
  34. checkboxList = document.querySelectorAll('[type="checkbox"]');
  35. selectAll.addEventListener('change', t => {
  36. checkboxList.forEach(e => {
  37. e.checked = t.target.checked;
  38. });
  39. });
  40. })();
  41. });