zander9255
zander9255
FFilament
Created by zander9255 on 11/13/2024 in #❓┊help
Remove All Filters button
Hi Guys, I have my table filters set up with a couple of toggle buttons, these contain basic options such as "This Month", "Year to Date", "Last Year", and "All dates" My problem comes in when the user clicks the "Remove All Filters" button at the top of the table. (It renders with a little x button in the top right once there are indicators present for the filters) I have the "All Dates" toggle set up with ->default() and this works on first load. But it's not selected after pressing remove all filters? I realise that this is probably intended behaviour, but is there a way for me to hide this button? Or programatically toggle this filter option after the button is pressed? I already have this indicator set the not be removeable:
->indicateUsing(function (array $data): Indicator {

if (empty($data['note_date_from']) && empty($data['note_date_until'])) {
return Indicator::make('Showing All Dates')->removable(false);
}

return Indicator::make(
'Created from ' . Carbon::parse($data['note_date_from'])->toFormattedDateString() .
' to ' . Carbon::parse($data['note_date_until'])->toFormattedDateString()
)->removable(false);

})
->indicateUsing(function (array $data): Indicator {

if (empty($data['note_date_from']) && empty($data['note_date_until'])) {
return Indicator::make('Showing All Dates')->removable(false);
}

return Indicator::make(
'Created from ' . Carbon::parse($data['note_date_from'])->toFormattedDateString() .
' to ' . Carbon::parse($data['note_date_until'])->toFormattedDateString()
)->removable(false);

})
Thanks in advance
2 replies
FFilament
Created by zander9255 on 8/20/2024 in #❓┊help
Repeater Component only showing one record despite HasMany relationship
No description
2 replies
FFilament
Created by zander9255 on 6/7/2024 in #❓┊help
Infolist ImageEntry question
Hi Guys, I am able to save the file to the local disc in my create form:
FileUpload::make('attachments')
->columnSpanFull()
->label('POD Image')
//->disk('public')
FileUpload::make('attachments')
->columnSpanFull()
->label('POD Image')
//->disk('public')
And I can see the uploaded file in this folder: /storage/app/public/ and this is working well. However, I have a question regarding the infolist ImageEntry which I want to use to display said image. According to the docs: The entry must contain the path to the image, relative to the root directory of its storage disk, or an absolute URL to it. So in order to test this, I have ensured that there are 2 images in the public disc: sushi.jpg and test.jpg I have tried the following ways to display an image:
ImageEntry::make('https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRy1FCk4ILwKxcNzcvjHpj0lqPVfuUCGKeg2w&s')
->label('POD Images6')
->height(500)
->width(500),

ImageEntry::make('test')
->label('POD Image 7')
->height(500)
->width(500),

ImageEntry::make('test.jpg')
->label('POD Image 8')
->height(500)
->width(500),

ImageEntry::make('sushi')
->label('POD Image 9')
->disk('public')
->height(500)
->width(500),

ImageEntry::make('sushi.jpg')
->label('POD Image 10')
->disk('public')
->height(500)
->width(500),
ImageEntry::make('https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRy1FCk4ILwKxcNzcvjHpj0lqPVfuUCGKeg2w&s')
->label('POD Images6')
->height(500)
->width(500),

ImageEntry::make('test')
->label('POD Image 7')
->height(500)
->width(500),

ImageEntry::make('test.jpg')
->label('POD Image 8')
->height(500)
->width(500),

ImageEntry::make('sushi')
->label('POD Image 9')
->disk('public')
->height(500)
->width(500),

