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

Projects, Locations & Departments

Manage projects with their sub-locations and departments.

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

{{-- Build location + department data maps for safe JS passing --}} @php $allLocsData = []; $allDeptsData = []; 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, ]; } foreach ($proj->departments as $dept) { $allDeptsData[$dept->id] = [ 'id' => $dept->id, 'name' => $dept->name, 'is_active' => $dept->is_active, ]; } } $allLocsJson = json_encode($allLocsData); $allDeptsJson = json_encode($allDeptsData); @endphp {{-- Projects accordion --}}
@forelse($projects as $project)
{{-- Header --}}
{{ $project->name }} Inactive {{ $project->locations->count() }} {{ Str::plural('location', $project->locations->count()) }}
{{-- Project edit form --}}

{{-- Body --}}
{{-- ── Locations column ── --}}
Locations
@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.
@endforelse
{{-- ── Departments column ── --}}
Departments
{{-- Inline add row --}}
@forelse($project->departments as $dept)
{{-- View row --}}
{{ $dept->name }} Inactive
{{-- Inline edit row --}}
@empty
No departments yet.
@endforelse
{{-- end proj-body-inner --}}
{{-- 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