'use client' import { AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from '@/components/ui/AlertDialog' import { Button } from '@/components/ui/button' import type { PersonCapacityExitManifest } from '@/utilities/people/personCapacityExit' type PeopleCapacityExitDialogProps = { open: boolean personName: string manifest: PersonCapacityExitManifest onConfirm: () => void onCancel: () => void } const plural = (count: number, singular: string, pluralForm?: string): string => `${count} ${count === 1 ? singular : (pluralForm ?? `${singular}s`)}` /** * C128 — the destructive-exit confirmation of the people list: when the LAST * municipality of a capacity leaves the row, the entity (staff account or * leadership) dies server-side. This dialog lists — verbatim from the * read-only manifest — everything the transactional exit removes, and only * then lets the guard resolve the pending commit (same pattern as * `DeletePersonButton`; a cancel resolves the guard to `false` and nothing is * touched). */ export const PeopleCapacityExitDialog = ({ open, personName, manifest, onConfirm, onCancel, }: PeopleCapacityExitDialogProps) => { const isLeadership = manifest.capacity === 'leadership' return ( !next && onCancel()}> {isLeadership ? 'Encerrar liderança' : 'Encerrar assessoria'} Esta ação não pode ser desfeita. Será removida a capacidade de{' '} {personName}: {isLeadership ? ( ) : ( )} Cancelar ) }