Skip to content

Commit 43f6edb

Browse files
authored
[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)
1 parent 0c5993b commit 43f6edb

File tree

78 files changed

+1900
-677
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1900
-677
lines changed

components/admin/permit-holders/Typeahead.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useQuery } from '@apollo/client'; // Apollo
1+
import { useQuery } from '@tools/hooks/graphql'; // Apollo
22
import { Text } from '@chakra-ui/react'; //Chakra UI
33
import Typeahead from '@components/Typeahead'; // Typeahead component
44
import { formatFullName } from '@lib/utils/format'; // String formatter util

components/admin/permit-holders/additional-notes/Modal.tsx

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { useMutation } from '@apollo/client';
1+
// import { useMutation } from '@tools/hooks/graphql';
2+
import { useMutation } from '@tools/hooks/graphql';
23
import {
34
Button,
45
Modal,
@@ -9,7 +10,6 @@ import {
910
ModalOverlay,
1011
Textarea,
1112
Text,
12-
useToast,
1313
} from '@chakra-ui/react';
1414
import {
1515
UpdateApplicantNotesRequest,
@@ -39,20 +39,8 @@ const AdditionalNotesModal: FC<Props> = ({
3939
setNotes(notesInput);
4040
}, [isOpen, notesInput]);
4141

42-
const toast = useToast();
43-
44-
const [updateApplicantNotes, { loading: submitting }] = useMutation<
45-
UpdateApplicantNotesResponse,
46-
UpdateApplicantNotesRequest
47-
>(UPDATE_APPLICANT_NOTES, {
48-
onError: error => {
49-
toast({
50-
status: 'error',
51-
description: error.message,
52-
isClosable: true,
53-
});
54-
},
55-
});
42+
const [updateApplicantNotes, { loading: submitting }] =
43+
useMutation<UpdateApplicantNotesResponse, UpdateApplicantNotesRequest>(UPDATE_APPLICANT_NOTES);
5644

5745
const handleSave = async () => {
5846
await updateApplicantNotes({ variables: { input: { id: applicantId, notes } } });

components/admin/permit-holders/current-application/Card/MedicalInformationSection.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,22 @@ const MedicalInformationSection: FC<Props> = ({ medicalInformation }) => {
3737
<Text as="p" textStyle="body-regular">
3838
{disability}
3939
</Text>
40-
<Badge bgColor="background.informative">{titlecase(patientCondition as string)}</Badge>
40+
41+
{patientCondition !== null
42+
? patientCondition.map(condition => (
43+
<Badge key={condition} bgColor="background.informative">
44+
{titlecase(condition)}
45+
</Badge>
46+
))
47+
: 'N/A'}
4148
</HStack>
4249
</GridItem>
43-
{patientCondition === 'OTHER' && (
50+
{patientCondition?.includes('OTHER') && (
4451
<>
4552
{/* Condition description */}
4653
<GridItem>
4754
<Text as="p" textStyle="body-regular">
48-
Condition description
55+
Other condition description
4956
</Text>
5057
</GridItem>
5158
<GridItem>

components/admin/permit-holders/doctor-information/Card.tsx

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Text, Divider, VStack, Button, Flex, useToast } from '@chakra-ui/react'; // Chakra UI
1+
import { Text, Divider, VStack, Button, Flex } from '@chakra-ui/react'; // Chakra UI
22
import PermitHolderInfoCard from '@components/admin/LayoutCard'; // Custom Card Component
33
import EditDoctorInformationModal from '@components/admin/requests/doctor-information/EditModal'; // Edit doctor information modal component
44
import PreviousDoctorsModal from '@components/admin/permit-holders/doctor-information/PreviousDoctorsModal'; // Previous Doctors' Information Modal
5-
import { useMutation, useQuery } from '@apollo/client';
5+
import { useMutation, useQuery } from '@tools/hooks/graphql';
66
import {
77
DoctorFormData,
88
GetDoctorInformationRequest,
@@ -31,27 +31,17 @@ type DoctorInformationProps = {
3131
export default function DoctorInformationCard(props: DoctorInformationProps) {
3232
const { applicantId, isUpdated } = props;
3333

34-
const toast = useToast();
35-
3634
const { data, refetch } = useQuery<GetDoctorInformationResponse, GetDoctorInformationRequest>(
3735
GET_DOCTOR_INFORMATION,
3836
{
3937
variables: { id: applicantId },
4038
}
4139
);
4240

43-
const [updateDoctorInformation] = useMutation<
44-
UpdateDoctorInformationResponse,
45-
UpdateDoctorInformationRequest
46-
>(UPDATE_DOCTOR_INFORMATION, {
47-
onError: error => {
48-
toast({
49-
status: 'error',
50-
description: error.message,
51-
isClosable: true,
52-
});
53-
},
54-
});
41+
const [updateDoctorInformation] =
42+
useMutation<UpdateDoctorInformationResponse, UpdateDoctorInformationRequest>(
43+
UPDATE_DOCTOR_INFORMATION
44+
);
5545
const handleSave = async (doctorFormData: DoctorFormData) => {
5646
const validatedData = await requestPhysicianInformationSchema.validate(doctorFormData);
5747

components/admin/permit-holders/guardian-information/Card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useMutation } from '@apollo/client';
1+
import { useMutation } from '@tools/hooks/graphql';
22
import { Button, Divider, VStack, Link as FileLink } from '@chakra-ui/react';
33
import PermitHolderInfoCard from '@components/admin/LayoutCard';
44
import {

components/admin/permit-holders/medical-history/Modal.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { ReactNode } from 'react'; // React
1818
import { MobilityAid } from '@lib/graphql/types'; // Application type & Aid enum
1919
import { formatDate } from '@lib/utils/date'; // Date formatter util
2020
import { MedicalHistoryRow } from '@tools/admin/permit-holders/medical-history';
21+
import { titlecase } from '@tools/string';
2122

2223
type MedicalHistoryModalProps = {
2324
details: MedicalHistoryRow['details'];
@@ -65,9 +66,15 @@ export default function MedicalHistoryModal(props: MedicalHistoryModalProps) {
6566
</Text>
6667
</ModalHeader>
6768
<ModalBody paddingTop="0px" paddingBottom="36px" paddingX="4px">
68-
<Badge display="inline-block" backgroundColor="background.informative">
69-
{patientCondition}
70-
</Badge>
69+
{patientCondition.map(condition => (
70+
<Badge
71+
key={condition}
72+
display="inline-block"
73+
backgroundColor="background.informative"
74+
>
75+
{titlecase(condition)}
76+
</Badge>
77+
))}
7178
<Divider my="24px" />
7279
<Box>
7380
<Text as="h3" textStyle="heading" paddingBottom="20px">

components/admin/permit-holders/permit-holder-information/Card.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ import {
2323
UpdateApplicantGeneralInformationResponse,
2424
UPDATE_APPLICANT_GENERAL_INFORMATION_MUTATION,
2525
} from '@tools/admin/permit-holders/permit-holder-information';
26-
import { useMutation, useQuery } from '@apollo/client';
26+
import { useMutation, useQuery } from '@tools/hooks/graphql';
2727
import Address from '@components/admin/Address';
2828
import { permitHolderInformationSchema } from '@lib/applicants/validation';
29+
import { titlecase } from '@tools/string';
2930

3031
type PersonalInformationProps = {
3132
readonly applicantId: number;
@@ -138,7 +139,7 @@ export default function PermitHolderInformationCard(props: PersonalInformationPr
138139
Date of Birth: {formatDateYYYYMMDD(new Date(dateOfBirth))}
139140
</Text>
140141
<Text as="p" textStyle="body-regular">
141-
Gender: {gender === 'OTHER' ? otherGender : gender}
142+
Gender: {gender === 'OTHER' ? otherGender : titlecase(gender)}
142143
</Text>
143144
</VStack>
144145

components/admin/permit-holders/reports/GenerateModal.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
} from '@chakra-ui/react'; // Chakra UI
2121
import { DownloadIcon } from '@chakra-ui/icons';
2222
import { GenerateReportStep, PERMIT_HOLDERS_COLUMNS } from '@tools/admin/reports'; //GenerateReportStep enum
23-
import { useLazyQuery } from '@apollo/client';
23+
import { useLazyQuery } from '@tools/hooks/graphql';
2424
import {
2525
GENERATE_PERMIT_HOLDERS_REPORT_QUERY,
2626
GeneratePermitHoldersReportRequest,
@@ -92,12 +92,6 @@ export default function GenerateReportModal(props: Props) {
9292
});
9393
}
9494
},
95-
onError: error => {
96-
toast({
97-
status: 'error',
98-
description: error.message,
99-
});
100-
},
10195
});
10296

10397
/**

components/admin/permit-holders/table/ConfirmSetActiveModal.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
Button,
1010
useToast,
1111
} from '@chakra-ui/react'; // Chakra UI
12-
import { useMutation } from '@apollo/client';
12+
import { useMutation } from '@tools/hooks/graphql';
1313
import {
1414
SetApplicantAsActiveRequest,
1515
SetApplicantAsActiveResponse,
@@ -46,12 +46,6 @@ export default function SetPermitHolderToActiveModal(props: Props) {
4646
});
4747
}
4848
},
49-
onError: error => {
50-
toast({
51-
status: 'error',
52-
description: error.message,
53-
});
54-
},
5549
});
5650

5751
// Sets permit holder status to active and closes modal

components/admin/permit-holders/table/ConfirmSetInactiveModal.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
Textarea,
1414
useToast,
1515
} from '@chakra-ui/react'; // Chakra UI
16-
import { useMutation } from '@apollo/client';
16+
import { useMutation } from '@tools/hooks/graphql';
1717
import {
1818
SetApplicantAsInactiveRequest,
1919
SetApplicantAsInactiveResponse,
@@ -55,12 +55,6 @@ export default function SetPermitHolderToInactiveModal({
5555
});
5656
}
5757
},
58-
onError: error => {
59-
toast({
60-
status: 'error',
61-
description: error.message,
62-
});
63-
},
6458
});
6559
// Close modal handler
6660
const handleClose = () => {

0 commit comments

Comments
 (0)