-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #785 from JoshKisb/main
update reports
- Loading branch information
Showing
12 changed files
with
106 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace App\Livewire; | ||
|
||
use App\Models\Person; | ||
use Filament\Actions\Action; | ||
use Filament\Actions\Concerns\InteractsWithActions; | ||
use Filament\Actions\Contracts\HasActions; | ||
use Filament\Forms\Components\Select; | ||
use Filament\Forms\Concerns\InteractsWithForms; | ||
use Filament\Forms\Contracts\HasForms; | ||
use Filament\Forms\Form; | ||
use Livewire\Component; | ||
|
||
class DevillierReport extends Component implements HasForms, HasActions | ||
{ | ||
|
||
use InteractsWithForms; | ||
use InteractsWithActions; | ||
|
||
public ?array $data = []; | ||
|
||
public function mount(): void | ||
{ | ||
$this->form->fill(); | ||
} | ||
|
||
public function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([ | ||
Select::make('person') | ||
->hiddenLabel() | ||
->options(Person::all()->pluck('name', 'id')) | ||
->placeholder('Select a Person:') | ||
->native(false), | ||
Select::make('generation') | ||
->hiddenLabel() | ||
->placeholder('Select Generation') | ||
->options([1, 2, 3, 4, 5]) | ||
->native(false) | ||
]) | ||
->statePath('data') | ||
; | ||
} | ||
|
||
public function generateAction(): Action | ||
{ | ||
return Action::make('generate') | ||
->action(fn () => null); | ||
} | ||
|
||
public function generateReport(): void | ||
{ | ||
dd($this->form->getState()); | ||
} | ||
|
||
public function render() | ||
{ | ||
return view('livewire.devilliers-report'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<x-filament-panels::page> | ||
|
||
<livewire:devillier-report /> | ||
</x-filament-panels::page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,25 @@ | ||
<div> | ||
<form wire:submit.prevent="generateReport"> | ||
<div class="flex"> | ||
{{ $this->form }} | ||
<button type="submit" class="btn btn-primary">Generate Report</button> | ||
<div class="flex items-end"> | ||
<div class="flex-1 pr-2">{{ $this->form }}</div> | ||
<div>{{ $this->generateAction }}</div> | ||
</div> | ||
</form> | ||
|
||
<div wire:loading> | ||
<div class="flex justify-center text-center mt-3" wire:loading> | ||
Generating report... | ||
</div> | ||
|
||
@if(!empty($reportData)) | ||
<table class="table mt-4"> | ||
<thead> | ||
<tr> | ||
<th>d'Aboville Number</th> | ||
<th>Name</th> | ||
<th>Birth Date</th> | ||
<th>Death Date</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@foreach($reportData as $data) | ||
<tr> | ||
<td>{{ $data['number'] }}</td> | ||
<td>{{ $data['name'] }}</td> | ||
<td>{{ $data['birth'] ?? 'N/A' }}</td> | ||
<td>{{ $data['death'] ?? 'N/A' }}</td> | ||
</tr> | ||
@endforeach | ||
</tbody> | ||
</table> | ||
@if (!empty($reportData)) | ||
<div v-for="data in reportLevels"> | ||
<div :style="`margin: 8px 6px 8px ${data.level * 42}px; display: flex`"> | ||
<span :style="`width: ${(data.level * 5) + 20}px;`">{{data.label}}</span> | ||
<span>{{ data.person.firstNames }}</span> | ||
</div> | ||
<div v-if="data.person.spouse && data.person.children" :style="`margin: 8px 0px 16px ${(data.level * 42)}px; display: flex`"> | ||
<span :style="`padding: 0 8px 0px ${(data.level * 5) + 20}px`">sp</span> | ||
<span>{{ data.person.spouse.firstNames }}</span> | ||
</div> | ||
</div> | ||
@endif | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters