nuovo2023
nuovo2023
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
Sure
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
And to add to that, we also have the poll method that's in the table widget.
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
By the looks of it, seems like no matter what JS code is run at init (or ax-loaded), it will make the modal disappear sometimes.
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
No description
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
No description
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
I ended add setting a random-ish value for wire:loading.attr, the final solutions is this one:
<x-slot name="trigger">
<x-filament::button icon="heroicon-m-puzzle-piece" tooltip="Listen" wire:loading.attr="enabled" x-on:click="window.dispatchEvent(new Event('js-modalopen-hndlr'));" />
</x-slot>
<x-slot name="trigger">
<x-filament::button icon="heroicon-m-puzzle-piece" tooltip="Listen" wire:loading.attr="enabled" x-on:click="window.dispatchEvent(new Event('js-modalopen-hndlr'));" />
</x-slot>
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
I found out that adding disabled="false" here will disable the x-on:click event
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
I found wire:loading.attr is the one that affects trigger disabled toggling, by default is set as this:
<x-filament::button icon="icon-headphones" tooltip="Listen" wire:loading.attr="disabled"...>
<x-filament::button icon="icon-headphones" tooltip="Listen" wire:loading.attr="disabled"...>
This will be toggling its state depending on poll value.
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
You guys made a great job documenting that info
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
I build that code using node bin/build.js, and it's bundled and included right in public folder
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
It's my code
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
I followed this guide https://filamentphp.com/docs/3.x/support/assets#asynchronous-alpinejs-components, to add custom JS code. It creates a sip.js instance, and allow me to make calls
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
Anyway, I don't like my solution, but it's working so far. If you can find what's wrong it would be nice to know 🙂
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
I can't find that post
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
I was also using poll()
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
btw: I'm using the close modal ID to trigger the close-modal event when a call ends
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
Yup
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
Sure, the action was this one:
->actions([
Tables\Actions\Action::make('spy')
->iconButton()
->button()
->label('')
->icon('icon-headphones')
->visible(fn($record) => $this->spyVisibility($record))
->modal()
->modalContent(fn($record) => view('filament.company.tables.modals.spy'))
->modalSubmitAction(false)
->modalCancelAction(
fn(StaticAction $action) => $action->extraAttributes(['id' => 'close-spy-modal'])->label('Close')
)
->extraModalWindowAttributes(fn($record) => ['id' => 'pbx_spymodal', 'data-sip' => $record->sipnum]),
])
->actions([
Tables\Actions\Action::make('spy')
->iconButton()
->button()
->label('')
->icon('icon-headphones')
->visible(fn($record) => $this->spyVisibility($record))
->modal()
->modalContent(fn($record) => view('filament.company.tables.modals.spy'))
->modalSubmitAction(false)
->modalCancelAction(
fn(StaticAction $action) => $action->extraAttributes(['id' => 'close-spy-modal'])->label('Close')
)
->extraModalWindowAttributes(fn($record) => ['id' => 'pbx_spymodal', 'data-sip' => $record->sipnum]),
])
And the blade view:
@php
use Filament\Facades\Filament;
$company = Filament::getTenant();
$spyUser = $company->spyUser ?? null;
$spyPass = $company->data['spy_pass'] ?? null;
$spyExt = config('pbx.defaults.spy_extension', null);
$closeModalID = 'spy-modal';
@endphp


<div x-ignore ax-load ax-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('sip-client') }}"
x-data="sipClient({
state: {
spyUser: '{{ @$spyUser }}',
spyPass: '{{ @$spyPass }}',
spyExtension: '{{ @$spyExt }}',
closeModalID: '{{ $closeModalID }}',
target: '{{ @$record->sipnum }}',
}
})">
{{ $record->channel ?? '' }}

<audio id="chspyaudio" controls style="display: none">
<p>Your browser does not support the audio element</p>
</audio>
</div>
@php
use Filament\Facades\Filament;
$company = Filament::getTenant();
$spyUser = $company->spyUser ?? null;
$spyPass = $company->data['spy_pass'] ?? null;
$spyExt = config('pbx.defaults.spy_extension', null);
$closeModalID = 'spy-modal';
@endphp


<div x-ignore ax-load ax-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('sip-client') }}"
x-data="sipClient({
state: {
spyUser: '{{ @$spyUser }}',
spyPass: '{{ @$spyPass }}',
spyExtension: '{{ @$spyExt }}',
closeModalID: '{{ $closeModalID }}',
target: '{{ @$record->sipnum }}',
}
})">
{{ $record->channel ?? '' }}

<audio id="chspyaudio" controls style="display: none">
<p>Your browser does not support the audio element</p>
</audio>
</div>
I'm not modifying any generated code in javascript, that was the odd part.
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
When the modal disappeared, it was creating additonal instances of my js object
36 replies
FFilament
Created by nuovo2023 on 1/27/2025 in #❓┊help
Custom Table Action and polling
The Blade view only purpose was to pass data to JavaScript, then in my js code I created an extension using sip.js
36 replies