Zoltar
Zoltar
FFilament
Created by Zoltar on 11/14/2024 in #❓┊help
exporter, simple question
How can I change the title or text of the exporter's modal form? Thanks
9 replies
FFilament
Created by Zoltar on 10/31/2024 in #❓┊help
filtersForm with action button
Hello, i create a simple report page with filter form. The filters work properly but how do I update the filters with an action button instead of the simple change event? And How do i create a reset button that reset all filters?
public function filtersForm(Form $form): Form
{
return $form
->schema([
Section::make()
->schema([
Select::make('group_id_filter')
->options(Group::all()
->pluck('descrizione', 'id'))
->multiple()
->searchable(),
Select::make('activity_id_filter')
->options(Activity::query()
->where('tipo','gaming') // ToDo Usare gaming o classifica???
->pluck('titolo', 'id'))
->multiple()
->searchable()
])
->columns(3),
]);
}
public function filtersForm(Form $form): Form
{
return $form
->schema([
Section::make()
->schema([
Select::make('group_id_filter')
->options(Group::all()
->pluck('descrizione', 'id'))
->multiple()
->searchable(),
Select::make('activity_id_filter')
->options(Activity::query()
->where('tipo','gaming') // ToDo Usare gaming o classifica???
->pluck('titolo', 'id'))
->multiple()
->searchable()
])
->columns(3),
]);
}
14 replies
FFilament
Created by Zoltar on 10/30/2024 in #❓┊help
Table Widget - query with join
Hello, I have simple Table widget with custom query that use JOIN. I can't use relations but need to use JOIN function How can I call join fields in columns? TextColumn::make('activity_group.activity_id') in code below Thanks
<?php

namespace App\Filament\Widgets;

use Filament\Tables;
use Filament\Tables\Table;
use Filament\Tables\Columns\TextColumn;

use Filament\Widgets\TableWidget as BaseWidget;

use Filament\Widgets\Concerns\InteractsWithPageFilters;

use App\Models\UserActivity;

class GroupsReportTable extends BaseWidget
{

use InteractsWithPageFilters;

public function table(Table $table): Table
{

$filtro = $this->filters['filtro'] ?? 0;

return $table
->query(UserActivity::query()
->leftJoin("activity_group", "user_activities.activity_id" ,"=", "activity_group.activity_id")
)
->columns([
TextColumn::make('id'),
TextColumn::make('activity_group.activity_id'),
]);
}
}
<?php

namespace App\Filament\Widgets;

use Filament\Tables;
use Filament\Tables\Table;
use Filament\Tables\Columns\TextColumn;

use Filament\Widgets\TableWidget as BaseWidget;

use Filament\Widgets\Concerns\InteractsWithPageFilters;

use App\Models\UserActivity;

class GroupsReportTable extends BaseWidget
{

use InteractsWithPageFilters;

public function table(Table $table): Table
{

$filtro = $this->filters['filtro'] ?? 0;

return $table
->query(UserActivity::query()
->leftJoin("activity_group", "user_activities.activity_id" ,"=", "activity_group.activity_id")
)
->columns([
TextColumn::make('id'),
TextColumn::make('activity_group.activity_id'),
]);
}
}
4 replies
FFilament
Created by Zoltar on 10/29/2024 in #❓┊help
Best pratices for reporting page
HI, I would like to create a reporting page (tables, graphs etc) for my application. Reading the documentation I saw that I can use widgets. What is the best practice for creating a custom or resource page that uses both tables and widgets (StatsOverviewWidget or ChartWidget) sharing the same filters? Thanks always
35 replies
FFilament
Created by Zoltar on 10/24/2024 in #❓┊help
table filter icon - add text after or before icon
Hello, Is it possible to insert text next to or before the table filter icon?
8 replies
FFilament
Created by Zoltar on 10/16/2024 in #❓┊help
Table ImageColumn only for certain rows
I'm creating a leaderboard table and would like the first 3 rows to have an image instead of text position (1,2,3). Is it possible? Any idea? thnks
9 replies
FFilament
Created by Zoltar on 10/9/2024 in #❓┊help
contentGrid mobile in table grid
Hello, how to set table 2 column grid in mobile? I use this in function table but don't find breakpoint for mobile
->contentGrid(['sm' => 2, 'md' => 3])
->contentGrid(['sm' => 2, 'md' => 3])
any suggestions? Regards
5 replies
FFilament
Created by Zoltar on 10/8/2024 in #❓┊help
Navigation Item use isActiveWhen()
i tried to use custom navigation item in my panel
NavigationItem::make('ActivityResource-Index')
->url(fn (): string => ActivityResource::getUrl('index'))
->icon('heroicon-o-presentation-chart-line')
->isActiveWhen(fn () => request()->routeIs(ActivityResource::getRouteBaseName()))
->sort(1),
NavigationItem::make('ActivityResource-Index')
->url(fn (): string => ActivityResource::getUrl('index'))
->icon('heroicon-o-presentation-chart-line')
->isActiveWhen(fn () => request()->routeIs(ActivityResource::getRouteBaseName()))
->sort(1),
Navigation is ok but i cant see active page How do I set isActiveWhen to works correct? thanks
4 replies
FFilament
Created by Zoltar on 10/7/2024 in #❓┊help
Action in custom page
Hello, Have a simple button in blade view
<x-filament::button wire:click="challenge" class="primary-bg">
Challenge
</x-filament::button>
<x-filament::button wire:click="challenge" class="primary-bg">
Challenge
</x-filament::button>
in my custom page, function challenge() call an action
//Challenge
public function challenge()
{
Action::make('sendEmail')
->form([
TextInput::make('subject')->required(),
RichEditor::make('body')->required(),
])
->action(function (array $data) {
Mail::to($this->client)
->send(new GenericEmail(
subject: $data['subject'],
body: $data['body'],
));
});
}
//Challenge
public function challenge()
{
Action::make('sendEmail')
->form([
TextInput::make('subject')->required(),
RichEditor::make('body')->required(),
])
->action(function (array $data) {
Mail::to($this->client)
->send(new GenericEmail(
subject: $data['subject'],
body: $data['body'],
));
});
}
when try to click button get error Method Filament\Notifications\Actions\Action::form does not exist. any suggest? thanks
23 replies
FFilament
Created by Zoltar on 9/3/2024 in #❓┊help
bottom menu
No description
6 replies
FFilament
Created by Zoltar on 7/18/2024 in #❓┊help
custom background columns in table grid
No description
46 replies
FFilament
Created by Zoltar on 7/16/2024 in #❓┊help
use pure javascript in livewire
hello, i create a simple javascript timer in blade view How can call method inside the script? i tryed with {{ $this->method() }} but not work
Timer: <label id="seconds">{{$record->tempo_max}}</label>
<input type="hidden" id="contatore" wire:model="tempo_risposta">

