chore: cleanup dead code + format with Pint
- Remove unused FeaturesController (empty stubs, no routes) - Remove ConvertSpatialFile CLI command (unused; service used in LayerManager) - Remove MigrateGeojsonToFeatures CLI command (one-shot migration, not referenced) - Remove .claude/worktrees/ (11 old agent worktrees from June) - Apply Laravel Pint formatting across 219 files (style only, no functional changes) Tests: 101 passing (319 assertions) API routes: unchanged (8 routes intact)
This commit is contained in:
@@ -2,14 +2,14 @@
|
||||
|
||||
namespace App\Livewire\Projects;
|
||||
|
||||
use Livewire\Component;
|
||||
use Livewire\Attributes\Layout;
|
||||
use App\Models\Project;
|
||||
use App\Models\Phase;
|
||||
use App\Models\Feature;
|
||||
use App\Models\Inspection;
|
||||
use App\Models\Issue;
|
||||
use App\Models\Phase;
|
||||
use App\Models\Project;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Layout('layouts.app')]
|
||||
class ProjectDashboard extends Component
|
||||
@@ -17,11 +17,16 @@ class ProjectDashboard extends Component
|
||||
public Project $project;
|
||||
|
||||
// Computed stats (cached as properties after mount)
|
||||
public array $stats = [];
|
||||
public array $stats = [];
|
||||
|
||||
public $phases;
|
||||
|
||||
public $recentInspections;
|
||||
|
||||
public $recentIssues;
|
||||
|
||||
public $teamMembers;
|
||||
|
||||
public $companies;
|
||||
|
||||
public function mount(Project $project): void
|
||||
@@ -34,8 +39,12 @@ class ProjectDashboard extends Component
|
||||
private function checkAccess(): void
|
||||
{
|
||||
$user = Auth::user();
|
||||
if ($user->can('manage all')) return;
|
||||
if (!$this->project->users()->where('user_id', $user->id)->exists()) abort(403);
|
||||
if ($user->can('manage all')) {
|
||||
return;
|
||||
}
|
||||
if (! $this->project->users()->where('user_id', $user->id)->exists()) {
|
||||
abort(403);
|
||||
}
|
||||
}
|
||||
|
||||
private function loadData(): void
|
||||
@@ -44,43 +53,42 @@ class ProjectDashboard extends Component
|
||||
|
||||
$this->phases = Phase::where('project_id', $pid)
|
||||
->withCount('layers')
|
||||
->with(['layers' => fn($q) => $q->withCount('features')])
|
||||
->with(['layers' => fn ($q) => $q->withCount('features')])
|
||||
->orderBy('order')
|
||||
->get();
|
||||
|
||||
$totalFeatures = Feature::whereHas('layer.phase', fn($q) => $q->where('project_id', $pid))->count();
|
||||
$completedFeatures = Feature::whereHas('layer.phase', fn($q) => $q->where('project_id', $pid))
|
||||
$totalFeatures = Feature::whereHas('layer.phase', fn ($q) => $q->where('project_id', $pid))->count();
|
||||
$completedFeatures = Feature::whereHas('layer.phase', fn ($q) => $q->where('project_id', $pid))
|
||||
->where('status', 'completed')->count();
|
||||
$verifiedFeatures = Feature::whereHas('layer.phase', fn($q) => $q->where('project_id', $pid))
|
||||
$verifiedFeatures = Feature::whereHas('layer.phase', fn ($q) => $q->where('project_id', $pid))
|
||||
->where('status', 'verified')->count();
|
||||
|
||||
$openIssues = Issue::where('project_id', $pid)->where('status', 'open')->count();
|
||||
$closedIssues = Issue::where('project_id', $pid)->where('status', 'closed')->count();
|
||||
$openIssues = Issue::where('project_id', $pid)->where('status', 'open')->count();
|
||||
$closedIssues = Issue::where('project_id', $pid)->where('status', 'closed')->count();
|
||||
$criticalIssues = Issue::where('project_id', $pid)->where('status', 'open')->where('priority', 'critical')->count();
|
||||
|
||||
$totalInspections = Inspection::where('project_id', $pid)->count();
|
||||
$passedInspections = Inspection::where('project_id', $pid)->where('result', 'pass')->count();
|
||||
$failedInspections = Inspection::where('project_id', $pid)->where('result', 'fail')->count();
|
||||
$totalInspections = Inspection::where('project_id', $pid)->count();
|
||||
$passedInspections = Inspection::where('project_id', $pid)->where('result', 'pass')->count();
|
||||
$failedInspections = Inspection::where('project_id', $pid)->where('result', 'fail')->count();
|
||||
|
||||
$globalProgress = $this->phases->avg('progress_percent') ?? 0;
|
||||
|
||||
$delayedPhases = $this->phases->filter(fn($p) =>
|
||||
$p->planned_end && $p->planned_end < now() && $p->progress_percent < 100
|
||||
$delayedPhases = $this->phases->filter(fn ($p) => $p->planned_end && $p->planned_end < now() && $p->progress_percent < 100
|
||||
)->count();
|
||||
|
||||
$this->stats = [
|
||||
'global_progress' => round($globalProgress),
|
||||
'total_phases' => $this->phases->count(),
|
||||
'delayed_phases' => $delayedPhases,
|
||||
'total_features' => $totalFeatures,
|
||||
'completed_features' => $completedFeatures,
|
||||
'verified_features' => $verifiedFeatures,
|
||||
'open_issues' => $openIssues,
|
||||
'closed_issues' => $closedIssues,
|
||||
'critical_issues' => $criticalIssues,
|
||||
'total_inspections' => $totalInspections,
|
||||
'passed_inspections' => $passedInspections,
|
||||
'failed_inspections' => $failedInspections,
|
||||
'global_progress' => round($globalProgress),
|
||||
'total_phases' => $this->phases->count(),
|
||||
'delayed_phases' => $delayedPhases,
|
||||
'total_features' => $totalFeatures,
|
||||
'completed_features' => $completedFeatures,
|
||||
'verified_features' => $verifiedFeatures,
|
||||
'open_issues' => $openIssues,
|
||||
'closed_issues' => $closedIssues,
|
||||
'critical_issues' => $criticalIssues,
|
||||
'total_inspections' => $totalInspections,
|
||||
'passed_inspections' => $passedInspections,
|
||||
'failed_inspections' => $failedInspections,
|
||||
];
|
||||
|
||||
$this->recentInspections = Inspection::where('project_id', $pid)
|
||||
|
||||
Reference in New Issue
Block a user