Zoltar
Zoltar
FFilament
Created by Zoltar on 11/14/2024 in #❓┊help
exporter, simple question
No description
9 replies
FFilament
Created by Zoltar on 11/14/2024 in #❓┊help
exporter, simple question
mean this modal
9 replies
FFilament
Created by Zoltar on 11/14/2024 in #❓┊help
exporter, simple question
No description
9 replies
FFilament
Created by Zoltar on 11/14/2024 in #❓┊help
exporter, simple question
click on the button in table header for exporting data
9 replies
FFilament
Created by Zoltar on 11/14/2024 in #❓┊help
exporter, simple question
no ideas?
9 replies
FFilament
Created by Zoltar on 10/31/2024 in #❓┊help
filtersForm with action button
Thanks a lot
14 replies
FFilament
Created by Zoltar on 10/31/2024 in #❓┊help
filtersForm with action button
any suggestions?
14 replies
FFilament
Created by Zoltar on 10/31/2024 in #❓┊help
filtersForm with action button
i don't use table filter, but filtersForm, next inject filter to table query
<?php

namespace App\Filament\Widgets;

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

use Filament\Widgets\TableWidget as BaseWidget;

use Filament\Widgets\Concerns\InteractsWithPageFilters;

use App\Models\UserActivity;
use App\Models\Group;
use App\Models\Activity;

use Illuminate\Support\Facades\DB;

use App\Filament\Exports\GroupsReportExporter;


class GroupsReportTable extends BaseWidget
{

use InteractsWithPageFilters;

public function table(Table $table): Table
{

$group_id_filter = $this->filters['group_id_filter'] ?? null;
$activity_id_filter = $this->filters['activity_id_filter'] ?? null;

if($group_id_filter == null) {
$group_id_filter = Group::all()->pluck('id')->toArray();
}

if($activity_id_filter == null) {
$activity_id_filter = Activity::all()->pluck('id')->toArray();
}

return $table
->query(Group::query()
->select("groups.*",
DB::raw("get_group_points(groups.id, '".implode(",", $activity_id_filter)."') AS point")
)
->whereIn("id", $group_id_filter)
)
->columns([
TextColumn::make('desc'),
TextColumn::make('point'),
]);
}
}
<?php

namespace App\Filament\Widgets;

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

use Filament\Widgets\TableWidget as BaseWidget;

use Filament\Widgets\Concerns\InteractsWithPageFilters;

use App\Models\UserActivity;
use App\Models\Group;
use App\Models\Activity;

use Illuminate\Support\Facades\DB;

use App\Filament\Exports\GroupsReportExporter;


class GroupsReportTable extends BaseWidget
{

use InteractsWithPageFilters;

public function table(Table $table): Table
{

$group_id_filter = $this->filters['group_id_filter'] ?? null;
$activity_id_filter = $this->filters['activity_id_filter'] ?? null;

if($group_id_filter == null) {
$group_id_filter = Group::all()->pluck('id')->toArray();
}

if($activity_id_filter == null) {
$activity_id_filter = Activity::all()->pluck('id')->toArray();
}

return $table
->query(Group::query()
->select("groups.*",
DB::raw("get_group_points(groups.id, '".implode(",", $activity_id_filter)."') AS point")
)
->whereIn("id", $group_id_filter)
)
->columns([
TextColumn::make('desc'),
TextColumn::make('point'),
]);
}
}
14 replies
FFilament
Created by Zoltar on 10/30/2024 in #❓┊help
Table Widget - query with join
Solved using select()
public function table(Table $table): Table
{

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

return $table
->query(UserActivity::query()
->join("activity_group", "user_activities.activity_id" ,"=", "activity_group.activity_id")
->join("groups", "groups.id" ,"=", "activity_group.group_id")
->select("user_activities.*", "groups.descrizione AS groups_descrizione")
)
->columns([
TextColumn::make('id'),
TextColumn::make('groups_descrizione'),
]);
}
public function table(Table $table): Table
{

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

return $table
->query(UserActivity::query()
->join("activity_group", "user_activities.activity_id" ,"=", "activity_group.activity_id")
->join("groups", "groups.id" ,"=", "activity_group.group_id")
->select("user_activities.*", "groups.descrizione AS groups_descrizione")
)
->columns([
TextColumn::make('id'),
TextColumn::make('groups_descrizione'),
]);
}
4 replies
FFilament
Created by Zoltar on 10/29/2024 in #❓┊help
Best pratices for reporting page
Thank you very much, as I imagined the problem was in the passage of the filters in the view. Your code gave me the solution this is my custom view
<x-filament-panels::page>

