@extends('layouts.app') @section('content')

{{ $user->name }}

View detailed user information and activity

User Personal Information

Full Name
Email Address
Phone Number
Rank
Designation
Status
Region
District
Department
Branch
Command
Role
First Login
Last Login
Last Password Change
Last Activity
Login Attempts
@if(auth()->user()->hasRole('superadmin'))

Unauthorized Access Attempts

@php $unauthorizedAccess = App\Models\UnauthorizedAccess::where('user_id', $user->id) ->orderBy('attempted_at', 'desc') ->get(); $totalAttempts = $unauthorizedAccess->count(); $todayAttempts = $unauthorizedAccess->where('attempted_at', '>=', now()->startOfDay())->count(); $thisWeekAttempts = $unauthorizedAccess->where('attempted_at', '>=', now()->startOfWeek())->count(); $thisMonthAttempts = $unauthorizedAccess->where('attempted_at', '>=', now()->startOfMonth())->count(); @endphp
{{ $totalAttempts }}
Total Attempts
{{ $todayAttempts }}
Today
{{ $thisWeekAttempts }}
This Week
{{ $thisMonthAttempts }}
This Month
@forelse($unauthorizedAccess as $attempt) @empty @endforelse
Date & Time Route Name URL Attempted Method User Role Required Roles IP Address
{{ $attempt->attempted_at->format('Y-m-d H:i:s') }} {{ $attempt->route_name }} {{ $attempt->url_attempted }} {{ $attempt->method }} {{ $attempt->user_role }} {{ $attempt->required_roles }} {{ $attempt->ip_address }}

No Unauthorized Access Attempts
This user has not attempted to access unauthorized resources.
@endif

Task Performance

@php $enquiries = App\Models\Enquiry::where('registered_by', $user->id)->get(); $enquiriesByStatus = $enquiries->groupBy('status')->map(function($group, $status) { return ['status' => ucfirst($status), 'count' => $group->count()]; })->values(); $enquiriesByType = $enquiries->groupBy('type')->map(function($group, $type) { return ['type' => ucwords(str_replace('_', ' ', $type)), 'type_key' => $type, 'count' => $group->count()]; })->values(); $totalCount = $enquiries->count(); @endphp @if($totalCount > 0)
@php $statusConfig = [ 'pending' => ['class' => 'metric-card-pending', 'icon' => 'bx-time'], 'approved' => ['class' => 'metric-card-approved', 'icon' => 'bx-check-circle'], 'rejected' => ['class' => 'metric-card-rejected', 'icon' => 'bx-x-circle'], 'assigned' => ['class' => 'metric-card-assigned', 'icon' => 'bx-user-check'], 'completed' => ['class' => 'metric-card-completed', 'icon' => 'bx-check-double'], 'pending_overdue' => ['class' => 'metric-card-overdue', 'icon' => 'bx-error'], ]; @endphp
{{ $totalCount }}
Total Enquiries
@foreach($enquiriesByStatus as $statusData) @php $statusLower = strtolower($statusData['status']); $config = $statusConfig[$statusLower] ?? ['class' => 'metric-card-total', 'icon' => 'bx-info-circle']; @endphp
{{ $statusData['count'] }}
{{ $statusData['status'] }}
@endforeach
@else

No Tasks Performed Yet

This user hasn't registered or processed any enquiries yet. Analytics and statistics will appear here once they start working on tasks.

Tip: Assign enquiries to this user to see their performance metrics.
@endif @if($totalCount > 0)
Enquiry Types
@forelse($enquiriesByType as $typeItem)
{{ $typeItem['type'] }} {{ $typeItem['count'] }}
@empty
No Enquiries Found

This user hasn't registered any enquiries yet.

@endforelse
Status Distribution
@if(count($enquiriesByStatus) > 0) @else
No Data Available

Status distribution will appear when user starts working on enquiries.

@endif
Enquiries by Type (Bar Chart)
@if(count($enquiriesByType) > 0) @else
No Data to Display

Enquiry type statistics will appear here once this user starts working.

@endif
@endif
@endsection