ImageEntry::make('sushi.jpg')
->label('POD Image 10')
->disk('public')
->height(500)
->width(500),
I can understand if the formatting is wrong for the rest of these configs, but surely the absolute path ImageEntry should work? I cannot see any relevant information in the laravel log either, anyone have any idea what I am doing wrong here? Thanks in advance
6 replies
FFilament
Created by zander9255 on 5/27/2024 in #❓┊help
Layout Question
Hi Guys I would appreciate any assistance with this layout issue I am having. I have a table that I am making mobile friendly. I was able to do this quite well with a combination of splits and stacks, and I can use the >visibleFrom() and ->hiddenFrom() to hide/display certain stacks when using tablets etc. to only show the most important info on mobile However I would still like the ability to show a normal table with headers etc if the user is on a size xl/2xl screen. It seems that as soon as there is a Stack in the columns, it automatically hides the header, and just displays the row content. Maybe for other users/applications its immediately obvious what the piece of info is, but in my case I might display 3 different date and times, and the user cant really determine which one is which, and a table header solves this. Is there any way to be able to switch between layouts when there is some button trigger? return $table ->query(PodResource::getEloquentQuery() ->myAgent(Auth::user()->getAgentAccnum()) )
->defaultSort('PODDATE', 'desc') ->columns( //$normalTable $tableSplit ) ->filters($filters, layout: FiltersLayout::AboveContentCollapsible) ->actions([ Tables\Actions\EditAction::make(), Tables\Actions\ViewAction::make(), ], position: ActionsPosition::AfterColumns) ->bulkActions([ ExportBulkAction::make(), Tables\Actions\BulkActionGroup::make([ ]), ]); I have tried this on the column in the table format: ->extraAttributes(['class' => 'hidden lg:table-cell']) But sadly this only hides the value, and the header still shows.
5 replies
FFilament
Created by zander9255 on 4/25/2024 in #❓┊help
Select box key-value pair
Hi guys! I have a selectbox component in my form. I would like to do some processing on the form once this field has been selected. I am currently tying into the afterStateUpdated function, and I do get the selectbox selection "ID" but I would like to also get the Label being displayed. Currently the $state variable only returns the "ID" Is there an easier way of getting this label, without doing another database search? Unfortunately, I can't search a declared variable of options here, since this changes depending on another input higher up in the form. $origpersField = Forms\Components\Select::make('ORIGPERS') ->label('From') ->columnSpan($defColSpan) ->live() ->afterStateUpdated(function ($state, Forms\Set $set, Forms\Get $get) { echo 'after Updated'; var_dump($state); // returns key var_dump($get('ORIGPERS')); // returns key
8 replies
FFilament
Created by zander9255 on 4/24/2024 in #❓┊help
Text input for selectbox
Hi there! I am still relatively new to Filament, but loving it so far! I do have a question regarding record creation within a form. I am rewriting a form in filament, and I am using a select dropdown to populate an address field. Now in our old application, you would be able to enter text directly in the selectbox, and it would try find that address, otherwise it would add a new address record based on the text entered in the selectbox. Now by the looks of it, it does not seem like you can enter text directly in filament Select components(unless I am missing something from the docs?) So my alternative would be to add a add button next the dropdown, and once the user clicks on it, it opens the Address creation modal. So my question is: Can I change the selectboxto accept text? And if not, how can I open that modal, so that the user can add and save their new address. Or maybe there is a better way of doing it? This is my Select field: $origpersField = Forms\Components\Select::make('ORIGPERS') ->label('From') ->columnSpan($defColSpan) ->options(function (Get $get) { // Retrieve the selected customer's value $selectedCustomer = $get('CUSTOMER'); // If a customer is selected, use their value to filter addresses if ($selectedCustomer) { return Addresses::where('ACCNUM', '=', $selectedCustomer)->pluck('NAME', 'PLACE')->toArray(); } // If no customer is selected, return an empty array or default options return Addresses::pluck('NAME', 'PLACE')->toArray(); }) ->required(); Thanks in advance
5 replies
FFilament
Created by zander9255 on 3/20/2024 in #❓┊help
Filament Table Filters
Hi Guys, First off, I am pretty new to Filament, absolutely loving it so far. This might be very easy, I just dont know the solution. I have a couple of filters on my table: ->filters([ Filter::make('Your Account') ->query(fn (Builder $query): Builder => $query->where('AGENT', Auth::user()->getAgentAccnum())) ->checkbox() ->default(), The filter works well, But I would like the filter to be applied permanently. And the User should not be able to remove the filter. I have tried the ->hidden() approach at the end of the filter, but this seems to not apply the filter, and just hides it. I have tried to add the where clause in getEloquentQuery() function. And that does apply it, but it then messes with my column's sorting functionality. Is there a way to prevent the filter from being de-selected? Or is there a better place to filter the initial results?
7 replies