Gerald Afable
Gerald Afable
FFilament
Created by Gerald Afable on 7/1/2024 in #❓┊help
Create Page: How to re-render component after mount and filled values from url params .
I just oeveriiding the fillForm method to populate the fields
11 replies
FFilament
Created by Gerald Afable on 7/1/2024 in #❓┊help
Create Page: How to re-render component after mount and filled values from url params .
In my create form page, I have this field like if the category value is "X" show other fields, but when fill the input with value "X" the other fields are not showing. Do I need to dispatch an event in order to rerender the form?
11 replies
FFilament
Created by Gerald Afable on 7/1/2024 in #❓┊help
Create Page: How to re-render component after mount and filled values from url params .
I filling it like this
#[Url]
public ?string $order_id = '';

#[Url]
public ?string $product_id = '';

#[Url]
public ?string $component_product = '';

protected function fillForm(): void
{
$this->callHook('beforeFill');

$order = Order::find($this->order_id);

$this->form->fill([
'order_id' => $order?->id,
'category' => $order?->category,
'product_id' => $this->product_id,
'component_product_id' => $this->component_product
]);

$this->callHook('afterFill');
}
#[Url]
public ?string $order_id = '';

#[Url]
public ?string $product_id = '';

#[Url]
public ?string $component_product = '';

protected function fillForm(): void
{
$this->callHook('beforeFill');

$order = Order::find($this->order_id);

$this->form->fill([
'order_id' => $order?->id,
'category' => $order?->category,
'product_id' => $this->product_id,
'component_product_id' => $this->component_product
]);

$this->callHook('afterFill');
}
It does the same thing, It populated the inputs but not re render.
11 replies
FFilament
Created by Gerald Afable on 7/1/2024 in #❓┊help
Create Page: How to re-render component after mount and filled values from url params .
No I am using the laravel request() to get the params value.
11 replies
FFilament
Created by Gerald Afable on 7/1/2024 in #❓┊help
Create Page: How to re-render component after mount and filled values from url params .
Filament resource in the create page
11 replies
FFilament
Created by Gerald Afable on 6/14/2024 in #❓┊help
How to display tables with actions inside infolist builder ?
Hi @Leandro Ferreira here is repo you request https://github.com/agcodex01/table-entry where you can review the code. Thanks 🙂
18 replies
FFilament
Created by Gerald Afable on 6/14/2024 in #❓┊help
How to display tables with actions inside infolist builder ?
yep yep will do,
18 replies
FFilament
Created by Gerald Afable on 6/14/2024 in #❓┊help
How to display tables with actions inside infolist builder ?
when action is click it calling again the table(Table $table) function, but my livewire properties reset to default values,
18 replies
FFilament
Created by Gerald Afable on 6/14/2024 in #❓┊help
How to display tables with actions inside infolist builder ?
yes yes, when I try to dump the query before the table is return it become null,
18 replies
FFilament
Created by Gerald Afable on 6/14/2024 in #❓┊help
How to display tables with actions inside infolist builder ?
No description
18 replies
FFilament
Created by Gerald Afable on 6/14/2024 in #❓┊help
How to display tables with actions inside infolist builder ?
No description
18 replies
FFilament
Created by Gerald Afable on 6/14/2024 in #❓┊help
How to display tables with actions inside infolist builder ?
yeap, my only problem is the action
18 replies
FFilament
Created by Gerald Afable on 6/14/2024 in #❓┊help
How to display tables with actions inside infolist builder ?
I am making the TableEntry Dynamic like not specific to every model, so I can reuse it in different pages,
18 replies
FFilament
Created by Gerald Afable on 6/14/2024 in #❓┊help
How to display tables with actions inside infolist builder ?
this is how I use it in infolist builder
Livewire::make(TableEntry::class, function ($state) {
$product = $state;
return [
'heading' => 'Components',
'columns' => [
Tables\Columns\TextColumn::make('component.name')->label('Name'),
Tables\Columns\TextColumn::make('board.code')->label('Board'),
Tables\Columns\TextColumn::make('qty_per_set')->label('Qty/Set')
->formatStateUsing(fn ($state) => $state * $product->qty),
],
'query' => ComponentProduct::query(),
'actions' => [
Tables\Actions\Action::make('jo')
->label('Create JO')
->button()
],
'modifyQueryUsing' => fn (Builder $query) => $query->whereBelongsTo($state->product)
];
})
Livewire::make(TableEntry::class, function ($state) {
$product = $state;
return [
'heading' => 'Components',
'columns' => [
Tables\Columns\TextColumn::make('component.name')->label('Name'),
Tables\Columns\TextColumn::make('board.code')->label('Board'),
Tables\Columns\TextColumn::make('qty_per_set')->label('Qty/Set')
->formatStateUsing(fn ($state) => $state * $product->qty),
],
'query' => ComponentProduct::query(),
'actions' => [
Tables\Actions\Action::make('jo')
->label('Create JO')
->button()
],
'modifyQueryUsing' => fn (Builder $query) => $query->whereBelongsTo($state->product)
];
})
18 replies
FFilament
Created by Gerald Afable on 6/14/2024 in #❓┊help
How to display tables with actions inside infolist builder ?
Here for my livewire component.
class TableEntry extends Component implements HasTable, HasForms
{
use InteractsWithForms;
use InteractsWithTable;

protected $columns = [];

protected Builder | Closure | null $query = null;
protected Closure | null $modifyQueryUsing = null;
public ?string $heading;

protected $actions = [];


public function mount(
array $columns = [],
array $actions = [],
Builder | Closure | null $query = null,
Closure | null $modifyQueryUsing,
) {
$this->columns = $columns;
$this->actions = $actions;
$this->query = $query;
$this->modifyQueryUsing = $modifyQueryUsing;
}

public function render()
{
return view('livewire.table-entry');
}

// getters
public function table(Table $table): Table
{
$table
->heading($this->heading)
->query($this->getQuery())
->columns($this->getColumns())
->actions($this->getActions());

if ($this->modifyQueryUsing) {
$table->modifyQueryUsing($this->modifyQueryUsing);
}

return $table->paginated(false);
}
}
class TableEntry extends Component implements HasTable, HasForms
{
use InteractsWithForms;
use InteractsWithTable;

protected $columns = [];

protected Builder | Closure | null $query = null;
protected Closure | null $modifyQueryUsing = null;
public ?string $heading;

protected $actions = [];


public function mount(
array $columns = [],
array $actions = [],
Builder | Closure | null $query = null,
Closure | null $modifyQueryUsing,
) {
$this->columns = $columns;
$this->actions = $actions;
$this->query = $query;
$this->modifyQueryUsing = $modifyQueryUsing;
}

public function render()
{
return view('livewire.table-entry');
}

// getters
public function table(Table $table): Table
{
$table
->heading($this->heading)
->query($this->getQuery())
->columns($this->getColumns())
->actions($this->getActions());

if ($this->modifyQueryUsing) {
$table->modifyQueryUsing($this->modifyQueryUsing);
}

return $table->paginated(false);
}
}
18 replies