- Dumpsites + Routes: full create forms (boundary point list, click-to-add ordered stops with reorder controls) - Trucks: list + create - Teams: list + create with conflict detection (override checkbox) - Trips: schedule + list + detail panel showing stops + timeline - Partner Stores: list + create + Issue-Inventory action - Reports: tabbed dashboard (daily collection, trip performance, store sales, compliance CSV export) + rebuild aggregations - Sidebar: moves Teams/Trucks/Trips/Stores/Reports out of "Soon", reorganized groups - Admin resources expose db_id alongside public uuid so admin forms can post integer FKs without a separate lookup endpoint 164 tests still passing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
30 lines
1.0 KiB
PHP
30 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class RouteResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->uuid,
|
|
'db_id' => $this->id,
|
|
'name' => $this->name,
|
|
'code' => $this->code,
|
|
'status' => $this->status,
|
|
'estimated_duration_minutes' => $this->estimated_duration_minutes,
|
|
'total_distance_km' => round((float) $this->total_distance_km, 3),
|
|
'notes' => $this->notes,
|
|
'area' => ServiceAreaResource::make($this->whenLoaded('area')),
|
|
'default_dumpsite' => DumpsiteResource::make($this->whenLoaded('defaultDumpsite')),
|
|
'default_team_id' => $this->default_team_id,
|
|
'stops' => RouteStopResource::collection($this->whenLoaded('stops')),
|
|
'stop_count' => $this->whenCounted('stops'),
|
|
'created_at' => $this->created_at?->toIso8601String(),
|
|
];
|
|
}
|
|
}
|