diff --git a/app/Filament/Widgets/ReportWidget.php b/app/Filament/Widgets/ReportWidget.php new file mode 100644 index 00000000..d0bf9188 --- /dev/null +++ b/app/Filament/Widgets/ReportWidget.php @@ -0,0 +1,34 @@ +livewire = [ + 'daboville-report' => DabovilleReport::class, + 'henry-report' => HenryReport::class, + 'ahnentafel-report' => AhnentafelReport::class, + ]; + } + + protected function getViewData(): array + { + return [ + 'livewire' => $this->livewire, + ]; + } +} \ No newline at end of file diff --git a/app/Http/Livewire/AhnentafelReport.php b/app/Http/Livewire/AhnentafelReport.php index 35944c7d..b29d041f 100644 --- a/app/Http/Livewire/AhnentafelReport.php +++ b/app/Http/Livewire/AhnentafelReport.php @@ -18,7 +18,7 @@ public function render() public function generateReport($personId) { $this->selectedPersonId = $personId; - $person = Person::find($personId); + $person = Person::with('child_in_family.birth', 'child_in_family.death')->find($personId); if ($person) { $this->reportData = []; $this->traverseFamilyTree($person, '1'); diff --git a/app/Http/Livewire/DabovilleReport.php b/app/Http/Livewire/DabovilleReport.php index 8868a5ff..e78a9cfa 100644 --- a/app/Http/Livewire/DabovilleReport.php +++ b/app/Http/Livewire/DabovilleReport.php @@ -39,7 +39,7 @@ public function render() public function generateReport($personId) { $this->selectedPersonId = $personId; - $person = Person::find($personId); + $person = Person::with('child_in_family.birth', 'child_in_family.death')->find($personId); if ($person) { $this->reportData = []; $this->traverseFamilyTree($person, '1'); diff --git a/app/Http/Livewire/HenryReport.php b/app/Http/Livewire/HenryReport.php index ef6412e9..65818570 100644 --- a/app/Http/Livewire/HenryReport.php +++ b/app/Http/Livewire/HenryReport.php @@ -18,7 +18,7 @@ public function render() public function generateReport($personId) { $this->selectedPersonId = $personId; - $person = Person::find($personId); + $person = Person::with('child_in_family.birth', 'child_in_family.death')->find($personId); if ($person) { $this->reportData = []; $this->processHenryReportData($person); diff --git a/resources/views/livewire/daboville-report.blade.php b/resources/views/livewire/daboville-report.blade.php index 28b4ea3e..84e5644b 100644 --- a/resources/views/livewire/daboville-report.blade.php +++ b/resources/views/livewire/daboville-report.blade.php @@ -31,8 +31,8 @@ {{ $data['number'] }} {{ $data['name'] }} - {{ $data['birth'] }} - {{ $data['death'] }} + {{ $data['birth'] ?? 'N/A' }} + {{ $data['death'] ?? 'N/A' }} @endforeach diff --git a/resources/views/livewire/henry-report.blade.php b/resources/views/livewire/henry-report.blade.php index 9cc9de71..94cd2316 100644 --- a/resources/views/livewire/henry-report.blade.php +++ b/resources/views/livewire/henry-report.blade.php @@ -29,8 +29,8 @@ @foreach($reportData as $data) {{ $data['name'] }} - {{ $data['birth'] }} - {{ $data['death'] }} + {{ $data['birth'] ?? 'N/A' }} + {{ $data['death'] ?? 'N/A' }} @endforeach