Skip to content

Commit 8f1a983

Browse files
authored
[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)
1 parent f264903 commit 8f1a983

File tree

5 files changed

+27
-8
lines changed

5 files changed

+27
-8
lines changed

components/admin/permit-holders/app-history/Card/AppHistoryRecord.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const AppHistoryRecord: FC<Props> = ({ permit }) => {
4040
Request Type: {titlecase(type)}
4141
</Text>
4242
<Text as="p" textStyle="body-regular">
43-
Expired on: {formatDate(expiryDate)}
43+
Expiry date: {formatDate(expiryDate)}
4444
</Text>
4545
</HStack>
4646
</VStack>

components/admin/requests/Header.tsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type RequestHeaderProps = {
1717
readonly paidThroughShopify?: boolean;
1818
readonly shopifyOrderID?: string;
1919
readonly shopifyOrderNumber?: string;
20+
readonly permitExpiry: Date | null;
2021
readonly temporaryPermitExpiry: Date | null;
2122
readonly reasonForRejection?: string;
2223
};
@@ -30,6 +31,7 @@ type RequestHeaderProps = {
3031
* @param paidThroughShopify If the permit fee was paid through Shopify
3132
* @param shopifyOrderID Order ID of Shopify payment if paid through Shopify
3233
* @param shopifyOrderNumber Order number of Shopify payment if paid through Shopify
34+
* @param permitExpiry Permit expiry if application is complete
3335
* @param temporaryPermitExpiry Permit expiry if application is for a temporary permit
3436
* @param reasonForRejection Reason for rejecting application
3537
*/
@@ -41,12 +43,26 @@ export default function RequestHeader({
4143
paidThroughShopify,
4244
shopifyOrderID,
4345
shopifyOrderNumber,
46+
permitExpiry,
4447
temporaryPermitExpiry,
4548
reasonForRejection,
4649
}: RequestHeaderProps) {
4750
const displayShopifyUrl = paidThroughShopify && shopifyOrderID && shopifyOrderNumber;
4851
const shopifyOrderUrl = `https://${process.env.NEXT_PUBLIC_SHOPIFY_DOMAIN}/admin/orders/${shopifyOrderID}`;
4952

53+
let expiryDateText: string | null;
54+
if (applicationStatus === 'COMPLETED' && !!permitExpiry) {
55+
expiryDateText = `Expiry date: ${formatDateYYYYMMDD(permitExpiry)}`;
56+
} else if (permitType === 'TEMPORARY' && !!temporaryPermitExpiry) {
57+
expiryDateText = `This permit will expire: ${formatDateYYYYMMDD(temporaryPermitExpiry)}`;
58+
} else if (permitType === 'PERMANENT') {
59+
expiryDateText = `This permit will expire: ${formatDateYYYYMMDD(
60+
getPermanentPermitExpiryDate()
61+
)} (expected)`;
62+
} else {
63+
expiryDateText = null;
64+
}
65+
5066
return (
5167
<Box textAlign="left">
5268
<NextLink href="/admin" passHref>
@@ -96,13 +112,7 @@ export default function RequestHeader({
96112
</Flex>
97113
<HStack justifyContent="flex-end">
98114
<Text textStyle="caption" as="p" mt="12px">
99-
{permitType === 'TEMPORARY' && !!temporaryPermitExpiry
100-
? `This permit will expire: ${formatDateYYYYMMDD(temporaryPermitExpiry)}`
101-
: permitType === 'PERMANENT'
102-
? `This permit will expire: ${formatDateYYYYMMDD(
103-
getPermanentPermitExpiryDate()
104-
)} (expected)`
105-
: null}
115+
{expiryDateText}
106116
</Text>
107117
</HStack>
108118
</VStack>

lib/applications/resolvers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ export const application: Resolver<
7474
newApplication: true,
7575
renewalApplication: true,
7676
replacementApplication: true,
77+
applicant: true,
78+
permit: true,
7779
},
7880
});
7981

pages/admin/request/[id].tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const Request: NextPage<Props> = ({ id: idString }: Props) => {
6060
appMailed,
6161
reviewRequestCompleted,
6262
},
63+
permit,
6364
} = data.application;
6465

6566
// Whether all application processing steps are completed
@@ -87,6 +88,7 @@ const Request: NextPage<Props> = ({ id: idString }: Props) => {
8788
paidThroughShopify={paidThroughShopify}
8889
shopifyOrderID={shopifyConfirmationNumber || undefined}
8990
shopifyOrderNumber={shopifyOrderNumber || undefined}
91+
permitExpiry={permit && permit.expiryDate}
9092
temporaryPermitExpiry={temporaryPermitExpiry || null}
9193
reasonForRejection={rejectedReason || undefined}
9294
/>

tools/admin/requests/view-request.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Invoice,
66
Applicant,
77
QueryApplicationArgs,
8+
Permit,
89
} from '@lib/graphql/types';
910

1011
// Queries an Application by ID along with the associated permit, replacement, applicationProcessing, and applicant
@@ -40,6 +41,9 @@ export const GET_APPLICATION_QUERY = gql`
4041
applicant {
4142
id
4243
}
44+
permit {
45+
expiryDate
46+
}
4347
}
4448
}
4549
`;
@@ -75,5 +79,6 @@ export type GetApplicationResponse = {
7579
};
7680
applicant: Pick<Applicant, 'id'>;
7781
temporaryPermitExpiry?: Date;
82+
permit: Pick<Permit, 'expiryDate'> | null;
7883
};
7984
};

0 commit comments

Comments
 (0)