114 lines
5.8 KiB
PHP
114 lines
5.8 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('content')
|
|
<section class="portal-header">
|
|
<div>
|
|
<span class="eyebrow">Account</span>
|
|
<h1>My licences</h1>
|
|
<p class="lead compact">Manage subscriptions, licence keys and activated Macs.</p>
|
|
</div>
|
|
<a class="btn btn-secondary" href="{{ route('buy') }}">Buy another licence</a>
|
|
</section>
|
|
|
|
@php
|
|
$activeLicences = $licenses->filter(fn ($license) => $license->is_usable);
|
|
$historyLicences = $licenses->reject(fn ($license) => $license->is_usable);
|
|
@endphp
|
|
|
|
@if($activeLicences->isEmpty())
|
|
<div class="empty-state">
|
|
<h2>No active licences</h2>
|
|
<p>No active Rsync Studio licence is associated with {{ auth()->user()->email }}.</p>
|
|
<a class="btn" href="{{ route('buy') }}">Choose a plan</a>
|
|
</div>
|
|
@else
|
|
<div class="licence-list">
|
|
@foreach($activeLicences as $license)
|
|
@php
|
|
$activeCount = $license->activations->whereNull('deactivated_at')->count();
|
|
$isDuplicatePersonal = $hasProfessional && $license->edition === 'Personal';
|
|
$billing = str_contains(strtolower((string) optional($license->product)->code), 'annual') ? 'Annual' : 'Monthly';
|
|
@endphp
|
|
<article class="licence-card {{ $license->edition === 'Professional' ? 'licence-card-featured' : '' }}">
|
|
<div class="licence-main">
|
|
<div class="licence-title-row">
|
|
<div>
|
|
<div class="badge-row">
|
|
<span class="status-badge status-active">Active</span>
|
|
<span class="plan-badge">{{ $license->edition }}</span>
|
|
<span class="billing-badge">{{ $billing }}</span>
|
|
</div>
|
|
<h2>Rsync Studio {{ $license->edition }}</h2>
|
|
<p class="muted licence-key">Licence ending <strong>{{ $license->license_key_last4 }}</strong></p>
|
|
</div>
|
|
<a class="btn btn-secondary" href="{{ route('portal.show', $license) }}">Manage licence</a>
|
|
</div>
|
|
|
|
<div class="licence-stats">
|
|
<div>
|
|
<span class="stat-label">Macs activated</span>
|
|
<strong>{{ $activeCount }} of {{ $license->activation_limit }}</strong>
|
|
</div>
|
|
<div>
|
|
<span class="stat-label">Subscription</span>
|
|
<strong>{{ ucfirst($license->subscription_status ?: 'active') }}</strong>
|
|
</div>
|
|
<div>
|
|
<span class="stat-label">{{ $license->subscription_status === 'trialing' ? 'Trial ends' : 'Renews' }}</span>
|
|
<strong>{{ optional($license->current_period_ends_at)->format('j M Y') ?: '—' }}</strong>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="activation-meter" aria-label="{{ $activeCount }} of {{ $license->activation_limit }} Macs activated">
|
|
<span style="width: {{ min(100, ($activeCount / max(1, $license->activation_limit)) * 100) }}%"></span>
|
|
</div>
|
|
|
|
@if($isDuplicatePersonal)
|
|
<div class="subscription-warning">
|
|
<div>
|
|
<strong>You already have an active Professional subscription.</strong>
|
|
<p>This Personal plan is a separate Paddle subscription and could be billed separately. Cancel it if it was only created while upgrading.</p>
|
|
</div>
|
|
<form method="post" action="{{ route('portal.cancel', $license) }}" onsubmit="return confirm('Cancel this Personal subscription immediately in Paddle? This cannot be undone.');">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button class="danger">Cancel Personal</button>
|
|
</form>
|
|
</div>
|
|
@elseif($license->edition === 'Personal')
|
|
<div class="upgrade-strip">
|
|
<div>
|
|
<strong>Need more Macs?</strong>
|
|
<span>Upgrade this subscription to Professional for up to 3 Macs.</span>
|
|
</div>
|
|
<form method="post" action="{{ route('portal.upgrade', $license) }}" onsubmit="return confirm('Upgrade this existing Paddle subscription to Professional now? Paddle will prorate the change.');">
|
|
@csrf
|
|
<button>Upgrade to Professional</button>
|
|
</form>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</article>
|
|
@endforeach
|
|
</div>
|
|
@endif
|
|
|
|
@if($historyLicences->isNotEmpty())
|
|
<details class="history-panel">
|
|
<summary>Licence history <span>{{ $historyLicences->count() }}</span></summary>
|
|
<div class="history-list">
|
|
@foreach($historyLicences as $license)
|
|
<div class="history-row">
|
|
<div>
|
|
<strong>Rsync Studio {{ $license->edition }}</strong>
|
|
<span>Licence ending {{ $license->license_key_last4 }}</span>
|
|
</div>
|
|
<div class="history-status">{{ ucfirst($license->subscription_status ?: ($license->revoked_at ? 'revoked' : 'unavailable')) }}</div>
|
|
<a href="{{ route('portal.show', $license) }}">Details</a>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</details>
|
|
@endif
|
|
@endsection
|