It looks like you're trying to use Livewire's $wire object within an Alpine.js expression, but you're encountering an error because $wire is not recognized. This can happen if Alpine.js tries to evaluate the expression before Livewire has fully initialized the component.
To ensure that $wire is available when Alpine tries to access it, you can use the x-init directive to defer the click event binding until after Livewire has initialized. Here's how you can modify your code:
<div
id="floor"
class="floor"
x-data
x-init="@this.entangle('someProperty').defer"
@click="
(
( $event.target.classList.contains('alloc') || $event.target.classList.contains('av') ) && $event.target.id>''
? $wire.seatClick($event.target.id)
: ''
)"
>
In this code snippet, x-data initializes an Alpine component, and x-init is used to entangle a Livewire property (you can replace 'someProperty' with an actual property from your Livewire component). The .defer modifier ensures that the Alpine component is only initialized after Livewire has made $wire available.
If you don't have a specific property to entangle, you can simply use x-init to create a delay:
<div
id="floor"
class="floor"
x-data
x-init="$nextTick(() => {})"
@click="
(
( $event.target.classList.contains('alloc') || $event.target.classList.contains('av') ) && $event.target.id>''
? $wire.seatClick($event.target.id)
: ''
)"
>
Here, $nextTick is an Alpine.js function that waits until the next DOM update cycle to execute the given function. In this case, it's an empty function, but it ensures that $wire is defined by the time the click event is processed.
If you continue to experience issues, make sure that your Livewire scripts are loaded before your Alpine.js scripts, as Livewire needs to be initialized first to work correctly with Alpine.js.