Skip to content

Commit

Permalink
change repeatable entry in table
Browse files Browse the repository at this point in the history
  • Loading branch information
alexPopaCode4 committed Jun 4, 2024
1 parent 6a49309 commit 33e8b5c
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use App\Filament\Organizations\Resources\BeneficiaryResource;
use App\Infolists\Components\EnumEntry;
use Filament\Infolists\Components\Actions\Action;
use Filament\Infolists\Components\RepeatableEntry;
use Filament\Infolists\Components\Livewire;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Components\TextEntry;
use Filament\Infolists\Infolist;
Expand Down Expand Up @@ -169,18 +169,7 @@ private function documents(): Section
->link(),
])
->schema([

RepeatableEntry::make('documents')
->label('')
->contained(false)
->columns()
->schema([
TextEntry::make('type')
->label(__('beneficiary.section.documents.labels.type'))
->formatStateUsing(fn ($state) => $state->label()),
TextEntry::make('name')
->label(__('beneficiary.section.documents.labels.name'))
]),
Livewire::make(\App\Livewire\Beneficiary\ListDocuments::class),
]);
}
}
53 changes: 53 additions & 0 deletions app/Livewire/Beneficiary/ListDocuments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

declare(strict_types=1);

namespace App\Livewire\Beneficiary;

use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Tables;
use Filament\Tables\Concerns\InteractsWithTable;
use Filament\Tables\Contracts\HasTable;
use Filament\Tables\Table;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Model;
use Livewire\Component;

class ListDocuments extends Component implements HasForms, HasTable
{
use InteractsWithForms;
use InteractsWithTable;

public ?Model $record = null;

public function table(Table $table): Table
{
return $table
->relationship(fn () => $this->record->documents())
->columns([
Tables\Columns\TextColumn::make('type')
->label(__('beneficiary.section.documents.labels.type'))
->formatStateUsing(fn ($state) => $state->label()),
Tables\Columns\TextColumn::make('name')
->label(__('beneficiary.section.documents.labels.name')),
])
->filters([
//
])
->actions([
//
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
//
]),
])
->defaultPaginationPageOption(5);
}

public function render(): View
{
return view('livewire.beneficiary.list-documents');
}
}
3 changes: 3 additions & 0 deletions resources/views/livewire/beneficiary/list-documents.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div>
{{ $this->table }}
</div>

0 comments on commit 33e8b5c

Please sign in to comment.