@extends('layouts.app') @section('title', $project->name) @section('back', route('projects.index')) @section('content') @php $profit = $financials['profit_total']; $margin = $financials['margin_percentage']; $budgetUsed = $financials['budget_used_percentage']; $pc = $profit < 0 ? 'text-red-500' : 'text-emerald-600'; $badgeClass = match ($project->status) { 'On Track' => 'g', 'At Risk' => 'r', 'Completed' => 's', 'On Hold' => 'v', default => 'a', }; $barClass = match ($project->status) { 'At Risk' => 'bg-red-400', 'Completed' => 'bg-slate-400', 'On Hold' => 'bg-violet-400', default => 'bg-blue-500', }; @endphp
{{ $project->status }} {{ $project->location ?? 'TBD' }} Started {{ $project->start_date?->format('M Y') ?? 'TBD' }}

{{ $project->name }}

Client: {{ $project->client?->company_name ?? 'TBD' }}  ·  Due: {{ $project->due_date?->format('M Y') ?? 'TBD' }}

Invoices: {{ \App\Support\Format::mwk($financials['invoice_total']) }} total · {{ \App\Support\Format::mwk($financials['paid_invoice_total']) }} paid · {{ \App\Support\Format::mwk($financials['outstanding_invoice_total']) }} outstanding

Contract value

{{ \App\Support\Format::mwk($project->contract_value) }}

Budget

{{ \App\Support\Format::mwk($project->budget) }}

Amount spent

{{ \App\Support\Format::mwk($financials['spent_total']) }}

Income

{{ \App\Support\Format::mwk($financials['income_total'], true) }}

Profit / Loss

{{ \App\Support\Format::mwk($profit, true) }}

Margin

{{ ($margin >= 0 ? '+' : '') . $margin }}%

Overall progress

{{ $project->progress_percentage }}%
Budget used: {{ $budgetUsed }}% @if($budgetAheadOfProgress) Budget use is well ahead of recorded completion — review spend. @endif Due: {{ $project->due_date?->format('M Y') ?? 'TBD' }}
@if($invoiceByStatus->isNotEmpty())

Invoice status

@foreach($invoiceByStatus as $row) {{ $row->status }}: {{ $row->cnt }} ({{ \App\Support\Format::mwk($row->total) }}) @endforeach
@endif

Project team

@forelse($team as $emp)
{{ $emp->initials }}

{{ $emp->name }}

{{ $emp->job_title }}

@empty

No team members assigned

@endforelse

Recent transactions

All in finance
@forelse($transactions as $t)

{{ $t->description }}

{{ $t->transaction_date?->format('M j') }}

{{ \App\Support\Format::mwk($t->amount, $t->transaction_type === 'Income') }}
@empty

No recent transactions

@endforelse
@endsection @push('scripts') @endpush