feat: initialize Dr-Panel project with patient file number support
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Resources\VisitResource\Pages;
|
||||
|
||||
use App\Filament\Resources\VisitResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListVisits extends ListRecords
|
||||
{
|
||||
protected static string $resource = VisitResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make()
|
||||
->icon('heroicon-o-plus'),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getHeaderWidgets(): array
|
||||
{
|
||||
return VisitResource::getWidgets();
|
||||
}
|
||||
|
||||
public function applyTableFilters(): void
|
||||
{
|
||||
parent::applyTableFilters();
|
||||
$this->applySortFromFilters();
|
||||
$this->dispatchStatsUpdate();
|
||||
}
|
||||
|
||||
public function updatedTableFilters(): void
|
||||
{
|
||||
parent::updatedTableFilters();
|
||||
$this->applySortFromFilters();
|
||||
$this->dispatchStatsUpdate();
|
||||
}
|
||||
|
||||
public function resetTableFiltersForm(): void
|
||||
{
|
||||
parent::resetTableFiltersForm();
|
||||
$this->tableSort = null;
|
||||
$this->dispatchStatsUpdate();
|
||||
}
|
||||
|
||||
protected function applySortFromFilters(): void
|
||||
{
|
||||
$filters = $this->tableFilters ?? [];
|
||||
$fromDate = ($filters['visit_date_range']['from_date'] ?? null) ?: null;
|
||||
|
||||
$this->tableSort = $fromDate ? 'visit_date:asc' : null;
|
||||
}
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user