trips, trip_stops, trip_timeline_events. Admin: schedule/show/cancel. Driver: start, arrive/depart/skip stops, report incident, arrive at dumpsite, release load (creates dumpsite_release row + tallies trip load), complete. Every action writes a typed timeline event with GPS. Trip number auto-generated TRIP-YYYYMMDD-NNN. Promotes dumpsite_releases.trip_id to a real FK now that trips exists. 148 feature tests passing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
26 lines
872 B
PHP
26 lines
872 B
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class TripStopResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'sequence' => $this->sequence,
|
|
'status' => $this->status,
|
|
'scheduled_arrival' => $this->scheduled_arrival?->toIso8601String(),
|
|
'actual_arrival' => $this->actual_arrival?->toIso8601String(),
|
|
'actual_departure' => $this->actual_departure?->toIso8601String(),
|
|
'total_scans' => $this->total_scans,
|
|
'estimated_load_added_kg' => $this->estimated_load_added_kg,
|
|
'skip_reason' => $this->skip_reason,
|
|
'drop_off_point' => DropOffPointResource::make($this->whenLoaded('dropOffPoint')),
|
|
];
|
|
}
|
|
}
|