62 lines
2.1 KiB
PHP
62 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Organisation;
|
|
use Inertia\Response;
|
|
|
|
class OnboardingController extends Controller
|
|
{
|
|
public function show(Organisation $organisation): Response
|
|
{
|
|
$organisation->loadCount(['providers', 'sourceProviders', 'registries', 'servers', 'applications']);
|
|
|
|
$steps = [
|
|
[
|
|
'key' => 'organisation',
|
|
'label' => 'Organisation',
|
|
'complete' => true,
|
|
'href' => route('organisations.show', ['organisation' => $organisation->id]),
|
|
],
|
|
[
|
|
'key' => 'provider',
|
|
'label' => 'Provider',
|
|
'complete' => $organisation->providers_count > 0,
|
|
'href' => route('organisations.show', ['organisation' => $organisation->id]),
|
|
],
|
|
[
|
|
'key' => 'source',
|
|
'label' => 'Source',
|
|
'complete' => $organisation->source_providers_count > 0,
|
|
'href' => route('source-providers.create', ['organisation' => $organisation->id]),
|
|
],
|
|
[
|
|
'key' => 'registry',
|
|
'label' => 'Registry',
|
|
'complete' => $organisation->registries_count > 0,
|
|
'href' => route('registries.create', ['organisation' => $organisation->id]),
|
|
],
|
|
[
|
|
'key' => 'server',
|
|
'label' => 'Server',
|
|
'complete' => $organisation->servers_count > 0,
|
|
'href' => route('servers.create', ['organisation' => $organisation->id]),
|
|
],
|
|
[
|
|
'key' => 'application',
|
|
'label' => 'Application',
|
|
'complete' => $organisation->applications_count > 0,
|
|
'href' => route('applications.create', ['organisation' => $organisation->id]),
|
|
],
|
|
];
|
|
|
|
$next = collect($steps)->firstWhere('complete', false) ?? $steps[array_key_last($steps)];
|
|
|
|
return inertia('onboarding/Show', [
|
|
'organisation' => $organisation,
|
|
'steps' => $steps,
|
|
'nextStep' => $next,
|
|
]);
|
|
}
|
|
}
|