@extends('admin.layouts.app') @section('title', get_setting('site_name').' | '.__('Asset assign report')) @include('admin.asset.partials.page_styles') @php use App\Support\Asset\AssetType; @endphp @push('css') @endpush @section('content')

{{ __('Asset assign report') }}

{{ __('View assigned assets by employee. Search one person or browse employees with active assignments.') }}

{{ __('Assignment list') }} @if(in_array($reportMode, ['single', 'all'], true)) @endif
{{ $stats['total_assignments'] ?? 0 }}
{{ __('Active assignments') }}
{{ $stats['employees_with_assets'] ?? 0 }}
{{ __('Employees with assets') }}
{{ $stats['pending_ack'] ?? 0 }}
{{ __('Pending acknowledgment') }}
{{ __('Report filters') }}
{{ __('Reset') }}
@if($reportMode === 'landing')
{{ __('Select an employee to view their report') }}

{{ __('Search one employee, or choose “All employees with assignments” for a paginated list. Loading all :count employees at once is avoided for better performance.', ['count' => number_format($stats['employees_with_assets'] ?? 0)]) }}

@elseif($reportMode === 'single' && $selectedStaff)
{{ $selectedStaff->user?->name ?? __('Unknown') }}
{{ __('Employee ID') }}: {{ $selectedStaff->user?->id ?? '—' }} · {{ __('Branch') }}: {{ $selectedStaff->warehouse?->name ?? '—' }} · {{ __('Assets') }}: {{ $assignments->count() }}
@if($assignments->isNotEmpty()) @include('admin.asset.partials.assign_report_rows', ['assignments' => $assignments]) @else @endif
{{ __('Category') }} {{ __('Asset') }} {{ __('Serial / code') }} {{ __('Type') }} {{ __('Qty') }} {{ __('Assigned') }} {{ __('Ack.') }} {{ __('Usage') }}
@include('no_record_found')
@elseif($reportMode === 'all' && $staffPage)

{{ __('Showing employees with active assignments') }} @if($staffPage->total() > 0) — {{ $staffPage->firstItem() }}–{{ $staffPage->lastItem() }} {{ __('of') }} {{ $staffPage->total() }} @endif

@forelse($staffPage as $staff) @php $staffAssignments = $assignmentsByStaff->get($staff->id, collect()); @endphp
{{ $staff->user?->name ?? __('Unknown') }} ID {{ $staff->user?->id ?? '—' }} · {{ $staff->warehouse?->name ?? '—' }}
{{ $staffAssignments->count() }} {{ __('assets') }}
@include('admin.asset.partials.assign_report_rows', ['assignments' => $staffAssignments])
{{ __('Category') }} {{ __('Asset') }} {{ __('Serial / code') }} {{ __('Type') }} {{ __('Qty') }} {{ __('Assigned') }} {{ __('Ack.') }} {{ __('Usage') }}
@empty

{{ __('No employees with active assignments match your filters.') }}

@endforelse @if($staffPage->hasPages())
{{ $staffPage->links() }}
@endif @endif
@endsection @section('script') @include('admin.asset.partials.scripts') @endsection