Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ HTTP input now accepts `field('..')` references in the HTTP body definition.
- **Searchable Select**: A new select component that allows searching through options. Useful for selects with a large number of options. Currently being used in address fields. [#10749](https://github.com/opencrvs/opencrvs-core/issues/10749)

### Bug fixes

- During user password reset, email address lookup is now case insensitive [#9869](https://github.com/opencrvs/opencrvs-core/issues/9869)
- Users cannot activate or reactivate users with roles not specified in the `user.edit` scope [#9933](https://github.com/opencrvs/opencrvs-core/issues/9933)
- Login page no longer show "Farajaland CRVS" before showing the correct title [#10958](https://github.com/opencrvs/opencrvs-core/issues/10958)
Expand Down Expand Up @@ -332,6 +333,8 @@ To see Events V2 in action, check out the example configurations in the **countr
- Add Import/Export system client and `record.export` scope to enable data migrations [#10415](https://github.com/opencrvs/opencrvs-core/issues/10415)
- Add an Alpha version of configurable "Print" button that will be refactored in a later release - this button can be used to print certificates during declaration/correction flow. [#10039](https://github.com/opencrvs/opencrvs-core/issues/10039)
- Add bulk import endpoint [#10590](https://github.com/opencrvs/opencrvs-core/pull/10590)
- Add multi-field search with a single component [#10617](https://github.com/opencrvs/opencrvs-core/issues/10617)
- Add registration number field to advanced search configuration so that documents can be searched by their `Registration Number`. [#10760](https://github.com/opencrvs/opencrvs-core/issues/10760)

### Improvements

Expand Down
9 changes: 9 additions & 0 deletions packages/client/src/v2-events/features/events/Search/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ const defaultSearchFieldGenerator: Record<
id: 'advancedSearch.status'
},
options: statusOptions
}),
'event.legalStatuses.REGISTERED.registrationNumber': (_) => ({
id: 'event.legalStatuses.REGISTERED.registrationNumber',
type: FieldType.TEXT,
label: {
defaultMessage: 'Registration number',
description: 'Label for registration number field',
id: 'advancedSearch.registrationNumber'
}
})
} satisfies Record<EventFieldId, (config: AdvancedSearchField) => FieldConfig>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,11 @@ function applyActionConditionalEffects({
'customActionType' in action ? action.customActionType : undefined
})

if (!actionConfig || !actionConfig.conditionals) {
if (
!actionConfig ||
!('conditionals' in actionConfig) ||
!actionConfig.conditionals
) {
return action
}

Expand Down
2 changes: 1 addition & 1 deletion packages/commons/src/conditionals/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ function isActionConditionMet(
context: ValidatorContext,
conditionalType: ConditionalType
) {
if (!actionConfig.conditionals) {
if (!('conditionals' in actionConfig) || !actionConfig.conditionals) {
return true
}

Expand Down
79 changes: 31 additions & 48 deletions packages/commons/src/events/ActionConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,59 +53,41 @@ const DeclarationActionBase = ActionConfigBase.extend({
deduplication: DeduplicationConfig.optional()
})

const ReadActionConfig = ActionConfigBase.extend(
z.object({
type: z.literal(ActionType.READ),
review: DeclarationReviewConfig.describe(
'Configuration of the review page for read-only view.'
),
conditionals: z
.never()
.optional()
.describe('Read-action can not be disabled or hidden with conditionals.')
}).shape
)
const ReadActionConfig = ActionConfigBase.omit({ conditionals: true }).extend({
type: z.literal(ActionType.READ),
review: DeclarationReviewConfig.describe(
'Configuration of the review page for read-only view.'
)
})

const DeclareConfig = DeclarationActionBase.extend(
z.object({
type: z.literal(ActionType.DECLARE),
review: DeclarationReviewConfig.describe(
'Configuration of the review page fields.'
)
}).shape
)
const DeclareConfig = DeclarationActionBase.extend({
type: z.literal(ActionType.DECLARE),
review: DeclarationReviewConfig.describe(
'Configuration of the review page fields.'
)
})

const RejectConfig = ActionConfigBase.extend(
z.object({
type: z.literal(ActionType.REJECT)
}).shape
)
const RejectConfig = ActionConfigBase.extend({
type: z.literal(ActionType.REJECT)
})

const ValidateConfig = DeclarationActionBase.extend(
z.object({
type: z.literal(ActionType.VALIDATE)
}).shape
)
const ValidateConfig = DeclarationActionBase.extend({
type: z.literal(ActionType.VALIDATE)
})

const RegisterConfig = DeclarationActionBase.extend(
z.object({
type: z.literal(ActionType.REGISTER)
}).shape
)
const RegisterConfig = DeclarationActionBase.extend({
type: z.literal(ActionType.REGISTER)
})

const PrintCertificateActionConfig = ActionConfigBase.extend(
z.object({
type: z.literal(ActionType.PRINT_CERTIFICATE),
printForm: ActionFormConfig
}).shape
)
const PrintCertificateActionConfig = ActionConfigBase.extend({
type: z.literal(ActionType.PRINT_CERTIFICATE),
printForm: ActionFormConfig
})

const RequestCorrectionConfig = ActionConfigBase.extend(
z.object({
type: z.literal(ActionType.REQUEST_CORRECTION),
correctionForm: ActionFormConfig
}).shape
)
const RequestCorrectionConfig = ActionConfigBase.extend({
type: z.literal(ActionType.REQUEST_CORRECTION),
correctionForm: ActionFormConfig
})

const CustomActionConfig = ActionConfigBase.merge(
z.object({
Expand Down Expand Up @@ -149,7 +131,8 @@ export type ActionConfig = z.infer<typeof ActionConfig>

// Build a runtime set directly from the schema
export const actionConfigTypes: Set<ActionConfigTypes> = new Set(
ActionConfig.options.map((opt) => opt.shape.type.value)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
ActionConfig.options.map((opt: z.ZodObject<any>) => opt.shape.type.value)
)
/**
* Action types that come specifically from the country configuration.
Expand Down
2 changes: 2 additions & 0 deletions packages/commons/src/events/AdvancedSearchConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ export const EventFieldIdInput = z.enum([
'status',
'legalStatuses.REGISTERED.acceptedAt',
'legalStatuses.REGISTERED.createdAtLocation',
'legalStatuses.REGISTERED.registrationNumber',
'updatedAt'
])

Expand All @@ -142,6 +143,7 @@ export const EventFieldId = z.enum([
`${METADATA_FIELD_PREFIX}status`,
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.createdAtLocation`,
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.registrationNumber`,
`${METADATA_FIELD_PREFIX}updatedAt`
])

Expand Down
Loading