127 lines
7.0 KiB
PHP
127 lines
7.0 KiB
PHP
<x-filament-panels::page>
|
||
<div class="flex flex-col gap-6">
|
||
@php($canRunProviderOps = $this->canRunProviderOperations())
|
||
|
||
<div class="rounded-lg border border-gray-200 bg-white p-4 text-sm text-gray-700 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-200">
|
||
<div class="flex flex-col gap-2">
|
||
<div class="font-medium text-gray-900 dark:text-gray-100">Tenant onboarding wizard</div>
|
||
<div>
|
||
This is the single supported entry point for creating and onboarding tenants.
|
||
You can safely close this page and resume later.
|
||
</div>
|
||
<div class="text-xs text-gray-600 dark:text-gray-300">
|
||
Note: the legacy “create tenant” screens are intentionally disabled to keep onboarding consistent and auditable.
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
@if ($this->tenantId)
|
||
<div class="rounded-lg border border-gray-200 bg-gray-50 p-4 text-sm text-gray-700 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-200">
|
||
<div class="flex flex-col gap-2">
|
||
<div>
|
||
<span class="font-medium">Session:</span> {{ $this->sessionId }}
|
||
</div>
|
||
<div>
|
||
<span class="font-medium">Client secret:</span>
|
||
{{ $this->tenantHasClientSecret() ? 'set' : 'missing' }}
|
||
</div>
|
||
<div class="text-xs text-gray-600 dark:text-gray-300">
|
||
If you need to resume later, open this wizard again from the tenant’s “Resume onboarding” action.
|
||
</div>
|
||
</div>
|
||
</div>
|
||
@endif
|
||
|
||
@if ($this->tenantId && $this->currentStep === 'permissions')
|
||
<div class="rounded-lg border border-gray-200 bg-white p-4 dark:border-gray-800 dark:bg-gray-900">
|
||
<div class="flex flex-col gap-4">
|
||
<div class="flex items-center justify-between gap-4">
|
||
<div class="text-sm font-medium text-gray-900 dark:text-gray-100">Required permissions</div>
|
||
<x-filament::button
|
||
size="sm"
|
||
color="primary"
|
||
wire:click="enqueueVerification"
|
||
:disabled="! $canRunProviderOps"
|
||
:title="$canRunProviderOps ? null : 'You do not have permission to run provider operations.'"
|
||
>
|
||
Verify permissions
|
||
</x-filament::button>
|
||
</div>
|
||
|
||
@php($runStatus = $this->latestVerificationRunStatus())
|
||
@if ($runStatus)
|
||
<div class="text-xs text-gray-600 dark:text-gray-300">
|
||
Last verification run status: <span class="font-medium">{{ $runStatus }}</span>
|
||
</div>
|
||
@endif
|
||
|
||
<div class="flex flex-col gap-2">
|
||
@forelse ($this->permissionRows() as $permission)
|
||
<div class="flex items-center justify-between gap-4 rounded-md border border-gray-100 bg-gray-50 px-3 py-2 text-sm dark:border-gray-800 dark:bg-gray-950">
|
||
<div class="min-w-0">
|
||
<div class="truncate font-mono text-xs text-gray-900 dark:text-gray-100">{{ $permission['key'] }}</div>
|
||
@if (! empty($permission['description']))
|
||
<div class="truncate text-xs text-gray-600 dark:text-gray-300">{{ $permission['description'] }}</div>
|
||
@endif
|
||
</div>
|
||
|
||
@php($status = (string) ($permission['status'] ?? 'missing'))
|
||
<span @class([
|
||
'inline-flex items-center rounded-md px-2 py-0.5 text-xs font-medium',
|
||
'bg-emerald-50 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300' => $status === 'granted',
|
||
'bg-rose-50 text-rose-700 dark:bg-rose-950 dark:text-rose-300' => in_array($status, ['missing', 'error'], true),
|
||
'bg-amber-50 text-amber-800 dark:bg-amber-950 dark:text-amber-300' => ! in_array($status, ['granted', 'missing', 'error'], true),
|
||
])>
|
||
{{ ucfirst($status) }}
|
||
</span>
|
||
</div>
|
||
@empty
|
||
<div class="text-sm text-gray-600 dark:text-gray-300">
|
||
No required permissions are configured.
|
||
</div>
|
||
@endforelse
|
||
</div>
|
||
</div>
|
||
</div>
|
||
@endif
|
||
|
||
@if ($this->tenantId && $this->currentStep === 'verification')
|
||
<div class="rounded-lg border border-gray-200 bg-white p-4 dark:border-gray-800 dark:bg-gray-900">
|
||
<div class="flex flex-col gap-4">
|
||
<div class="flex items-center justify-between gap-4">
|
||
<div class="text-sm font-medium text-gray-900 dark:text-gray-100">Verification</div>
|
||
<x-filament::button
|
||
size="sm"
|
||
color="success"
|
||
wire:click="enqueueConnectionCheck"
|
||
:disabled="! $canRunProviderOps"
|
||
:title="$canRunProviderOps ? null : 'You do not have permission to run provider operations.'"
|
||
>
|
||
Check connection
|
||
</x-filament::button>
|
||
</div>
|
||
|
||
@php($connectionRunStatus = $this->latestConnectionCheckRunStatus())
|
||
@if ($connectionRunStatus)
|
||
<div class="text-xs text-gray-600 dark:text-gray-300">
|
||
Last connection check status: <span class="font-medium">{{ $connectionRunStatus }}</span>
|
||
</div>
|
||
@endif
|
||
|
||
<div class="rounded-md border border-gray-100 bg-gray-50 px-3 py-2 text-sm text-gray-700 dark:border-gray-800 dark:bg-gray-950 dark:text-gray-200">
|
||
@if ($this->isReadyToCompleteOnboarding())
|
||
<span class="font-medium">Ready:</span> all stored checks look good.
|
||
@else
|
||
<span class="font-medium">Not ready yet:</span> run checks and ensure permissions are granted.
|
||
@endif
|
||
</div>
|
||
</div>
|
||
</div>
|
||
@endif
|
||
|
||
<form wire:submit.prevent>
|
||
{{ $this->form }}
|
||
</form>
|
||
</div>
|
||
</x-filament-panels::page>
|