diff --git a/assets/controllers/filters/number_constraint_controller.js b/assets/controllers/filters/number_constraint_controller.js new file mode 100644 index 00000000..3f7ad065 --- /dev/null +++ b/assets/controllers/filters/number_constraint_controller.js @@ -0,0 +1,21 @@ +import {Controller} from "@hotwired/stimulus"; + +export default class extends Controller { + + static targets = ["operator", "thingsToHide"]; + + connect() { + this.update(); + debugger; + } + + /** + * Updates the visibility state of the value2 input, based on the operator selection. + */ + update() + { + for (const thingToHide of this.thingsToHideTargets) { + thingToHide.classList.toggle("d-none", this.operatorTarget.value !== "BETWEEN"); + } + } +} \ No newline at end of file diff --git a/templates/Form/FilterTypesLayout.html.twig b/templates/Form/FilterTypesLayout.html.twig index 46dc7e5f..ec082128 100644 --- a/templates/Form/FilterTypesLayout.html.twig +++ b/templates/Form/FilterTypesLayout.html.twig @@ -1,9 +1,13 @@ {% block number_constraint_widget %} -