140 lines
5.9 KiB
PHP
140 lines
5.9 KiB
PHP
@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="$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"
|
|
:label="__('Name')"
|
|
:value="old('name')"
|
|
type="text"
|
|
required
|
|
autofocus
|
|
autocomplete="name"
|
|
:placeholder="__('Full name')"
|
|
/>
|
|
|
|
<!-- Email Address -->
|
|
<flux:input
|
|
name="email"
|
|
:label="__('Email address')"
|
|
:value="old('email')"
|
|
type="email"
|
|
required
|
|
autocomplete="email"
|
|
placeholder="email@example.com"
|
|
/>
|
|
|
|
<!-- Password -->
|
|
<flux:input
|
|
name="password"
|
|
:label="__('Password')"
|
|
type="password"
|
|
required
|
|
autocomplete="new-password"
|
|
:placeholder="__('Password')"
|
|
passwordrules="{{ \Illuminate\Validation\Rules\Password::defaults()->toPasswordRulesString() }}"
|
|
viewable
|
|
/>
|
|
|
|
<!-- Confirm Password -->
|
|
<flux:input
|
|
name="password_confirmation"
|
|
:label="__('Confirm password')"
|
|
type="password"
|
|
required
|
|
autocomplete="new-password"
|
|
:placeholder="__('Confirm password')"
|
|
passwordrules="{{ \Illuminate\Validation\Rules\Password::defaults()->toPasswordRulesString() }}"
|
|
viewable
|
|
/>
|
|
|
|
<div class="flex items-center justify-end">
|
|
<flux:button type="submit" variant="primary" class="w-full" data-test="register-user-button">
|
|
{{ $plans !== [] ? __('Continue to payment') : __('Create account') }}
|
|
</flux:button>
|
|
</div>
|
|
</form>
|
|
|
|
<div class="space-x-1 rtl:space-x-reverse text-center text-sm text-zinc-600 dark:text-zinc-400">
|
|
<span>{{ __('Already have an account?') }}</span>
|
|
<flux:link :href="route('login')" wire:navigate>{{ __('Log in') }}</flux:link>
|
|
</div>
|
|
</div>
|
|
</x-layouts::auth>
|