SOIX
SOIX
FFilament
Created by SOIX on 11/9/2024 in #❓┊help
Using infolist actions inside livewire component
Hello, i have an issue when trying to use infolist actions inside livewire component:
<?php

namespace App\Livewire;

use Filament\Forms\Components\TextInput;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Infolists\Components\Actions\Action;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Concerns\InteractsWithInfolists;
use Filament\Infolists\Contracts\HasInfolists;
use Filament\Infolists\Infolist;
use Filament\Pages\Concerns\InteractsWithFormActions;
use Livewire\Component;

class Custom extends Component implements HasForms, HasInfolists
{
use InteractsWithInfolists;
use InteractsWithForms;
use InteractsWithFormActions;

public function render()
{
return view('livewire.custom');
}

public function infolist(Infolist $infolist): Infolist
{
return $infolist->schema([
Section::make('test')
->headerActions([
Action::make('test2')
->form([
TextInput::make('test3')
])
->action(fn ($data) => dump($data))
])
]);
}
}
<?php

namespace App\Livewire;

use Filament\Forms\Components\TextInput;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Infolists\Components\Actions\Action;
use Filament\Infolists\Components\Section;
use Filament\Infolists\Concerns\InteractsWithInfolists;
use Filament\Infolists\Contracts\HasInfolists;
use Filament\Infolists\Infolist;
use Filament\Pages\Concerns\InteractsWithFormActions;
use Livewire\Component;

class Custom extends Component implements HasForms, HasInfolists
{
use InteractsWithInfolists;
use InteractsWithForms;
use InteractsWithFormActions;

public function render()
{
return view('livewire.custom');
}

public function infolist(Infolist $infolist): Infolist
{
return $infolist->schema([
Section::make('test')
->headerActions([
Action::make('test2')
->form([
TextInput::make('test3')
])
->action(fn ($data) => dump($data))
])
]);
}
}
When I do this I get: Uncaught Component not found: 2qC986qfFCNK6TbSNG8M In console. Any specific trait for actions inside infolist?
4 replies
FFilament
Created by SOIX on 10/16/2024 in #❓┊help
Share state between nested modal
Hello, is it possible to share state between nested modals, my solution almost works but when i try to re-open child modal I cannot get parent one values to set as default:
Forms\Components\Section::make('Heading')
->collapsible()
->schema([
Forms\Components\Hidden::make('heading.color'), // sadly I need to have this, otherwise $set('heading.color', $data['color']); would be inside child modal only
Forms\Components\TextInput::make("heading.text")
->hiddenLabel()
->required()
->columnSpan(5),

Forms\Components\Actions::make([
Forms\Components\Actions\Action::make('settings')
->form([
Forms\Components\ColorPicker::make('color')
->default(fn (Get $get) => $get('heading.color')),
])
->action(function (Set $set, Get $get, $data) {
$set('heading.color', $data['color']);
})
])
->columnSpan(1)

])->columns(6),
Forms\Components\Section::make('Heading')
->collapsible()
->schema([
Forms\Components\Hidden::make('heading.color'), // sadly I need to have this, otherwise $set('heading.color', $data['color']); would be inside child modal only
Forms\Components\TextInput::make("heading.text")
->hiddenLabel()
->required()
->columnSpan(5),

Forms\Components\Actions::make([
Forms\Components\Actions\Action::make('settings')
->form([
Forms\Components\ColorPicker::make('color')
->default(fn (Get $get) => $get('heading.color')),
])
->action(function (Set $set, Get $get, $data) {
$set('heading.color', $data['color']);
})
])
->columnSpan(1)

])->columns(6),
5 replies
FFilament
Created by SOIX on 10/8/2024 in #❓┊help
Form doesnt work with builder blocks and blockPreviews
No description
1 replies
FFilament
Created by SOIX on 10/7/2024 in #❓┊help
default value on dynamically added form fields
Forms\Components\Group::make(
function (Get $get) {
$collection = $get('component.collection') ?? [];

return collect($collection)
->filter(function ($componentClass) {
// Ensure the component class is valid
return class_exists($componentClass);
})
->map(function ($componentClass, $key) {
// Dynamically resolve the component class and return its schema
return Forms\Components\Section::make($componentClass::$title)
->collapsible()
->schema($componentClass::getSchema($key)); // Show only if it's the current component
})
->toArray(); // Ensure it's an array of components
}
)->live()
Forms\Components\Group::make(
function (Get $get) {
$collection = $get('component.collection') ?? [];

return collect($collection)
->filter(function ($componentClass) {
// Ensure the component class is valid
return class_exists($componentClass);
})
->map(function ($componentClass, $key) {
// Dynamically resolve the component class and return its schema
return Forms\Components\Section::make($componentClass::$title)
->collapsible()
->schema($componentClass::getSchema($key)); // Show only if it's the current component
})
->toArray(); // Ensure it's an array of components
}
)->live()
And one of component classes have:
public static function getSchema (string $key): array
{
return [
Forms\Components\TextInput::make($key . '.title')
->default('Some default text')
->required()
];
}
public static function getSchema (string $key): array
{
return [
Forms\Components\TextInput::make($key . '.title')
->default('Some default text')
->required()
];
}
Some default text is not appearing.. Anyone know why? Thanks
3 replies
FFilament
Created by SOIX on 2/20/2024 in #❓┊help
Table interact with filtersForm
No description
3 replies
FFilament
Created by SOIX on 2/18/2024 in #❓┊help
Register chart controller
How can we register new chart controller on existing filament chart object?
import { ChoroplethController } from 'chartjs-chart-geo';

// Register the controller
Chart.register(ChoroplethController);
import { ChoroplethController } from 'chartjs-chart-geo';

// Register the controller
Chart.register(ChoroplethController);
11 replies
FFilament
Created by SOIX on 2/6/2024 in #❓┊help
Drag n Drop From Modal
Is it possible to drap n drop elements from modal into content or does it need to be a custom page? 😄
1 replies
FFilament
Created by SOIX on 1/16/2024 in #❓┊help
Is there a way to override vendor/filament/filament/routes/web.php?
Is there a way to override vendor/filament/filament/routes/web.php?
1 replies
FFilament
Created by SOIX on 1/15/2024 in #❓┊help
Update tabs count from filters
Is it possible to catch table query after applying filters and use it in tabs badge?
->badge($query->count())
->badge($query->count())
Something like $this->getTableQuery() || $this->getFilteredTableQuery() but getFilteredTableQuery returns cannot be accessed before init and getTableQuery doesn't have filters/tab filters.. On $this->getTable()->getQuery() I get nginx timeout error
2 replies