mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-09-07 17:45:43 +00:00
feat: implement auto-filling of license and registration document slots from personal vault and add UI labels for vault-sourced files
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import {
|
||||
Alert,
|
||||
Button,
|
||||
Checkbox,
|
||||
Divider,
|
||||
@@ -12,6 +13,7 @@ import {
|
||||
Text,
|
||||
TextInput,
|
||||
} from '@mantine/core';
|
||||
import { IconInfoCircle } from '@tabler/icons-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { BilingualInput, ModalFooter } from '@ema-platform/ui';
|
||||
import {
|
||||
@@ -225,6 +227,20 @@ export function DocumentRequirementEditorDrawer({
|
||||
title={<Text fw={700}>{isNew ? t('certReq.doc.add', 'Add document requirement') : t('certReq.doc.edit', 'Edit document requirement')}</Text>}
|
||||
>
|
||||
<Stack gap="md">
|
||||
{personal && (
|
||||
<Alert
|
||||
variant="light"
|
||||
color="blue"
|
||||
icon={<IconInfoCircle size={16} />}
|
||||
title={t('certReq.doc.keyMatchTitle', 'Keys are what link this to a licence')}
|
||||
>
|
||||
{t(
|
||||
'certReq.doc.keyMatchBody',
|
||||
'An applicant who holds this document has it copied onto any licence application asking for a requirement with the same key. A key that matches nothing is still collected — it simply never fills a form by itself.',
|
||||
)}
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
<TextInput
|
||||
label={t('certReq.doc.key', 'Key')}
|
||||
placeholder="bank_letter"
|
||||
@@ -232,7 +248,16 @@ export function DocumentRequirementEditorDrawer({
|
||||
value={draft.key}
|
||||
error={keyError}
|
||||
disabled={!isNew}
|
||||
description={isNew ? t('certReq.doc.keyHelp', 'Stable slug identifying this document slot') : t('certReq.doc.keyLocked', 'Key cannot change once created')}
|
||||
description={
|
||||
!isNew
|
||||
? t('certReq.doc.keyLocked', 'Key cannot change once created')
|
||||
: personal
|
||||
? t(
|
||||
'certReq.doc.keyHelpPersonal',
|
||||
'Use the same key as the licence document this should answer — an application is filled from this document only when the two keys match exactly.',
|
||||
)
|
||||
: t('certReq.doc.keyHelp', 'Stable slug identifying this document slot')
|
||||
}
|
||||
// The value is read out of the event first: a functional updater
|
||||
// runs after React has released the event, so `currentTarget` is
|
||||
// null by the time it would be read inside one.
|
||||
|
||||
@@ -174,6 +174,7 @@ export function DocumentsTab({
|
||||
|
||||
{attachments.map((attachment) => {
|
||||
const file = attachment.files?.[0];
|
||||
const fromVault = Boolean(attachment.copiedFromAttachmentId);
|
||||
const flagged = attachment.documentKey in flags;
|
||||
const verdict = verdictFor(attachment.documentKey);
|
||||
const pendingReject = attachment.documentKey in rejecting;
|
||||
@@ -199,6 +200,14 @@ export function DocumentsTab({
|
||||
requirementByKey.get(attachment.documentKey)?.name,
|
||||
) || attachment.documentKey}
|
||||
</Text>
|
||||
{/* Filed from the applicant's own document vault rather
|
||||
than uploaded against this application — worth knowing
|
||||
when the same file turns up on several files. */}
|
||||
{fromVault && (
|
||||
<Badge size="xs" variant="light" color="blue">
|
||||
{t("review.documents.fromVault", "From My Documents")}
|
||||
</Badge>
|
||||
)}
|
||||
{verdict && (
|
||||
<Tooltip
|
||||
label={
|
||||
|
||||
@@ -1148,6 +1148,7 @@ export const am: Translations = {
|
||||
uploaded: "{{document}} ተጭኗል",
|
||||
},
|
||||
documents: {
|
||||
fromVault: "ከሰነዶቼ",
|
||||
completeness: "የሚያስፈልጉ ሰነዶች",
|
||||
accepted: "ተቀባይነት አግኝቷል",
|
||||
rejected: "ተቀባይነት አላገኘም",
|
||||
@@ -1460,6 +1461,11 @@ export const am: Translations = {
|
||||
emptyKind: "ለዚህ የማመልከቻ ዓይነት እስካሁን የሰነድ መስፈርት የለም።",
|
||||
key: "ቁልፍ",
|
||||
keyHelp: "ይህን የሰነድ ቦታ የሚለይ ቋሚ መጠሪያ",
|
||||
keyHelpPersonal:
|
||||
"ይህ ሰነድ ሊመልሰው ከሚገባው የፈቃድ ሰነድ ጋር አንድ አይነት ቁልፍ ይጠቀሙ — ሁለቱ ቁልፎች በትክክል ሲመሳሰሉ ብቻ ማመልከቻው ከዚህ ሰነድ ይሞላል።",
|
||||
keyMatchTitle: "ከፈቃድ ጋር የሚያገናኘው ቁልፍ ነው",
|
||||
keyMatchBody:
|
||||
"ይህን ሰነድ የያዘ አመልካች፣ ተመሳሳይ ቁልፍ ያለው መስፈርት ለሚጠይቅ ማንኛውም የፈቃድ ማመልከቻ ሰነዱ ይገለበጥለታል። ከምንም ጋር የማይመሳሰል ቁልፍ አሁንም ይሰበሰባል — በራሱ ብቻ ቅጽ አይሞላም።",
|
||||
keyLocked: "ከተፈጠረ በኋላ ቁልፍ መቀየር አይቻልም",
|
||||
keyRequired: "ቁልፍ ያስፈልጋል",
|
||||
name: "ስም",
|
||||
|
||||
@@ -1155,6 +1155,7 @@ export const en = {
|
||||
uploaded: 'Uploaded {{document}}',
|
||||
},
|
||||
documents: {
|
||||
fromVault: 'From My Documents',
|
||||
completeness: 'Required documents',
|
||||
accepted: 'Accepted',
|
||||
rejected: 'Rejected',
|
||||
@@ -1466,6 +1467,11 @@ export const en = {
|
||||
emptyKind: 'No document requirements for this application kind yet.',
|
||||
key: 'Key',
|
||||
keyHelp: 'Stable slug identifying this document slot',
|
||||
keyHelpPersonal:
|
||||
'Use the same key as the licence document this should answer — an application is filled from this document only when the two keys match exactly.',
|
||||
keyMatchTitle: 'Keys are what link this to a licence',
|
||||
keyMatchBody:
|
||||
'An applicant who holds this document has it copied onto any licence application asking for a requirement with the same key. A key that matches nothing is still collected — it simply never fills a form by itself.',
|
||||
keyLocked: 'Key cannot change once created',
|
||||
keyRequired: 'Key is required',
|
||||
name: 'Name',
|
||||
|
||||
Reference in New Issue
Block a user