FilamentF
Filament10mo ago
hxnnxs

Modal window does not create a map.

Hello! I have encountered a problem that the form in my modal window does not create a map.

Livewire/show-user-cards.blade.php:
<div>
<div class="py-5">
<form wire:submit.prevent="create">
{{ $this->form }}
</form>
</div>
{{$this->table}}
</div>


Filament/pages/show-user-cards.balde.php:
<x-filament-panels::page>
<livewire:show-user-cards :user-id="$userId"/>
</x-filament-panels::page>

Filament/Pages/ShowUserCards.php:
<?php

namespace App\Filament\Pages;

use Filament\Pages\Page;

class ShowUserCards extends Page
{
protected static ?string $navigationIcon = 'heroicon-o-document-text';

protected static string $view = 'filament.pages.show-user-cards';

protected static bool $shouldRegisterNavigation = false;
}


If you need additional pin information, I will provide it immediately!

Thanks in advance ❤️
Solution
Seems like a complicated approach. just make the card button an action that loads a ->form() and users ->model() fillForm() and uses a repeater?

 \Filament\Tables\Actions\Action::make('account_records')
                    ->label(' ')
                    ->hiddenLabel()
                    ->modalHeading(fn ($record) => 'Editing Details For: '.$record->first_name.' '.$record->last_name)
                    ->model(fn ($record) => $record->accounts)
                    ->fillForm(fn ($record) => ['accounts' => $record->accounts->toArray()])
                    ->form([
                        Repeater::make('accounts')
                            ->relationship('accounts')
                            ->defaultItems(1)
                            ->schema(
                                TextInput::make('card_number')
                            )
                            ->columnSpanFull()
                            ->columns(2)
                            ->addActionLabel('Add Account')
                            ->label(fn ($record) => 'Accounts'),
                    ])
                    ->slideOver()
                    ->action(function ($record, $data) {
                        Notification::make()
                            ->title('Details Updated Successfully')
                            ->icon('heroicon-o-document-text')
                            ->iconColor('success')
                            ->send()
                            ->sendToDatabase(auth()->user());
                    })
                    ->icon('heroicon-o-building-library')
                    ->color(fn ($record) => $record->accounts_count ? 'primary' : 'danger'),
Was this page helpful?