Skip to content

Commit

Permalink
Merge pull request #586 from liberu-genealogy/sweep/reports
Browse files Browse the repository at this point in the history
Sweep: reports
  • Loading branch information
curtisdelicata committed May 12, 2024
2 parents edbd2b4 + 2b58b51 commit 3e09314
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 7 deletions.
34 changes: 34 additions & 0 deletions app/Filament/Widgets/ReportWidget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace App\Filament\Widgets;

use App\Http\Livewire\DabovilleReport;
use App\Http\Livewire\HenryReport;
use App\Http\Livewire\AhnentafelReport;
use Filament\Widgets\Widget;

class ReportWidget extends Widget
{
protected static string $view = 'filament.widgets.report-widget';

protected function getHeading(): string
{
return 'Reports';
}

public function mount(): void
{
$this->livewire = [
'daboville-report' => DabovilleReport::class,
'henry-report' => HenryReport::class,
'ahnentafel-report' => AhnentafelReport::class,
];
}

protected function getViewData(): array
{
return [
'livewire' => $this->livewire,
];
}
}
2 changes: 1 addition & 1 deletion app/Http/Livewire/AhnentafelReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Livewire/DabovilleReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Livewire/HenryReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions resources/views/livewire/daboville-report.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
<tr>
<td>{{ $data['number'] }}</td>
<td>{{ $data['name'] }}</td>
<td>{{ $data['birth'] }}</td>
<td>{{ $data['death'] }}</td>
<td>{{ $data['birth'] ?? 'N/A' }}</td>
<td>{{ $data['death'] ?? 'N/A' }}</td>
</tr>
@endforeach
</tbody>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/livewire/henry-report.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
@foreach($reportData as $data)
<tr>
<td>{{ $data['name'] }}</td>
<td>{{ $data['birth'] }}</td>
<td>{{ $data['death'] }}</td>
<td>{{ $data['birth'] ?? 'N/A' }}</td>
<td>{{ $data['death'] ?? 'N/A' }}</td>
</tr>
@endforeach
</tbody>
Expand Down

0 comments on commit 3e09314

Please sign in to comment.