kennyhorna
kennyhorna
FFilament
Created by kennyhorna on 9/20/2024 in #❓┊help
Conditionally displaying delete action in a Repeater based on row
Thanks everyone for their help though 👌🏽. Have a nice weekend 😎
11 replies
FFilament
Created by kennyhorna on 9/20/2024 in #❓┊help
Conditionally displaying delete action in a Repeater based on row
No description
11 replies
FFilament
Created by kennyhorna on 9/20/2024 in #❓┊help
Conditionally displaying delete action in a Repeater based on row
Hi 👋 But this doesn't answer how to inject the element in the closure, that's the problem for me
11 replies
FFilament
Created by kennyhorna on 8/11/2024 in #❓┊help
How to re-render/refresh the parent form after a new entry of a RelationManager has been created?
Sorry, I went into meetings and I forgot about this. But I found this https://github.com/filamentphp/filament/discussions/7221#discussioncomment-6551399
18 replies
FFilament
Created by kennyhorna on 8/11/2024 in #❓┊help
How to re-render/refresh the parent form after a new entry of a RelationManager has been created?
Because if that is in another side and you expect this to update another page (in another tab for example) then you will need to broadcast notifications instead https://filamentphp.com/docs/3.x/notifications/broadcast-notifications
18 replies
FFilament
Created by kennyhorna on 8/11/2024 in #❓┊help
How to re-render/refresh the parent form after a new entry of a RelationManager has been created?
@slakkie Is that filament page that you mention loaded when you trigger the event? I mean, is that view rendered on that screen?
18 replies
FFilament
Created by kennyhorna on 8/11/2024 in #❓┊help
How to re-render/refresh the parent form after a new entry of a RelationManager has been created?
Try adding a dd('reached!); inside the method of the listener (refreshBadgeCount()). Just to double check if it's going inside. Another thing that I noticed is that you have two methods listening to the event. This is not wrong though but I think that the getNavigationBadge() should be called after the other one, right? If so, then I think you should call it afterwards or inside it. But that's just a comment
18 replies
FFilament
Created by kennyhorna on 8/11/2024 in #❓┊help
How to re-render/refresh the parent form after a new entry of a RelationManager has been created?
Is it a typo or the reason why the event is not listened given that you are dispatching 'updated_cart' -> but listening to 'cart-updated'? (check the #[On('...')])
18 replies
FFilament
Created by kennyhorna on 8/26/2024 in #❓┊help
Problem when saving a record in a form that contains a table (custom filament Livewire component)
Not perfect, but I it works I guess 🙂
6 replies
FFilament
Created by kennyhorna on 8/26/2024 in #❓┊help
Problem when saving a record in a form that contains a table (custom filament Livewire component)
Ok I fixed the problem like this: - I created a view page for the resource. - The custom filament component (the table view) is only visible in the view page - During edition I have the component hidden -> this makes the form to be stored again.
6 replies
FFilament
Created by kennyhorna on 8/26/2024 in #❓┊help
Problem when saving a record in a form that contains a table (custom filament Livewire component)
Anybody? 👀
6 replies
FFilament
Created by kennyhorna on 8/26/2024 in #❓┊help
Problem when saving a record in a form that contains a table (custom filament Livewire component)
The problem The problem is when you want to save (after an edit) on the big SaleTrackingResource. It just doesn't work or trigger anything. If I comment out that code, then it works again. I think the problem is that some events are being registered when the custom component is added that makes the main one to be ignored. I inspected it with the browser and it doesn't trigger anything. Have you experience that and know how to solve it? Thanks in advance.
6 replies
FFilament
Created by kennyhorna on 8/11/2024 in #❓┊help
How to re-render/refresh the parent form after a new entry of a RelationManager has been created?
@bardolf_6969 What I ended up doing was a full refresh. Let me share you the details. 1. Event dispatch from RelationsManager/SectionsRelationManager.php:
// ...
->headerActions([
Tables\Actions\CreateAction::make()
->after(fn () => $this->dispatch('sections-modified')),
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make()
->after(fn () => $this->dispatch('sections-modified')),
])
// ...
// ...
->headerActions([
Tables\Actions\CreateAction::make()
->after(fn () => $this->dispatch('sections-modified')),
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make()
->after(fn () => $this->dispatch('sections-modified')),
])
// ...
2. Set up listener on list page PriceListResource/Pages/EditPriceList.php
use Livewire\Attributes\On;

// ...

#[On('section-modified')]
public function refreshForm(): void
{
/** @var PriceList $record */
$record = $this->record;
$this->redirect(self::getUrl([
'record' => $record->id,
'tab' => 'sections',
]));
}
use Livewire\Attributes\On;

// ...

#[On('section-modified')]
public function refreshForm(): void
{
/** @var PriceList $record */
$record = $this->record;
$this->redirect(self::getUrl([
'record' => $record->id,
'tab' => 'sections',
]));
}
So, it pretty much does a redirect to the same page. Ps: The additional parameter that I pass in there is the tab. This is a query param to set the active tab of the tabs component. Since I'm interested in the tab called "sections", I will check if there is the query param in the url to set it dynamically, because by default it will open the first tab only, even if you refresh the page with another one active. If you want to know how this works, then you can do this (in the resource): PriceListResource:
public static function form(Form $form): Form
{
return $form
->schema([
Tabs::make('tabs')
->schema([/** ... */])
->activeTab(fn () => request('tab') === 'sections' ? 2 : 1), // <-- my tab nº 2 is the "sections" one.
]);
}
public static function form(Form $form): Form
{
return $form
->schema([
Tabs::make('tabs')
->schema([/** ... */])
->activeTab(fn () => request('tab') === 'sections' ? 2 : 1), // <-- my tab nº 2 is the "sections" one.
]);
}
I hope this helps you.
18 replies
FFilament
Created by kennyhorna on 7/29/2024 in #❓┊help
Customize "create :resource" button label
Anyway, thank you @TheRealTeeHill 😃 Have a nice day
19 replies
FFilament
Created by kennyhorna on 7/29/2024 in #❓┊help
Customize "create :resource" button label
So, it didn't work before cause the method was already defined (I generated the resource with Laravel idea.
19 replies
FFilament
Created by kennyhorna on 7/29/2024 in #❓┊help
Customize "create :resource" button label
Ah my bad
19 replies
FFilament
Created by kennyhorna on 7/29/2024 in #❓┊help
Customize "create :resource" button label
@TheRealTeeHill that's what I did but it doesn't work (see the snippet in the question)
19 replies
FFilament
Created by kennyhorna on 7/29/2024 in #❓┊help
Customize "create :resource" button label
yes
19 replies
FFilament
Created by kennyhorna on 7/29/2024 in #❓┊help
Customize "create :resource" button label
No, just the create button label text
19 replies
FFilament
Created by kennyhorna on 7/29/2024 in #❓┊help
Customize "create :resource" button label
What I'd like to do is rename the whole button label to "Register whatever" instead
19 replies