protected function getStats(): array
{
$errorCount = Product::where('is_error', true)->count();
return [
Stat::make('Product Sync Errors', $errorCount)
->description('Number of products with sync errors')
->color('danger')
->extraAttributes([
'class' => 'relative cursor-pointer',
'x-data' => '{}',
'role' => 'button',
'tabindex' => '0',
'aria-label' => 'Filter Product Sync Errors',
'x-init' => "
let button = document.createElement('button');
button.className = 'absolute top-0 right-0 mt-2 mr-2 px-2 py-1 text-sm text-white bg-blue-500 rounded hover:bg-blue-600';
button.setAttribute('aria-label', 'Fix Errors');
button.innerText = 'Fix Errors';
button.setAttribute('wire:click', `\$dispatch('setStatusFilter',{ filter: ['processed', {$errorCount}]})`);
\$el.appendChild(button);
",
]),
];
}
protected function getStats(): array
{
$errorCount = Product::where('is_error', true)->count();
return [
Stat::make('Product Sync Errors', $errorCount)
->description('Number of products with sync errors')
->color('danger')
->extraAttributes([
'class' => 'relative cursor-pointer',
'x-data' => '{}',
'role' => 'button',
'tabindex' => '0',
'aria-label' => 'Filter Product Sync Errors',
'x-init' => "
let button = document.createElement('button');
button.className = 'absolute top-0 right-0 mt-2 mr-2 px-2 py-1 text-sm text-white bg-blue-500 rounded hover:bg-blue-600';
button.setAttribute('aria-label', 'Fix Errors');
button.innerText = 'Fix Errors';
button.setAttribute('wire:click', `\$dispatch('setStatusFilter',{ filter: ['processed', {$errorCount}]})`);
\$el.appendChild(button);
",
]),
];
}