lbar
lbar
FFilament
Created by lbar on 11/11/2024 in #❓┊help
DatePicker problem accessing the field from the relationship
I'm struggling with this specific problem on DatePicker, so as last resort i'm trying to write there. Basically I have a birth_date (type date) field on the sql. I'm accessing this field on two different resource. The first one is the resource itself of the table, and works correctly:
Forms\Components\DatePicker::make('birth_date')
->translateLabel()
->required(),
Forms\Components\DatePicker::make('birth_date')
->translateLabel()
->required(),
the DatePicker is correctly populated with the date that I have on the database. The second one give the problems:
Grid::make()
->relationship('mainMember')
->schema([
[...]
Forms\Components\DatePicker::make('birth_date')
->translateLabel()
->required(),
Grid::make()
->relationship('mainMember')
->schema([
[...]
Forms\Components\DatePicker::make('birth_date')
->translateLabel()
->required(),
The relation on the model is that one:
public function mainMember(): HasOne
{
return $this->hasOne(Member::class)->where('is_main', 1);
}
public function mainMember(): HasOne
{
return $this->hasOne(Member::class)->where('is_main', 1);
}
If I compare the date on both field (working/no-working, dumping the value on formatStateUsing) i have the exaclty date:
working -> 2020-12-25T00:00:00.000000Z
no working -> 2020-12-25T00:00:00.000000Z
working -> 2020-12-25T00:00:00.000000Z
no working -> 2020-12-25T00:00:00.000000Z
There is some hero that can understand what I wrong? ty
4 replies
FFilament
Created by lbar on 10/30/2024 in #❓┊help
NavigationGroup translate and icons
I'm struggling with the translation of NavigationGroup. Basically what i'm going to do is:
->navigationGroups([
NavigationGroup::make(__('contests.races'))
->icon('heroicon-s-squares-plus')
->collapsed(),
[...]
->navigationGroups([
NavigationGroup::make(__('contests.races'))
->icon('heroicon-s-squares-plus')
->collapsed(),
[...]
and then in the related resource:
[...]
public static function getNavigationGroup(): ?string
{
return __('contests.races');
}
[...]
[...]
public static function getNavigationGroup(): ?string
{
return __('contests.races');
}
[...]
and works. But for I reason that i don't known and that drive me crazy, the ->icon('heroicon-s-squares-plus') is visible only on one translation, and not on the others. It's just me that i wrong something, or is a kind of bug? ty
2 replies
FFilament
Created by lbar on 10/4/2024 in #❓┊help
alignment in panel
No description
3 replies
FFilament
Created by lbar on 10/2/2024 in #❓┊help
extraAttributes add class on Section seems not works
hi! actually i have a form section like this:
Section::make()
->description('Main Contact Referent')
->relationship('user')
->schema([
TextInput::make('firstname')
->label('First Name')
->formatStateUsing(fn($record) => $record->mainMember ? $record->mainMember->firstname : null)
->disabled(),
TextInput::make('lastname')
->label('Last Name')
->formatStateUsing(fn($record) => $record->mainMember ? $record->mainMember->lastname : null)
->disabled(),
TextInput::make('tax_code')
->label('Tax Code')
->disabled(),
])
->collapsed()
->extraAttributes(['class' => 'bg-neutral-950']),
Section::make()
->description('Main Contact Referent')
->relationship('user')
->schema([
TextInput::make('firstname')
->label('First Name')
->formatStateUsing(fn($record) => $record->mainMember ? $record->mainMember->firstname : null)
->disabled(),
TextInput::make('lastname')
->label('Last Name')
->formatStateUsing(fn($record) => $record->mainMember ? $record->mainMember->lastname : null)
->disabled(),
TextInput::make('tax_code')
->label('Tax Code')
->disabled(),
])
->collapsed()
->extraAttributes(['class' => 'bg-neutral-950']),
the class added on the html appear correctly, but nothing change from the rendered html. I basically want change a background for a specific section of this form. Is that a correct approach? ty
8 replies