Skip to content

Commit 7c77fcb

Browse files
sherryhlialbertlai431ChinemeremChigbossreekarOustanDing
authored
[Release] Version 0.3.8 (#411)
* [Fix] Use Heroku recommended heap configs for 512 MB dyno (#405) * [Fix] make patient condition mandatory (#404) * [Fix] make patient condition mandatory * set default * Use created at not expiry date for sorting apps (#399) * Use created at not expiry date * Update utils.ts * Wallet Card Fix (#398) * [Release] Version 0.0.1 (#243) * [Fix] Fix replacement application expiry date ([Fix] Fix replacement application expiry date #242) * [Feature] Build privacy policy and terms and conditions pages ([Feature] Build privacy policy and terms and conditions pages #241) * [Improvement] Add error logging, improve error handling ([Improvement] Add error logging, improve error handling #240) * [Fix] Convert patient condition field to checkbox field ([Fix] Convert patient condition field to checkbox field #239) * [Feature] Add date of birth filter to permit holders page ([Feature] Add date of birth filter to permit holders page #238) * [Fix] Prevent RCD email from breaking into two lines ([Fix] Prevent RCD email from breaking into two lines #237) * [Fix] Various bug fixes ([Fix] Various bug fixes #236) * [Release] Version 0.0.2 (#249) * [Fix] Various bug fixes (#236) * [Fix] Prevent RCD email from breaking into two lines (#237) * [Feature] Add date of birth filter to permit holders page (#238) * [Fix] Convert patient condition field to checkbox field (#239) * Convert patient condition field to checkbox field * Fix build error * [Improvement] Add error logging, improve error handling (#240) * Add error logging, improve error handling * Replace GraphQL hooks with custom implementation * [Feature] Build privacy policy and terms and conditions pages (#241) * Create privacy policy and ToC pages * Fix links in ToC pages * [Fix] Fix replacement application expiry date (#242) * [Fix] Disable GraphQL playground in production (#244) * [Fix] Remove GQL playground redirect (#245) * [Improvement] Various fixes (#246) * [Fix] Fix homepage RCD emails (#247) * [Fix] Get most recent permit by latest expiry date (#248) * [Release] Version 0.0.3 (#251) * [Fix] Various bug fixes (#236) * [Fix] Prevent RCD email from breaking into two lines (#237) * [Feature] Add date of birth filter to permit holders page (#238) * [Fix] Convert patient condition field to checkbox field (#239) * Convert patient condition field to checkbox field * Fix build error * [Improvement] Add error logging, improve error handling (#240) * Add error logging, improve error handling * Replace GraphQL hooks with custom implementation * [Feature] Build privacy policy and terms and conditions pages (#241) * Create privacy policy and ToC pages * Fix links in ToC pages * [Fix] Fix replacement application expiry date (#242) * [Fix] Disable GraphQL playground in production (#244) * [Fix] Remove GQL playground redirect (#245) * [Improvement] Various fixes (#246) * [Fix] Fix homepage RCD emails (#247) * [Fix] Get most recent permit by latest expiry date (#248) * [Fix] Fix various applications issues (#250) * [Release] Version 0.0.4 (#255) * [Improvement] Split address fields in permit holders report ([Improvement] Split address fields in permit holders report #253) * [Fix] Restrict permit expiry filter to only active permits ([Fix] Restrict permit expiry filter to only active permits #254) * [Fix] Standardize date formatting ([Fix] Standardize date formatting #252) * [Release] Version 0.0.5 (#257) * [Fix] Show applicants even if they do not have an active permit ([Fix] Show applicants even if they do not have an active permit #256) * [Release] Version 0.0.6 (#264) * [Fix] Fix create new APP flow failing (#263) * [Fix] Fix task log entries not showing (#262) * [Fix] Fix inconsistent applicant flow copy (#261) * [Fix] Fix accountant report aggregation values (#260) * [Fix] Fix invoice records failing to be created (#259) * [Fix] Fix permit holders not rendering if no recent permit (#258) * Revert "[Release] Version 0.0.6 (#264)" This reverts commit 1f971f9. * [Release] Version 0.0.6 (#270) * [Fix] Disable GQL playground and introspection in production (#269) * [Fix] Specify node version in package.json (#268) * [Fix] Allow GQL introspection (#267) * [Fix] Re-enable GQL playground for debugging (#266) * [Fix] Add port to Next start script (#265) * [Fix] Fix create new APP flow failing (#263) * [Fix] Fix task log entries not showing (#262) * [Fix] Fix inconsistent applicant flow copy (#261) * [Fix] Fix accountant report aggregation values (#260) * [Fix] Fix invoice records failing to be created (#259) * [Fix] Fix permit holders not rendering if no recent permit (#258) * [Release] Version 0.0.7 * [Fix] Pin GitHub CI runner image to ubuntu-20.04 (#285) * Update README (#284) * Fix time zone bug in requests header (#281) * [Fix] Fix time zone for requests and reports (#278) * [Chore] Add BSF contributors to employee database (#277) * [Chore] Create docker-compose.yml file for local PostgreSQL instance (#276) * [Docs] BSF CONTRIBUTING.md (#275) * Revert "[Release] Version 0.0.7" This reverts commit 3f2d160. * [Release] Version 0.0.7 (#294) * [Fix] Change renewal report to most recent expiring permits (#293) * [Feature] Allow processing fee field to be manually edited (#291) * [Fix] Fix the GraphQL delete employee mutation (#286) * [Fix] Add refunds to accountant report (#292) * Add note field for permit holder’s old user ID (#290) * Update User ID copy (#289) * [Fix] Pin GitHub CI runner image to ubuntu-20.04 (#285) * Update README (#284) * Fix time zone bug in requests header (#281) * [Fix] Fix time zone for requests and reports (#278) * [Chore] Add BSF contributors to employee database (#277) * [Chore] Create docker-compose.yml file for local PostgreSQL instance (#276) * [Docs] BSF CONTRIBUTING.md (#275) * [Release] Version 0.0.8 (#304) * Update shopify-buy in yarn.lock (#303) * update shopify version to undeprecated one (#302) * Revert "[Release] Version 0.0.8 (#304)" This reverts commit 73dd958. * [Release] Version 0.0.8 (#308) * Allow numbers in MSP (#296) * [Fix] Broken contact us link (#298) * change nam and address spacing to absolute instead of floating (#300) * Go to applicationProcessing instead of application (#301) * update shopify version to undeprecated one (#302) * Fix bash command for Windows (#299) * Update shopify-buy in yarn.lock (#303) * [Fix] No guardian on delete (#297) * Update processing fee from $26 to $31 (#305) * [Feature] Support search by permit ID on Permit Holders page (#307) * Change pdf address spacing from 1.5 to 1.4 (#306) * [Fix] Update form links to reflect new processing fee (#309) * [Release] Version 0.0.9 (#321) * [Fix] Save poaFormS3ObjectKey when updating guardian information in permit holders page (#319) * [Fix] Postal Code Space Issue (#316) * Set other gender field on permit holders page (#318) * Add .nvmrc file (#317) * [Feature] Implement applicant deletion (#310) * [Feature] Implement application deletion (#315) * Display other gender field on permit holders page (#314) * Move wallet card task in application processing (#313) * [Feature] Tax receipt (#311) * [Fix] Fix expiry date for in-progress replacement applications (#274) * [Fix] Fix APP history permit type badge (#273) * [Improvement] Adjust spacing of address in invoice (#272) * [Fix] Show validation error messages on form mount (#271) * Revert "[Release] Version 0.0.9 (#321)" This reverts commit 6fb599c. * [Release] Version 0.0.9 (#324) * [Feature] Create setEmployeeAsActive GraphQL endpoint (#322) * [Fix] Save poaFormS3ObjectKey when updating guardian information in permit holders page (#319) * [Fix] Postal Code Space Issue (#316) * Set other gender field on permit holders page (#318) * Add .nvmrc file (#317) * [Feature] Implement applicant deletion (#310) * [Feature] Implement application deletion (#315) * Display other gender field on permit holders page (#314) * Move wallet card task in application processing (#313) * [Feature] Tax receipt (#311) * [Fix] Fix expiry date for in-progress replacement applications (#274) * [Fix] Fix APP history permit type badge (#273) * [Improvement] Adjust spacing of address in invoice (#272) * [Fix] Show validation error messages on form mount (#271) * [Release] Version 0.1.0 (#332) * [Release] Version 0.2.0 (#337) * [Improvement] Update donation receipt spacing (#326) * Fix validation schema for other gender field (#327) * Adjust schema to evaluate date at validation time (#328) * [Fix] Make replacement requests clearer (#325) * Add new contributor to seeding script (#330) * ignore the .yarn file for > v2.0.0 (#331) * [Misc] Create initial baseline migration file (#333) * [Doc] Update README with prisma migrate deploy command (#334) * [Fix] Fix replacement request otherGender and lostTimestamp form validations (#335) * [Misc] Add holiday closure banner (#336) * [Release] Version 0.3.0 (#351) * [Improvement] Clarify lowercase extension requirement for POA form upload (#343) * Change text on processing task 2 (#344) * Remove holiday closure banner (#345) * [Feature] Update ci.yml to add pending migrations to db (#339) * Update ci.yml to add pending migrations to db * Add .env file to CI * Update ci.yml * Update ci.yml * Use longer URL * Add to package.json instead * revert ci.yml * Re-add ci.yml * Add space to yarn build * Make title fit on one line (#347) * [Fix] Remove npx from start script (#348) * [Feature] Add AMEX (#346) * Add Amex * Add Amex to popoulate js file * Update populate-db-09-13-21.ts * [Fix] Revert init migration file and add new migration for AMEX paymenttype (#349) * Revert paymenttype edit to init migration file * Create migration to add AMEX paymenttype * [Improvement] Change helper text for date of birth (#350) * Change helper text for date of birth * Remove text wrapper on DOB helper text * [Feature] Add second payment method for permit requests (#338) * Add second payment method types to schema * Update application validation schema to allow second payment methods * Change payment detail components to show second payment method * Consider donations on second payment method in processing tasks * Update data pipelines to generate accountant reports with second payment method included * Update invoice and donation receipt with second payment method included * Rename second payment method variables to improve clarity * Add migration for second payment method --------- Co-authored-by: Sherry Li <sherryhli@users.noreply.github.com> Co-authored-by: Chinemerem <chinemeremchigbo@Outlook.com> * [Release] Version 0.3.1 (#354) * Fix second payment method reports (#352) * [Feature] Update permit holders report (#353) * Combine address lines 1 and 2 into one line * Add applicant age to permit holders report * Add recent app expiry date to permit holders report * [Version] Release 0.3.2 (#359) * Matthew Wang (#356) * [Fix] Fix formatting of date in donation tax receipt number (#357) * Fix month value indexing and padding in tax receipt number * Switch to using formatDate function from date util * Update permit holders report 2 (#358) * Update permit holders report 2 * Format postal code --------- Co-authored-by: Chinemerem <chinemeremchigbo@Outlook.com> Co-authored-by: Matthew Wang <53355975+mslwang@users.noreply.github.com> * [Release] Version 0.3.3 (#365) * Add Sharujan to employees.ts (#360) * [Improvement] Add Mail Lost Option as Replacement Reason (#340) * initial commit for the mail lost option * changed the processing fee for mail lost * made the migrations for mail lost * reverted yarn lock to staging * initial commit for the mail lost option * changed the processing fee for mail lost * made the migrations for mail lost * reverted yarn lock to staging --------- Co-authored-by: Chinemerem <chinemeremchigbo@Outlook.com> * Add $200 donation option (#355) * Add $200 donation option * Add $200 donation option * Update .env.sample with $200 donation product id --------- Co-authored-by: Chinemerem <chinemeremchigbo@Outlook.com> * Change address from unit 842 to 968 (#361) * [Fix] Add AMEX as a second payment option (#362) * [Feature] Add receipt numbers to application reports (#363) * [Misc] Update README.md (#364) --------- Co-authored-by: Chinemerem <chinemeremchigbo@Outlook.com> Co-authored-by: Keane Moraes <lordvader3002@gmail.com> Co-authored-by: Sherry Li <sherryhli@users.noreply.github.com> * [Release] Version 0.3.4 (#375) * Add bowen to employees (#367) * Add Jenny to employees (#368) * [Fix] Mail Lost Default to Cash (#366) * initial commit for the mail lost option * changed the processing fee for mail lost * made the migrations for mail lost * reverted yarn lock to staging * mail lost default to cash * removed the extra other option * Add Jenn Chen * fix name * [Fix] Fix names being clipped in table cell content (#370) * Set overflow-y to visible for table content * Update employee email for testing * Update overflow property for requests table * move generate report button (#369) * Update permit form links (#373) Use the 2024 links for the permit replacement and application forms * [Fix] Force network call for accountant report download (#371) --------- Co-authored-by: Chinemerem <chinemeremchigbo@Outlook.com> Co-authored-by: Keane Moraes <lordvader3002@gmail.com> Co-authored-by: Jennifer Chen <32009013+jennchenn@users.noreply.github.com> Co-authored-by: Jenny Vong <jenny_vong@outlook.com> * [Release] Version 0.3.5 (#384) * [enhancement] Track application status to return to original tab in admin view (#372) * Track application status to return to correct tab * fixup! Track application status to return to correct tab * [Fix] Unsaved Doctor's Information (#374) * used values.doctorInformation instead of doctorInformation * using validated values for doctor's info * [Improvement] Add pagination controls to top of requests/permit holders tables (#376) * Add pagination to top of requests table * Add pagination to top of permit holders table * Add Vihaan to employees.ts (#379) * Add Braydent to employee.ts (#380) * broyston: updated stamp png to contain new address (#382) * Add phone number and addresses to request report (#383) * Remove applicant deletion (#377) --------- Co-authored-by: Jennifer Chen <32009013+jennchenn@users.noreply.github.com> Co-authored-by: Keane Moraes <lordvader3002@gmail.com> Co-authored-by: Chinemerem <chinemeremchigbo@Outlook.com> Co-authored-by: Brayden Royston <brayden.royston10@gmail.com> * [Release] Version 0.3.6 (#396) * [Improvement] Sort permit past applications (#378) * Return creation timestamp in permit application query * Sort past permit applications in permit holder page * Fix types in sort function * Add createdAt type to application Pick * [Fix] updatedAt for Replacement Application fixed (#381) * added the updatedAt tag for the replacement appplicaiton * added the migration for the replacement app * removed the migration * Add David to employee.ts (#388) * Remove completed request deletion (#386) * [Feature] Add editable page numbers (#387) * Add editable page numbers * Add total pagination denominator * Added the model updatedAt to the prisma schema (#385) * Fixed Finanical Report Header Order (#390) * update GitHub Actions to use v4 cache/actions (#394) * Migrate Shopify checkout to Cart API (#393) * Migrate Shopify checkout to Cart API - Replace deprecated shopify-buy Checkout API with Shopify's Cart API - Remove shopify-buy.d.ts * Update utils.ts * Downgrad graphql-request * Create Wallet Card (#389) * Update Prisma Schema to store Generated Wallet Card (cherry picked from commit 3fc2703) * Update Prisma Schema to maintain both WalletCardCreated and WalletCard (cherry picked from commit 2b65a46) * Prisma Schema Wallet Bug fix (cherry picked from commit 4aa3307) * Update resolvers to upload test pdf to s3 bucket (cherry picked from commit dc1b7c1) * Update GraphQl Schema with WalletCard info (cherry picked from commit b371b48) * Renaming changes from wallet to walletCard in generateWalletCard Resolvers (cherry picked from commit 96d06e9) * Add Wallet Document Creation Logic * Update Prisma Schema to store Generated Wallet Card (cherry picked from commit 3fc2703) * Update Prisma Schema to maintain both WalletCardCreated and WalletCard (cherry picked from commit 2b65a46) * Prisma Schema Wallet Bug fix (cherry picked from commit 4aa3307) * Update resolvers to upload test pdf to s3 bucket (cherry picked from commit dc1b7c1) * Update GraphQl Schema with WalletCard info (cherry picked from commit b371b48) * Renaming changes from wallet to walletCard in generateWalletCard Resolvers (cherry picked from commit 96d06e9) * Add Wallet Document Creation Logic * Update PDF Generation to use user data * Update PDF Generation Expiry Time * Remove Wallet Card from Application Processing * Fix Bug with disabled mark as complete button * Generate Wallet With Application Completion * Fix CLI errors * Fix Lint Issues * Add wallet card creation and PDF generation to transaction application completion process * Upgrade to ubuntu 22.04 * Revert to Ubuntu 20.04 --------- Co-authored-by: Chinemerem <chinemeremchigbo@Outlook.com> * [Feature] Search by Doctor MSP number for Renewal Application (#392) * added a doctor typeahead * added the graphql for the typeahead * updated thre graphql schemas to correctky handle the request * generated the graphql types * sending the request correctly to the graphql server * sending the request correctly to the graphql server * changed the search criterion to contains * added the resolver to the lib graphql * kept only msp number in the git commit * changed the search box placeholder text * return more doctor information * added the form filling code * added spacing and explanations * patched the problem with the reinitialize form * patching the linting errors --------- Co-authored-by: Jennifer Chen <32009013+jennchenn@users.noreply.github.com> Co-authored-by: Keane Moraes <lordvader3002@gmail.com> Co-authored-by: Chinemerem <chinemeremchigbo@Outlook.com> Co-authored-by: David Lu <151972620+ludavidca@users.noreply.github.com> Co-authored-by: Sharujan Sreekaran <34523327+ssreekar@users.noreply.github.com> * Fix Application Id * Update Wallet Card to be 2.75 by 1.25 * Add Comment * Fix Lint issues * Update lib/application-processing/resolvers.ts Co-authored-by: Chinemerem <chinemeremchigbo@Outlook.com> --------- Co-authored-by: Oustan Ding <oustan10@gmail.com> Co-authored-by: Leo Huang <leogjhuang@gmail.com> Co-authored-by: Leo Huang <77544794+leogjhuang@users.noreply.github.com> Co-authored-by: Sherry Li <sherryhli@users.noreply.github.com> Co-authored-by: Chinemerem <chinemeremchigbo@Outlook.com> Co-authored-by: Matthew Wang <53355975+mslwang@users.noreply.github.com> Co-authored-by: Keane Moraes <lordvader3002@gmail.com> Co-authored-by: Jennifer Chen <32009013+jennchenn@users.noreply.github.com> Co-authored-by: Jenny Vong <jenny_vong@outlook.com> Co-authored-by: Brayden Royston <brayden.royston10@gmail.com> Co-authored-by: David Lu <151972620+ludavidca@users.noreply.github.com> * Add Banner for Jan 1st Price increase (#407) * Add Banner for Jan 1st * Update Description * Update Banner Info * Update price increase message (#409) * Revert heap size configs in start script (#410) --------- Co-authored-by: Albert Lai <albertlai631@outlook.com> Co-authored-by: Chinemerem <chinemeremchigbo@Outlook.com> Co-authored-by: Sharujan Sreekaran <34523327+ssreekar@users.noreply.github.com> Co-authored-by: Oustan Ding <oustan10@gmail.com> Co-authored-by: Leo Huang <leogjhuang@gmail.com> Co-authored-by: Leo Huang <77544794+leogjhuang@users.noreply.github.com> Co-authored-by: Matthew Wang <53355975+mslwang@users.noreply.github.com> Co-authored-by: Keane Moraes <lordvader3002@gmail.com> Co-authored-by: Jennifer Chen <32009013+jennchenn@users.noreply.github.com> Co-authored-by: Jenny Vong <jenny_vong@outlook.com> Co-authored-by: Brayden Royston <brayden.royston10@gmail.com> Co-authored-by: David Lu <151972620+ludavidca@users.noreply.github.com>
1 parent e276cdc commit 7c77fcb

File tree

6 files changed

+140
-107
lines changed

6 files changed

+140
-107
lines changed

lib/applicants/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ export const getMostRecentPermit = async (applicantId: number): Promise<Permit |
3434
where: { id: applicantId },
3535
})
3636
.permits({
37-
orderBy: { expiryDate: SortOrder.DESC },
37+
where: { active: true },
38+
orderBy: [{ expiryDate: SortOrder.DESC }, { createdAt: SortOrder.DESC }],
3839
take: 1,
3940
});
4041

lib/application-processing/resolvers.ts

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ export const completeApplication: Resolver<
400400
firstName,
401401
lastName,
402402
dateOfBirth,
403-
id
403+
applicantId.toString()
404404
);
405405
if (!result || !result.ok) {
406406
logger.error({ error: 'Error creating Wallet Card PDF' });
@@ -465,14 +465,29 @@ export const completeApplication: Resolver<
465465
},
466466
});
467467

468-
const [upsertedPhysician, createdPermit, completedApplicationProcessing] =
469-
await prisma.$transaction([
470-
upsertPhysicianOperation,
471-
createPermitOperation,
472-
completeApplicationOperation,
473-
]);
468+
const queryApplicationOperation = prisma.application.findUnique({
469+
where: { id },
470+
include: { applicationProcessing: true },
471+
});
472+
473+
const [
474+
upsertedPhysician,
475+
createdPermit,
476+
completedApplicationProcessing,
477+
queriedApplication,
478+
] = await prisma.$transaction([
479+
upsertPhysicianOperation,
480+
createPermitOperation,
481+
completeApplicationOperation,
482+
queryApplicationOperation,
483+
]);
474484

475-
if (!upsertedPhysician || !createdPermit || !completedApplicationProcessing) {
485+
if (
486+
!upsertedPhysician ||
487+
!createdPermit ||
488+
!completedApplicationProcessing ||
489+
!queriedApplication
490+
) {
476491
const message = 'Error completing application';
477492
logger.error({ error: message });
478493
throw new ApolloError(message);
@@ -499,7 +514,7 @@ export const completeApplication: Resolver<
499514
firstName,
500515
lastName,
501516
dateOfBirth,
502-
id
517+
queriedApplication?.applicantId?.toString() ?? 'N/A'
503518
);
504519
if (!result || !result.ok) {
505520
logger.error({ error: 'Error creating Wallet Card PDF' });
@@ -644,7 +659,7 @@ export const completeApplication: Resolver<
644659
firstName,
645660
lastName,
646661
updatedApplicant.dateOfBirth,
647-
id
662+
applicantId.toString()
648663
);
649664
if (!result || !result.ok) {
650665
logger.error({ error: 'Error creating Wallet Card PDF' });
@@ -767,7 +782,7 @@ export const completeApplication: Resolver<
767782
firstName,
768783
lastName,
769784
updatedApplicant.dateOfBirth,
770-
id
785+
applicantId.toString()
771786
);
772787
if (!result || !result.ok) {
773788
logger.error({ error: 'Error creating Wallet Card PDF' });
@@ -1018,7 +1033,14 @@ export const createWalletCard = async (
10181033
}
10191034

10201035
const walletCardPdf = createdWalletCard
1021-
? generateWalletCardPDF(permitId, permitExpiry, firstName, lastName, dateOfBirth, userId)
1036+
? generateWalletCardPDF(
1037+
permitId,
1038+
permitExpiry,
1039+
firstName,
1040+
lastName,
1041+
dateOfBirth,
1042+
userId.toString()
1043+
)
10221044
: null;
10231045

10241046
if (walletCardPdf && createdWalletCard) {

lib/application-processing/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const createWalletCardPDF = async (
3131
firstName: string,
3232
lastName: string,
3333
dateOfBirth: Date,
34-
userId: number
34+
userId: string
3535
): Promise<{ ok: boolean; error?: any }> => {
3636
const walletCardPdf = createdWalletCard
3737
? generateWalletCardPDF(permitId, permitExpiry, firstName, lastName, dateOfBirth, userId)

lib/physicians/validation.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ export const physicianAssessmentSchema = object({
1919
mixed<PatientCondition>()
2020
.oneOf(Object.values(PatientCondition))
2121
.required('Please select a condition')
22-
).required(),
22+
)
23+
.default([])
24+
.min(1, 'Please select at least one condition'),
2325
otherPatientCondition: string()
2426
.nullable()
2527
.default(null)

lib/walletCard/utils.ts

Lines changed: 79 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -8,141 +8,129 @@ const walletCardPdfDefinition = (
88
firstName: string,
99
lastName: string,
1010
dateOfBirth: Date,
11-
userId: number
11+
userId: string
1212
) => {
13-
const calculateTextWidth = (text: string, fontSize: number, averageCharacterWidth = 0.5) => {
14-
return fontSize * averageCharacterWidth * text.length;
15-
};
16-
1713
const pad2Dig = (amount: number) => {
1814
if (amount < 10) {
1915
return '0' + amount.toString();
2016
}
2117
return amount.toString();
2218
};
2319

24-
// Pixel Constants
25-
const MARGIN_TOP = 40;
26-
const MARGIN_LEFT = 40;
20+
// Pixel Constants for 2.75" x 1.25" wallet card
2721
const PTS_TO_INCH = 72;
28-
const CARD_FRONT_HEIGHT = 2 * PTS_TO_INCH;
29-
const CARD_FRONT_WIDTH = 3.5 * PTS_TO_INCH;
30-
const CARD_BACK_HEIGHT = 1.5 * PTS_TO_INCH;
31-
const CARD_BACK_WIDTH = 3 * PTS_TO_INCH;
32-
const CARDS_SPACING = 50;
33-
const HEADER_FONT_SIZE = 12;
34-
const FOOTER_FONT_SIZE = 9;
35-
const boxStartY = MARGIN_TOP + CARD_FRONT_HEIGHT + CARDS_SPACING;
36-
const boxStartX = MARGIN_LEFT;
22+
const CARD_WIDTH = 2.75 * PTS_TO_INCH; // 198 points
23+
const CARD_HEIGHT = 1.25 * PTS_TO_INCH; // 90 points
24+
const MARGIN = 4; // Small margin for content
3725

3826
// Text
3927
const headerText = 'Richmond Centre For Disability';
4028
const footerText = '604.232.2404 parkingpermit@rcdrichmond.org';
4129

4230
return {
4331
content: [
32+
// Card border
4433
{
45-
image: 'cardFront',
46-
width: CARD_FRONT_WIDTH,
47-
height: CARD_FRONT_HEIGHT,
48-
},
49-
{
50-
stack: [
34+
canvas: [
5135
{
52-
canvas: [
53-
{
54-
type: 'rect',
55-
x: 0, // x position
56-
y: 50, // y position
57-
w: CARD_BACK_WIDTH, // width
58-
h: CARD_BACK_HEIGHT, // height
59-
r: 5, // Border radius
60-
lineColor: 'black', // Border color
61-
lineWidth: 1, // Border width
62-
},
63-
],
64-
},
65-
{
66-
text: [{ text: headerText, style: 'header' }],
67-
absolutePosition: {
68-
x:
69-
boxStartX +
70-
(CARD_BACK_WIDTH - calculateTextWidth(headerText, HEADER_FONT_SIZE)) / 2,
71-
y: boxStartY + 14,
72-
},
36+
type: 'rect',
37+
x: 1,
38+
y: 1,
39+
w: CARD_WIDTH - 2,
40+
h: CARD_HEIGHT - 2,
41+
r: 6,
42+
color: 'white',
43+
lineColor: 'black',
44+
lineWidth: 1.5,
7345
},
46+
],
47+
},
48+
// Header
49+
{
50+
text: headerText,
51+
style: 'header',
52+
absolutePosition: {
53+
x: 0,
54+
y: MARGIN + 3,
55+
},
56+
width: CARD_WIDTH,
57+
},
58+
// Permit information
59+
{
60+
text: [
61+
{ text: 'Permit # ', style: 'label' },
62+
{ text: permitId.toString(), style: 'value' },
63+
{ text: ' Expiry: ', style: 'label' },
7464
{
75-
text: [
76-
{ text: 'Permit # ', style: 'subheader' },
77-
{ text: permitId.toString(), style: 'subheaderB' },
78-
{ text: ' Expiry: ', style: 'subheader' },
79-
{
80-
text: permitExpiry.getFullYear() + '-' + pad2Dig(permitExpiry.getDate()),
81-
style: 'subheaderB',
82-
},
83-
{ text: '\n\n', style: 'space' },
84-
{ text: 'Name: ', style: 'subheader' },
85-
{ text: firstName + ' ' + lastName, style: 'subheaderB' },
86-
{ text: '\n\n', style: 'space' },
87-
{ text: 'MoB: ', style: 'subheader' },
88-
{
89-
text: dateOfBirth.getFullYear() + '-' + pad2Dig(dateOfBirth.getDate()),
90-
style: 'subheaderB',
91-
},
92-
{ text: ' User # ', style: 'subheader' },
93-
{ text: userId.toString(), style: 'subheaderB' },
94-
],
95-
absolutePosition: { x: boxStartX + 10, y: boxStartY + 35 },
65+
text: permitExpiry.getFullYear() + '-' + pad2Dig(permitExpiry.getMonth() + 1),
66+
style: 'value',
9667
},
68+
],
69+
absolutePosition: { x: MARGIN + 6, y: MARGIN + 20 },
70+
},
71+
// Name
72+
{
73+
text: [
74+
{ text: 'Name: ', style: 'label' },
75+
{ text: firstName + ' ' + lastName, style: 'value' },
76+
],
77+
absolutePosition: { x: MARGIN + 6, y: MARGIN + 36 },
78+
},
79+
// Month of birth and User ID
80+
{
81+
text: [
82+
{ text: 'MoB: ', style: 'label' },
9783
{
98-
text: [{ text: footerText, style: 'footer' }],
99-
absolutePosition: {
100-
x:
101-
boxStartX +
102-
(CARD_BACK_WIDTH - calculateTextWidth(footerText, FOOTER_FONT_SIZE)) / 2,
103-
y: boxStartY + CARD_BACK_HEIGHT - FOOTER_FONT_SIZE - 10,
104-
},
84+
text: dateOfBirth.getFullYear() + '-' + pad2Dig(dateOfBirth.getMonth() + 1),
85+
style: 'value',
10586
},
87+
{ text: ' User # ', style: 'label' },
88+
{ text: userId, style: 'value' },
10689
],
90+
absolutePosition: { x: MARGIN + 6, y: MARGIN + 52 },
91+
},
92+
// Footer
93+
{
94+
text: footerText,
95+
style: 'footer',
96+
absolutePosition: {
97+
x: MARGIN,
98+
y: CARD_HEIGHT - MARGIN - 11,
99+
},
100+
width: CARD_WIDTH - MARGIN * 2,
107101
},
108102
],
103+
// Styles
109104
styles: {
110105
header: {
111-
fontSize: HEADER_FONT_SIZE,
106+
fontSize: 9,
112107
bold: true,
113-
alignment: 'left',
108+
alignment: 'center',
114109
},
115-
subheader: {
116-
fontSize: 10,
110+
label: {
111+
fontSize: 8,
117112
bold: false,
118113
alignment: 'left',
119114
},
120-
subheaderB: {
121-
fontSize: 10,
115+
value: {
116+
fontSize: 8,
122117
bold: true,
123118
alignment: 'left',
124119
},
125120
footer: {
126-
fontSize: FOOTER_FONT_SIZE,
121+
fontSize: 8,
127122
bold: false,
128-
alignment: 'left',
129-
},
130-
space: {
131-
fontSize: 9,
132-
bold: false,
133-
alignment: 'center',
134-
},
135-
tableHeader: {
136-
bold: true,
137123
alignment: 'center',
138124
},
139125
},
140126
defaultStyle: {
141127
font: 'Helvetica',
142128
},
143-
images: {
144-
cardFront: 'public/assets/card-front.png',
129+
pageSize: {
130+
width: CARD_WIDTH,
131+
height: CARD_HEIGHT,
145132
},
133+
pageMargins: [0, 0, 0, 0] as [number, number, number, number],
146134
};
147135
};
148136

@@ -152,7 +140,7 @@ export const generateWalletCardPDF = (
152140
firstName: string,
153141
lastName: string,
154142
dateOfBirth: Date,
155-
userId: number
143+
userId: string
156144
): PDFKit.PDFDocument | null => {
157145
let pdfDoc = null;
158146
try {

pages/index.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import {
1010
ListItem,
1111
Button,
1212
VStack,
13+
Alert,
14+
AlertIcon,
15+
AlertDescription,
1316
} from '@chakra-ui/react'; // Chakra UI
1417
import Layout from '@components/applicant/Layout'; // Layout wrapper
1518
import FAQs from '@components/applicant/FAQs';
@@ -19,6 +22,20 @@ export default function Landing() {
1922

2023
return (
2124
<Layout>
25+
{Date.now() < new Date('2026-01-10T00:00:00.000Z').getTime() && (
26+
<GridItem colSpan={12} colStart={1}>
27+
<Alert status="warning" variant="top-accent">
28+
<AlertIcon />
29+
<AlertDescription textAlign="left">
30+
Due to increased operational and postage expenses, RCD will implement a $33 parking
31+
permit processing fee starting January 1, 2026. All applications received on or after
32+
January 1st, 2026, will be processed at $33, including all permanent and temporary
33+
permits (regardless of the signed date or postage date stamp). Thank you for your
34+
understanding and continued support!
35+
</AlertDescription>
36+
</Alert>
37+
</GridItem>
38+
)}
2239
<GridItem colSpan={12} colStart={1}>
2340
<Text as="h1" textStyle={{ sm: 'display-large', md: 'display-xlarge' }} align="left">
2441
{t('landing')}
@@ -65,7 +82,10 @@ export default function Landing() {
6582
<Text as="p">Provide your date of birth</Text>
6683
</ListItem>
6784
<ListItem textAlign="left" textStyle="body-regular">
68-
<Text as="p">Complete the online form and pay a $31 processing fee</Text>
85+
<Text as="p">
86+
Complete the online form and pay the processing fee — $31 for submissions received
87+
before Jan 1; $33 for submissions on or after Jan 1.
88+
</Text>
6989
</ListItem>
7090
</UnorderedList>
7191
</Box>

0 commit comments

Comments
 (0)