Ga naar hoofdinhoud

CnDuplicateWarning

"This may already exist", shown before a record is filed. It renders OpenRegister's scored matches ({ uuid, score, matchedOn }) and never scores anything itself, so the warning cannot drift from the check that refuses the write. Each row shows the matched record's title and a meta line, linked to its page, then what it matched on and how strongly. A match the user may not read is reported as "A record you may not open", without disclosing it.

Under a warn policy anyone may file it anyway. Under block only a user who mayOverride may, and they must say why; everyone else is told to open the record it matches. dossiq's case intake is the first consumer; pipelinq contacts share it.

Usage​

<CnDuplicateWarning
:matches="matches"
:records="readableCases"
policy="block"
:may-override="isCoordinator"
row-title="{title}"
row-meta="{identifier}"
record-url="/apps/dossiq/cases/{uuid}"
:field-labels="{ requester: 'Requester', title: 'Subject', caseType: 'Case type' }"
headline="{count} open cases look like this one."
@file="save"
@close="cancel" />

From code, for example a create override, use openDuplicateWarning: it mounts the warning and resolves with { reason, over } or null. duplicateAffordances decides what it offers, and candidateWithoutBlanks builds the candidate for the check.

Props​

PropTypeDefaultDescription
matchesArray[]The scored matches: { uuid, score, matchedOn }
recordsArray[]The matched records the user may read, matched by id, uuid or @self.id
policyString'warn'warn or block; anything else reads as warn
mayOverrideBooleanfalseWhether this user may file over a block (and must say why)
rowTitleString'{title}'A record's title, a template
matchedTextString''What a match was found on, with {fields} (joined as a list: "Aanvrager en Onderwerp") and {percentage} filled, through the host translate. Empty: "Aanvrager, Onderwerp (82%)".
eyebrowString''A line above the title, as the board dialogs draw one.
reasonHintString''The help line under the reason field.
footnoteString''A muted note under the matches and the reason, for what Cancel and a block mean.
rowMetaString'{identifier}'A record's meta line, a template
recordUrlString''A record's page, a template with {uuid}; empty draws no link
fieldLabelsObject{}Words for the matched fields, through the app's translate
titleString''The dialog title; defaults to "This may already exist"
headlineString''The note's sentence with {count}; defaults to "%n existing record(s) look like this one."
blockedTextString''The sentence under a block the user may not pass
reasonLabelString''The reason field's label; defaults to "Why file it anyway"
continueLabelString''The continue button's label; defaults to "File it anyway"

Events​

EventPayloadDescription
file{ reason, over }The user files it anyway; over lists the matched uuids
closeThe user went back without filing