Skip to content

Commit 24b4593

Browse files
committed
Expose collector form field values to svg
The handlebars context had no access to the collector form's values
1 parent 7360225 commit 24b4593

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
This version enforces environment to have Node 22 installed (supported until 30 April 2027) and removes support for Node 18 for better performance and using [new features](https://github.com/nodejs/node/releases/tag/v22.0.0) offered by NodeJS
2020

2121
- Use nvm to upgrade your local development environment to use node version `22.x.x.`
22+
- Add collector form fields to the handlebars context so that helper can have logic targeting collector form values
2223

2324
- **UI enhancements**
2425

packages/client/src/v2-events/features/events/actions/print-certificate/Review.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ export function Review() {
218218
locations,
219219
users,
220220
certificateConfig,
221-
language
221+
language,
222+
collectorFormData: annotation
222223
})
223224
/**
224225
* If there are validation errors in the form, redirect to the

packages/client/src/v2-events/features/events/actions/print-certificate/pdfUtils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ export function compileSvg({
219219
$metadata,
220220
$declaration,
221221
$actions,
222+
$collectorForm,
222223
locations,
223224
users,
224225
review,
@@ -233,6 +234,7 @@ export function compileSvg({
233234
}
234235
$actions: ActionDocument[]
235236
$declaration: EventState
237+
$collectorForm?: Record<string, unknown>
236238
locations: Location[]
237239
users: UserOrSystem[]
238240
/**
@@ -566,6 +568,7 @@ export function compileSvg({
566568
const data = {
567569
$declaration,
568570
$metadata,
571+
$collectorForm: $collectorForm ?? {},
569572
$review: review,
570573
$references: {
571574
locations,

packages/client/src/v2-events/hooks/usePrintableCertificate.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,16 @@ export const usePrintableCertificate = ({
6767
locations,
6868
users,
6969
certificateConfig,
70-
language
70+
language,
71+
collectorFormData
7172
}: {
7273
event: EventDocument
7374
config: EventConfig
7475
locations: Location[]
7576
users: UserOrSystem[]
7677
certificateConfig?: CertificateTemplateConfig
7778
language?: LanguageConfig
79+
collectorFormData?: Record<string, unknown>
7880
}) => {
7981
const { eventConfiguration } = useEventConfiguration(event.type)
8082
const { config: appConfig } = useSelector(getOfflineData)
@@ -112,6 +114,7 @@ export const usePrintableCertificate = ({
112114
$metadata: modifiedMetadata,
113115
$declaration: declaration,
114116
$actions: event.actions as ActionDocument[],
117+
$collectorForm: collectorFormData,
115118
review: true,
116119
locations,
117120
users,
@@ -148,6 +151,7 @@ export const usePrintableCertificate = ({
148151
},
149152
$declaration: declarationWithResolvedImages,
150153
$actions: event.actions as ActionDocument[],
154+
$collectorForm: collectorFormData,
151155
locations,
152156
review: false,
153157
users,

0 commit comments

Comments
 (0)