@php
// Helper function to return colors based on percentage
$getStatusColor = function($percentage) {
if ($percentage >= 90) {
return [
'bar' => '#ef4444', // Red
'badge_bg' => '#fef2f2',
'badge_text' => '#b91c1c'
];
} elseif ($percentage >= 70) {
return [
'bar' => '#f59e0b', // Orange
'badge_bg' => '#fffbeb',
'badge_text' => '#b45309'
];
} else {
return [
'bar' => '#10b981', // Green
'badge_bg' => '#ecfdf5',
'badge_text' => '#047857'
];
}
};
@endphp
@php
$storageUsed = (float) Session::get("total_size_used", 0);
$storageMax = (float) Session::get("plan_storage", 0);
$storagePer = $storageMax > 0 ? min(100, round(($storageUsed / $storageMax) * 100)) : 0;
$storageColor = $getStatusColor($storagePer);
@endphp
{{ $storageUsed }} MB
Limit: {{ $storageMax }} MB
@php
$usersUsed = (int) Session::get("total_user", 0);
$planUsersRaw = Session::get("plan_users", 0);
$isUnlimitedU = ($planUsersRaw == 10000 || $planUsersRaw <= 0);
$userPer = !$isUnlimitedU && $planUsersRaw > 0 ? min(100, round(($usersUsed / $planUsersRaw) * 100)) : 0;
$userColor = $getStatusColor($userPer);
@endphp
{{ $isUnlimitedU ? 'Unlimited' : $userPer.'%' }}
{{ $usersUsed }} Active
Limit: {{ $isUnlimitedU ? 'Unlimited' : $planUsersRaw.' seats' }}
@php
$tplUsed = (int) Session::get("template_count", 0);
$planTplRaw = Session::get("plan_templates", 0);
$isUnlimitedT = ($planTplRaw == 10000 || $planTplRaw <= 0);
$tplPer = !$isUnlimitedT && $planTplRaw > 0 ? min(100, round(($tplUsed / $planTplRaw) * 100)) : 0;
$tplColor = $getStatusColor($tplPer);
@endphp
{{ $isUnlimitedT ? 'Unlimited' : $tplPer.'%' }}
{{ $tplUsed }} Created
Limit: {{ $isUnlimitedT ? 'Unlimited' : $planTplRaw.' max' }}
@php
$apiUsed = (int) ($api_credit_used ?? 0);
$apiMax = (int) ($plan_api_credit ?? 0);
$apiPer = $apiMax > 0 ? min(100, round(($apiUsed / $apiMax) * 100)) : 0;
$apiColor = $getStatusColor($apiPer);
@endphp
{{ number_format($apiUsed) }} Calls
Limit: {{ number_format($apiMax) }} max