23 lines
618 B
JavaScript
23 lines
618 B
JavaScript
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.ticketSelectTarget.value === '0') {
|
|
this.foodSelectTarget.disabled = true;
|
|
this.prevValue = this.foodSelectTarget.value;
|
|
this.foodSelectTarget.value = '0';
|
|
} else {
|
|
this.foodSelectTarget.disabled = false;
|
|
this.foodSelectTarget.value = this.prevValue ?? '';
|
|
}
|
|
}
|
|
} |