@extends('admin.layout') @section('title', 'PPC Spending') @section('page-title', 'PPC Spending') @section('page-icon', 'graph-up') @section('content') @php $curMonth = DateTime::createFromFormat('!m', $month)->format('F') . ' ' . $year; @endphp {{-- Month / Year Filter --}}
{{-- Stat cards --}}
Total Spending — {{ $curMonth }}
${{ number_format($totalSpending, 2) }}
Teams Tracked
{{ $teams->count() }}
Teams with Spending
{{ $teams->where('month_spending', '>', 0)->count() }}
{{-- Per-team cards --}}
@foreach($teams as $team)
{{ $team->name }}
{{ $team->company?->name ?? '—' }}
@if($team->month_spending > 0) ${{ number_format($team->month_spending, 0) }} @else No spending @endif
@if($totalSpending > 0 && $team->month_spending > 0) @php $pct = round(($team->month_spending / $totalSpending) * 100, 1); @endphp
{{ $pct }}% of total
@endif
@endforeach
{{-- Full history --}}
All Entries — {{ $curMonth }}
@forelse($spendings as $entry) @empty @endforelse @if($spendings->count() > 0) @endif
Date Team Added By Notes Amount Action
{{ $entry->created_at->format('d M Y') }} {{ $entry->team?->name ?? '-' }} {{ $entry->user?->name ?? '-' }} {{ $entry->notes ?: '-' }} ${{ number_format($entry->amount, 2) }} @if(auth()->user()->hasRole('Admin') || $entry->user_id === auth()->id())
@csrf @method('DELETE')
@endif
No entries for {{ $curMonth }}.
Total ${{ number_format($totalSpending, 2) }}
@endsection