hide food select when selecting aftershow ticket
All checks were successful
build / build (pull_request) Successful in 5m33s

This commit is contained in:
2025-02-25 21:59:40 +01:00
parent c557551a73
commit feff4cb115
2 changed files with 50 additions and 16 deletions

View File

@ -0,0 +1,23 @@
import {Controller} from "@hotwired/stimulus";
export default class extends Controller {
static targets = ['foodSelect', 'ticketSelect'];
prevValue;
connect() {
this.hide();
}
hide() {
if (this.ticketSelectTarget.value === '2') {
this.foodSelectTarget.disabled = true;
this.prevValue = this.foodSelectTarget.value;
this.foodSelectTarget.value = '0';
} else {
this.foodSelectTarget.disabled = false;
this.foodSelectTarget.value = this.prevValue ?? '';
}
}
}