Skip to content

Conversation

@bvenceslas
Copy link
Contributor

@bvenceslas bvenceslas commented Sep 18, 2025

Description

This PR is made to create a Print Button that will facilitate Madagascar to print the certificate in offline mode.
The print button will be used on the review page.

country confid PR

Issues

[Issue #10039 ]
Issue #10102

Checklist

  • I have linked the correct Github issue under "Development"
  • I have tested the changes locally, and written appropriate tests
  • I have tested beyond the happy path (e.g. edge cases, failure paths)
  • I have updated the changelog with this change (if applicable)
  • I have updated the GitHub issue status accordingly

bvenceslas and others added 3 commits September 10, 2025 18:32
# Conflicts:
#	packages/client/src/v2-events/components/forms/File.interaction.stories.tsx
#	packages/client/src/v2-events/components/forms/FormFieldGenerator/FormSectionComponent.tsx
@github-actions

This comment has been minimized.

@bvenceslas bvenceslas marked this pull request as ready for review September 25, 2025 13:46
Copy link
Contributor

@cibelius cibelius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the PR check failures need to be fixed, will review again after that is done

@bvenceslas bvenceslas changed the title WIP: Create print button — add hasRole feature Create print button — add hasRole feature Sep 29, 2025
? findActiveDraftForEvent(event, remoteDraft)
: undefined

const emptyDraft = createEmptyDraft(event.id, createTemporaryId(), 'DECLARE')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need further clarification about which actionTypes can be passed here

throw Error(res.statusText)
}
const response = await res.json()
const response: IApplicationConfigResponse = await res.json()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these changes are failing storybook stories locally and in CI

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the default HTTP handlers in Storybook now return a 8 byte string as the "font". Previously it seemed like our http handlers were internally making requests to country config to fetch the fonts. Not sure how it ever worked as CI certainly doens't have country config running

return HttpResponse.arrayBuffer(fontArrayBuffer)
}),

http.get('/api/countryconfig/fonts/NotoSans-Bold.ttf', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

storybook interactions passing locally now, but still failing when snapshots are being taken a tad early, do we need to introduce a delay in the snapshot?

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

// If even one of the parts is undefined or null, then return empty string
const idParts = args.slice(0, -1)
if (idParts.some((part) => part === undefined)) {
if (idParts.some((part) => !isNil(part))) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Intl Helper Condition Inverted

The $intl Handlebars helper's condition if (idParts.some((part) => !isNil(part))) is inverted. It currently returns an empty string when all idParts are defined, rather than when any part is null or undefined, leading to incorrect translation ID processing.

Fix in Cursor Fix in Web

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pankaj-pant note this. I changed it to isNil(part)

…s tennis club membership cert expects there to be a PRINT_CERTIFICATE action
// If even one of the parts is undefined or null, then return empty string
const idParts = args.slice(0, -1)
if (idParts.some((part) => part === undefined)) {
if (idParts.some((part) => !isNil(part))) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Intl Helper Returns Incorrectly

The $intl Handlebars helper in pdfUtils.ts has an inverted condition. It currently returns an empty string when all idParts are defined, rather than when any part is null or undefined as intended.

Fix in Cursor Fix in Web

createdBySignature: userDetails.localRegistrar?.signature,
createdAtLocation: userDetails.primaryOffice.id as UUID
}
]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Invalid Action Type Causes Runtime Errors

The AlphaPrintButton component creates an optimistic action with DECLARATION_ACTION_UPDATE as its type. This string constant is not a valid ActionType enum value, causing type mismatches and runtime errors when the action is processed or used in an EventDocument.

Fix in Cursor Fix in Web

mobile: '+260911111111',
email: '[email protected]',
role: {
id: TestUserRole.Enum.SOCIAL_WORKER,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Role ID and Label Mismatch Causes Authorization Issues

The fieldAgent user's role ID is set to TestUserRole.Enum.SOCIAL_WORKER, but its label remains 'Hospital Clerk'. This mismatch between the role ID and its displayed name could lead to incorrect authorization or confusing behavior.

Fix in Cursor Fix in Web

@rikukissa
Copy link
Member

E2Es passing here @bvenceslas @pankaj-pant https://github.com/opencrvs/e2e/actions/runs/18240400113

@opencrvs opencrvs deleted a comment from cursor bot Oct 4, 2025
@opencrvs opencrvs deleted a comment from cursor bot Oct 4, 2025
@opencrvs opencrvs deleted a comment from cursor bot Oct 4, 2025
@pankaj-pant pankaj-pant dismissed cibelius’s stale review October 4, 2025 15:09

All change requests resolved, and tests passing in CI and in e2e

@pankaj-pant pankaj-pant merged commit 7b299f3 into develop Oct 4, 2025
163 of 165 checks passed
@bvenceslas bvenceslas deleted the ocrvs-10039-new branch October 20, 2025 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

As a system admin, I need to be able to configure a print button in any page of the form that can print one of the certified copy templates

8 participants