Initial commit

This commit is contained in:
2025-08-01 22:04:00 +02:00
commit d1f466d1d4
155 changed files with 15995 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
<?php
declare(strict_types=1);
namespace App\Filament\Widgets;
use App\Models\Resume;
use Filament\Widgets\ChartWidget;
use Flowframe\Trend\Trend;
use Flowframe\Trend\TrendValue;
final class ResumesChart extends ChartWidget
{
protected static ?string $heading = 'Created resumes per month';
/** @return array<string, mixed> */
protected function getData(): array
{
$data = Trend::model(Resume::class)
->between(
start: now()->startOfYear(),
end: now()->endOfYear()
)
->perMonth()
->count();
return [
'datasets' => [
[
'label' => 'New resumes',
'data' => $data->map(fn (TrendValue $value) => $value->aggregate),
],
],
'labels' => $data->map(fn (TrendValue $value) => $value->date),
];
}
/** @return array<string, mixed> */
protected function getOptions(): array
{
return [
'plugins' => [
'legend' => [
'display' => false,
],
],
'scales' => [
'y' => [
'ticks' => [
'stepSize' => 1, // Ensure consistent steps
'precision' => 0, // No decimal places
],
'beginAtZero' => true,
],
],
];
}
protected function getType(): string
{
return 'line';
}
}