Files
breakpilot-compliance/admin-compliance/app/sdk/training/_components/MatrixTab.tsx
Sharang Parnerkar b5d20a4c1d
Some checks failed
Build + Deploy / build-admin-compliance (push) Failing after 34s
Build + Deploy / build-developer-portal (push) Successful in 56s
Build + Deploy / build-tts (push) Successful in 1m8s
CI/CD / go-lint (push) Has been skipped
Build + Deploy / trigger-orca (push) Has been skipped
CI/CD / python-lint (push) Has been skipped
CI/CD / nodejs-lint (push) Has been skipped
CI/CD / test-go-ai-compliance (push) Successful in 38s
CI/CD / test-python-backend-compliance (push) Successful in 32s
Build + Deploy / build-backend-compliance (push) Successful in 7s
Build + Deploy / build-ai-sdk (push) Successful in 7s
Build + Deploy / build-document-crawler (push) Successful in 33s
Build + Deploy / build-dsms-gateway (push) Successful in 20s
CI/CD / test-python-dsms-gateway (push) Has been cancelled
CI/CD / validate-canonical-controls (push) Has been cancelled
CI/CD / test-python-document-crawler (push) Has been cancelled
fix: add missing training page components to fix admin-compliance Docker build
All 8 components imported by app/sdk/training/page.tsx were missing.
Docker build was failing with Module not found errors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 10:32:35 +02:00

81 lines
3.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use client'
import type { MatrixResponse } from '@/lib/sdk/training/types'
import { ALL_ROLES, ROLE_LABELS } from '@/lib/sdk/training/types'
export default function MatrixTab({
matrix,
onDeleteEntry,
onAddEntry,
}: {
matrix: MatrixResponse
onDeleteEntry: (roleCode: string, moduleId: string) => void
onAddEntry: (roleCode: string) => void
}) {
return (
<div className="space-y-4">
<div className="flex items-center justify-between">
<p className="text-sm text-gray-500">Pflichtzuordnung von Schulungsmodulen zu Rollen</p>
</div>
<div className="bg-white border rounded-lg overflow-hidden">
<table className="w-full text-sm">
<thead className="bg-gray-50">
<tr>
<th className="px-4 py-3 text-left font-medium text-gray-600 w-48">Rolle</th>
<th className="px-4 py-3 text-left font-medium text-gray-600">Zugewiesene Module</th>
<th className="px-4 py-3 text-right font-medium text-gray-600 w-24">Aktion</th>
</tr>
</thead>
<tbody className="divide-y">
{ALL_ROLES.map(role => {
const entries = matrix.entries[role] ?? []
return (
<tr key={role} className="hover:bg-gray-50">
<td className="px-4 py-3">
<div className="font-medium text-gray-900">{ROLE_LABELS[role] ?? role}</div>
<div className="text-xs text-gray-400">{role}</div>
</td>
<td className="px-4 py-3">
{entries.length === 0 ? (
<span className="text-gray-400 text-xs">Keine Module zugewiesen</span>
) : (
<div className="flex flex-wrap gap-1.5">
{entries.map(entry => (
<span
key={entry.id}
className="inline-flex items-center gap-1 text-xs bg-blue-50 text-blue-700 border border-blue-200 px-2 py-0.5 rounded-full"
>
<code className="text-xs">{entry.module_code ?? entry.module_id.slice(0, 8)}</code>
{entry.is_mandatory && <span className="text-red-500 font-bold">*</span>}
<button
onClick={() => onDeleteEntry(role, entry.module_id)}
className="ml-0.5 text-blue-400 hover:text-red-600"
title="Entfernen"
>
×
</button>
</span>
))}
</div>
)}
</td>
<td className="px-4 py-3 text-right">
<button
onClick={() => onAddEntry(role)}
className="px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700"
>
+ Modul
</button>
</td>
</tr>
)
})}
</tbody>
</table>
</div>
<p className="text-xs text-gray-400">* = Pflichtmodul</p>
</div>
)
}