| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- /**
- * Add new role Modal JS
- */
-
- 'use strict';
-
- document.addEventListener('DOMContentLoaded', function (e) {
- (function () {
- // add role form validation
- FormValidation.formValidation(document.getElementById('addRoleForm'), {
- fields: {
- modalRoleName: {
- validators: {
- notEmpty: {
- message: 'Please enter role name'
- }
- }
- }
- },
- plugins: {
- trigger: new FormValidation.plugins.Trigger(),
- bootstrap5: new FormValidation.plugins.Bootstrap5({
- // Use this for enabling/changing valid/invalid class
- // eleInvalidClass: '',
- eleValidClass: '',
- rowSelector: '.form-control-validation'
- }),
- submitButton: new FormValidation.plugins.SubmitButton(),
- // Submit the form when all fields are valid
- // defaultSubmit: new FormValidation.plugins.DefaultSubmit(),
- autoFocus: new FormValidation.plugins.AutoFocus()
- }
- });
-
- // Select All checkbox click
- const selectAll = document.querySelector('#selectAll'),
- checkboxList = document.querySelectorAll('[type="checkbox"]');
- selectAll.addEventListener('change', t => {
- checkboxList.forEach(e => {
- e.checked = t.target.checked;
- });
- });
- })();
- });
|