fix(dossier): désactiver la checkbox select_all quand action en cours
This commit is contained in:
parent
bf8c218d3a
commit
cb6875352e
3 changed files with 2 additions and 20 deletions
|
@ -89,6 +89,7 @@ module Instructeurs
|
||||||
.per(ITEMS_PER_PAGE)
|
.per(ITEMS_PER_PAGE)
|
||||||
|
|
||||||
@projected_dossiers = DossierProjectionService.project(@filtered_sorted_paginated_ids, procedure_presentation.displayed_fields)
|
@projected_dossiers = DossierProjectionService.project(@filtered_sorted_paginated_ids, procedure_presentation.displayed_fields)
|
||||||
|
@disable_checkbox_all = @projected_dossiers.all? { _1.batch_operation_id.present? }
|
||||||
|
|
||||||
assign_exports
|
assign_exports
|
||||||
@batch_operations = BatchOperation.joins(:groupe_instructeurs)
|
@batch_operations = BatchOperation.joins(:groupe_instructeurs)
|
||||||
|
|
|
@ -149,22 +149,3 @@ function emptyCheckboxes() {
|
||||||
);
|
);
|
||||||
inputs.forEach((e) => (e.checked = false));
|
inputs.forEach((e) => (e.checked = false));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable select_all checkbox if all checkboxes are disabled
|
|
||||||
addEventListener('DOMContentLoaded', () => {
|
|
||||||
const checkbox_all = document.querySelector<HTMLInputElement>(
|
|
||||||
'#checkbox_all_batch_operation'
|
|
||||||
);
|
|
||||||
const inputs = document.querySelectorAll<HTMLInputElement>(
|
|
||||||
'div[data-controller="batch-operation"] input[data-batch-operation-target="input"]'
|
|
||||||
);
|
|
||||||
if (checkbox_all) {
|
|
||||||
const disabled_inputs = Array.from(inputs).filter(
|
|
||||||
(input) => input.disabled == true
|
|
||||||
);
|
|
||||||
if (disabled_inputs.length == inputs.length) {
|
|
||||||
checkbox_all.checked = true;
|
|
||||||
checkbox_all.disabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
|
@ -109,7 +109,7 @@
|
||||||
%tr
|
%tr
|
||||||
- if batch_operation_component.render?
|
- if batch_operation_component.render?
|
||||||
%th.text-center
|
%th.text-center
|
||||||
%input{ type: "checkbox", data: { action: "batch-operation#onCheckAll" }, id: dom_id(BatchOperation.new, :checkbox_all), aria: { label: t('views.instructeurs.dossiers.select_all') } }
|
%input{ type: "checkbox", disabled: @disable_checkbox_all, checked: @disable_checkbox_all, data: { action: "batch-operation#onCheckAll" }, id: dom_id(BatchOperation.new, :checkbox_all), aria: { label: t('views.instructeurs.dossiers.select_all') } }
|
||||||
- else
|
- else
|
||||||
- if @statut.in? %w(suivis traites tous)
|
- if @statut.in? %w(suivis traites tous)
|
||||||
= render partial: "header_field", locals: { field: { "label" => "●", "table" => "notifications", "column" => "notifications" }, classname: "notification-col text-center" }
|
= render partial: "header_field", locals: { field: { "label" => "●", "table" => "notifications", "column" => "notifications" }, classname: "notification-col text-center" }
|
||||||
|
|
Loading…
Add table
Reference in a new issue