| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <?php
- /** @var int $schemaVersion */
- /** @var string $dbPath */
- /** @var string $appEnv */
- /** @var \App\Domain\User|null $currentUser */
- /** @var bool $oidcConfigured */
- /** @var bool $localAdminEnabled */
- /** @var bool $authError */
- /** @var list<array{sprint: \App\Domain\Sprint, nWorkers:int, nTasks:int}> $sprintRows */
- use function App\Http\e;
- $sprintRows = $sprintRows ?? [];
- ?>
- <section class="space-y-6">
- <?php if ($authError ?? false): ?>
- <div class="rounded-md border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800 dark:bg-red-900 dark:border-red-800 dark:text-red-200">
- Sign-in failed. Check the server logs or the audit log for details.
- </div>
- <?php endif; ?>
- <?php if ($currentUser === null): ?>
- <div class="rounded-lg border bg-white p-6 dark:bg-slate-800 dark:border-slate-700">
- <h1 class="text-2xl font-semibold tracking-tight">Sprint Planner</h1>
- <p class="text-slate-600 mt-2 max-w-prose dark:text-slate-400">
- Sign in with your Microsoft account to get started. The first person
- to sign in becomes the admin automatically.
- </p>
- <div class="mt-4 flex flex-wrap items-center gap-3">
- <?php if ($oidcConfigured): ?>
- <a href="/auth/login"
- class="inline-flex items-center gap-2 rounded-md bg-slate-900 text-white px-4 py-2 text-sm font-medium hover:bg-slate-800 dark:bg-slate-700 dark:hover:bg-slate-600">
- Sign in with Microsoft
- </a>
- <?php endif; ?>
- <?php if ($localAdminEnabled): ?>
- <a href="/auth/local"
- class="inline-flex items-center gap-2 rounded-md border border-slate-300 bg-white text-slate-700 px-4 py-2 text-sm font-medium hover:bg-slate-100 dark:bg-slate-800 dark:border-slate-600 dark:text-slate-200 dark:hover:bg-slate-700">
- Sign in as local admin
- </a>
- <?php endif; ?>
- <?php if (!$oidcConfigured && !$localAdminEnabled): ?>
- <span class="inline-block rounded-md bg-slate-100 text-slate-600 px-3 py-2 text-sm dark:bg-slate-700 dark:text-slate-300">
- No sign-in method configured. Set <code>ENTRA_*</code> or
- <code>LOCAL_ADMIN_*</code> in <code>.env</code>.
- </span>
- <?php endif; ?>
- </div>
- </div>
- <?php else: ?>
- <div class="flex items-end justify-between gap-4">
- <div>
- <h1 class="text-2xl font-semibold tracking-tight">Sprints</h1>
- <p class="text-slate-600 mt-1 text-sm dark:text-slate-400">
- <?= count($sprintRows) ?> sprint<?= count($sprintRows) === 1 ? '' : 's' ?>.
- </p>
- </div>
- <?php if ($currentUser->isAdmin): ?>
- <a href="/sprints/new"
- class="inline-flex items-center gap-2 rounded-md bg-slate-900 text-white px-4 py-2 text-sm font-medium hover:bg-slate-800 dark:bg-slate-700 dark:hover:bg-slate-600">
- New sprint
- </a>
- <?php endif; ?>
- </div>
- <div class="rounded-lg border bg-white overflow-hidden dark:bg-slate-800 dark:border-slate-700">
- <?php if ($sprintRows === []): ?>
- <div class="p-8 text-center text-slate-500 text-sm dark:text-slate-400">
- No sprints yet.
- <?php if ($currentUser->isAdmin): ?>
- <a href="/sprints/new" class="text-blue-700 hover:underline dark:text-blue-400 dark:hover:text-blue-300">Create the first one</a>.
- <?php endif; ?>
- </div>
- <?php else: ?>
- <table class="min-w-full text-sm">
- <thead class="bg-slate-50 text-slate-600 text-xs uppercase tracking-wider dark:bg-slate-700 dark:text-slate-300">
- <tr>
- <th class="text-left px-4 py-2 font-semibold">Name</th>
- <th class="text-left px-4 py-2 font-semibold">Dates</th>
- <th class="text-right px-4 py-2 font-semibold">Workers</th>
- <th class="text-right px-4 py-2 font-semibold">Tasks</th>
- <th class="text-right px-4 py-2 font-semibold">Reserve</th>
- <th class="text-left px-4 py-2 font-semibold">Status</th>
- </tr>
- </thead>
- <tbody class="divide-y divide-slate-100 dark:divide-slate-700">
- <?php foreach ($sprintRows as $row): $s = $row['sprint']; ?>
- <tr class="hover:bg-slate-50 cursor-pointer dark:hover:bg-slate-700"
- data-href="/sprints/<?= (int) $s->id ?>">
- <td class="px-4 py-2 font-medium">
- <a href="/sprints/<?= (int) $s->id ?>" class="hover:underline">
- <?= e($s->name) ?>
- </a>
- </td>
- <td class="px-4 py-2 text-slate-600 dark:text-slate-400">
- <?= e($s->startDate) ?> – <?= e($s->endDate) ?>
- </td>
- <td class="px-4 py-2 text-right font-mono"><?= (int) $row['nWorkers'] ?></td>
- <td class="px-4 py-2 text-right font-mono"><?= (int) $row['nTasks'] ?></td>
- <td class="px-4 py-2 text-right font-mono">
- <?= e(number_format($s->reserveFraction * 100, 0)) ?>%
- </td>
- <td class="px-4 py-2">
- <?php if ($s->isArchived): ?>
- <span class="inline-block px-2 py-0.5 text-xs bg-slate-100 text-slate-600 rounded dark:bg-slate-700 dark:text-slate-300">archived</span>
- <?php else: ?>
- <span class="inline-block px-2 py-0.5 text-xs bg-green-100 text-green-800 rounded dark:bg-green-900 dark:text-green-200">active</span>
- <?php endif; ?>
- </td>
- </tr>
- <?php endforeach; ?>
- </tbody>
- </table>
- <?php endif; ?>
- </div>
- <?php endif; ?>
- <?php if ($currentUser === null || $currentUser->isAdmin): ?>
- <details class="rounded-lg border bg-white p-4 dark:bg-slate-800 dark:border-slate-700">
- <summary class="text-sm font-semibold text-slate-700 uppercase tracking-wider cursor-pointer dark:text-slate-200">Runtime</summary>
- <dl class="mt-3 grid grid-cols-[max-content_1fr] gap-x-6 gap-y-1 text-sm">
- <dt class="text-slate-500 dark:text-slate-400">PHP</dt>
- <dd class="font-mono"><?= e(PHP_VERSION) ?></dd>
- <dt class="text-slate-500 dark:text-slate-400">APP_ENV</dt>
- <dd class="font-mono"><?= e($appEnv) ?></dd>
- <dt class="text-slate-500 dark:text-slate-400">SQLite file</dt>
- <dd class="font-mono break-all"><?= e($dbPath) ?></dd>
- <dt class="text-slate-500 dark:text-slate-400">Schema version</dt>
- <dd class="font-mono"><?= e($schemaVersion) ?></dd>
- <dt class="text-slate-500 dark:text-slate-400">OIDC</dt>
- <dd class="font-mono"><?= $oidcConfigured ? 'configured' : 'not configured' ?></dd>
- <dt class="text-slate-500 dark:text-slate-400">Local admin</dt>
- <dd class="font-mono"><?= $localAdminEnabled ? 'enabled' : 'disabled' ?></dd>
- </dl>
- <p class="mt-4 text-xs text-slate-500 dark:text-slate-400">
- Liveness probe: <a class="text-blue-700 hover:underline dark:text-blue-400 dark:hover:text-blue-300" href="/healthz"><code>/healthz</code></a>
- </p>
- </details>
- <?php endif; ?>
- </section>
|