TenantAtlas/apps/platform/app/Support/OpsUx/OpsUxBrowserEvents.php
ahmido 867bd92370 Automated: 268-operationrun-activity-feedback — commit & PR (#324)
Automated commit and PR created by agent. Branch: 268-operationrun-activity-feedback-session-1777896580

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #324
2026-05-04 12:17:15 +00:00

34 lines
1014 B
PHP

<?php
declare(strict_types=1);
namespace App\Support\OpsUx;
use App\Filament\Widgets\Inventory\InventoryKpiHeader;
use App\Livewire\BulkOperationProgress;
use Filament\Facades\Filament;
final class OpsUxBrowserEvents
{
public const RunEnqueued = 'ops-ux:run-enqueued';
public static function dispatchRunEnqueued(mixed $livewire): void
{
if (! is_object($livewire)) {
return;
}
if (! method_exists($livewire, 'dispatch')) {
return;
}
$tenantId = Filament::getTenant()?->getKey();
// In Livewire v3, dispatch() emits a DOM event that bubbles.
// Our progress widget is mounted outside the initiating component's DOM tree,
// so we target it explicitly to ensure it receives the event immediately.
$livewire->dispatch(self::RunEnqueued, tenantId: $tenantId)->to(BulkOperationProgress::class);
$livewire->dispatch(self::RunEnqueued, tenantId: $tenantId)->to(InventoryKpiHeader::class);
}
}