@extends('layouts.app') @section('title', 'Dashboard - ISP ERP System') @section('styles') @endsection @section('page-title', 'Dashboard') @section('content')

Welcome back, {{ Auth::user()->name ?? 'Admin' }}!

Here's what's happening with {{ Auth::user()->company_name ?? Auth::user()->branch->name ?? 'your ISP' }} business today. {{ date('l, F j, Y') }}

@php $upcomingPaymentsQuery = \App\Models\SalesPaymentSchedule::whereHas('salesInvoice'); // If user is a reseller, filter by their invoices only if (Auth::user() && Auth::user()->role === 'reseller') { $upcomingPaymentsQuery->whereHas('salesInvoice', function($query) { $query->where('customer_id', Auth::id()); }); } $upcomingPaymentsCount = $upcomingPaymentsQuery ->where('expected_payment_date', '>=', now()) ->where('expected_payment_date', '<=', now()->addDays(7)) ->whereNull('paid_on') ->count(); @endphp @if($upcomingPaymentsCount > 0) {{ $upcomingPaymentsCount }} @endif
@php $pendingRequestsCount = \App\Models\ClientRequest::where('status', '!=', 'completed')->count(); @endphp @if($pendingRequestsCount > 0) {{ $pendingRequestsCount }} @endif
@php $currentUser = Auth::user(); $isEmployee = !($isSuperAdmin ?? false) && $currentUser->role !== 'admin' && $currentUser->role !== 'reseller'; $isAdmin = $currentUser->role === 'admin'; $showAssignedTicketButton = $isEmployee || $isAdmin || ($isSuperAdmin ?? false); @endphp @if($showAssignedTicketButton)
@if(isset($assignedTicketsCount) && $assignedTicketsCount > 0) {{ $assignedTicketsCount }} @endif
@endif
@if(in_array('client_stats', $dashboardContains) || empty($dashboardContains))
🏒

{{ ($activeBranches ?? 0) + ($activeUsers ?? 0) }}

Active Branch & User

βœ… {{ $activeBranches ?? 0 }} branches, {{ $activeUsers ?? 0 }} users
πŸ‘₯

{{ $totalClients ?? 0 }}

Total Clients

πŸ“ˆ {{ $totalClients ?? 0 }} total clients
βœ…

{{ $activeClients ?? 0 }}

Active Clients

βœ… {{ $activeClients ?? 0 }} active clients
πŸ“Ά

{{ $onlineClients ?? 0 }}

Online Clients

πŸ“Ά {{ $onlineClients ?? 0 }} clients connected
@endif @if(in_array('revenue_stats', $dashboardContains) || empty($dashboardContains))
πŸ–₯️

{{ $activeServers ?? 0 }}

Active Servers

πŸ–₯️ {{ $activeServers ?? 0 }} routers online
⏸️

{{ $suspendedClients ?? 0 }}

Suspended Clients

⏸️ {{ $suspendedClients ?? 0 }} clients suspended
πŸ’°

${{ number_format($monthlyRevenue ?? 0, 2) }}

Monthly Revenue

πŸ’° ${{ number_format($monthlyRevenue ?? 0, 2) }} monthly revenue
⏰

{{ $pendingBills ?? 0 }}

Pending Bills

πŸ“„ {{ $pendingBills ?? 0 }} pending bills
@endif @if(in_array('new_clients', $dashboardContains) || empty($dashboardContains))
New Clients (Last 7 Days)
@if($newClients->count() > 0)
@foreach($newClients as $client) @endforeach
Client Name Username Package Branch Status Joined Date Action
{{ $client->name }}
{{ $client->phone ?? 'No phone' }}
{{ $client->username }} @if($client->package_name) {{ $client->package_name }}
${{ number_format($client->package_price, 2) }} @else No package @endif
@if($client->branch) {{ $client->branch->name }} @else No branch @endif @if($client->status === 'active') Active @elseif($client->status === 'suspended') Suspended @else {{ ucfirst($client->status) }} @endif
{{ $client->created_at->format('M d, Y') }}
{{ $client->created_at->format('h:i A') }}
@else
No New Clients

No new clients have been added in the last 7 days.

Add New Client
@endif
@endif @if(in_array('revenue_stats', $dashboardContains) || empty($dashboardContains))
Revenue Trend (Last 12 Months)
Client Distribution
@endif
@if(in_array('quick_actions', $dashboardContains) || empty($dashboardContains)) @endif @if(in_array('recent_activities', $dashboardContains) || empty($dashboardContains))
Recent Activity
Activity User Time Status
New client registered
John Doe 2 minutes ago Completed
Payment received
Jane Smith 15 minutes ago Completed
Server maintenance
System 1 hour ago In Progress
Client sync completed
Admin 2 hours ago Completed
Monthly bills generated
System 3 hours ago Completed
@endif
System Status
Web Server
Database
MikroTik API
Email Service
Database Management
Downloads a complete backup of the laravel_app database as ZIP file
Recent Alerts
System Update: New features have been deployed successfully.
Maintenance: Scheduled maintenance in 2 hours.
Backup: Daily backup completed successfully.
@endsection @section('scripts') @endsection