feat: simplify registry number format to B-2026-00001

New format: single-letter prefix + year + 5-digit sequence.
No direction code (IN/OUT) in the number — shown via arrow icon.
Sequence is shared across directions within the same company+year.

Changes:
- REGISTRY_COMPANY_PREFIX: BTG→B, USW→U, SDT→S, GRP→G
- OLD_COMPANY_PREFIX map for backward compat with existing entries
- allocateSequenceNumber: searches both old and new format entries
  to find the actual max sequence (backward compat)
- recalculateSequence: same dual-format search
- parseRegistryNumber: supports 3 formats (current, v1, legacy)
- isNewFormat: updated regex for B-2026-00001
- CompactNumber: already used single-letter badges, just updated comment
- debug-sequences endpoint: updated for new format
- Notification test data: updated to new format
- RegistrySequence.type: now "SEQ" (shared) instead of "IN"/"OUT"

After deploy: POST /api/registratura/debug-sequences to clean up
old counters, then recreate test entries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-11 21:49:35 +02:00
parent eb39024548
commit 0f555c55ee
9 changed files with 175 additions and 85 deletions
@@ -377,7 +377,7 @@ export function RegistraturaModule() {
<div className="space-y-1.5">
<p className="text-xs font-semibold text-muted-foreground uppercase tracking-wider">Numerotare</p>
<ul className="text-xs text-muted-foreground space-y-1 list-disc pl-4">
<li>Numerele se atribuie automat (BTG-2026-IN-00001)</li>
<li>Numerele se atribuie automat (B-2026-00001)</li>
<li>Nu modifica manual numărul de înregistrare</li>
<li>Fiecare companie are propria secvență</li>
</ul>
@@ -588,7 +588,7 @@ const COMPANY_BADGE: Record<string, { label: string; className: string }> = {
};
function CompactNumber({ entry }: { entry: RegistryEntry }) {
// Extract plain number with leading zeros: "BTG-0042/2026" → "0042/2026"
// Extract plain number: "B-2026-00001" → "2026-00001"
const plain = (entry.number ?? "").replace(/^[A-Z]+-/, "");
const badge = COMPANY_BADGE[entry.company ?? ""] ?? { label: "B", className: "bg-blue-600 text-white" };