mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-15 04:14:24 +00:00
Disable header row bulk_coop report
This commit is contained in:
21
app/webpacker/controllers/csv_select_controller.js
Normal file
21
app/webpacker/controllers/csv_select_controller.js
Normal 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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user