ehbfa
ehbfa
FFilament
Created by ehbfa on 6/7/2024 in #❓┊help
Having viewData with value of another field available
That helped me out, thanks!
5 replies
FFilament
Created by ehbfa on 9/7/2023 in #❓┊help
Open up a modal from a dashboard widget
I did read those docs. But I think we are talking about two different things? This is the code of my widget:
<?php

namespace App\Filament\Widgets;

use App\Traits\WidgetsTrait;
use Filament\Widgets\Widget;

class PlusThemes extends Widget
{

protected static string $view = 'filament.widgets.plus-themes';

protected function getViewData(): array
{
$tenant = resolve('tenant');
$tenant->loadMissing('textSuggestionThemes');

return [
'firstTheme' => $tenant->textSuggestionThemes->first(),
];
}

}
<?php

namespace App\Filament\Widgets;

use App\Traits\WidgetsTrait;
use Filament\Widgets\Widget;

class PlusThemes extends Widget
{

protected static string $view = 'filament.widgets.plus-themes';

protected function getViewData(): array
{
$tenant = resolve('tenant');
$tenant->loadMissing('textSuggestionThemes');

return [
'firstTheme' => $tenant->textSuggestionThemes->first(),
];
}

}
And this is the contents of the view;
<div class="plus-themes-widget col-[--col-span-default] text-kto-black" style="--col-span-default: span 2 / span 2;">
<x-filament-widgets::widget>
<x-filament::card>
{{-- Widget content --}}

<h2 class="text-xl font-semibold tracking-tight filament-card-heading">Hi {{ auth()->user()->name }}!</h2>


<p id="typed-text" class="text-sm font-medium">Some text</p>

<button x-on:click="$dispatch('open-modal', { id: 'custom-modal-handle' })">
Open modal
</button>

</x-filament::card>
</x-filament-widgets::widget>
</div>
<div class="plus-themes-widget col-[--col-span-default] text-kto-black" style="--col-span-default: span 2 / span 2;">
<x-filament-widgets::widget>
<x-filament::card>
{{-- Widget content --}}

<h2 class="text-xl font-semibold tracking-tight filament-card-heading">Hi {{ auth()->user()->name }}!</h2>


<p id="typed-text" class="text-sm font-medium">Some text</p>

<button x-on:click="$dispatch('open-modal', { id: 'custom-modal-handle' })">
Open modal
</button>

</x-filament::card>
</x-filament-widgets::widget>
</div>
Now I am probably missing something, but where to place an action in this logic? I want that <button> to somehow open a modal, or however that works 🙂 I tried to do something with that $dispatch, but couldn't figure out how to do that or get that to work 😦
47 replies
FFilament
Created by ehbfa on 9/7/2023 in #❓┊help
Open up a modal from a dashboard widget
Sorry, can you please dumb this down for me? Call an action from where, from within that widget? And use the ->view() on that action..? And that view then has to be the modal html? Or the content that needs to be in that modal?
47 replies
FFilament
Created by chrislcarr on 8/22/2023 in #❓┊help
How to add a CSS class to a v3 widget?
It seems adding a <div> around the entire blade view contents and add the needed classes in that div worked. But it is still a bit weird to do it like that? Adding a class attribute to the component tag <x-filament-widgets::widget> did not work, it is ignored/replaced Using {{ $attributes->merge(['class' => 'test-class']) }} on the component tag did not work either, gives the error: Call to a member function merge() on null. I did see there was a $component var, which did had an attributes property. But doing the merge via that way (<x-filament-widgets::widget {{ $component->attributes->merge(['class' => 'test-class']) }}>) I got the error syntax error, unexpected token "endif", expecting end of file. So not sure what the correct approach would be? For now this is working with just a regular div around the entire blade template: <div class="katoo-plus-themes-widget col-[--col-span-default]" style="--col-span-default: span 2 / span 2;"> - but that doesn't feel right... So I'm sure I'm missing something obvious 🙂
8 replies
FFilament
Created by ehbfa on 8/17/2023 in #❓┊help
Can you hide the default menu but still discover the resources?
That did the trick, thank you!
4 replies
FFilament
Created by ehbfa on 8/16/2023 in #❓┊help
Route [filament.admin.pages.dashboard] not defined.
Thanks! Solved it
10 replies
FFilament
Created by ehbfa on 7/12/2023 in #❓┊help
Is this the best way to add a class to a custom widget?
Ow my, feeling a bit dumb now lol. Thanks for that addition! I'm not used to the new blade components yet...
3 replies
FFilament
Created by Lambertn33 on 4/12/2023 in #❓┊help
getHeaderWidgets on simple Resource
@lambertn33 you can put widgets in a modal with custom code in a resource (not sure about a simple resource, haven't tested that). I had to do a similar thing. I made a custom action in my resource:
Tables\Actions\Action::make('insights')
->action(function() {})
->modalActions([])
->modalContent(view('filament.pages.companies.insights')),
Tables\Actions\Action::make('insights')
->action(function() {})
->modalActions([])
->modalContent(view('filament.pages.companies.insights')),
Then I made that blade view with this content:
<div class="grid grid-cols-1 lg:grid-cols-2 filament-widgets-container gap-4 lg:gap-8 mb-6">
@livewire(\Livewire\Livewire::getAlias(App\Filament\Widgets\DoughnutChart::class))
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 filament-widgets-container gap-4 lg:gap-8 mb-6">
@livewire(\Livewire\Livewire::getAlias(App\Filament\Widgets\DoughnutChart::class))
</div>
7 replies
FFilament
Created by ehbfa on 5/12/2023 in #❓┊help
Form action location
Only thing is the action, calling $this->delete is deprecated, I had to change it to: ->action('delete')
4 replies
FFilament
Created by ehbfa on 5/12/2023 in #❓┊help
Form action location
Not sure either, but it works - that's the good part 😅 Thanks @Leandro Ferreira
4 replies
FFilament
Created by ehbfa on 3/28/2023 in #❓┊help
getTableColumns with conditional columns based on the record/row parents type
Just made a new ImageOrTextColumn, and a view which now contains: @if ($getRecord()->setting->type == 'image') @include('tables::columns.image-column') @else <div> {{ $getState() }} </div> @endif
5 replies
FFilament
Created by ehbfa on 3/28/2023 in #❓┊help
getTableColumns with conditional columns based on the record/row parents type
Yeah, I think so too. Got that working 🙂
5 replies
FFilament
Created by ehbfa on 3/28/2023 in #❓┊help
getTableColumns with conditional columns based on the record/row parents type
But maybe this is not possible, as you define the column and not the cell in that column..? Any idea on how to do that? Maybe define a custom column class and have that decide what to become for that record/row?
5 replies
FFilament
Created by ehbfa on 3/19/2023 in #❓┊help
Can you add a link in the avatar dropdown?
Thank you for solving this so adequate
3 replies