@if (method_exists($this, 'filtersForm'))
{{ $this->filtersForm }}
@endif

@livewire(\App\Filament\Widgets\DemoWidget::class, (property_exists($this, 'filters') ? ['filters' => $this->filters] : []))

</x-filament-panels::page>
<x-filament-panels::page>

@if (method_exists($this, 'filtersForm'))
{{ $this->filtersForm }}
@endif

@livewire(\App\Filament\Widgets\DemoWidget::class, (property_exists($this, 'filters') ? ['filters' => $this->filters] : []))

</x-filament-panels::page>
35 replies
FFilament
Created by Zoltar on 10/29/2024 in #❓┊help
Best pratices for reporting page
if i use dashboard without blade view its work...but it isnt my solution 😦
35 replies
FFilament
Created by Zoltar on 10/29/2024 in #❓┊help
Best pratices for reporting page
<?php

namespace App\Filament\Pages;

//use Filament\Pages\Page;
use Filament\Pages\Dashboard as BaseDashboard;

use Filament\Forms\Form;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Section;

use Filament\Pages\Dashboard\Concerns\HasFiltersForm;

use App\Models\Activity;

class ReportActivities extends BaseDashboard
{
use HasFiltersForm;

protected static string $routePath = 'finance';

protected static ?int $navigationSort = 1;
protected static ?string $navigationIcon = 'heroicon-o-chart-bar';
protected static ?string $navigationLabel = 'Report Attività - Dashboard';
protected static ?string $navigationGroup = 'Report';

//protected static string $view = 'filament.pages.report-activities';

public function filtersForm(Form $form): Form
{
return $form
->schema([
Section::make()
->schema([
TextInput::make('test_filtro'),
])
->columns(3),
]);
}

}
<?php

namespace App\Filament\Pages;

//use Filament\Pages\Page;
use Filament\Pages\Dashboard as BaseDashboard;

use Filament\Forms\Form;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Section;

use Filament\Pages\Dashboard\Concerns\HasFiltersForm;

use App\Models\Activity;

class ReportActivities extends BaseDashboard
{
use HasFiltersForm;

protected static string $routePath = 'finance';

protected static ?int $navigationSort = 1;
protected static ?string $navigationIcon = 'heroicon-o-chart-bar';
protected static ?string $navigationLabel = 'Report Attività - Dashboard';
protected static ?string $navigationGroup = 'Report';

//protected static string $view = 'filament.pages.report-activities';

public function filtersForm(Form $form): Form
{
return $form
->schema([
Section::make()
->schema([
TextInput::make('test_filtro'),
])
->columns(3),
]);
}

}
35 replies
FFilament
Created by Zoltar on 10/29/2024 in #❓┊help
Best pratices for reporting page
Ok find the problem...the problem...is the view blade
35 replies
FFilament
Created by Zoltar on 10/29/2024 in #❓┊help
Best pratices for reporting page
i try to use dashboard instead of page...and NOT WORKING 😦
35 replies
FFilament
Created by Zoltar on 10/29/2024 in #❓┊help
Best pratices for reporting page
that's right, the only difference is that I use a page instead of a dashboard
35 replies
FFilament
Created by Zoltar on 10/29/2024 in #❓┊help
Best pratices for reporting page
3.2.121
35 replies
FFilament
Created by Zoltar on 10/29/2024 in #❓┊help
Best pratices for reporting page
trying to update
35 replies
FFilament
Created by Zoltar on 10/29/2024 in #❓┊help
Best pratices for reporting page
latest
35 replies
FFilament
Created by Zoltar on 10/29/2024 in #❓┊help
Best pratices for reporting page
No description
35 replies
FFilament
Created by Zoltar on 10/29/2024 in #❓┊help
Best pratices for reporting page
That's exactly what I'm looking at. the only difference is that the documentation uses BaseDashboard instead of Page
35 replies