astronomic
astronomic
FFilament
Created by astronomic on 6/13/2024 in #❓┊help
Filters in table builder, don't search instantly, only if you click outside
Hello everyone, I have an issue where none of the filters search when selecting or typing in the field; they only search if I click somewhere else. Does anyone know why this happens? If I click outside the filter it works, but this error appears in the console: livewire.js?id=07f22875:1123 Alpine Expression Error: Cannot read properties of undefined (reading 'getElementsByClassName')
21 replies
FFilament
Created by astronomic on 5/22/2024 in #❓┊help
When selecting filters in a list of records, the widget does not update
I have an invoice resource and I have added a widget to it to calculate the total of invoices. The widget needs to update according to the filters applied. I have tried this solution: https://filamentphp.com/community/how-to-refresh-widgets-when-table-actions-are-fired, but it still doesn't work. Widget totals not updating. Filament 2 version.
5 replies
FFilament
Created by astronomic on 4/29/2024 in #❓┊help
Doubts with summarize(Count)
I want to put 3 summarize columns in a table with only two columns. How do I do it? I tried to create two empty columns in the table, but only 2 summarize fields appear. My code: return $table ->columns([ Tables\Columns\TextColumn::make('name') ->label('Nombre') ->searchable(), Tables\Columns\TextColumn::make('type') ->label('Tipo') ->summarize( Count::make('uno')->label('Nº total de clientes')->query(fn ($query) => $query), ) ->sortable() ->searchable(), TextColumn::make('') ->label('') ->summarize( Count::make()->label('Nº total de ayuntamientos')->query(fn ($query) => $query->where('type', 0)), ), TextColumn::make('') ->label('') ->summarize( Count::make()->label('Nº total de NO ayuntamientos')->query(fn ($query) => $query->where('type', 1)), ) ])->paginated([25, 35, 50, 100])->defaultSort('name', 'ASC')
21 replies
FFilament
Created by astronomic on 3/22/2024 in #❓┊help
How to put the filter above in a custom dashboard page?
Hello, I have created a dashboard page that replaces the original one. I am customizing it so that a table and filters appear. I want these filters to appear at the top, but if I add the usual (up to version 2) getTableFiltersLayout, it doesn't work. How is it done now in the latest version of filament?
10 replies
FFilament
Created by astronomic on 10/24/2023 in #❓┊help
Pdf stream() doesn't work on submit() custom page
Hello, I have a custom page, where I have a search form, but I want a PDF to open when I click send. But it's not working, I guess it will be done another way, but I don't know which one. I need to open the pdf in another tab and that's it, I don't want to download it directly. Can somebody help me? thanks Submit custom page: public function submit() { $teacher = Employee::find($this->data['professor']); $sessions = $teacher->sessions()->where('course_id', $this->data['course'])->get(); if (!$this->data['course']) { return Notification::make()->duration(12000)->title("Selecciona un/a curs per seguir")->danger()->send(); } if (count($sessions) == 0) { return Notification::make()->duration(12000)->title("No hi ha sessions per generar informe")->danger()->send(); } $pdf = PDF::loadView('pdf.report-hours-kms', ['data' => $sessions,'teacher' => $teacher]); return $pdf->stream(); }
19 replies
FFilament
Created by astronomic on 10/20/2023 in #❓┊help
{!! !!} directive for rich editor field does not work in modal
I try to display a text from a rich editor field, with html, but it doesn't work. Show text without html. Can somebody help me? View: <div class="relative overflow-x-auto filament-tables-table-container"> <h3 class="font-bold text-l">Objectiu: {{ $course->Objective ? $course->Objective->name : '' }}</h3> <div class="mt-4"> <p>{!! $course->Objective->objectives !!}</p> </div> <h3 class="mt-8 font-bold tracking-tight filament-header-heading text-l">Contingut: {{ $course->Content ? $course->Content->name : '' }}</h3> <div class="mt-4"> <p>{!! $course->Content ? $course->Content->contents : '' !!}</p> </div> </div> The modal in page custom: protected function getActions(): array { return [ Actions\ViewAction::make('objectives_contents') ->label('Objectius i continguts') ->color('success') ->action(fn () => $this->course) ->modalContent(fn (): View => view( 'filament.pages.objectives-contents', ['course' => $this->course], )) ->modalActions([]) ->modalHeading('Objectius i continguts del curs'), ]; }
11 replies
FFilament
Created by astronomic on 8/31/2023 in #❓┊help
How can I add a url to the label of a checkbox
I have a form, and I need to add a link to the text of a checkbox field. But I don't know how to do it. With url() it doesn't work, it says it doesn't exist, I guess for checkbox it's something else. Can you help me? thank you
15 replies
FFilament
Created by astronomic on 7/10/2023 in #❓┊help
Error when I use searchable() in wizard step
Hello everyone. I have an error when I want to use a Select with searchable() in a wizard step. Error: Cannot read properties of null (reading 'location'), my code: Wizard\Step::make('form') ->icon('heroicon-o-pencil') ->label('Formulario') ->schema([ Forms\Components\TextInput::make('name') ->label('Nombre') ->required(), Forms\Components\TextInput::make('last_name') ->label('Apellidos') ->required(), Forms\Components\TextInput::make('dni') ->label('DNI') ->required(), Forms\Components\Select::make('location') ->label('Población') ->required() ->options(CpMunicipality::get()->take(20)->pluck('name', 'id')) ->searchable() ->columnSpan(3), Forms\Components\TextInput::make('contact_name') ->label('Nombre persona contacto') ->required(), Forms\Components\TextInput::make('contact_last_name') ->label('Apellido persona contacto') ->required(), Forms\Components\TextInput::make('email') ->label('Email') ->required(), Forms\Components\TextInput::make('phone') ->label('Teléfono') ->required(), ]), If I remove searchable(), the error goes away. Can anybody help me? I am doing something wrong? Thank you
13 replies
FFilament
Created by astronomic on 6/29/2023 in #❓┊help
How can I create a virtual column with a name field from another table
I need to create a virtual column (or something similar) that concatenates the name of the product (products table) with the color of the product variant (product_variants table). The virtual column would be in the variant table. Is there any way to do it?
9 replies
FFilament
Created by astronomic on 6/27/2023 in #❓┊help
How to know the mime and the originalName of a file with a FileUpload
Hi, How can I know the mime and the originalName of a file with a FileUpload? It is a bulkaction that calls a modal with a form, and I want to send the file by mail. I leave my code: ->form([ Forms\Components\TextInput::make('asunto')->required(), RichEditor::make('cuerpo')->required(), Forms\Components\FileUpload::make('attachments') ->label('Adjunto') ->acceptedFileTypes(['application/pdf','application/msword', 'image/jpg', 'image/png']) ->multiple() ->getUploadedFileNameForStorageUsing(function (TemporaryUploadedFile $file): string { return (string) str($file->getClientOriginalName())->prepend('file-'); }) ->disk('private') ->directory(function () {return 'emails-alumnos/'.now()->format('d-m-Y');}) ])->requiresConfirmation(),
6 replies
FFilament
Created by astronomic on 5/29/2023 in #❓┊help
How can I sort a table on a custom page?
Hi, How can I sort a table on a custom page? I want the arrows to come out in the table, so that the user can sort by the column of their choice. How can I do it?
23 replies
FFilament
Created by astronomic on 5/26/2023 in #❓┊help
How can I put an Select or TextInput in red when something happens?
I need that if the user chooses a client, for example, from a select, verify if that client has a bank account, if not, the input or select has to come out in red with a text informing that the bank account is missing. Is that possible?
14 replies