Disable header row bulk_coop report

This commit is contained in:
Lucas da Costa
2022-08-16 16:32:19 -03:00
parent 4766c7a00b
commit 2a9db0eea4
2 changed files with 41 additions and 23 deletions

View File

@@ -0,0 +1,21 @@
import { Controller } from "stimulus";
export default class extends Controller {
static targets = ["reportType", "checkbox", "label"]
handleSelectChange() {
this.reportTypeTarget.value == "csv" ? this.disableField() : this.enableField()
}
disableField() {
this.checkboxTarget.checked = false;
this.checkboxTarget.disabled = true;
this.labelTarget.classList.add("disabled");
}
enableField() {
this.checkboxTarget.checked = true;
this.checkboxTarget.disabled = false;
this.labelTarget.classList.remove("disabled");
}
}