Files
Verde-Web/app/Http/Resources/CollectionTeamResource.php
admin 77af5ca876 feat(web): wire admin UI for Modules 9-13
- 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>
2026-04-30 19:50:08 +08:00

32 lines
1.1 KiB
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class CollectionTeamResource extends JsonResource
{
public function toArray(Request $request): array
{
return [
'id' => $this->uuid,
'db_id' => $this->id,
'name' => $this->name,
'status' => $this->status,
'area' => ServiceAreaResource::make($this->whenLoaded('area')),
'driver' => UserResource::make($this->whenLoaded('driver')),
'scanner' => UserResource::make($this->whenLoaded('scanner')),
'truck' => TruckResource::make($this->whenLoaded('truck')),
'helpers' => $this->whenLoaded('helpers', fn () => $this->helpers->map(fn ($m) => [
'id' => $m->user?->uuid,
'name' => $m->user?->full_name,
'assigned_from' => $m->assigned_from?->toDateString(),
'assigned_until' => $m->assigned_until?->toDateString(),
])),
'notes' => $this->notes,
'created_at' => $this->created_at?->toIso8601String(),
];
}
}