From 92f2f16b805d3d488e0a10ab275f379d5ada2add Mon Sep 17 00:00:00 2001 From: estifanos Date: Wed, 2 Sep 2026 10:31:18 +0000 Subject: [PATCH] feat: add REISSUE application kind and dynamic file size limits, and remove unused serviceKind logic --- .../components/BehaviorTab.tsx | 34 ++++++++----------- .../DocumentRequirementEditorDrawer.tsx | 1 + .../components/DocumentRequirementsTab.tsx | 13 ++++--- apps/backoffice/src/app/i18n/locales/am.ts | 1 + apps/backoffice/src/app/i18n/locales/en.ts | 1 + .../licensing/components/DocumentSlots.tsx | 8 +++-- .../pages/LicenseApplicationPage.tsx | 18 +++++++--- 7 files changed, 45 insertions(+), 31 deletions(-) diff --git a/apps/backoffice/src/app/features/certificate-requirements/components/BehaviorTab.tsx b/apps/backoffice/src/app/features/certificate-requirements/components/BehaviorTab.tsx index d1606b697..41ce93dd3 100644 --- a/apps/backoffice/src/app/features/certificate-requirements/components/BehaviorTab.tsx +++ b/apps/backoffice/src/app/features/certificate-requirements/components/BehaviorTab.tsx @@ -21,7 +21,6 @@ import { type CertificateCategory, type CompletionEffect, type LicenseType, - type ServiceKind, type WorkflowProfile, } from '@ema-platform/api'; import { useRequirementActions } from '../hooks/useRequirementActions'; @@ -29,7 +28,6 @@ import { useRequirementActions } from '../hooks/useRequirementActions'; /** The shape the form edits — every field the behaviour endpoint accepts. */ interface Draft { workflowProfile: WorkflowProfile; - serviceKind: ServiceKind; completionEffect: CompletionEffect | null; certificateCategory: CertificateCategory | null; requiresExamination: boolean; @@ -57,7 +55,6 @@ const REMINDER_OFFSETS = ['90', '60', '30', '14', '7']; function toDraft(licenseType: LicenseType): Draft { return { workflowProfile: licenseType.workflowProfile ?? 'STANDARD', - serviceKind: licenseType.serviceKind ?? 'LICENSE', completionEffect: licenseType.completionEffect ?? null, certificateCategory: licenseType.certificateCategory ?? null, requiresExamination: licenseType.requiresExamination ?? false, @@ -154,12 +151,22 @@ export function BehaviorTab({ licenseType }: { licenseType: LicenseType }) { ...rest } = draft; + // A type switched from "does not expire" straight to a term in days still + // carries `validityMonths: 0`, which the server's 6-month floor refuses. + // Days win over months at issuance, so the zero is simply left alone. + const term = expires + ? { + validityDays, + ...(validityMonths > 0 ? { validityMonths } : {}), + } + : {}; + const ok = await run( () => save({ id: licenseType.id, ...rest, - ...(expires ? { validityMonths, validityDays } : {}), + ...term, ...(expires && draft.renewalEnabled ? { renewalWindowDays, expiryReminderDays } : {}), @@ -241,21 +248,10 @@ export function BehaviorTab({ licenseType }: { licenseType: LicenseType }) { disabled={!canEdit} /> -