@extends('layouts.admin') @section('page-title', 'Client – ' . ($client->name ?? 'Unknown')) @section('page-subtitle', 'Employee-wise and entry-wise submitted conveyance for ' . ($currentMonthLabel ?? '')) @php use Illuminate\Support\Str; @endphp @section('content')

{{ $client->name ?? 'Unknown Client' }}

Period: {{ $currentMonthLabel }}  •  Submitted entries only

{{-- Export Summary --}} Export Summary {{-- Export Detailed --}} Export Day-wise (Sheet/Emp) {{-- Back Button --}} Back to Summary
@if($client->city) City: {{ $client->city }} @endif {{-- totalAmount already onward + return/custom from controller --}} Total Amount: ₹ {{ number_format($totalAmount, 2) }} Entries: {{ $totalEntries }} Employees: {{ $employeeCount }}
@if($rows->isEmpty())
No submitted conveyance entries found for this client in {{ $currentMonthLabel }}.
@else {{-- EMPLOYEE SUMMARY + INLINE VERIFICATION --}}
{{-- Header + Controls --}}

Employee-wise Summary

Click on a row to expand and verify detailed entries for this client in {{ $currentMonthLabel }}.

🔍
{{-- Table: summary + inline detail rows --}}
@foreach($employeeGroups as $userId => $empItems) @php $user = $empItems->first()->user; $empName = $user->name ?? 'Unknown'; $empEmail = $user->email ?? ''; // effective per-employee total (onward + return/custom) $empAmount = $empItems->sum(function($c) { $onward = (float) $c->amount; if ($c->is_return) { $return = $c->return_amount !== null ? (float) $c->return_amount : $onward; return $onward + $return; } return $onward; }); $empCount = $empItems->count(); @endphp {{-- SUMMARY ROW --}} {{-- DETAIL ROW (INLINE, COLLAPSIBLE) --}} @endforeach @if($employeeGroups->isEmpty()) @endif
Employee Email Amount (₹) Entries Details
{{ Str::upper(Str::substr($empName, 0, 2)) }}
{{ $empName }}
User ID: {{ $userId }}
{{ $empEmail }} ₹ {{ number_format($empAmount, 2) }} {{ $empCount }}
No employees have submitted conveyance for this client in {{ $currentMonthLabel }}.
@endif @endsection @section('scripts') @endsection