first commit
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled

This commit is contained in:
brusnitsyn
2026-04-06 00:06:00 +09:00
commit fb2e6c58e3
409 changed files with 42953 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
<?php
namespace App\Http\Controllers\Reports;
use App\Http\Controllers\Controller;
use App\Models\ReportPeriod;
use App\Models\Team;
use App\Services\Reports\AnalysisReportService;
use Illuminate\Http\Request;
use Inertia\Inertia;
use Inertia\Response;
class AnalysisController extends Controller
{
/**
* Display the analysis page.
*/
public function index(Request $request, Team $current_team, AnalysisReportService $analysisReportService): Response
{
$periods = ReportPeriod::query()
->whereBelongsTo($current_team)
->orderByDesc('year')
->orderByDesc('month')
->get();
/** @var ReportPeriod|null $selectedPeriod */
$selectedPeriod = $periods->firstWhere('id', $request->integer('period', $periods->first()?->id));
$analysis = $selectedPeriod
? $analysisReportService->build($current_team, $selectedPeriod->year, $selectedPeriod->month)
: [
'period' => null,
'columns' => [],
'rows' => [],
'meta' => [
'status' => null,
'statusLabel' => null,
'updatedAt' => null,
'canEditSources' => false,
],
];
return Inertia::render('reports/analysis/Index', [
'periods' => $periods->map(fn (ReportPeriod $period) => [
'id' => $period->id,
'label' => $period->label(),
'status' => $period->status->value,
'statusLabel' => $period->status->label(),
])->values(),
'selectedPeriodId' => $selectedPeriod?->id,
...$analysis,
]);
}
}