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

Dashboard

@if (Auth::user()->role == 'admin')

{{ \App\License::where('status', '1')->where('end_at', '>=', now())->count() }}

Active Licenses

More info

{{ \App\Reseller::sum('balance') }}$

Wallet Balance

More info

{{ \App\License::where('end_at', '<=', now()->addDays(7))->where('end_at', '>', now())->count() }}

Expiring Licenses in 7 Days

More info

{{ \App\License::where('end_at', '<', now())->count() }}

Expired Licenses

More info
@else
@php $reseller_id = App\Models\Reseller::firstWhere('user_id', Auth::id())->id; @endphp

{{ \App\License::where('reseller_id', $reseller_id)->where('status', '1')->where('end_at', '>=', now())->count() }}

Active Licenses

More info

${{ App\Models\Reseller::firstWhere('user_id', Auth::id())->balance }}

Wallet Balance

More info

{{ \App\License::where('reseller_id', $reseller_id)->where('end_at', '<=', now()->addDays(7))->where('end_at', '>', now())->count() }}

Expiring Licenses in 7 Days

More info

{{ \App\License::where('reseller_id', $reseller_id)->where('end_at', '<', now())->count() }}

Expired Licenses

More info
@endif

License Purchase Graph @php echo date("Y") @endphp

@if (Auth::user()->role == 'admin') @php $licenseData = DB::table('licenses') ->select(DB::raw('COUNT(*) as total'), DB::raw("DATE_FORMAT(created_at, '%b') as month")) ->whereYear('created_at', date('Y')) ->groupBy('month') ->get(); $groupedLicenseData = []; $months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; // Initialize each month count to 0 foreach ($months as $month) { $groupedLicenseData[$month] = 0; } // Add the license counts to the corresponding months foreach ($licenseData as $data) { $groupedLicenseData[$data->month] = $data->total; } @endphp @else @php $reseller_id = App\Models\Reseller::firstWhere('user_id', Auth::id())->id; $licenseData = DB::table('licenses') ->select(DB::raw('COUNT(*) as total'), DB::raw("DATE_FORMAT(created_at, '%b') as month")) ->where('reseller_id', $reseller_id) ->whereYear('created_at', date('Y')) ->groupBy('month') ->get(); $groupedLicenseData = []; $months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; // Initialize each month count to 0 foreach ($months as $month) { $groupedLicenseData[$month] = 0; } // Add the license counts to the corresponding months foreach ($licenseData as $data) { $groupedLicenseData[$data->month] = $data->total; } @endphp @endif

Notice

@foreach($notices->take(2) as $notice)

{{ $notice->title }}

{{ $notice->content }}

Posted on: {{ $notice->created_at->format('F d, Y H:i A') }}

@endforeach @if ($notices->count() > 2) View all @endif

Active Licenses by Softwares

@if (Auth::user()->role == 'admin') @php $licenseData = DB::table('licenses') ->select( DB::raw('CASE WHEN software_id = 1 THEN "cPanel VPS" WHEN software_id = 2 THEN "Softaculous" WHEN software_id = 3 THEN "Plesk VPS" WHEN software_id = 4 THEN "CloudLinux" WHEN software_id = 6 THEN "Imunify 360" WHEN software_id = 13 THEN "cPanel DEDICATED" WHEN software_id = 17 THEN "Virtualizor Premium" WHEN software_id = 18 THEN "Sitepad" WHEN software_id = 19 THEN "Jetbackup" WHEN software_id = 20 THEN "WhmReseller" WHEN software_id = 23 THEN "LiteSpeed 2c" WHEN software_id = 46 THEN "LiteSpeed xc" WHEN software_id = 53 THEN "Webuzo" WHEN software_id = 56 THEN "LiteSpeed 8c" WHEN software_id = 58 THEN "Virtualizor Professional" WHEN software_id = 59 THEN "Plesk DEDICATED" WHEN software_id = 60 THEN "KernelCare" WHEN software_id = 61 THEN "cPnginx" WHEN software_id = 62 THEN "JetbackupMC" WHEN software_id = 70 THEN "OSM" WHEN software_id = 72 THEN "CXS" WHEN software_id = 74 THEN "Dareseller" WHEN software_id = 75 THEN "LiteSpeed 1c" WHEN software_id = 76 THEN "Directadmin" WHEN software_id = 102 THEN "AaPanel" WHEN software_id = 103 THEN "MediaCP" ELSE "Others" END AS category'), DB::raw('COUNT(*) as total'), ) ->where('end_at', '>', now()) // Add this line to filter licenses by end_at timestamp ->groupBy('category') ->get(); // Initialize the counts for each category $categoryCounts = ['cPanel VPS' => 0, 'Softaculous' => 0, 'Plesk VPS' => 0, 'CloudLinux' => 0, 'Imunify 360' => 0, 'cPanel DEDICATED' => 0, 'Virtualizor Premium' => 0, 'Sitepad' => 0, 'Jetbackup' => 0, 'WhmReseller' => 0, 'LiteSpeed 2c' => 0, 'LiteSpeed xc' => 0, 'Webuzo' => 0, 'LiteSpeed 8c' => 0, 'Virtualizor Professional' => 0, 'Plesk DEDICATED' => 0,'Webuzo' => 0, 'KernelCare' => 0, 'cPnginx' => 0, 'JetbackupMC' => 0, 'OSM' => 0, 'CXS' => 0, 'Dareseller' => 0, 'LiteSpeed 1c' => 0,'Directadmin' => 0,'AaPanel' => 0,'MediaCP' => 0,'Others' => 0]; // Calculate the sum for each category foreach ($licenseData as $data) { if (in_array($data->category, array_keys($categoryCounts))) { $categoryCounts[$data->category] += $data->total; } else { $categoryCounts['Others'] += $data->total; } } // Remove any categories that have a count of 0 $categoryCounts = array_filter($categoryCounts); // Check if $categoryCounts is empty if (empty($categoryCounts)) { // Set default values for the chart $values = [1]; $titles = ['No data available']; } else { // Prepare data for the chart $values = array_values($categoryCounts); $titles = array_keys($categoryCounts); } // Encode data as JSON $valuesJSON = json_encode($values); $titlesJSON = json_encode($titles); @endphp @else @php $reseller_id = App\Models\Reseller::firstWhere('user_id', Auth::id())->id; $licenseData = DB::table('licenses') ->select( DB::raw('CASE WHEN software_id = 1 THEN "cPanel" WHEN software_id = 23 THEN "LiteSpeed" WHEN software_id = 4 THEN "CloudLinux" ELSE "Others" END AS category'), DB::raw('COUNT(*) as total'), ) ->where('reseller_id', $reseller_id) ->where('end_at', '>', now()) // Add this line to filter licenses by end_at timestamp ->groupBy('category') ->get(); // Initialize the counts for each category $categoryCounts = ['cPanel' => 0, 'LiteSpeed' => 0, 'CloudLinux' => 0, 'Others' => 0]; // Calculate the sum for each category foreach ($licenseData as $data) { if (in_array($data->category, array_keys($categoryCounts))) { $categoryCounts[$data->category] += $data->total; } else { $categoryCounts['Others'] += $data->total; } } // Remove any categories that have a count of 0 $categoryCounts = array_filter($categoryCounts); // Check if $categoryCounts is empty if (empty($categoryCounts)) { // Set default values for the chart $values = [1]; $titles = ['No data available']; } else { // Prepare data for the chart $values = array_values($categoryCounts); $titles = array_keys($categoryCounts); } // Encode data as JSON $valuesJSON = json_encode($values); $titlesJSON = json_encode($titles); @endphp @endif
@endsection @section('endfooter')