Files
2026-09-09 16:10:28 +01:00

81 lines
4.0 KiB
PHP

@extends('layouts.app')
@section('content')
@php
$activeActivations = $license->activations->whereNull('deactivated_at');
$billing = str_contains(strtolower((string) optional($license->product)->code), 'annual') ? 'Annual' : 'Monthly';
@endphp
<a class="back-link" href="{{ route('portal.index') }}">← My licences</a>
<section class="licence-detail-head">
<div>
<div class="badge-row">
<span class="status-badge {{ $license->is_usable ? 'status-active' : 'status-inactive' }}">{{ $license->is_usable ? 'Active' : 'Unavailable' }}</span>
<span class="plan-badge">{{ $license->edition }}</span>
<span class="billing-badge">{{ $billing }}</span>
</div>
<h1>Rsync Studio {{ $license->edition }}</h1>
<p class="muted">Licence ending <strong>{{ $license->license_key_last4 }}</strong></p>
</div>
<form method="post" action="{{ route('portal.resend', $license) }}">
@csrf
<button class="btn-secondary">Email licence key</button>
</form>
</section>
<div class="detail-grid">
<section class="panel">
<div class="panel-heading">
<div>
<h2>Activated Macs</h2>
<p>{{ $activeActivations->count() }} of {{ $license->activation_limit }} activation slots in use.</p>
</div>
<span class="activation-count">{{ $activeActivations->count() }}/{{ $license->activation_limit }}</span>
</div>
@forelse($activeActivations as $activation)
<div class="device-row">
<div class="device-icon">⌘</div>
<div class="device-copy">
<strong>{{ $activation->installation_name ?: 'Mac' }}</strong>
<span>{{ $activation->platform ?: 'macOS' }}@if($activation->app_version) · Rsync Studio {{ $activation->app_version }}@endif</span>
<small>Last seen {{ optional($activation->last_seen_at)->diffForHumans() ?: 'not yet recorded' }}</small>
</div>
<form method="post" action="{{ route('portal.deactivate', [$license, $activation->id]) }}" onsubmit="return confirm('Deactivate this Mac? Rsync Studio on that Mac will lose access when it next validates.');">
@csrf
@method('DELETE')
<button class="danger-outline">Deactivate</button>
</form>
</div>
@empty
<div class="empty-inline">No Macs are currently activated with this licence.</div>
@endforelse
</section>
<aside class="panel subscription-panel">
<h2>Subscription</h2>
<dl class="subscription-facts">
<div><dt>Plan</dt><dd>{{ $license->edition }} {{ $billing }}</dd></div>
<div><dt>Status</dt><dd>{{ ucfirst($license->subscription_status ?: 'active') }}</dd></div>
<div><dt>{{ $license->subscription_status === 'trialing' ? 'Trial ends' : 'Current period ends' }}</dt><dd>{{ optional($license->current_period_ends_at)->format('j M Y') ?: '—' }}</dd></div>
</dl>
@if($license->edition === 'Personal' && $license->is_usable)
<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 class="full-width">Upgrade to Professional</button>
</form>
@endif
@if($license->payment_provider === 'paddle' && $license->external_subscription_id && $license->subscription_status !== 'canceled')
<form method="post" action="{{ route('portal.cancel', $license) }}" onsubmit="return confirm('Cancel this Paddle subscription immediately? This cannot be undone.');">
@csrf
@method('DELETE')
<button class="danger-outline full-width">Cancel subscription</button>
</form>
@endif
</aside>
</div>
@endsection