neverender24
neverender24
FFilament
Created by neverender24 on 12/20/2023 in #❓┊help
Placeholder badge color not working
I have made a badge which color is based on the condition. My problem is the class color is not reflected EXCEPT for gray color. Yellow and green does not reflect. Although I checked it in browser dev view the class (e.g bg-yellow-100) is there but the actual style is not applied.
Placeholder::make('Status')->content(function ($record){
$color = match ($record->status) {
'pending' => 'gray',
'delivered' => 'yellow',
'completed' => 'green',
};

$string = '<span class="inline-flex items-center gap-x-1.5 rounded-md bg-'.$color.'-100 px-2 py-1 text-xs font-medium text-'.$color.'-600">
<svg class="h-1.5 w-1.5 fill-'.$color.'-400" viewBox="0 0 6 6" aria-hidden="true"><circle cx="3" cy="3" r="3" />
</svg>'.$record->status.'</span>';

return new HtmlString($string);
})
Placeholder::make('Status')->content(function ($record){
$color = match ($record->status) {
'pending' => 'gray',
'delivered' => 'yellow',
'completed' => 'green',
};

$string = '<span class="inline-flex items-center gap-x-1.5 rounded-md bg-'.$color.'-100 px-2 py-1 text-xs font-medium text-'.$color.'-600">
<svg class="h-1.5 w-1.5 fill-'.$color.'-400" viewBox="0 0 6 6" aria-hidden="true"><circle cx="3" cy="3" r="3" />
</svg>'.$record->status.'</span>';

return new HtmlString($string);
})
7 replies
FFilament
Created by neverender24 on 11/14/2023 in #❓┊help
How to access $record in RelationManager inside Repeater Select
What I am trying to do: I have a RelationManager and I want to access $record inside getSearchResultsUsing() which is in a repeater, I do this for additional query filter in the select search My issue/the error: $record always return null, inside the repeater, the $record outside it seem to do fine. Code:
Action::make('Serve')
->form([
Section::make('')->schema([
Placeholder::make('Type')
->content(fn (Model $record): string => $record->bloodType->description),
Placeholder::make('Component')
->content(fn (Model $record): string => $record->bloodComponent->description),
Placeholder::make('Quantity')
->content(fn (Model $record): string => $record->qty),
])
->columns(3),
Repeater::make('order')
->relationship('dispositions')
->simple(
Select::make('disposition')
->searchable()
->getSearchResultsUsing(function ($record, string $search) {

dd($record); //ALWAYS NULL

}
)
->getOptionLabelUsing(fn ($value): ?string => Disposition::find($value)?->serial),
)
->columns(2)
]),
Action::make('Serve')
->form([
Section::make('')->schema([
Placeholder::make('Type')
->content(fn (Model $record): string => $record->bloodType->description),
Placeholder::make('Component')
->content(fn (Model $record): string => $record->bloodComponent->description),
Placeholder::make('Quantity')
->content(fn (Model $record): string => $record->qty),
])
->columns(3),
Repeater::make('order')
->relationship('dispositions')
->simple(
Select::make('disposition')
->searchable()
->getSearchResultsUsing(function ($record, string $search) {

dd($record); //ALWAYS NULL

}
)
->getOptionLabelUsing(fn ($value): ?string => Disposition::find($value)?->serial),
)
->columns(2)
]),
3 replies
FFilament
Created by neverender24 on 10/19/2023 in #❓┊help
Disable bulk action only limit to the paginated page
No description
3 replies
FFilament
Created by neverender24 on 9/13/2023 in #❓┊help
How to retain sidebar scroll position if there are many menu items.
I have navigation that has many items, it has scrollbar in nav. But if I click the bottom items, the position of the scroll goes back to the top. I have ->spa() enabled also.
3 replies
FFilament
Created by neverender24 on 8/23/2023 in #❓┊help
Dependent select searchable
I can't seem to make this work. The second selection doesn't seem to populate. If I use the options ()instead of getSearchResultsUsing() and getOptionLabelUsing() Without searchable(), the second selection populates but doesn't clear it. But I want both of the selects is searchable.
Select::make('drawer_id')
->searchable()

// ->options(Drawer::query()->pluck('name', 'id'))
// ->afterStateUpdated(fn (Set $set) => $set('folder_id', []))

