@php use App\Services\PlanMapper; $isGuest = (bool) ($isGuest ?? false); $planName = $isGuest ? 'Starter' : ($user->subscription?->plan?->name ?? 'Starter'); $planDisplayName = plan_display_name($planName); $now = \carbon\Carbon::now(); $expire = (! $isGuest && $user->subscription?->expired_at) ? \carbon\Carbon::create($user->subscription->expired_at) : null; // Guests are on free Starter — show Subscribe / trial CTAs (not disabled Active). $planExpired = $isGuest ? false : ($expire ? $now->greaterThanOrEqualTo($expire) : true); // Check if plan is monthly (supports both old and new names) $isMonthly = PlanMapper::isPlan($planName, ['Pro Monthly', 'Multi Pro Monthly', 'Reply Monthly', 'Invite Reply Monthly']); // For new plan names (Reply, Invite Reply), check the subscription duration if (!$isMonthly && $expire && in_array($planName, ['Reply', 'Invite Reply']) && isset($user->subscription->started_at)) { $started = \carbon\Carbon::create($user->subscription->started_at); $daysDiff = $started->diffInDays($expire); // If subscription is around 30-35 days, it's monthly. If around 365+ days, it's yearly $isMonthly = $daysDiff <= 45; // Monthly plans are typically 30-31 days, give some buffer } $isOnInviteOrAgency = ! $isGuest && PlanMapper::isPlan($planName, [ 'Multi Pro Monthly', 'Multi Pro Yearly', 'Invite Reply', 'Multi Pro Trial', 'Invite Reply Trial', 'Agency / Reseller', ]) && !$planExpired; $isStarter = $isGuest || PlanMapper::isStarterPlan($planName) || $user?->subscription?->plan?->name === null; $planTitle = $isGuest ? 'Starter — Free' : ($user->subscription?->plan?->name === null ? 'No plan' : ($isStarter ? 'Starter — Free' : $planDisplayName)); if ($isGuest) { $planSub = '25 invites · 5 replies a month · no card on file'; } elseif ($user->subscription?->plan?->name === null) { $planSub = 'Subscribe to a plan below to get started'; } elseif ($isStarter) { $planSub = '25 invites · 5 replies a month · no card on file'; } elseif ($expire) { $planSub = 'Active until '.$expire->toDayDateTimeString(); } else { $planSub = 'Active subscription'; } @endphp
{{-- Current plan strip --}}
Current plan
{{ $planTitle }}
{{ $planSub }}
0/25
Invites
0/5
Replies
{{-- Coverage nudge when appointments exceed free/invite cover --}} @if (!$isOnInviteOrAgency) @endif @include('dashboard.v2.pricing-plans', [ 'idPrefix' => 'dashv2', 'planName' => $planName, 'planExpired' => $planExpired, 'isMonthly' => $isMonthly, ])
@include('dashboard.v2.pricing-plans-scripts', ['idPrefix' => 'dashv2'])