@if ($countPlans > 0)
@php
$plans = [
[
'count' => $weeklyPlans->count(),
'id' => 'week-tab',
'target' => '#pills-week',
'label' => 'Weekly',
],
[
'count' => $monthlyPlans->count(),
'id' => 'month-tab',
'target' => '#pills-month',
'label' => 'Monthly',
],
[
'count' => $yearlyPlans->count(),
'id' => 'year-tab',
'target' => '#pills-year',
'label' => 'Yearly',
],
[
'count' => $lifetimePlans->count(),
'id' => 'lifetime-tab',
'target' => '#pills-lifetime',
'label' => 'Lifetime',
],
];
$availablePlans = array_filter($plans, function ($plan) {
return $plan['count'] > 0;
});
$activePlan = $availablePlans ? reset($availablePlans) : null;
$showSwitcher = count($availablePlans) > 1;
@endphp
@if ($showSwitcher)
@foreach ($plans as $plan)
@if ($plan['count'] > 0)
@endif
@endforeach
@endif
@php
$firstAvailableTab = null;
if ($weeklyPlans->count() > 0) {
$firstAvailableTab = 'pills-week';
} elseif ($monthlyPlans->count() > 0) {
$firstAvailableTab = 'pills-month';
} elseif ($yearlyPlans->count() > 0) {
$firstAvailableTab = 'pills-year';
} elseif ($lifetimePlans->count() > 0) {
$firstAvailableTab = 'pills-lifetime';
}
@endphp
@if ($weeklyPlans->count() > 0)
@foreach ($weeklyPlans as $plan)
@include('themes.basic.partials.plan', ['plan' => $plan])
@endforeach
@endif
@if ($monthlyPlans->count() > 0)
@foreach ($monthlyPlans as $plan)
@include('themes.basic.partials.plan', ['plan' => $plan])
@endforeach
@endif
@if ($yearlyPlans->count() > 0)
@foreach ($yearlyPlans as $plan)
@include('themes.basic.partials.plan', ['plan' => $plan])
@endforeach
@endif
@if ($lifetimePlans->count() > 0)
@foreach ($lifetimePlans as $plan)
@include('themes.basic.partials.plan', ['plan' => $plan])
@endforeach
@endif