->getSearchResultsUsing(fn (string $search): array => Drawer::query()->pluck('name', 'id')->toArray())
->getOptionLabelUsing(fn ($value): ?string => Drawer::find($value)?->name)

->reactive(),

Select::make('folder_id')
>searchable()
->getSearchResultsUsing(fn (Get $get): array => Folder::where('drawer_id', $get('drawer_id'))->limit(50)->pluck('name', 'id')->toArray())
->getOptionLabelUsing(fn ($value): ?string => Drawer::find($value)?->name),
Select::make('drawer_id')
->searchable()

// ->options(Drawer::query()->pluck('name', 'id'))
// ->afterStateUpdated(fn (Set $set) => $set('folder_id', []))

->getSearchResultsUsing(fn (string $search): array => Drawer::query()->pluck('name', 'id')->toArray())
->getOptionLabelUsing(fn ($value): ?string => Drawer::find($value)?->name)

->reactive(),

Select::make('folder_id')
>searchable()
->getSearchResultsUsing(fn (Get $get): array => Folder::where('drawer_id', $get('drawer_id'))->limit(50)->pluck('name', 'id')->toArray())
->getOptionLabelUsing(fn ($value): ?string => Drawer::find($value)?->name),
17 replies
FFilament
Created by neverender24 on 8/10/2023 in #❓┊help
TextInput afterStateUpdated() reactive weird behavior
I have copied a well-functional code from my V2 app. But I have this weird behavior in V3 The text goes back and forth. The code works really well in V2. I have tested it also in a freshly installed Laravel and Filament V3.
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name')->reactive()
->afterStateUpdated(function ($set, $state) {
$set('slug', Str::slug($state));
}),
Forms\Components\TextInput::make('slug')->required()->disabled(),
]);
}
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name')->reactive()
->afterStateUpdated(function ($set, $state) {
$set('slug', Str::slug($state));
}),
Forms\Components\TextInput::make('slug')->required()->disabled(),
]);
}
41 replies
FFilament
Created by neverender24 on 8/10/2023 in #❓┊help
Select box is flickering when loading/refreshing the page
The select box is flickering just like in the video. How to fix it?
6 replies
FFilament
Created by neverender24 on 8/2/2023 in #❓┊help
Call to a member function getId() on null
I have this error "Call to a member function getId() on null" when converting from v2 to v3 In AdminPanelProvider.php
->userMenuItems([
MenuItem::make()
->label('Change Password')
->url(UserResource::getUrl('changePassword')) // <-error
->icon('heroicon-s-cog'),
])
->userMenuItems([
MenuItem::make()
->label('Change Password')
->url(UserResource::getUrl('changePassword')) // <-error
->icon('heroicon-s-cog'),
])
In UserResource
public static function getPages(): array
{
return [
'index' => Pages\ListUsers::route('/'),
'create' => Pages\CreateUser::route('/create'),
'edit' => Pages\EditUser::route('/{record}/edit'),
'changePassword' => Pages\ChangePassword::route('/change-password'),
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListUsers::route('/'),
'create' => Pages\CreateUser::route('/create'),
'edit' => Pages\EditUser::route('/{record}/edit'),
'changePassword' => Pages\ChangePassword::route('/change-password'),
];
}
12 replies
FFilament
Created by neverender24 on 8/2/2023 in #❓┊help
Automatic upgrade from v2 to v3 problem
25 replies
FFilament
Created by neverender24 on 8/1/2023 in #❓┊help
How to create custom page
No description
32 replies
FFilament
Created by neverender24 on 7/31/2023 in #❓┊help
Custom filament page route for change password
I created a custom filament page using this https://filamentphp.com/docs/2.x/admin/resources/custom-pages And added to appserviceprovider boot. I call the Resource URL with the following. I also added the page in the resource getPages(). use Filament\Facades\Filament; use Filament\Navigation\UserMenuItem; Filament::serving(function () { Filament::registerUserMenuItems([ UserMenuItem::make() ->label('Change Password') ->url(UserResource::getUrl('changePassword')) ->icon('heroicon-s-cog'), ]); }); I get error Route [filament.resources.users.changePassword] not defined. How do I register the route?
8 replies
FFilament
Created by neverender24 on 7/31/2023 in #❓┊help
How to call create from a resource into a modal?
4 replies