@extends('layouts.app') @section('mobile-title', $project->name) @section('mobile-subtitle', $project->code.' · '.$project->location) @section('mobile-back', route('projects.index')) @if ($project->status === 'active') @section('mobile-action-url', route('reports.create', ['project_id' => $project->id])) @section('mobile-action-icon', 'add') @section('mobile-action-label', 'New report') @endif @section('content') @php $reports = $project->reports->sortByDesc('work_date'); $totalReports = $project->reports->count(); $approvedReports = $project->reports->where('status', \App\Models\Report::STATUS_APPROVED)->count(); $submittedReports = $project->reports->where('status', \App\Models\Report::STATUS_SUBMITTED)->count(); $completion = $totalReports > 0 ? round(($approvedReports / $totalReports) * 100) : 0; $lead = $project->supervisors->first() ?: $project->technicians->first(); $galleryPhotos = $reports ->flatMap(fn ($report) => $report->photos->map(fn ($photo) => ['photo' => $photo, 'report' => $report])) ->take(8); $featuredPhoto = $galleryPhotos->first(); @endphp
{{ $project->client_name }} @include('partials.status-badge', ['status' => $project->status])

{{ $project->name }}

ID: {{ $project->code }} · {{ $project->location }}

@if (auth()->user()->isAdmin()) Export Data Edit Project @if ($project->status !== 'archived')
@csrf
@endif @can('delete', $project)
@csrf @method('DELETE')
@endcan @endif @if ($project->status === 'active') New report @endif
@if ($featuredPhoto) {{ $featuredPhoto['photo']->original_name }}
Latest site photo
{{ $featuredPhoto['report']->title }}
{{ $featuredPhoto['report']->work_date->format('M j, Y') }} · {{ $featuredPhoto['photo']->caption ?: $featuredPhoto['photo']->original_name }}
@else
photo_camera

No project photos yet

Photos uploaded through field reports will appear here automatically.

@endif

Project Gallery

{{ $galleryPhotos->count() }} recent photo{{ $galleryPhotos->count() === 1 ? '' : 's' }} from field reports

@if ($project->status === 'active') @endif
@forelse ($galleryPhotos->skip($featuredPhoto ? 1 : 0)->take(6) as $item) {{ $item['photo']->original_name }}
{{ $item['report']->reference_number }}
{{ $item['photo']->caption ?: $item['report']->work_date->format('M j') }}
@empty
Upload photos on a site report to build this gallery.
@endforelse
Timeline
calendar_month
{{ $completion }}% complete
{{ optional($project->ends_on)->format('M j') ?: 'No handover date' }} handover
Compliance
verified
{{ $approvedReports }}/{{ max($totalReports, 1) }} {{ $completion }}%
Reports approved
Safety
health_and_safety
{{ max(1, 14 - $submittedReports) }} Days
Incident free estimate
Activity
analytics
{{ $totalReports }}
Site reports logged

Recent Field Reports

View All

Resource Allocation

@foreach ([['Structural Team', 24, 25, 'bg-emerald-800'], ['Electrical Team', 12, 15, 'bg-blue-700'], ['Plumbing Team', 8, 8, 'bg-emerald-800']] as [$label, $present, $total, $color])
{{ $label }} {{ $present }} / {{ $total }} Present
@endforeach
@endsection