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,12 +2,12 @@
|
||||
|
||||
namespace App\Livewire\Projects;
|
||||
|
||||
use Livewire\Component;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Attributes\On;
|
||||
use App\Models\Project;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Attributes\On;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Layout('layouts.app')]
|
||||
class ProjectForm extends Component
|
||||
@@ -15,33 +15,39 @@ class ProjectForm extends Component
|
||||
public ?Project $project = null;
|
||||
|
||||
// Identification
|
||||
public string $name = '';
|
||||
public string $name = '';
|
||||
|
||||
public string $reference = '';
|
||||
public string $status = 'planning';
|
||||
|
||||
public string $status = 'planning';
|
||||
|
||||
// Location
|
||||
public string $address = '';
|
||||
|
||||
public string $country = '';
|
||||
public string $lat = '';
|
||||
public string $lng = '';
|
||||
|
||||
public string $lat = '';
|
||||
|
||||
public string $lng = '';
|
||||
|
||||
// Planning
|
||||
public string $startDate = '';
|
||||
public string $endDateEstimated = '';
|
||||
public string $startDate = '';
|
||||
|
||||
public string $endDateEstimated = '';
|
||||
|
||||
public function mount(?Project $project = null): void
|
||||
{
|
||||
if ($project && $project->exists) {
|
||||
Gate::authorize('edit projects', $project);
|
||||
$this->project = $project;
|
||||
$this->name = $project->name;
|
||||
$this->reference = $project->reference ?? '';
|
||||
$this->status = $project->status;
|
||||
$this->address = $project->address;
|
||||
$this->country = $project->country ?? '';
|
||||
$this->lat = (string) ($project->lat ?? '');
|
||||
$this->lng = (string) ($project->lng ?? '');
|
||||
$this->startDate = $project->start_date->format('Y-m-d');
|
||||
$this->project = $project;
|
||||
$this->name = $project->name;
|
||||
$this->reference = $project->reference ?? '';
|
||||
$this->status = $project->status;
|
||||
$this->address = $project->address;
|
||||
$this->country = $project->country ?? '';
|
||||
$this->lat = (string) ($project->lat ?? '');
|
||||
$this->lng = (string) ($project->lng ?? '');
|
||||
$this->startDate = $project->start_date->format('Y-m-d');
|
||||
$this->endDateEstimated = $project->end_date_estimated?->format('Y-m-d') ?? '';
|
||||
} else {
|
||||
Gate::authorize('create projects');
|
||||
@@ -56,34 +62,38 @@ class ProjectForm extends Component
|
||||
{
|
||||
$this->lat = $lat;
|
||||
$this->lng = $lng;
|
||||
if ($address) $this->address = $address;
|
||||
if ($country) $this->country = strtolower($country);
|
||||
if ($address) {
|
||||
$this->address = $address;
|
||||
}
|
||||
if ($country) {
|
||||
$this->country = strtolower($country);
|
||||
}
|
||||
}
|
||||
|
||||
protected function rules(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'required|string|max:255',
|
||||
'reference' => 'nullable|string|max:100',
|
||||
'status' => 'required|in:planning,in_progress,paused,completed',
|
||||
'address' => 'required|string',
|
||||
'country' => 'nullable|string|size:2',
|
||||
'lat' => 'nullable|numeric|between:-90,90',
|
||||
'lng' => 'nullable|numeric|between:-180,180',
|
||||
'startDate' => 'required|date',
|
||||
'name' => 'required|string|max:255',
|
||||
'reference' => 'nullable|string|max:100',
|
||||
'status' => 'required|in:planning,in_progress,paused,completed',
|
||||
'address' => 'required|string',
|
||||
'country' => 'nullable|string|size:2',
|
||||
'lat' => 'nullable|numeric|between:-90,90',
|
||||
'lng' => 'nullable|numeric|between:-180,180',
|
||||
'startDate' => 'required|date',
|
||||
'endDateEstimated' => 'nullable|date|after_or_equal:startDate',
|
||||
];
|
||||
}
|
||||
|
||||
protected $validationAttributes = [
|
||||
'name' => 'nombre',
|
||||
'reference' => 'referencia',
|
||||
'status' => 'estado',
|
||||
'address' => 'dirección',
|
||||
'country' => 'país',
|
||||
'lat' => 'latitud',
|
||||
'lng' => 'longitud',
|
||||
'startDate' => 'fecha de inicio',
|
||||
'name' => 'nombre',
|
||||
'reference' => 'referencia',
|
||||
'status' => 'estado',
|
||||
'address' => 'dirección',
|
||||
'country' => 'país',
|
||||
'lat' => 'latitud',
|
||||
'lng' => 'longitud',
|
||||
'startDate' => 'fecha de inicio',
|
||||
'endDateEstimated' => 'fecha de fin estimada',
|
||||
];
|
||||
|
||||
@@ -92,14 +102,14 @@ class ProjectForm extends Component
|
||||
$this->validate();
|
||||
|
||||
$data = [
|
||||
'name' => $this->name,
|
||||
'reference' => $this->reference ?: null,
|
||||
'status' => $this->status,
|
||||
'address' => $this->address,
|
||||
'country' => $this->country ?: null,
|
||||
'lat' => $this->lat ?: null,
|
||||
'lng' => $this->lng ?: null,
|
||||
'start_date' => $this->startDate,
|
||||
'name' => $this->name,
|
||||
'reference' => $this->reference ?: null,
|
||||
'status' => $this->status,
|
||||
'address' => $this->address,
|
||||
'country' => $this->country ?: null,
|
||||
'lat' => $this->lat ?: null,
|
||||
'lng' => $this->lng ?: null,
|
||||
'start_date' => $this->startDate,
|
||||
'end_date_estimated' => $this->endDateEstimated ?: null,
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user