@include('hk.header')
User Activity Report
{{-- Filter Form --}}
{{-- Data Table --}}
User Name |
Date |
No. of Companies Added |
No. of Products Added |
@php
$grandTotalCompanies = 0;
$grandTotalProducts = 0;
@endphp
@foreach ($users as $user)
@php
$dates = collect([...$user->companies, ...$user->products])
->pluck('date')
->unique()
->sort();
@endphp
@foreach ($dates as $index => $date)
@php
$companyCount = $user->companies->firstWhere('date', $date)->companies_count ?? 0;
$productCount = $user->products->firstWhere('date', $date)->products_count ?? 0;
$grandTotalCompanies += $companyCount;
$grandTotalProducts += $productCount;
@endphp
@if ($index === 0)
{{ $user->name }} |
@endif
{{ $date }} |
{{ $companyCount }} |
{{ $productCount }} |
@endforeach
@endforeach
Total |
{{ $grandTotalCompanies }} |
{{ $grandTotalProducts }} |
@include('hk.footer')