Skip to content

Commit 3346e7b

Browse files
authored
Merge pull request #1121 from opencrvs/ocrvs-10131-b
feat: configure SearchField for tennis-club-membership
2 parents ef2d952 + 3f01147 commit 3346e7b

File tree

4 files changed

+93
-11
lines changed

4 files changed

+93
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"@hapi/boom": "^9.1.1",
7070
"@hapi/hapi": "^20.0.1",
7171
"@hapi/inert": "^6.0.3",
72-
"@opencrvs/toolkit": "1.8.1-rc.c8c6227",
72+
"@opencrvs/toolkit": "1.9.0-rc.9518bea",
7373
"@types/chalk": "^2.2.0",
7474
"@types/csv2json": "^1.4.0",
7575
"@types/fhir": "^0.0.30",

src/form/tennis-club-membership.ts

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ import {
2121
field,
2222
event,
2323
user,
24-
or
24+
or,
25+
defineConditional,
26+
never
2527
} from '@opencrvs/toolkit/events'
2628
import { Event } from './types/types'
2729
import { MAX_NAME_LENGTH } from './v2/birth/validators'
@@ -220,11 +222,81 @@ const TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
220222
id: 'event.tennis-club-membership.action.declare.form.section.recommender.field.none.label'
221223
}
222224
},
225+
{
226+
id: 'recommender.search',
227+
type: FieldType.SEARCH,
228+
label: {
229+
defaultMessage: 'Registration Number of recommender',
230+
description: 'This is the label for the field',
231+
id: 'event.tennis-club-membership.action.declare.form.section.recommender.field.search.label'
232+
},
233+
configuration: {
234+
query: {
235+
type: 'or',
236+
clauses: [
237+
{
238+
'legalStatuses.REGISTERED.registrationNumber': {
239+
term: '{term}',
240+
type: 'exact'
241+
}
242+
}
243+
]
244+
},
245+
limit: 10,
246+
offset: 0,
247+
validation: {
248+
validator: defineConditional({
249+
type: 'string',
250+
pattern: '^[A-Za-z0-9]{12}$',
251+
description: 'Must be alpha-numeric and 12 characters long'
252+
}),
253+
message: {
254+
defaultMessage:
255+
'Invalid value: Must be alpha-numeric and 12 characters long',
256+
description: 'Error message for invalid value',
257+
id: 'tennis-club-membership.searchField.validation.invalid'
258+
}
259+
},
260+
indicators: {
261+
ok: {
262+
defaultMessage: 'Recommender found',
263+
description: 'OK button text',
264+
id: 'tennis-club-membership.searchField.indicators.ok'
265+
},
266+
clearModal: {
267+
title: {
268+
defaultMessage: 'Clear recommender?',
269+
description: 'Title for the clear confirmation modal',
270+
id: 'tennis-club-membership.searchField.indicators.clearModal.title'
271+
},
272+
description: {
273+
defaultMessage:
274+
'This will remove the details of the current recommender.',
275+
description: 'Description for the clear confirmation modal',
276+
id: 'tennis-club-membership.searchField.indicators.clearModal.description'
277+
}
278+
}
279+
}
280+
},
281+
conditionals: [
282+
{
283+
type: ConditionalType.DISPLAY_ON_REVIEW,
284+
conditional: never()
285+
}
286+
]
287+
},
223288
{
224289
id: 'recommender.name',
225290
configuration: { maxLength: MAX_NAME_LENGTH },
226291
type: FieldType.NAME,
227292
required: true,
293+
parent: field('recommender.search'),
294+
value: field('recommender.search').getByPath([
295+
'data',
296+
'firstResult',
297+
'declaration',
298+
'applicant.name'
299+
]),
228300
conditionals: [
229301
{
230302
type: ConditionalType.SHOW,
@@ -242,6 +314,10 @@ const TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
242314
id: 'recommender.id',
243315
type: 'TEXT',
244316
required: true,
317+
parent: field('recommender.search'),
318+
value: field('recommender.search').get(
319+
'data.firstResult.legalStatuses.REGISTERED.registrationNumber'
320+
),
245321
conditionals: [
246322
{
247323
type: ConditionalType.SHOW,

src/translations/client.csv

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -875,8 +875,6 @@ event.death.action.certificate.form.cancel.confirmation.title,This is the title
875875
event.death.action.certificate.form.label,This is what this form is referred as in the system,Death certificate collector,Collecteur de certificat de décès
876876
event.death.action.certificate.form.section.collectPayment.data.label,Title for the data section,Payment details,Détails du paiement
877877
event.death.action.certificate.form.section.collectPayment.fee.label,Title for the data entry,Fee,Frais
878-
event.death.action.certificate.form.section.collectPayment.fee.label,Title for the data entry,Fee,Frais
879-
event.death.action.certificate.form.section.collectPayment.service.label,Title for the data entry,Service,Service
880878
event.death.action.certificate.form.section.collectPayment.service.label,Title for the data entry,Service,Service
881879
event.death.action.certificate.form.section.collectPayment.service.label.afterRegistrationTarget,Death registration after 45 days of date of death message,Death registration after 45 days of date of death,Enregistrement du décès après 45 jours de la date du décès
882880
event.death.action.certificate.form.section.collectPayment.service.label.beforeRegistrationTarget,Death registration before 45 days of date of death message,Death registration before 45 days of date of death,Enregistrement du décès avant 45 jours de la date du décès
@@ -934,8 +932,6 @@ event.death.action.correction.reason.option.other.label,Label for the other opti
934932
event.death.action.correction.reason.other.label,Label for the reason,Specify reason,Préciser la raison
935933
event.death.action.declare.form.label,This is what this form is referred as in the system,Death declaration form,Formulaire de déclaration de décès
936934
event.death.action.declare.form.nid.unique,This is the error message for non-unique ID Number,National id must be unique,L'identifiant national doit être unique
937-
event.death.action.declare.form.nid.unique,This is the error message for non-unique ID Number,National id must be unique,L'identifiant national doit être unique
938-
event.death.action.declare.form.nid.unique,This is the error message for non-unique ID Number,National id must be unique,L'identifiant national doit être unique
939935
event.death.action.declare.form.review.comment.label,Label for the comment field in the review section,Comment,Commentaire
940936
event.death.action.declare.form.review.signature.label,Label for the signature field in the review section,Signature of informant,Signature de l'informateur
941937
event.death.action.declare.form.review.title,Title of the form to show in review page,"{deceased.name.firstname, select, __EMPTY__ {{deceased.name.surname, select, __EMPTY__ {Death declaration} other {Death declaration for {deceased.name.surname}}}} other {{deceased.name.surname, select, __EMPTY__ {Death declaration for {deceased.name.firstname}} other {Death declaration for {deceased.name.firstname} {deceased.name.surname}}}}}","{deceased.name.firstname, select, __EMPTY__ {{deceased.name.surname, select, __EMPTY__ {Déclaration de décès} other {Déclaration de décès de {deceased.name.surname}}}} other {{deceased.name.surname, select, __EMPTY__ {Déclaration de décès de {deceased.name.firstname}} other {Déclaration de décès de {deceased.name.firstname} {deceased.name.surname}}}}}"
@@ -1073,7 +1069,6 @@ event.tennis-club-membership.action.collect-certificate.label,This is shown as t
10731069
event.tennis-club-membership.action.declare.form.label,This is what this form is referred as in the system,Tennis club membership application,Tennis club membership application
10741070
event.tennis-club-membership.action.declare.form.review.title,Title of the form to show in review page,"{applicant.name.firstname, select, __EMPTY__{{applicant.name.surname, select, __EMPTY__{Member declaration} other{Member declaration for {applicant.name.surname}}}} other{{applicant.name.surname, select, __EMPTY__{Member declaration for {applicant.name.firstname}} other{Member declaration for {applicant.name.firstname} {applicant.name.surname}}}}}","{applicant.name.firstname, select, __EMPTY__ {{applicant.name.surname, select, __EMPTY__ {Déclaration des membres} other {Déclaration des membres pour {applicant.name.surname}}}} other {{applicant.name.surname, select, __EMPTY__ {Déclaration des membres pour {applicant.name.firstname}} other {Déclaration des membres pour {applicant.name.firstname} {applicant.name.surname}}}}}"
10751071
event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label,This is the label for the field,Recommender's first name,Recommender's first name
1076-
event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label,This is the label for the field,Recommender's name,Nom du recommandataire
10771072
event.tennis-club-membership.action.declare.form.section.recommender.field.id.label,This is the label for the field,Recommender's membership ID,Recommender's membership ID
10781073
event.tennis-club-membership.action.declare.form.section.recommender.field.none.label,This is the label for the field,No recommender,No recommender
10791074
event.tennis-club-membership.action.declare.form.section.recommender.title,This is the title of the section,Who is recommending the applicant?,Who is recommending the applicant?
@@ -2011,6 +2006,17 @@ search.searchResultFor,The search result text,Search result for “{param}”,r
20112006
search.searchingFor,The searching for text,Searching for “{param}”,Recherche de “{param}”
20122007
search.totalResultText,The total result text,"{total, plural, =0 {} one {# record found} other {# records found}} ","{total, plural, =0 {} one {# record found} other {# records found}}"
20132008
search.waitingForConnection,The text when there is no connectivity,Reconnect to load declarations,Se reconnecter pour charger les déclarations
2009+
searchField.indicators.clearButton,Clear button text,Clear,Effacer
2010+
searchField.indicators.clearModal.cancel,Cancel button for clear confirmation modal,Cancel,Annuler
2011+
searchField.indicators.clearModal.confirm,Confirm button for clear confirmation modal,Confirm,Confirmer
2012+
searchField.indicators.clearModal.description,Description for the clear confirmation modal,This will remove the current search results.,Cela supprimera les résultats de recherche actuels.
2013+
searchField.indicators.clearModal.title,Title for the clear confirmation modal,Clear search results?,Effacer les résultats de recherche ?
2014+
searchField.indicators.confirmButton,Confirm button text,Search,Rechercher
2015+
searchField.indicators.httpError,HTTP error indicator,"{statusCode, select, 408{Timed out} other{An error occurred while fetching data}}","{statusCode, select, 408{Délai d'attente dépassé} other{Une erreur s'est produite lors de la récupération des données}}"
2016+
searchField.indicators.loading,Loading indicator,Searching...,Recherche en cours...
2017+
searchField.indicators.noResultsError,No results found indicator,No record found,Aucun enregistrement trouvé
2018+
searchField.indicators.offline,Offline indicator,Search is unavailable while offline,La recherche n'est pas disponible hors ligne
2019+
searchField.indicators.ok,OK button text,Found {count} results,{count} résultats trouvés
20142020
serviceWorker.cacheKey.WorkBoxRuntime.error.button.logout,Button label for logging out when WorkBox runtime cache key is missing,Log out,Se déconnecter
20152021
serviceWorker.cacheKey.WorkBoxRuntime.error.button.reload,Button label for logging out when WorkBox runtime cache key is missing,Reload,Recharger
20162022
serviceWorker.cacheKey.WorkBoxRuntime.error.content,Content shown when WorkBox runtime cache key is missing,"Something went wrong with loading the app. Reload this page, or log out and log back in to continue.",Un problème est survenu lors du chargement de l’application. Rechargez cette page ou déconnectez-vous puis reconnectez-vous pour continuer.

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -834,10 +834,10 @@
834834
dependencies:
835835
"@octokit/openapi-types" "^18.0.0"
836836

837-
"@opencrvs/toolkit@1.8.1-rc.c8c6227":
838-
version "1.8.1-rc.c8c6227"
839-
resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-1.8.1-rc.c8c6227.tgz#bac5a80475c4578e6aa802ae70aa4491872c6008"
840-
integrity sha512-RdTYBVgJRc2aSrKuLbDRYpAXu1TOssTra6cTuPwoJV23X48NOWuyrSImHf0PUKyS2puF/6v73G1QYyE5FK38Kg==
837+
"@opencrvs/toolkit@1.9.0-rc.9518bea":
838+
version "1.9.0-rc.9518bea"
839+
resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-1.9.0-rc.9518bea.tgz#e2277311379fffa88941a5e31c24a7b38639104c"
840+
integrity sha512-gVqKIX6SP+gO2BpjQfahc+TCn77e8/tp4OH8sJCHiRkEWoRoAsBe8cTbsT2NOVRwu4e4CWDeWS1jf8BOPGmRhA==
841841
dependencies:
842842
"@trpc/client" "11.4.3"
843843
"@trpc/server" "11.4.3"

0 commit comments

Comments
 (0)