Personalakte als Aktenblatt, Status als Etiketten, Verknüpfen von beiden Seiten
Das Formular der Personalabteilung ist übernommen, nicht durch eine Bildschirmansicht ersetzt: schwarzer Rahmen, Kopf mit Kennung und Klassifizierungsbalken, Raster aus fünf Spalten, Unterschriftenzeilen, Fußzeile. Es steht bewusst außerhalb des Design-Systems - es wird gedruckt und muss auf Papier aussehen wie das Blatt daneben. Datengetrieben bleibt es trotzdem. Kein Feld steht im Programm: sheetTitle und sheetSubtitle an der Vorlage, span für die Zellbreite, rows für das Lichtbild, dateKey für das Datum unter einer Unterschrift, slot für den Klassifizierungsbalken. Eine weitere Dokumentart mit layout = DOSSIER braucht keine Zeile Code. Der Balken zeigt die Foundation-Stufe aus der neuen Tabelle FoundationClearance. Sie ist Inhalt, kein Zugriff - was jemand sehen darf, entscheidet weiterhin allein die interne Stufe. Ohne Auswahl bleibt der Balken neutral, statt eine Einstufung zu behaupten. Die Dienstnummer ist entfallen, es gibt sie nicht. Der Status ist zu mehreren Etiketten geworden: "Gekündigt" und "Verhaftet" schließen einander nicht aus. Unbekannte Schlüssel werden verworfen und die Reihenfolge kommt aus der Konfiguration, nicht aus der Eingabe. PersonnelAssignment hängt AfiS-Mitglieder an eine Person - Aktenführung, Ermittler, Ansprechpartner - und ist zugleich der ausnahmsweise Zugang, wie CaseParticipant bei der Fallakte. Betroffen zu sein gibt weiterhin keinen Zugang: das ist eine Eigenschaft der Person, die Zuordnung eine Entscheidung der Abteilung. Fall und Person lassen sich von beiden Seiten verknüpfen und schon beim Anlegen einer Fallakte. Alle drei Wege laufen in addParticipant zusammen. Noch offen: das Lichtbild. Feldtyp und Platz stehen, hochladen kommt mit der Prüfkette in Phase 5 - ein Bild als Data-URL im Abschnittswert verstiesse gegen harte Regel 4. 102 Tests im Web-Paket, davon sechs auf dem gerenderten Blatt selbst.
This commit is contained in:
@@ -5,7 +5,12 @@ import { notFound } from 'next/navigation'
|
||||
import { db } from '@/lib/db'
|
||||
import { requirePermission } from '@/lib/auth/current'
|
||||
import { recordRead, READ_AUDIT_FROM_LEVEL } from '@/lib/audit'
|
||||
import { loadBacklinks, loadVisiblePersonnelFile } from '@/lib/personnel/service'
|
||||
import {
|
||||
listAssignments,
|
||||
listStatusTags,
|
||||
loadBacklinks,
|
||||
loadVisiblePersonnelFile,
|
||||
} from '@/lib/personnel/service'
|
||||
import { listDocuments, listTemplatesFor } from '@/lib/documents/service'
|
||||
import { canWritePersonnel } from '@/lib/access/documentWrite'
|
||||
import { de } from '@/lib/i18n/de'
|
||||
@@ -14,6 +19,8 @@ import { SkeletonLine } from '@/components/Skeleton'
|
||||
import { DocumentList } from '@/components/documents/DocumentList'
|
||||
import { NewDocument } from '@/components/documents/NewDocument'
|
||||
import { PersonnelHead } from './PersonnelHead'
|
||||
import { Assignments } from './Assignments'
|
||||
import { LinkCase } from './LinkCase'
|
||||
import type { EffectivePermissions } from '@/lib/auth/permissions'
|
||||
|
||||
export const dynamic = 'force-dynamic'
|
||||
@@ -39,14 +46,21 @@ export async function generateMetadata({
|
||||
async function Backlinks({
|
||||
file,
|
||||
permissions,
|
||||
canLink,
|
||||
}: {
|
||||
file: { id: string; userId: string | null }
|
||||
permissions: EffectivePermissions
|
||||
canLink: boolean
|
||||
}) {
|
||||
const { total, byRole } = await loadBacklinks(permissions, file)
|
||||
|
||||
if (total === 0) {
|
||||
return <p className="text-text-dim">{de.personnel.backlinksEmpty}</p>
|
||||
return (
|
||||
<div>
|
||||
<p className="text-text-dim">{de.personnel.backlinksEmpty}</p>
|
||||
{canLink ? <LinkCase personnelFileId={file.id} /> : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -76,6 +90,7 @@ async function Backlinks({
|
||||
</ul>
|
||||
</div>
|
||||
))}
|
||||
{canLink ? <LinkCase personnelFileId={file.id} /> : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -113,6 +128,37 @@ async function Documents({
|
||||
)
|
||||
}
|
||||
|
||||
async function AssignmentBlock({
|
||||
fileId,
|
||||
permissions,
|
||||
canEdit,
|
||||
}: {
|
||||
fileId: string
|
||||
permissions: EffectivePermissions
|
||||
canEdit: boolean
|
||||
}) {
|
||||
const [assignments, members] = await Promise.all([
|
||||
listAssignments(permissions, fileId),
|
||||
canEdit
|
||||
? db.user.findMany({
|
||||
where: { isActive: true },
|
||||
orderBy: { displayName: 'asc' },
|
||||
take: 200,
|
||||
select: { id: true, displayName: true },
|
||||
})
|
||||
: Promise.resolve([]),
|
||||
])
|
||||
|
||||
return (
|
||||
<Assignments
|
||||
personnelFileId={fileId}
|
||||
assignments={assignments}
|
||||
members={members}
|
||||
canEdit={canEdit}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export default async function PersonnelPage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const user = await requirePermission('personnel.read')
|
||||
const { id } = await params
|
||||
@@ -133,7 +179,10 @@ export default async function PersonnelPage({ params }: { params: Promise<{ id:
|
||||
})
|
||||
}
|
||||
|
||||
const levels = await db.clearanceLevelConfig.findMany({ orderBy: { level: 'asc' } })
|
||||
const [levels, statusTags] = await Promise.all([
|
||||
db.clearanceLevelConfig.findMany({ orderBy: { level: 'asc' } }),
|
||||
listStatusTags(),
|
||||
])
|
||||
const level = levels.find((l) => l.level === akte.classification)
|
||||
const canEdit = canWritePersonnel(user.permissions, akte.classification).ok
|
||||
|
||||
@@ -154,10 +203,24 @@ export default async function PersonnelPage({ params }: { params: Promise<{ id:
|
||||
file={akte}
|
||||
canEdit={canEdit}
|
||||
levels={levels.filter((l) => l.level <= user.permissions.clearanceLevel)}
|
||||
statusTags={statusTags}
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="mt-10">
|
||||
<h2 className="font-condensed">{de.assignment.heading}</h2>
|
||||
<div className="mt-4">
|
||||
<Suspense fallback={<SkeletonLine width="50%" />}>
|
||||
<AssignmentBlock
|
||||
fileId={akte.id}
|
||||
permissions={user.permissions}
|
||||
canEdit={canEdit}
|
||||
/>
|
||||
</Suspense>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="mt-10">
|
||||
<h2 className="font-condensed">{de.document.heading}</h2>
|
||||
<div className="mt-4">
|
||||
@@ -179,7 +242,7 @@ export default async function PersonnelPage({ params }: { params: Promise<{ id:
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<Backlinks file={akte} permissions={user.permissions} />
|
||||
<Backlinks file={akte} permissions={user.permissions} canLink={canEdit} />
|
||||
</Suspense>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user