<script>
var secondsLabel = document.getElementById("seconds");
var totalSeconds = {{$record->tempo_max}};
setInterval(setTime, 1000);

function setTime() {
--totalSeconds;
secondsLabel.innerHTML = totalSeconds;

var element = document.getElementById('contatore');
element.value = totalSeconds;
element.dispatchEvent(new Event('input'));


if(totalSeconds == 0) {
//ToDo call method
}
}

</script>
Timer: <label id="seconds">{{$record->tempo_max}}</label>
<input type="hidden" id="contatore" wire:model="tempo_risposta">

<script>
var secondsLabel = document.getElementById("seconds");
var totalSeconds = {{$record->tempo_max}};
setInterval(setTime, 1000);

function setTime() {
--totalSeconds;
secondsLabel.innerHTML = totalSeconds;

var element = document.getElementById('contatore');
element.value = totalSeconds;
element.dispatchEvent(new Event('input'));


if(totalSeconds == 0) {
//ToDo call method
}
}

</script>
35 replies
FFilament
Created by Zoltar on 7/11/2024 in #❓┊help
Notification with confirm and cancel button
Hello, How can I create a notification with 'ok' and 'cancel' action button?
5 replies
FFilament
Created by Zoltar on 7/10/2024 in #❓┊help
change icon color in blade view
Hello, which class i use for change color to icon in blade view? i try this but not work
<x-filament::icon
icon="heroicon-m-check-badge"
class="h-5 w-5 text-cyan-500 dark:text-gray-400"
/>
<x-filament::icon
icon="heroicon-m-check-badge"
class="h-5 w-5 text-cyan-500 dark:text-gray-400"
/>
6 replies
FFilament
Created by Zoltar on 7/9/2024 in #❓┊help
list of component in doc
Is available in the documentation a list of <x-filament:: components for use in views page?
7 replies
FFilament
Created by Zoltar on 7/5/2024 in #❓┊help
table custom css
Hello, It is possible to apply a custom style to a Filament table?
->extraAttributes(['class' => 'my-width-class']) is the way?
->extraAttributes(['class' => 'my-width-class']) is the way?
21 replies
FFilament
Created by Zoltar on 7/3/2024 in #❓┊help
Use Resource Page for Dashboard
Hello, is it possible to use a resource as a dashboard page?
17 replies
FFilament
Created by Zoltar on 7/2/2024 in #❓┊help
ManageRelatedRecords use getEloquentQuery() not working
Hello, i need to filter result in table in ManageRelatedRecord page i'm trying to use:
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()->where('is_active', true);
}
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()->where('is_active', true);
}
but not working any suggestions? regards
6 replies
FFilament
Created by Zoltar on 7/1/2024 in #❓┊help
Filament Importer skip import row if certain conditions is true
I create a simple importer that import only one column "email". The importer works properly, now i try to stop import row if email has already been imported I try to use beforeValidate hooks, but it doesn't seem to work. alternative to $this->action->halt(); ??? thank you always for your availability
protected function beforeValidate(): void
{
$user = User::where('email', $this->data['email'])->first();
if ($user) {
Notification::make()
->danger()
->title('User already exist')
->body('This email has already been used for a user on the platform')
->persistent()
->send();

$this->action->halt();
}
}
protected function beforeValidate(): void
{
$user = User::where('email', $this->data['email'])->first();
if ($user) {
Notification::make()
->danger()
->title('User already exist')
->body('This email has already been used for a user on the platform')
->persistent()
->send();

$this->action->halt();
}
}
4 replies
FFilament
Created by Zoltar on 7/1/2024 in #❓┊help
mail exception unable to manage try catch
No description
12 replies