@@ -1,12 +1,82 @@
|
||||
@php
|
||||
use App\Models\Organization;
|
||||
|
||||
$plans = Organization::availablePlans();
|
||||
$trialDays = Organization::trialDays();
|
||||
@endphp
|
||||
|
||||
<x-layouts::auth :title="__('Register')">
|
||||
<div class="flex flex-col gap-6">
|
||||
<x-auth-header :title="__('Create an account')" :description="__('Enter your details below to create your account')" />
|
||||
<x-auth-header
|
||||
:title="__('Create an account')"
|
||||
:description="$plans !== []
|
||||
? __('Choose a plan, then enter your details to get started')
|
||||
: __('Enter your details below to create your account')"
|
||||
/>
|
||||
|
||||
<!-- Session Status -->
|
||||
<x-auth-session-status class="text-center" :status="session('status')" />
|
||||
|
||||
<form method="POST" action="{{ route('register.store') }}" class="flex flex-col gap-6">
|
||||
@csrf
|
||||
|
||||
@if ($plans !== [])
|
||||
{{-- Plan picker. Plain inputs rather than flux:radio because this form
|
||||
is server rendered and does not load Livewire's UI runtime. --}}
|
||||
<fieldset class="flex flex-col gap-2">
|
||||
<legend class="text-sm font-medium text-zinc-800 dark:text-white">
|
||||
{{ __('Choose your plan') }}
|
||||
</legend>
|
||||
|
||||
@foreach ($plans as $key => $plan)
|
||||
<label
|
||||
@class([
|
||||
'flex cursor-pointer items-start gap-3 rounded-lg border border-zinc-200 p-3 transition has-[:checked]:border-accent-500 has-[:checked]:bg-zinc-50 dark:border-white/10 dark:has-[:checked]:bg-white/5',
|
||||
'border-zinc-400 bg-zinc-50 dark:border-zinc-500 dark:bg-white/5' => old('plan', array_key_first($plans)) === $key,
|
||||
])
|
||||
data-test="register-plan-{{ $key }}"
|
||||
>
|
||||
<input
|
||||
type="radio"
|
||||
name="plan"
|
||||
value="{{ $key }}"
|
||||
@checked(old('plan', array_key_first($plans)) === $key)
|
||||
required
|
||||
class="mt-0.5 size-4 shrink-0 accent-accent-500"
|
||||
/>
|
||||
|
||||
<span class="flex flex-col gap-0.5">
|
||||
<span class="flex items-baseline justify-between gap-3">
|
||||
<span class="text-sm font-medium text-zinc-800 dark:text-white">
|
||||
{{ $plan['name'] }}
|
||||
</span>
|
||||
|
||||
<span
|
||||
class="text-sm font-semibold text-zinc-900 dark:text-white"
|
||||
data-test="register-plan-{{ $key }}-amount"
|
||||
>
|
||||
{{ Organization::formatAmount($plan['amount']) }}
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<span class="text-xs text-zinc-500 dark:text-zinc-400">
|
||||
{{ $trialDays > 0
|
||||
? __('Free for :days days, then billed every :interval', [
|
||||
'days' => $trialDays,
|
||||
'interval' => $plan['interval'],
|
||||
])
|
||||
: __('Billed every :interval', ['interval' => $plan['interval']]) }}
|
||||
</span>
|
||||
</span>
|
||||
</label>
|
||||
@endforeach
|
||||
|
||||
@error('plan')
|
||||
<flux:error name="plan" />
|
||||
@enderror
|
||||
</fieldset>
|
||||
@endif
|
||||
|
||||
<!-- Name -->
|
||||
<flux:input
|
||||
name="name"
|
||||
@@ -56,7 +126,7 @@
|
||||
|
||||
<div class="flex items-center justify-end">
|
||||
<flux:button type="submit" variant="primary" class="w-full" data-test="register-user-button">
|
||||
{{ __('Create account') }}
|
||||
{{ $plans !== [] ? __('Continue to payment') : __('Create account') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user