Avi
Avi
FFilament
Created by Avi on 4/27/2025 in #❓┊help
Display Cards under Select
I ended up using a Placeholder component with custom HTML rendered for each item in the list, ditching the idea of using a component for each item. This seems to be working!
20 replies
FFilament
Created by Avi on 4/27/2025 in #❓┊help
Display Cards under Select
the context is there is an Account and now we're adding Employees to the account. When selecting an employee to be added, we want to display the cards. So when viewing in edit mode, we could have the ViewField query and iterate. But when adding in real time, we just want to use local state because the employees aren't really added to the account until the user clicks "save" on this step of the wizard.
20 replies
FFilament
Created by Avi on 4/27/2025 in #❓┊help
Display Cards under Select
I must be missing something fundamental but I don't know what I don't know and am not sure how to look it up
20 replies
FFilament
Created by Avi on 4/27/2025 in #❓┊help
Display Cards under Select
the error points to the ->state() line
20 replies
FFilament
Created by Avi on 4/27/2025 in #❓┊help
Display Cards under Select
a static card throws the same error:
Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization
Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization
20 replies
FFilament
Created by Avi on 4/27/2025 in #❓┊help
Display Cards under Select
(also, thank you so much for your time/help)
20 replies
FFilament
Created by Avi on 4/27/2025 in #❓┊help
Display Cards under Select
static card with dummy data or what? the idea is that when a user selects an Employee, the selected employee(s) appear in cards. I thought I would be able to set some sort of state so every time an employee is selected it gets pushed into an array and as long as they array is populated, we can map over it and display a card per employee.
20 replies
FFilament
Created by Avi on 4/27/2025 in #❓┊help
Display Cards under Select
the imports are there but I took them out of this message because of the character limit
20 replies
FFilament
Created by Avi on 4/27/2025 in #❓┊help
Display Cards under Select
this is the card
<?php

class ContactCard extends Field
{
protected string $view = 'filament.forms.components.contact-card';

public static function make(string $name): static
{
return (new static($name))
->schema([
Hidden::make("{$name}_id"),
Grid::make(1)
->schema([
TextInput::make("{$name}_first_name")
->label('First Name')
->disabled(),
TextInput::make("{$name}_last_name")
->label('Last Name')
->disabled(),
TextInput::make("{$name}_email")
->label('Email')
->disabled(),
TextInput::make("{$name}_phone")
->label('Phone')
->disabled(),
]),
Actions::make([
Action::make('view')
->label('View')
->url(fn ($get) => route('filament.admin.resources.contacts.edit', ['record' => $get("{$name}_id")]))
->openUrlInNewTab()
->color('warning'),
Action::make('remove')
->label('')
->icon('heroicon-o-x-mark')
->color('danger')
->action(fn ($get, $set) => $set($name, null)),
])->alignment(Alignment::Right),
])
->columnSpanFull()
->extraAttributes([
'class' => 'bg-white rounded-lg shadow-sm border border-gray-200 p-4',
]);
}
}
<?php

class ContactCard extends Field
{
protected string $view = 'filament.forms.components.contact-card';

public static function make(string $name): static
{
return (new static($name))
->schema([
Hidden::make("{$name}_id"),
Grid::make(1)
->schema([
TextInput::make("{$name}_first_name")
->label('First Name')
->disabled(),
TextInput::make("{$name}_last_name")
->label('Last Name')
->disabled(),
TextInput::make("{$name}_email")
->label('Email')
->disabled(),
TextInput::make("{$name}_phone")
->label('Phone')
->disabled(),
]),
Actions::make([
Action::make('view')
->label('View')
->url(fn ($get) => route('filament.admin.resources.contacts.edit', ['record' => $get("{$name}_id")]))
->openUrlInNewTab()
->color('warning'),
Action::make('remove')
->label('')
->icon('heroicon-o-x-mark')
->color('danger')
->action(fn ($get, $set) => $set($name, null)),
])->alignment(Alignment::Right),
])
->columnSpanFull()
->extraAttributes([
'class' => 'bg-white rounded-lg shadow-sm border border-gray-200 p-4',
]);
}
}
20 replies
FFilament
Created by Avi on 4/27/2025 in #❓┊help
Display Cards under Select
This is the step within the Wizard
20 replies
FFilament
Created by Avi on 3/11/2025 in #❓┊help
Opening a modal from a button in a Form Section and from a Card in a Form Section Repeater
Checking it out, thanks~
6 replies