@extends('admin.layout.main') @section('admin')

Dashboard Overview

Welcome back! Here's what's happening with your platform today.

{{ now()->format('l, F j, Y') }}

Total Users

{{ $user->count() }}

{{ $user->where('created_at', '>=', now()->subDays(7))->count() }} this week

Active Projects

{{ $project->count() }}

{{ $project->where('status', 'in_progress')->count() }} in progress

Service Requests

{{ $servicesRequest->count() }}

{{ $servicesRequest->where('status', 'pending')->count() }} pending

Packages

{{ $packages->count() }}

Active packages

Blog Posts

{{ $blog->count() }}

{{ $blog->where('status', 'published')->count() }} published

Contact Messages

{{ $contacts->count() }}

{{ $contacts->where('status', 'new')->count() }} unread

Total Revenue

{{ number_format($servicesRequest->sum('total_price'), 2) }} SR

This month: {{ number_format($servicesRequest->where('created_at', '>=', now()->startOfMonth())->sum('total_price'), 2) }} SR

Recent Service Requests

View All
@forelse($servicesRequest->sortByDesc('created_at')->take(5) as $request) @php $contactInfo = $request->contact_info ; $statusColors = [ 'pending' => 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300', 'in_progress' => 'bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300', 'approved' => 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300', 'cancelled' => 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300' ]; $statusLabels = [ 'pending' => 'Pending', 'in_progress' => 'In Progress', 'approved' => 'Completed', 'cancelled' => 'Cancelled' ]; @endphp

{{ $contactInfo['name'] ?? 'Unknown' }}

{{ $request->businessType->name ?? 'N/A' }} • {{ number_format($request->total_price, 2) }} SR

{{ $statusLabels[$request->status] }}
{{ $request->created_at->diffForHumans() }} View
@empty

No service requests found

@endforelse

Recent Users

View All
@forelse($user->sortByDesc('created_at')->take(5) as $userItem)
@if($userItem->image) {{ $userItem->name }} @else @endif

{{ $userItem->name }}

{{ $userItem->email }}

@if($userItem->phone)

{{ $userItem->phone }}

@endif
{{ $userItem->created_at->format('M j') }}
@empty

No users found

@endforelse

Active Projects

View All
@forelse($project->sortByDesc('created_at')->take(5) as $projectItem) @php $progressPercentage = $projectItem->total_amount > 0 ? ($projectItem->paid_amount / $projectItem->total_amount) * 100 : 0; $statusColors = [ 'not_started' => 'bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300', 'in_progress' => 'bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300', 'completed' => 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300', 'on_hold' => 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300', 'cancelled' => 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300' ]; $statusLabels = [ 'not_started' => 'Not Started', 'in_progress' => 'In Progress', 'completed' => 'Completed', 'on_hold' => 'On Hold', 'cancelled' => 'Cancelled' ]; @endphp

{{ $projectItem->project_name }}

{{ number_format($projectItem->total_amount, 2) }} SR
Progress {{ number_format($progressPercentage, 0) }}%
{{--
{{ $projectItem->deadline ? $projectItem->deadline->format('M j') : 'No deadline' }} {{ $statusLabels[$projectItem->status] }}
--}}
@empty

No projects found

@endforelse

Recent Contact Messages

View All
@forelse($contacts->sortByDesc('created_at')->take(5) as $contact) @php $statusColors = [ 'new' => 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300', 'read' => 'bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300', 'responded' => 'bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300', 'archived' => 'bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300' ]; $statusLabels = [ 'new' => 'Unread', 'read' => 'Read', 'responded' => 'Responded', 'archived' => 'Archived' ]; @endphp

{{ $contact->name }}

{{ $contact->email }}

{{ $statusLabels[$contact->status] }}

{{ Str::limit($contact->message, 80) }}

@if($contact->service) {{ $contact->service }} @endif
{{ $contact->created_at->diffForHumans() }} View
@empty

No contact messages found

@endforelse

Recent Blog Posts

View All
@forelse($blog->sortByDesc('created_at')->take(5) as $post)
@if($post->featured_image)
{{ $post->title }}
@endif

{{ $post->title }}

{{ Str::limit(strip_tags($post->content), 100) }}

{{ $post->created_at->format('M j, Y') }} {{ ucfirst($post->status) }}
@empty

No blog posts found

@endforelse

Platform Statistics

Service Requests Status

@php $statusCounts = $servicesRequest->groupBy('status')->map->count(); $totalRequests = $servicesRequest->count(); @endphp @foreach(['pending', 'in_progress', 'completed', 'cancelled'] as $status) @if($statusCounts->has($status)) @php $percentage = $totalRequests > 0 ? ($statusCounts[$status] / $totalRequests) * 100 : 0; $colors = [ 'pending' => 'bg-yellow-500', 'in_progress' => 'bg-blue-500', 'completed' => 'bg-green-500', 'cancelled' => 'bg-red-500' ]; @endphp
{{ $status }}
{{ $statusCounts[$status] }}
@endif @endforeach

Recent Activity

{{ $user->where('created_at', '>=', now()->subDays(7))->count() }} new users this week

User registration

{{ $servicesRequest->where('status', 'completed')->count() }} completed requests

Service delivery

{{ $contacts->where('status', 'new')->count() }} unread messages

Require attention

@endsection