Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As a user I want to select a template to issue a certified copy with #290

Merged
merged 37 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ece7b17
new certificate svg template added
tareq89 Oct 3, 2024
df4ccad
client csv certificate fields updated
tareq89 Oct 3, 2024
5707a73
added new route to get certificate config data
tareq89 Oct 3, 2024
b37fe8b
update certificate template folder
tareq89 Oct 4, 2024
ea0feec
select certificate template label added
tareq89 Oct 4, 2024
daf4039
additional certificate config info added
tareq89 Oct 14, 2024
e7593bd
selectedTemplate translation added
tareq89 Oct 22, 2024
3b70b35
ICertificateConfigData added
tareq89 Oct 29, 2024
70f3eca
change log updated
tareq89 Oct 29, 2024
9817ad2
misc
tareq89 Oct 31, 2024
4c6f497
/certificates auth enabled
tareq89 Oct 31, 2024
1ab5a36
certificate svg auth enabled
tareq89 Nov 1, 2024
3fa9bdb
variables binding in sample svg certificates
tareq89 Nov 6, 2024
27c1e1b
certificate indentation fixed
tareq89 Nov 11, 2024
0ff8a8f
rect removed from svg certificate as image container
tareq89 Nov 12, 2024
768f9e9
groom and bride last name added in the certificate
tareq89 Nov 12, 2024
f11a733
misc binding issues in certificates
tareq89 Nov 12, 2024
76d8889
misc
tareq89 Nov 13, 2024
22fb4f2
registrar signature condition updated
tareq89 Nov 14, 2024
ce98c00
serving svg templates as file
tareq89 Nov 14, 2024
125f534
marriage certificate witness relation added
tareq89 Nov 18, 2024
a4b1b25
added formattedAddress helper
tareq89 Nov 19, 2024
79f37bf
always using birth date in certificates, not years of age
tareq89 Nov 19, 2024
5863316
informant helper added in certificates
tareq89 Nov 19, 2024
1c597ef
different certificate fees changed
tareq89 Nov 20, 2024
1513082
added secondary font Libre Baskerville in birth certificate
tareq89 Nov 20, 2024
18ca15b
marriage otherRelationship template operation changed to fieldValueTr…
tareq89 Nov 22, 2024
cc54d0b
ageOf**InYears variable implementation fixed
tareq89 Nov 25, 2024
b114adf
hide parent address if not available in birth certificate
tareq89 Nov 27, 2024
94bac86
Merge branch 'develop' of github.com:opencrvs/opencrvs-countryconfig …
tareq89 Nov 28, 2024
3379e8b
certificateTemplateId validation message added
tareq89 Nov 29, 2024
74d669b
otherInformantType added in birth and death certificate
tareq89 Dec 3, 2024
3173284
Merge branch 'develop' of github.com:opencrvs/opencrvs-countryconfig …
tareq89 Dec 5, 2024
5db618f
modified certificate/{id}
tareq89 Dec 10, 2024
173a327
Merge branch 'develop' of github.com:opencrvs/opencrvs-countryconfig …
tareq89 Dec 19, 2024
f899dfb
Merge branch 'develop' of github.com:opencrvs/opencrvs-countryconfig …
tareq89 Dec 26, 2024
b07cb57
unused ccertificate template svgs removed
tareq89 Dec 26, 2024
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
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

### Breaking changes

