feat: improve visits filter UX and update currency label

This commit is contained in:
SajjadMahmoody
2026-04-18 22:47:23 +03:30
parent 4abd856bf9
commit 1e8ec1f76f
13 changed files with 296 additions and 68 deletions
@@ -19,4 +19,40 @@ protected function getHeaderActions(): array
->icon('heroicon-o-plus'),
];
}
protected function getHeaderWidgets(): array
{
return VisitResource::getWidgets();
}
public function applyTableFilters(): void
{
parent::applyTableFilters();
$this->dispatchStatsUpdate();
}
public function updatedTableFilters(): void
{
parent::updatedTableFilters();
$this->dispatchStatsUpdate();
}
public function resetTableFiltersForm(): void
{
parent::resetTableFiltersForm();
$this->dispatchStatsUpdate();
}
protected function dispatchStatsUpdate(): void
{
$filters = $this->tableFilters ?? [];
$this->dispatch('visit-stats-updated',
fromDate: ($filters['visit_date_range']['from_date'] ?? null) ?: null,
toDate: ($filters['visit_date_range']['to_date'] ?? null) ?: null,
doctor: isset($filters['doctor']['value']) && $filters['doctor']['value'] !== '' ? (int) $filters['doctor']['value'] : null,
treatment: isset($filters['treatment']['value']) && $filters['treatment']['value'] !== '' ? (int) $filters['treatment']['value'] : null,
paymentType: isset($filters['payment_type']['value']) && $filters['payment_type']['value'] !== '' ? (int) $filters['payment_type']['value'] : null,
);
}
}