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,6 +2,7 @@
|
||||
|
||||
namespace App\Livewire\Issues;
|
||||
|
||||
use App\Models\Feature;
|
||||
use App\Models\Issue;
|
||||
use App\Models\Project;
|
||||
use App\Notifications\IssueAssignedNotification;
|
||||
@@ -14,22 +15,31 @@ use Livewire\Component;
|
||||
class IssueForm extends Component
|
||||
{
|
||||
public Project $project;
|
||||
|
||||
public ?Issue $issue = null; // null = create, set = edit
|
||||
|
||||
public $projectUsers = [];
|
||||
|
||||
// Form fields
|
||||
public $title = '';
|
||||
|
||||
public $description = '';
|
||||
|
||||
public $status = 'open';
|
||||
|
||||
public $priority = 'medium';
|
||||
|
||||
public $type = 'defect';
|
||||
|
||||
public $assignedTo = '';
|
||||
|
||||
public $resolutionNotes = '';
|
||||
|
||||
// Optional context (e.g. when reporting from a map feature)
|
||||
public $featureId = null;
|
||||
|
||||
public $inspectionId = null;
|
||||
|
||||
public $featureName = null; // shown when the issue is pre-linked to a map element
|
||||
|
||||
public function mount(Project $project, ?Issue $issue = null)
|
||||
@@ -44,22 +54,22 @@ class IssueForm extends Component
|
||||
$this->projectUsers = $project->users()->orderBy('name')->get();
|
||||
|
||||
if ($issue) {
|
||||
$this->issue = $issue;
|
||||
$this->title = $issue->title;
|
||||
$this->description = $issue->description ?? '';
|
||||
$this->status = $issue->status;
|
||||
$this->priority = $issue->priority;
|
||||
$this->type = $issue->type ?? 'defect';
|
||||
$this->assignedTo = $issue->assigned_to ?? '';
|
||||
$this->issue = $issue;
|
||||
$this->title = $issue->title;
|
||||
$this->description = $issue->description ?? '';
|
||||
$this->status = $issue->status;
|
||||
$this->priority = $issue->priority;
|
||||
$this->type = $issue->type ?? 'defect';
|
||||
$this->assignedTo = $issue->assigned_to ?? '';
|
||||
$this->resolutionNotes = $issue->resolution_notes ?? '';
|
||||
$this->featureId = $issue->feature_id;
|
||||
$this->inspectionId = $issue->inspection_id;
|
||||
$this->featureName = $issue->feature?->name;
|
||||
$this->featureId = $issue->feature_id;
|
||||
$this->inspectionId = $issue->inspection_id;
|
||||
$this->featureName = $issue->feature?->name;
|
||||
} elseif ($featureId = request()->integer('feature')) {
|
||||
// Pre-link to a map element when reporting from the project map.
|
||||
$feature = \App\Models\Feature::with('layer.phase')->find($featureId);
|
||||
$feature = Feature::with('layer.phase')->find($featureId);
|
||||
if ($feature && $feature->layer?->phase?->project_id === $project->id) {
|
||||
$this->featureId = $feature->id;
|
||||
$this->featureId = $feature->id;
|
||||
$this->featureName = $feature->name;
|
||||
}
|
||||
}
|
||||
@@ -68,6 +78,7 @@ class IssueForm extends Component
|
||||
private function canAccessProject(): bool
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
return $user->can('manage all')
|
||||
|| $this->project->users()->where('user_id', $user->id)->exists();
|
||||
}
|
||||
@@ -75,12 +86,12 @@ class IssueForm extends Component
|
||||
protected function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'required|string|max:255',
|
||||
'description' => 'nullable|string',
|
||||
'status' => 'required|in:' . implode(',', Issue::STATUSES),
|
||||
'priority' => 'required|in:' . implode(',', Issue::PRIORITIES),
|
||||
'type' => 'required|in:' . implode(',', Issue::TYPES),
|
||||
'assignedTo' => 'nullable|exists:users,id',
|
||||
'title' => 'required|string|max:255',
|
||||
'description' => 'nullable|string',
|
||||
'status' => 'required|in:'.implode(',', Issue::STATUSES),
|
||||
'priority' => 'required|in:'.implode(',', Issue::PRIORITIES),
|
||||
'type' => 'required|in:'.implode(',', Issue::TYPES),
|
||||
'assignedTo' => 'nullable|exists:users,id',
|
||||
'resolutionNotes' => 'nullable|string',
|
||||
];
|
||||
}
|
||||
@@ -91,14 +102,14 @@ class IssueForm extends Component
|
||||
$this->validate();
|
||||
|
||||
$payload = [
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'status' => $this->status,
|
||||
'priority' => $this->priority,
|
||||
'type' => $this->type,
|
||||
'feature_id' => $this->featureId,
|
||||
'inspection_id' => $this->inspectionId,
|
||||
'assigned_to' => $this->assignedTo ?: null,
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'status' => $this->status,
|
||||
'priority' => $this->priority,
|
||||
'type' => $this->type,
|
||||
'feature_id' => $this->featureId,
|
||||
'inspection_id' => $this->inspectionId,
|
||||
'assigned_to' => $this->assignedTo ?: null,
|
||||
'resolution_notes' => $this->resolutionNotes ?: null,
|
||||
];
|
||||
|
||||
@@ -120,7 +131,7 @@ class IssueForm extends Component
|
||||
}
|
||||
} else {
|
||||
$issue = Issue::create(array_merge($payload, [
|
||||
'project_id' => $this->project->id,
|
||||
'project_id' => $this->project->id,
|
||||
'reported_by' => Auth::id(),
|
||||
]));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user