@php /* | Requires in scope: $package (with licenses_count), $badges, $totalLicenses. | Everything is derived from the collection the controller loaded — no row | here costs a query. */ $isCustom = $package->duration_days === null; $perDay = (! $isCustom && $package->price > 0) ? $package->price / $package->duration_days : null; $share = $totalLicenses > 0 ? $package->licenses_count / $totalLicenses * 100 : 0; $inUse = $package->licenses_count > 0; $billingLabels = [ 'monthly' => 'Monthly', 'quarterly' => 'Quarterly', 'semiannual' => 'Semiannual', 'annual' => 'Annual', 'custom' => 'Custom', ]; @endphp {{-- Package: name, what it is, and the labels this catalogue earns from its own numbers. --}}
! $isCustom, 'bg-slate-100 text-slate-500 ring-slate-500/20 dark:bg-white/5 dark:text-slate-300 dark:ring-white/10' => $isCustom, ]) aria-hidden="true"> @foreach ($badges as $badge) {{ $badge['label'] }} @endforeach {{ $billingLabels[$package->billing_period] ?? ucfirst($package->billing_period) }} · {{ $isCustom ? 'term set per license' : $package->duration_days.'-day term' }}
{{ $isCustom ? 'Custom' : $package->duration_days.' days' }} {{-- Price leads with the figure; the daily rate underneath is what actually lets two packages be compared. --}} @if ($package->price > 0) Rs {{ number_format($package->price) }} {{ $perDay ? 'Rs '.number_format($perDay, 2).' / day' : 'One-time' }} @else Rs 0 Quoted per license @endif {{ number_format($package->licenses_count) }} {{-- Share of every licence ever issued. A bar with nothing in it is still information: this package has never been sold. --}} {{ round($share) }}% {{ $package->created_at?->format('d M Y') ?? '—' }} {{ $package->created_at?->format('H:i') }} View details Edit Duplicate
{{-- Straight to the licence form. It does not read a package from the query string, so no parameter is passed rather than one that would quietly do nothing. --}} Assign a license
@if ($package->is_active) Deactivate @else Activate @endif {{-- Deleting a package that has licences is refused by the server. Saying so here is better than letting someone find out from a red banner after the click. --}} @if ($inUse) Delete ({{ $package->licenses_count }} in use) @else
@csrf @method('DELETE') Delete
@endif