TenantAtlas/resources/views/filament/pages/onboarding/tenant-onboarding-task-board.blade.php
2026-02-01 12:20:18 +01:00

170 lines
9.1 KiB
PHP

<x-filament-panels::page>
<div class="space-y-6">
<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-start justify-between gap-4">
<div>
<h2 class="text-lg font-semibold text-gray-900 dark:text-gray-100">Onboarding task board</h2>
<p class="mt-1 text-sm text-gray-600 dark:text-gray-300">
Run and re-run onboarding tasks. Status comes from stored evidence.
</p>
</div>
@if ($session)
<div class="text-sm text-gray-600 dark:text-gray-300">
Step {{ $session->current_step }}
</div>
@endif
</div>
</div>
<div class="space-y-4">
@foreach ($this->taskRows() as $row)
@php
$taskType = $row['task_type'];
$badge = $row['badge'];
$evidence = $row['evidence'];
$unmet = $row['unmet_prerequisites'];
$disabled = ! $canStartProviderTasks || ! $row['prerequisites_met'];
$hints = $this->fixHintsFor($evidence?->reason_code);
@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-start justify-between gap-4">
<div class="min-w-0">
<div class="text-sm font-semibold text-gray-900 dark:text-gray-100">
{{ $row['title'] }}
</div>
<div class="mt-1 text-xs text-gray-500 dark:text-gray-400">
{{ $taskType }} · Step {{ $row['step'] }}
</div>
@if (count($unmet) > 0)
<div class="mt-2 text-xs text-amber-800 dark:text-amber-200">
Blocked by prerequisites: {{ implode(', ', $unmet) }}
</div>
@endif
</div>
<div class="flex flex-col items-end gap-3">
<x-filament::badge :color="$badge->color" size="sm">
{{ $badge->label }}
</x-filament::badge>
<button
type="button"
wire:click="startTask('{{ $taskType }}')"
@disabled($disabled)
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"
>
Start
</button>
@if (isset($runUrls[$taskType]) && is_string($runUrls[$taskType]) && $runUrls[$taskType] !== '')
<a
href="{{ $runUrls[$taskType] }}"
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>
@endif
</div>
</div>
@if ($evidence)
<div class="mt-4 rounded-lg bg-gray-50 p-4 text-sm text-gray-800 dark:bg-gray-950 dark:text-gray-100">
<div class="flex flex-col gap-1">
<div class="text-xs text-gray-500 dark:text-gray-400">Latest evidence</div>
@if (is_string($evidence->reason_code) && $evidence->reason_code !== '')
<div class="text-xs text-gray-600 dark:text-gray-300">
Reason: {{ $evidence->reason_code }}
</div>
@endif
@if (is_string($evidence->message) && $evidence->message !== '')
<div>{{ $evidence->message }}</div>
@endif
</div>
@if (count($hints) > 0)
<div class="mt-4">
<div class="text-sm font-semibold text-gray-900 dark:text-gray-100">Fix hints</div>
<ul class="mt-2 list-disc space-y-1 pl-5 text-sm text-gray-700 dark:text-gray-200">
@foreach ($hints as $hint)
<li>{{ $hint }}</li>
@endforeach
</ul>
</div>
@endif
</div>
@endif
</div>
@endforeach
</div>
<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">Evidence history</h2>
<p class="text-sm text-gray-600 dark:text-gray-300">
Recent onboarding evidence entries across all tasks.
</p>
</div>
@php
$recent = $this->recentEvidenceRows();
@endphp
@if (count($recent) === 0)
<div class="mt-4 text-sm text-gray-600 dark:text-gray-300">No evidence recorded yet.</div>
@else
<div class="mt-4 overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200 text-sm dark:divide-gray-800">
<thead>
<tr class="text-left text-xs font-medium uppercase tracking-wide text-gray-500 dark:text-gray-400">
<th class="py-2 pr-4">Recorded</th>
<th class="py-2 pr-4">Task</th>
<th class="py-2 pr-4">Status</th>
<th class="py-2 pr-4">Reason</th>
<th class="py-2">Message</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200 dark:divide-gray-800">
@foreach ($recent as $row)
<tr>
<td class="py-3 pr-4 whitespace-nowrap text-xs text-gray-500 dark:text-gray-400">
{{ $row['recorded_at'] }}
</td>
<td class="py-3 pr-4 whitespace-nowrap text-xs text-gray-500 dark:text-gray-400">
{{ $row['task_type'] }}
@if (is_string($row['run_url']) && $row['run_url'] !== '')
<div class="mt-1">
<a
href="{{ $row['run_url'] }}"
class="text-xs 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
</td>
<td class="py-3 pr-4 whitespace-nowrap">
<x-filament::badge :color="$row['badge']->color" size="sm">
{{ $row['badge']->label }}
</x-filament::badge>
</td>
<td class="py-3 pr-4 whitespace-nowrap text-xs text-gray-500 dark:text-gray-400">
{{ $row['reason_code'] ?? '' }}
</td>
<td class="py-3 text-sm text-gray-800 dark:text-gray-100">
{{ $row['message'] ?? '' }}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endif
</div>
</div>
</x-filament-panels::page>