@extends('layouts.app') @section('title', 'Settings — Projects') @section('content') {{-- Page header --}}

Projects & Locations

Manage projects and their physical sub-locations with addresses and GPS coordinates.

{{-- Stat boxes --}}
{{ $stats['total_projects'] }}
Total Projects
{{ $stats['active_projects'] }}
Active Projects
{{ $stats['total_locations'] }}
Total Locations
{{ $stats['active_locations'] }}
Active Locations
{{-- Add Project --}}

{{-- Build location data map for safe JS passing --}} @php $allLocsData = []; foreach ($projects as $proj) { foreach ($proj->locations as $loc) { $allLocsData[$loc->id] = [ 'id' => $loc->id, 'name' => $loc->name, 'address' => $loc->address, 'latitude' => $loc->latitude, 'longitude' => $loc->longitude, 'is_active' => $loc->is_active, ]; } } $allLocsJson = json_encode($allLocsData); @endphp {{-- Projects accordion --}}
@forelse($projects as $project)
{{-- Header --}}
{{ $project->name }} Inactive {{ $project->locations->count() }} {{ Str::plural('location', $project->locations->count()) }}
{{-- Project edit form --}}

{{-- Body --}}
{{-- Location rows (sorted alphabetically by server) --}}
@forelse($project->locations as $location)
{{ $location->name }} Inactive
{{ $location->address }}
@if($location->latitude && $location->longitude) {{ number_format((float)$location->latitude, 6) }}°, {{ number_format((float)$location->longitude, 6) }}° @endif
@empty
No locations yet — add the first one below.
@endforelse
{{-- Add Location button --}}
{{-- end proj-body --}}
{{-- end proj-card --}} @empty
No projects yet. Add your first project above.
@endforelse
{{-- ═══════════════ Location Map Modal ═══════════════ --}}
{{-- Header --}}

{{-- Two-panel body --}}
{{-- Left: form fields --}}

Map tips:
• Click anywhere on the map to place the pin
• Drag the pin to fine-tune position
• Type an address and press or click 🔍 to find it

{{-- Right: Leaflet map --}}
Click map to place pin • Drag pin to adjust
{{-- Footer --}}
{{-- ═══════════════════════════════════════════════════ --}} @endsection