Skip to main content

CnPartyPicker

One search field over several kinds of party: people and organisations from OpenRegister register sets (BRP persons, KvK companies, an app's own clients) and the reader's Nextcloud contacts, in one list. Each row shows initials, the name and a second line starting with the kind, as board DqNieuweZaak draws "Aanvrager" ("Henk Visser · Inwoner · Beukenlaan 3", "Visser Bouw B.V. · Organisatie · KvK 24157431"). It is built on CnSearchSelect.

Usage​

<CnPartyPicker
v-model="form.requester"
input-label="Requester"
placeholder="Name, BSN, trade name or KvK number"
:sources="[
{ id: 'person', register: 'dossiq', schema: 'brpPerson', label: 'Resident', title: '{firstName} {lastName}', secondary: '{residence.street} {residence.houseNumber}' },
{ id: 'company', register: 'dossiq', schema: 'kvkCompany', label: 'Organisation', title: '{tradeName}', secondary: 'KvK {sourceId}' },
{ id: 'contact', type: 'contacts', label: 'Contact' },
]"
@select="onRequester" />

Typing two characters or more searches every source at once (OpenRegister's _search, or Nextcloud's contacts menu for type: "contacts"); a source that fails adds nothing. update:modelValue emits the chosen row's id, and select the whole choice { source, id, label, secondary, row }, so a host can store more than the id (a case's initiator type, source id and display name). A value the list does not hold shows selectedLabel, or is looked up by id in the OpenRegister sources. A term a source refuses (OpenRegister answers 400 for a term it cannot parse, such as an unclosed bracket) is said under the field in the server's words, rather than shown as an empty list. A source that could not be searched at all (an app not installed, a server error) is named under the field, so an empty list never hides a missing source.

Props​

PropTypeDefaultDescription
modelValueString | NumbernullThe chosen party's id
sourcesArray[]{ id, register, schema, label?, title?, secondary?, limit?, icon? } per OpenRegister set (title and secondary templates filled from the row, label the kind, through the app's translate), or { id, type: "contacts", label? }
inputLabelString''The field's label
inputIdStringundefinedThe search input's id, so the form's own label names it.
labelOutsideBooleanfalseDraw the label above the field
placeholderString''Placeholder, through the app's translate
selectedLabelString''The chosen party's name before the list holds it
clearableBooleantrueOffer a clear button
disabledBooleanfalseDisable the field
minLengthNumber2The fewest characters a search needs

Events​

EventPayloadDescription
update:modelValueid or nullThe chosen party's id
select{ source, id, label, secondary, row } or nullThe whole choice