@extends('layouts.app') @section('title', $client->company_name) @section('page', 'clients') @section('content') @php $owner = $contacts->first(); $nextDue = $open->sortBy('due_date')->first(); $u = auth()->user(); @endphp All clients
{{ av($client, 'lg', true) }}

{{ $client->company_name }} {{ match ($client->status) { 'active' => badge('Active', 'b-green'), 'onboarding' => badge('Onboarding', 'b-blue'), default => badge('Inactive') } }}

Client since {{ $client->client_since?->format('F Y') }}.@if ($owner) Main contact {{ $owner->name }}, {{ $owner->email }}@endif

@csrf
Message @if ($u->allows('manage_invoices'))Create invoice@endif
Active projects
{{ $client->projects->where('status', '!=', 'completed')->count() }}
Billed to date
{{ money($billed) }}
Outstanding
{{ money($open->sum(fn ($i) => $i->balance())) }}
@if ($nextDue)
Due {{ d_short($nextDue->due_date) }}
@endif
Avg. approval time
{{ $avgApproval !== null ? $avgApproval.' days' : 'None yet' }}
@forelse ($client->projects->sortBy(fn ($p) => $p->status === 'completed') as $p) @empty @endforelse
ProjectManagerProgressDueStatus
{{ $p->name }}{{ $p->manager?->name }}
{{ $p->progress }}%
{{ $p->due_date ? d_long($p->due_date) : 'TBC' }}@php [$l, $c] = $p->adminBadge(); @endphp{{ badge($l, $c) }}
No projects yet.@if ($u->allows('manage_projects')) Create the first one.@endif
@forelse ($client->invoices->sortByDesc('number') as $inv) @empty @endforelse
InvoiceProjectDueAmountStatus
{{ $inv->number }}{{ $inv->project?->name }}{{ $inv->due_date ? d_short($inv->due_date) : '' }}{{ money($inv->total, $inv->currency) }}@php [$l, $c] = $inv->adminBadge(); @endphp{{ badge($l, $inv->isOpen() && ! $inv->isOverdue() ? 'b-amber' : $c) }}
No invoices yet.
@foreach ($contacts as $c) @php $rights = collect([$c->job_title, $c->is_client_owner ? 'owner' : null, $c->can_approve && $c->can_see_invoices ? 'can approve and pay' : ($c->can_approve ? 'can approve' : ($c->can_see_invoices ? 'sees invoices' : null))])->filter()->implode(', '); @endphp
{{ av($c) }}
{{ $c->name }}
{{ ucfirst($rights) }}
@if ($c->status === 'invited'){{ badge('Invite sent', 'b-amber') }}@else{{ $c->phone ?: $c->email }}@endif
@endforeach @if ($invite)
Pending invitation link (demo): {{ route('invite.show', $invite->token) }}
@endif

Only your team can see these notes.

@foreach ($client->notes as $n)
{{ av($n->user, 'sm') }}
{{ $n->user->name }}

{{ $n->body }}

@endforeach
@csrf
@if ($u->allows('manage_projects')) @include('admin.partials.project-modal', ['clientsForModal' => collect([$client]), 'selectedClient' => $client->id, 'managers' => \App\Models\User::where('agency_id', $u->agency_id)->where('type', 'staff')->where('status', 'active')->whereIn('role', ['admin', 'project_manager', 'team_member'])->get()]) @endif @endsection