bizext.ui.js 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. $(function()
  2. {
  3. $(document).on('change', 'input.check-all', function()
  4. {
  5. const checked = $(this).prop('checked');
  6. $(this).parents('.form-row').find('input[type=checkbox]').prop('checked', checked);
  7. window.showError();
  8. });
  9. $(document).on('change', 'input[name^=members]', function()
  10. {
  11. let checked = true;
  12. const checkedCount = $(this).closest('.form-group').find('input[name^=members]:checked').length;
  13. const totalCount = $(this).closest('.form-group').find('input[name^=members]').length;
  14. if(checkedCount < totalCount) checked = false;
  15. $(this).closest('.form-row').find('input.check-all').prop('checked', checked);
  16. window.showError();
  17. });
  18. });
  19. window.showError = function()
  20. {
  21. const $form = $('#manageExtMember').find('form');
  22. const checkedCount = $form.find('input[name^=members]:checked').length;
  23. $form.find('button[type=submit]').removeAttr('disabled');
  24. if(checkedCount > licenseCount)
  25. {
  26. zui.Modal.alert(extGrantCountError.replace('%s', checkedCount).replace('%s', checkedCount - licenseCount));
  27. $form.find('button[type=submit]').attr('disabled', 'disabled');
  28. }
  29. };