212 lines
12 KiB
PHP
212 lines
12 KiB
PHP
<x-filament-panels::page>
|
||
<div class="space-y-6">
|
||
@if ($sessionLockedByOther)
|
||
<div class="rounded-xl border border-amber-200 bg-amber-50 p-4 text-sm text-amber-900 dark:border-amber-900/40 dark:bg-amber-950 dark:text-amber-100">
|
||
<div class="font-medium">Session locked</div>
|
||
<div class="mt-1">
|
||
Onboarding is currently locked by {{ $sessionLockedByLabel ?? 'another user' }}
|
||
@if (is_string($sessionLockedUntil) && $sessionLockedUntil !== '')
|
||
(expires {{ $sessionLockedUntil }}).
|
||
@endif
|
||
You can view progress, but you can’t make changes unless you take over the lock.
|
||
</div>
|
||
</div>
|
||
@elseif ($hasSessionLock)
|
||
<div class="rounded-xl border border-emerald-200 bg-emerald-50 p-4 text-sm text-emerald-900 dark:border-emerald-900/40 dark:bg-emerald-950 dark:text-emerald-100">
|
||
<div class="font-medium">You have the lock</div>
|
||
@if (is_string($sessionLockedUntil) && $sessionLockedUntil !== '')
|
||
<div class="mt-1">Expires {{ $sessionLockedUntil }}.</div>
|
||
@endif
|
||
</div>
|
||
@endif
|
||
|
||
<div class="rounded-xl bg-white p-6 shadow-sm ring-1 ring-gray-200 dark:bg-gray-900 dark:ring-gray-800">
|
||
<div class="flex flex-col gap-2">
|
||
<h2 class="text-lg font-semibold text-gray-900 dark:text-gray-100">Onboarding plan</h2>
|
||
<p class="text-sm text-gray-600 dark:text-gray-300">
|
||
This plan is shown before running any tasks.
|
||
</p>
|
||
</div>
|
||
|
||
<div class="mt-4">
|
||
<ul class="divide-y divide-gray-200 dark:divide-gray-800">
|
||
@foreach ($this->planTasks() as $task)
|
||
<li class="flex items-start justify-between gap-6 py-3">
|
||
<div class="min-w-0">
|
||
<div class="text-sm font-medium text-gray-900 dark:text-gray-100">
|
||
{{ $task['title'] }}
|
||
</div>
|
||
<div class="text-xs text-gray-500 dark:text-gray-400">
|
||
Step {{ $task['step'] }}
|
||
</div>
|
||
</div>
|
||
<div class="shrink-0 text-xs text-gray-500 dark:text-gray-400">
|
||
{{ $task['task_type'] }}
|
||
</div>
|
||
</li>
|
||
@endforeach
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
|
||
@if (! $canStartProviderTasks)
|
||
<div class="rounded-xl border border-amber-200 bg-amber-50 p-4 text-sm text-amber-900 dark:border-amber-900/40 dark:bg-amber-950 dark:text-amber-100">
|
||
<div class="font-medium">Missing permission</div>
|
||
<div class="mt-1">
|
||
You can view onboarding, but running provider tasks requires additional permission.
|
||
</div>
|
||
</div>
|
||
@endif
|
||
|
||
@if ($session?->current_step !== null && $session->current_step >= 4)
|
||
<div class="rounded-xl bg-white p-6 shadow-sm ring-1 ring-gray-200 dark:bg-gray-900 dark:ring-gray-800">
|
||
<h2 class="text-lg font-semibold text-gray-900 dark:text-gray-100">Consent</h2>
|
||
<p class="mt-2 text-sm text-gray-600 dark:text-gray-300">
|
||
Ensure admin consent is granted for the required Microsoft Graph permissions before running tasks.
|
||
</p>
|
||
|
||
<div class="mt-4">
|
||
<label class="block text-sm font-medium text-gray-900 dark:text-gray-100">Provider connection</label>
|
||
<div class="mt-2">
|
||
<select
|
||
wire:model.blur="selectedProviderConnectionId"
|
||
@disabled(! $canStartProviderTasks || $sessionLockedByOther)
|
||
class="block w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm focus:border-gray-900 focus:outline-none focus:ring-0 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-100"
|
||
>
|
||
<option value="">Select a provider connection…</option>
|
||
@foreach ($this->providerConnections() as $connection)
|
||
<option value="{{ $connection['id'] }}">{{ $connection['label'] }}</option>
|
||
@endforeach
|
||
</select>
|
||
</div>
|
||
<p class="mt-2 text-xs text-gray-500 dark:text-gray-400">
|
||
This wizard never shows secrets. Credentials remain managed by the provider credential store.
|
||
</p>
|
||
</div>
|
||
|
||
<div class="mt-4">
|
||
<a
|
||
href="{{ $this->createProviderConnectionUrl() }}"
|
||
class="inline-flex items-center gap-2 rounded-lg bg-gray-900 px-3 py-2 text-sm font-medium text-white hover:bg-gray-800 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-white"
|
||
>
|
||
Create provider connection
|
||
</a>
|
||
</div>
|
||
</div>
|
||
|
||
@php
|
||
$statuses = $this->latestEvidenceStatusByTaskType();
|
||
$verifyStatus = $statuses[\App\Support\Onboarding\OnboardingTaskType::VerifyPermissions] ?? 'unknown';
|
||
$verifySpec = \App\Support\Badges\BadgeCatalog::spec(\App\Support\Badges\BadgeDomain::OnboardingTaskStatus, $verifyStatus);
|
||
$consentStatus = $statuses[\App\Support\Onboarding\OnboardingTaskType::ConsentStatus] ?? 'unknown';
|
||
$consentSpec = \App\Support\Badges\BadgeCatalog::spec(\App\Support\Badges\BadgeDomain::OnboardingTaskStatus, $consentStatus);
|
||
@endphp
|
||
|
||
<div class="rounded-xl bg-white p-6 shadow-sm ring-1 ring-gray-200 dark:bg-gray-900 dark:ring-gray-800">
|
||
<div class="flex flex-wrap items-center justify-between gap-4">
|
||
<div>
|
||
<h2 class="text-lg font-semibold text-gray-900 dark:text-gray-100">Step 4 tasks</h2>
|
||
<p class="mt-1 text-sm text-gray-600 dark:text-gray-300">Run verification tasks and review evidence-driven status.</p>
|
||
|
||
<div class="mt-3">
|
||
<a
|
||
href="{{ \App\Filament\Pages\Onboarding\TenantOnboardingTaskBoard::getUrl(tenant: \App\Models\Tenant::current()) }}"
|
||
class="text-sm font-medium text-gray-900 underline underline-offset-4 hover:text-gray-700 dark:text-gray-100 dark:hover:text-gray-200"
|
||
>
|
||
Open task board
|
||
</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div>
|
||
<x-filament::badge :color="$verifySpec->color" size="sm">
|
||
Verify permissions: {{ $verifySpec->label }}
|
||
</x-filament::badge>
|
||
|
||
<x-filament::badge :color="$consentSpec->color" size="sm">
|
||
Consent status: {{ $consentSpec->label }}
|
||
</x-filament::badge>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="mt-4 flex flex-wrap gap-3">
|
||
<button
|
||
type="button"
|
||
wire:click="startVerifyPermissions"
|
||
@disabled(! $canStartProviderTasks || $sessionLockedByOther)
|
||
class="inline-flex items-center gap-2 rounded-lg bg-gray-900 px-3 py-2 text-sm font-medium text-white hover:bg-gray-800 disabled:cursor-not-allowed disabled:bg-gray-400 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-white dark:disabled:bg-gray-700"
|
||
>
|
||
Verify permissions
|
||
</button>
|
||
|
||
<button
|
||
type="button"
|
||
wire:click="startConsentStatus"
|
||
@disabled(! $canStartProviderTasks || $sessionLockedByOther)
|
||
class="inline-flex items-center gap-2 rounded-lg bg-gray-900 px-3 py-2 text-sm font-medium text-white hover:bg-gray-800 disabled:cursor-not-allowed disabled:bg-gray-400 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-white dark:disabled:bg-gray-700"
|
||
>
|
||
Check consent status
|
||
</button>
|
||
</div>
|
||
|
||
@if (is_string($verifyPermissionsRunUrl) && $verifyPermissionsRunUrl !== '')
|
||
<div class="mt-3">
|
||
<a
|
||
href="{{ $verifyPermissionsRunUrl }}"
|
||
class="text-sm font-medium text-gray-900 underline underline-offset-4 hover:text-gray-700 dark:text-gray-100 dark:hover:text-gray-200"
|
||
>
|
||
View run
|
||
</a>
|
||
</div>
|
||
@endif
|
||
|
||
@if (is_string($consentStatusRunUrl) && $consentStatusRunUrl !== '')
|
||
<div class="mt-3">
|
||
<a
|
||
href="{{ $consentStatusRunUrl }}"
|
||
class="text-sm font-medium text-gray-900 underline underline-offset-4 hover:text-gray-700 dark:text-gray-100 dark:hover:text-gray-200"
|
||
>
|
||
View consent status run
|
||
</a>
|
||
</div>
|
||
@endif
|
||
</div>
|
||
@else
|
||
<div class="rounded-xl bg-white p-6 shadow-sm ring-1 ring-gray-200 dark:bg-gray-900 dark:ring-gray-800">
|
||
<h2 class="text-lg font-semibold text-gray-900 dark:text-gray-100">Provider connection</h2>
|
||
<p class="mt-2 text-sm text-gray-600 dark:text-gray-300">
|
||
Create or select a provider connection before starting tasks.
|
||
</p>
|
||
|
||
<div class="mt-4">
|
||
<label class="block text-sm font-medium text-gray-900 dark:text-gray-100">Provider connection</label>
|
||
<div class="mt-2">
|
||
<select
|
||
wire:model.blur="selectedProviderConnectionId"
|
||
@disabled(! $canStartProviderTasks || $sessionLockedByOther)
|
||
class="block w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm focus:border-gray-900 focus:outline-none focus:ring-0 dark:border-gray-700 dark:bg-gray-950 dark:text-gray-100"
|
||
>
|
||
<option value="">Select a provider connection…</option>
|
||
@foreach ($this->providerConnections() as $connection)
|
||
<option value="{{ $connection['id'] }}">{{ $connection['label'] }}</option>
|
||
@endforeach
|
||
</select>
|
||
</div>
|
||
<p class="mt-2 text-xs text-gray-500 dark:text-gray-400">
|
||
This wizard never shows secrets. Credentials remain managed by the provider credential store.
|
||
</p>
|
||
</div>
|
||
|
||
<div class="mt-4">
|
||
<a
|
||
href="{{ $this->createProviderConnectionUrl() }}"
|
||
class="inline-flex items-center gap-2 rounded-lg bg-gray-900 px-3 py-2 text-sm font-medium text-white hover:bg-gray-800 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-white"
|
||
>
|
||
Create provider connection
|
||
</a>
|
||
</div>
|
||
</div>
|
||
@endif
|
||
</div>
|
||
</x-filament-panels::page>
|