Add indeterminate state to report wizard checkbox [SCI-5714]

This commit is contained in:
aignatov-bio 2021-05-20 15:54:46 +02:00
parent b7f4ac5e67
commit 0200cd4b6e

View file

@ -1331,10 +1331,7 @@ function reportHandsonTableConverter() {
disableSearch: true
});
function SelectAllRepositoriesStatus() {
var selectAll = $('.task-contents-container .select-all-repositories');
var all = $('.repositories-contents .sci-checkbox').length;
var checked = $('.repositories-contents .sci-checkbox:checked').length;
function selectAllCheckboxState(selectAll, all, checked) {
selectAll.prop('indeterminate', false);
if (all === checked) {
selectAll.prop('checked', true);
@ -1344,6 +1341,35 @@ function reportHandsonTableConverter() {
}
}
function SelectAllRepositoriesStatus() {
var selectAll = $('.task-contents-container .select-all-repositories');
var all = $('.repositories-contents .sci-checkbox').length;
var checked = $('.repositories-contents .sci-checkbox:checked').length;
selectAllCheckboxState(selectAll, all, checked);
}
function SelectAllProtocolStatus() {
var selectAll = $('.task-contents-container .protocol-steps-checkbox');
var all = $('.step-contents .sci-checkbox').length;
var checked = $('.step-contents .sci-checkbox:checked').length;
selectAllCheckboxState(selectAll, all, checked);
}
function SelectAllResultsStatus() {
var selectAll = $('.task-contents-container .all-results-checkbox');
var all = $('.results-type-contents .sci-checkbox:not(.skip-select-all)').length;
var checked = $('.results-type-contents .sci-checkbox:not(.skip-select-all):checked').length;
selectAllCheckboxState(selectAll, all, checked);
}
function SelectAllTaskContentStatus() {
var selectAll = $('.task-contents-container .select-all-task-contents');
var all = $('.report-task-settings .sci-checkbox:not(.skip-select-all)').length;
var checked = $('.report-task-settings .sci-checkbox:not(.skip-select-all):checked').length;
selectAllCheckboxState(selectAll, all, checked);
}
$('.task-contents-container')
.on('change', '.select-all-task-contents', function() {
$('.content-element .sci-checkbox:not(.skip-select-all)')
@ -1363,6 +1389,15 @@ function reportHandsonTableConverter() {
})
.on('change', '.repositories-contents .sci-checkbox', function() {
SelectAllRepositoriesStatus();
})
.on('change', '.step-contents .sci-checkbox', function() {
SelectAllProtocolStatus();
})
.on('change', '.results-type-contents .sci-checkbox:not(.skip-select-all)', function() {
SelectAllResultsStatus();
})
.on('change', '.report-task-settings .sci-checkbox:not(.skip-select-all)', function() {
SelectAllTaskContentStatus();
});
SelectAllRepositoriesStatus();