- **Title** Description
- Existing implementations relying on database-stored SVGs need to be updated to use the new configuration-based approach. A migration needs to be run (defined in [migration](https://github.com/opencrvs/opencrvs-core/pull/7813/files#diff-e5472dec87399bb9f73f75ec379ceb6a32ca135bc01dd8d0eb8f7d7aaa0bc0b1)), and default certificate templates must be created for each event type, following the convention `${event}-certificate` as the certificate template ID.

### Improvements

Expand All @@ -32,7 +32,7 @@

### New features

- **Major new feature** Description
- **Refactored certificate handling:** SVGs are no longer stored in the database; streamlined configurations now include certificate details, and clients request SVGs directly via URLs.
- Misc new feature
- Add constant.humanName to allow coutries to have custom ordering on thier full name e.g start with `lastName` or `firstName` [#6830](https://github.com/opencrvs/opencrvs-core/issues/6830)

Expand Down
2 changes: 1 addition & 1 deletion src/api/application/application-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const applicationConfig = {
DECLARATION_AUDIT_LOCATIONS: 'DISTRICT',
FEATURES: {
DEATH_REGISTRATION: true,
MARRIAGE_REGISTRATION: false,
tareq89 marked this conversation as resolved.
Show resolved Hide resolved
MARRIAGE_REGISTRATION: true,
EXTERNAL_VALIDATION_WORKQUEUE: false,
INFORMANT_SIGNATURE: false,
PRINT_DECLARATION: false,
Expand Down
36 changes: 0 additions & 36 deletions src/api/certificate-configuration/handler.ts

This file was deleted.

183 changes: 178 additions & 5 deletions src/api/certificates/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,184 @@
*/

import { Request, ResponseToolkit } from '@hapi/hapi'
import { readFileSync } from 'fs'

type FontFamilyTypes = {
normal: string
bold: string
italics: string
bolditalics: string
}
export interface ICertificateConfigData {
id: string
event: Event
label: {
id: string
defaultMessage: string
description: string
}
isDefault: boolean
fee: {
onTime: number
late: number
delayed: number
}
svgUrl: string
fonts?: Record<string, FontFamilyTypes>
}

export async function certificateHandler(request: Request, h: ResponseToolkit) {
const res = readFileSync(
`./src/api/certificates/source/Farajaland-${request.params.event}-certificate-v2.svg`
).toString()
return h.response(res).code(200)
if (request.params.id) {
const filePath = `${__dirname}/source/${request.params.id}`
return h.file(filePath)
}
const certificateConfigs: ICertificateConfigData[] = [
{
id: 'birth-certificate',
event: 'birth',
label: {
id: 'certificates.birth.certificate',
defaultMessage: 'Birth Certificate',
description: 'The label for a birth certificate'
},
isDefault: true,
fee: {
onTime: 5,
late: 7,
delayed: 15
},
svgUrl: '/api/countryconfig/certificates/birth-certificate.svg',
fonts: {
'Libre Baskerville': {
normal: '/api/countryconfig/fonts/LibreBaskerville-Regular.ttf',
bold: '/api/countryconfig/fonts/LibreBaskerville-Bold.ttf',
italics: '/api/countryconfig/fonts/LibreBaskerville-Italic.ttf',
bolditalics: '/api/countryconfig/fonts/LibreBaskerville-Regular.ttf'
}
}
},
{
id: 'birth-certificate-certified-copy',
event: 'birth',
label: {
id: 'certificates.birth.certificate.copy',
defaultMessage: 'Birth Certificate certified copy',
description: 'The label for a birth certificate'
},
isDefault: false,
fee: {
onTime: 8,
late: 11.5,
delayed: 17
},
svgUrl:
'/api/countryconfig/certificates/birth-certificate-certified-copy.svg',
fonts: {
'Noto Sans': {
normal: '/api/countryconfig/fonts/NotoSans-Regular.ttf',
bold: '/api/countryconfig/fonts/NotoSans-Bold.ttf',
italics: '/api/countryconfig/fonts/NotoSans-Regular.ttf',
bolditalics: '/api/countryconfig/fonts/NotoSans-Regular.ttf'
}
}
},
{
id: 'death-certificate',
event: 'death',
label: {
id: 'certificates.death.certificate',
defaultMessage: 'Death Certificate',
description: 'The label for a death certificate'
},
isDefault: true,
fee: {
onTime: 3,
late: 5.7,
delayed: 12
},
svgUrl: '/api/countryconfig/certificates/death-certificate.svg',
fonts: {
'Noto Sans': {
normal: '/api/countryconfig/fonts/NotoSans-Regular.ttf',
bold: '/api/countryconfig/fonts/NotoSans-Bold.ttf',
italics: '/api/countryconfig/fonts/NotoSans-Regular.ttf',
bolditalics: '/api/countryconfig/fonts/NotoSans-Regular.ttf'
}
}
},
{
id: 'death-certificate-certified-copy',
event: 'death',
label: {
id: 'certificates.death.certificate.copy',
defaultMessage: 'Death Certificate certified copy',
description: 'The label for a death certificate'
},
isDefault: false,
fee: {
onTime: 6,
late: 9,
delayed: 14.5
},
svgUrl:
'/api/countryconfig/certificates/death-certificate-certified-copy.svg',
fonts: {
'Noto Sans': {
normal: '/api/countryconfig/fonts/NotoSans-Regular.ttf',
bold: '/api/countryconfig/fonts/NotoSans-Bold.ttf',
italics: '/api/countryconfig/fonts/NotoSans-Regular.ttf',
bolditalics: '/api/countryconfig/fonts/NotoSans-Regular.ttf'
}
}
},
{
id: 'marriage-certificate',
event: 'marriage',
label: {
id: 'certificates.marriage.certificate',
defaultMessage: 'Marriage Certificate',
description: 'The label for a marriage certificate'
},
isDefault: true,
fee: {
onTime: 4.4,
late: 6,
delayed: 13.5
},
svgUrl: '/api/countryconfig/certificates/marriage-certificate.svg',
fonts: {
'Noto Sans': {
normal: '/api/countryconfig/fonts/NotoSans-Regular.ttf',
bold: '/api/countryconfig/fonts/NotoSans-Bold.ttf',
italics: '/api/countryconfig/fonts/NotoSans-Regular.ttf',
bolditalics: '/api/countryconfig/fonts/NotoSans-Regular.ttf'
}
}
},
{
id: 'marriage-certificate-certified-copy',
event: 'marriage',
label: {
id: 'certificates.marriage.certificate.copy',
defaultMessage: 'Marriage Certificate certified copy',
description: 'The label for a marriage certificate'
},
isDefault: false,
fee: {
onTime: 7,
late: 10.6,
delayed: 18
},
svgUrl:
'/api/countryconfig/certificates/marriage-certificate-certified-copy.svg',
fonts: {
'Noto Sans': {
normal: '/api/countryconfig/fonts/NotoSans-Regular.ttf',
bold: '/api/countryconfig/fonts/NotoSans-Bold.ttf',
italics: '/api/countryconfig/fonts/NotoSans-Regular.ttf',
bolditalics: '/api/countryconfig/fonts/NotoSans-Regular.ttf'
}
}
}
]
return certificateConfigs
}
Loading
Loading