Skip to content

Commit

Permalink
[Release] Version 0.0.1 (#243)
Browse files Browse the repository at this point in the history
* [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)
  • Loading branch information
OustanDing committed Jul 31, 2022
1 parent 0c5993b commit 43f6edb
Show file tree
Hide file tree
Showing 78 changed files with 1,900 additions and 677 deletions.
2 changes: 1 addition & 1 deletion components/admin/permit-holders/Typeahead.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useQuery } from '@apollo/client'; // Apollo
import { useQuery } from '@tools/hooks/graphql'; // Apollo
import { Text } from '@chakra-ui/react'; //Chakra UI
import Typeahead from '@components/Typeahead'; // Typeahead component
import { formatFullName } from '@lib/utils/format'; // String formatter util
Expand Down
20 changes: 4 additions & 16 deletions components/admin/permit-holders/additional-notes/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useMutation } from '@apollo/client';
// import { useMutation } from '@tools/hooks/graphql';
import { useMutation } from '@tools/hooks/graphql';
import {
Button,
Modal,
Expand All @@ -9,7 +10,6 @@ import {
ModalOverlay,
Textarea,
Text,
useToast,
} from '@chakra-ui/react';
import {
UpdateApplicantNotesRequest,
Expand Down Expand Up @@ -39,20 +39,8 @@ const AdditionalNotesModal: FC<Props> = ({
setNotes(notesInput);
}, [isOpen, notesInput]);

const toast = useToast();

const [updateApplicantNotes, { loading: submitting }] = useMutation<
UpdateApplicantNotesResponse,
UpdateApplicantNotesRequest
>(UPDATE_APPLICANT_NOTES, {
onError: error => {
toast({
status: 'error',
description: error.message,
isClosable: true,
});
},
});
const [updateApplicantNotes, { loading: submitting }] =
useMutation<UpdateApplicantNotesResponse, UpdateApplicantNotesRequest>(UPDATE_APPLICANT_NOTES);

const handleSave = async () => {
await updateApplicantNotes({ variables: { input: { id: applicantId, notes } } });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,22 @@ const MedicalInformationSection: FC<Props> = ({ medicalInformation }) => {
<Text as="p" textStyle="body-regular">
{disability}
</Text>
<Badge bgColor="background.informative">{titlecase(patientCondition as string)}</Badge>

{patientCondition !== null
? patientCondition.map(condition => (
<Badge key={condition} bgColor="background.informative">
{titlecase(condition)}
</Badge>
))
: 'N/A'}
</HStack>
</GridItem>
{patientCondition === 'OTHER' && (
{patientCondition?.includes('OTHER') && (
<>
{/* Condition description */}
<GridItem>
<Text as="p" textStyle="body-regular">
Condition description
Other condition description
</Text>
</GridItem>
<GridItem>
Expand Down
22 changes: 6 additions & 16 deletions components/admin/permit-holders/doctor-information/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Text, Divider, VStack, Button, Flex, useToast } from '@chakra-ui/react'; // Chakra UI
import { Text, Divider, VStack, Button, Flex } from '@chakra-ui/react'; // Chakra UI
import PermitHolderInfoCard from '@components/admin/LayoutCard'; // Custom Card Component
import EditDoctorInformationModal from '@components/admin/requests/doctor-information/EditModal'; // Edit doctor information modal component
import PreviousDoctorsModal from '@components/admin/permit-holders/doctor-information/PreviousDoctorsModal'; // Previous Doctors' Information Modal
import { useMutation, useQuery } from '@apollo/client';
import { useMutation, useQuery } from '@tools/hooks/graphql';
import {
DoctorFormData,
GetDoctorInformationRequest,
Expand Down Expand Up @@ -31,27 +31,17 @@ type DoctorInformationProps = {
export default function DoctorInformationCard(props: DoctorInformationProps) {
const { applicantId, isUpdated } = props;

const toast = useToast();

const { data, refetch } = useQuery<GetDoctorInformationResponse, GetDoctorInformationRequest>(
GET_DOCTOR_INFORMATION,
{
variables: { id: applicantId },
}
);

const [updateDoctorInformation] = useMutation<
UpdateDoctorInformationResponse,
UpdateDoctorInformationRequest
>(UPDATE_DOCTOR_INFORMATION, {
onError: error => {
toast({
status: 'error',
description: error.message,
isClosable: true,
});
},
});
const [updateDoctorInformation] =
useMutation<UpdateDoctorInformationResponse, UpdateDoctorInformationRequest>(
UPDATE_DOCTOR_INFORMATION
);
const handleSave = async (doctorFormData: DoctorFormData) => {
const validatedData = await requestPhysicianInformationSchema.validate(doctorFormData);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMutation } from '@apollo/client';
import { useMutation } from '@tools/hooks/graphql';
import { Button, Divider, VStack, Link as FileLink } from '@chakra-ui/react';
import PermitHolderInfoCard from '@components/admin/LayoutCard';
import {
Expand Down
13 changes: 10 additions & 3 deletions components/admin/permit-holders/medical-history/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { ReactNode } from 'react'; // React
import { MobilityAid } from '@lib/graphql/types'; // Application type & Aid enum
import { formatDate } from '@lib/utils/date'; // Date formatter util
import { MedicalHistoryRow } from '@tools/admin/permit-holders/medical-history';
import { titlecase } from '@tools/string';

type MedicalHistoryModalProps = {
details: MedicalHistoryRow['details'];
Expand Down Expand Up @@ -65,9 +66,15 @@ export default function MedicalHistoryModal(props: MedicalHistoryModalProps) {
</Text>
</ModalHeader>
<ModalBody paddingTop="0px" paddingBottom="36px" paddingX="4px">
<Badge display="inline-block" backgroundColor="background.informative">
{patientCondition}
</Badge>
{patientCondition.map(condition => (
<Badge
key={condition}
display="inline-block"
backgroundColor="background.informative"
>
{titlecase(condition)}
</Badge>
))}
<Divider my="24px" />
<Box>
<Text as="h3" textStyle="heading" paddingBottom="20px">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ import {
UpdateApplicantGeneralInformationResponse,
UPDATE_APPLICANT_GENERAL_INFORMATION_MUTATION,
} from '@tools/admin/permit-holders/permit-holder-information';
import { useMutation, useQuery } from '@apollo/client';
import { useMutation, useQuery } from '@tools/hooks/graphql';
import Address from '@components/admin/Address';
import { permitHolderInformationSchema } from '@lib/applicants/validation';
import { titlecase } from '@tools/string';

type PersonalInformationProps = {
readonly applicantId: number;
Expand Down Expand Up @@ -138,7 +139,7 @@ export default function PermitHolderInformationCard(props: PersonalInformationPr
Date of Birth: {formatDateYYYYMMDD(new Date(dateOfBirth))}
</Text>
<Text as="p" textStyle="body-regular">
Gender: {gender === 'OTHER' ? otherGender : gender}
Gender: {gender === 'OTHER' ? otherGender : titlecase(gender)}
</Text>
</VStack>

Expand Down
8 changes: 1 addition & 7 deletions components/admin/permit-holders/reports/GenerateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from '@chakra-ui/react'; // Chakra UI
import { DownloadIcon } from '@chakra-ui/icons';
import { GenerateReportStep, PERMIT_HOLDERS_COLUMNS } from '@tools/admin/reports'; //GenerateReportStep enum
import { useLazyQuery } from '@apollo/client';
import { useLazyQuery } from '@tools/hooks/graphql';
import {
GENERATE_PERMIT_HOLDERS_REPORT_QUERY,
GeneratePermitHoldersReportRequest,
Expand Down Expand Up @@ -92,12 +92,6 @@ export default function GenerateReportModal(props: Props) {
});
}
},
onError: error => {
toast({
status: 'error',
description: error.message,
});
},
});

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
Button,
useToast,
} from '@chakra-ui/react'; // Chakra UI
import { useMutation } from '@apollo/client';
import { useMutation } from '@tools/hooks/graphql';
import {
SetApplicantAsActiveRequest,
SetApplicantAsActiveResponse,
Expand Down Expand Up @@ -46,12 +46,6 @@ export default function SetPermitHolderToActiveModal(props: Props) {
});
}
},
onError: error => {
toast({
status: 'error',
description: error.message,
});
},
});

// Sets permit holder status to active and closes modal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
Textarea,
useToast,
} from '@chakra-ui/react'; // Chakra UI
import { useMutation } from '@apollo/client';
import { useMutation } from '@tools/hooks/graphql';
import {
SetApplicantAsInactiveRequest,
SetApplicantAsInactiveResponse,
Expand Down Expand Up @@ -55,12 +55,6 @@ export default function SetPermitHolderToInactiveModal({
});
}
},
onError: error => {
toast({
status: 'error',
description: error.message,
});
},
});
// Close modal handler
const handleClose = () => {
Expand Down
19 changes: 12 additions & 7 deletions components/admin/requests/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import PermitTypeBadge from '@components/admin/PermitTypeBadge';
import { ApplicationStatus, ApplicationType, PermitType } from '@lib/graphql/types';
import { titlecase } from '@tools/string';
import { formatDateYYYYMMDD } from '@lib/utils/date';
import { getPermanentPermitExpiryDate } from '@lib/utils/permit-expiry';

type RequestHeaderProps = {
readonly applicationType: ApplicationType;
Expand Down Expand Up @@ -86,21 +87,25 @@ export default function RequestHeader({
</Text>
)}
</Box>
<Box>
<VStack alignItems="flex-end" spacing="0">
<Flex alignItems="center">
<Text textStyle="heading" as="h3" marginRight={3} textTransform="capitalize">
Permit Type:
</Text>
<PermitTypeBadge variant={permitType} />
</Flex>
<HStack justifyContent="flex-end">
{permitType === 'TEMPORARY' && !!temporaryPermitExpiry && (
<Text textStyle="caption" as="p" mt="12px">
This permit will expire: {formatDateYYYYMMDD(temporaryPermitExpiry)}
</Text>
)}
<Text textStyle="caption" as="p" mt="12px">
{permitType === 'TEMPORARY' && !!temporaryPermitExpiry
? `This permit will expire: ${formatDateYYYYMMDD(temporaryPermitExpiry)}`
: permitType === 'PERMANENT'
? `This permit will expire: ${formatDateYYYYMMDD(
getPermanentPermitExpiryDate()
)} (expected)`
: null}
</Text>
</HStack>
</Box>
</VStack>
</Flex>
{applicationStatus === 'REJECTED' && (
<Alert status="error">
Expand Down
2 changes: 1 addition & 1 deletion components/admin/requests/additional-questions/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC, useState } from 'react';
import { useMutation, useQuery } from '@apollo/client';
import { useMutation, useQuery } from '@tools/hooks/graphql';
import { Box, Text, SimpleGrid, VStack, Button } from '@chakra-ui/react'; // Chakra UI
import PermitHolderInfoCard from '@components/admin/LayoutCard'; // Custom Card component
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from '@chakra-ui/react'; // Chakra UI
import { formatFullName, formatPhoneNumber } from '@lib/utils/format'; // Date formatter util
import { formatDate } from '@lib/utils/date';
import { useQuery } from '@apollo/client';
import { useQuery } from '@tools/hooks/graphql';
import {
GetSelectedApplicantRequest,
GetSelectedApplicantResponse,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC, useEffect, useState } from 'react';
import { useQuery, useMutation, useLazyQuery } from '@apollo/client';
import { useQuery, useMutation, useLazyQuery } from '@tools/hooks/graphql';
import { Text, Divider, Button, VStack, Box } from '@chakra-ui/react'; // Chakra UI
import PermitHolderInfoCard from '@components/admin/LayoutCard'; // Custom Card Component
import EditDoctorInformationModal from '@components/admin/requests/doctor-information/EditModal'; // Edit modal
Expand Down
22 changes: 12 additions & 10 deletions components/admin/requests/guardian-information/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMutation, useQuery } from '@apollo/client';
import { useMutation, useQuery } from '@tools/hooks/graphql';
import { Box, Text, Divider, VStack, Button, Link as FileLink } from '@chakra-ui/react'; // Chakra UI
import PermitHolderInfoCard from '@components/admin/LayoutCard'; // Custom Card Component
import { formatFullName, formatPhoneNumber } from '@lib/utils/format';
Expand Down Expand Up @@ -98,17 +98,19 @@ export default function GuardianInformationCard({
<Text as="p" textStyle="body-regular">
This permit holder does not have a guardian/POA
</Text>
<EditGuardianInformationModal
guardianInformation={INITIAL_GUARDIAN_INFORMATION}
onSave={handleSave}
>
<Button height="50px" leftIcon={<AddIcon height="14px" width="14px" />}>
Add a Guardian/POA
</Button>
</EditGuardianInformationModal>
{!editDisabled && (
<EditGuardianInformationModal
guardianInformation={INITIAL_GUARDIAN_INFORMATION}
onSave={handleSave}
>
<Button height="50px" leftIcon={<AddIcon height="14px" width="14px" />}>
Add a Guardian/POA
</Button>
</EditGuardianInformationModal>
)}
</VStack>
);
}, []);
}, [editDisabled]);

/** Render guardian information */
const _renderGuardianInformation = useCallback((guardian: GuardianCardData) => {
Expand Down
2 changes: 1 addition & 1 deletion components/admin/requests/payment-information/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC, useState } from 'react';
import { useQuery, useMutation } from '@apollo/client';
import { useQuery, useMutation } from '@tools/hooks/graphql';
import { Box, Text, Divider, SimpleGrid, VStack, Button } from '@chakra-ui/react'; // Chakra UI
import PermitHolderInfoCard from '@components/admin/LayoutCard'; // Custom Card component
import EditPaymentDetailsModal from '@components/admin/requests/payment-information/EditModal'; // Edit modal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC, useState } from 'react';
import { useQuery, useMutation } from '@apollo/client';
import { useQuery, useMutation } from '@tools/hooks/graphql';
import { HStack, VStack, Text, Divider, Button } from '@chakra-ui/react'; // Chakra UI
import PermitHolderInfoCard from '@components/admin/LayoutCard'; // Custom Card component
import EditPermitHolderInformationModal from '@components/admin/requests/permit-holder-information/EditModal'; // Edit modal
Expand Down
14 changes: 10 additions & 4 deletions components/admin/requests/physician-assessment/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC, useState } from 'react';
import { useMutation, useQuery } from '@apollo/client';
import { useMutation, useQuery } from '@tools/hooks/graphql';
import {
Text,
VStack,
Expand Down Expand Up @@ -151,14 +151,20 @@ const Card: FC<Props> = props => {
</Text>
</GridItem>
<Wrap>
<Badge bgColor="background.informative">{titlecase(patientCondition as string)}</Badge>
{patientCondition !== null
? patientCondition.map(condition => (
<Badge key={condition} bgColor="background.informative">
{titlecase(condition)}
</Badge>
))
: 'N/A'}
</Wrap>
{patientCondition === 'OTHER' && (
{patientCondition?.includes('OTHER') && (
<>
{/* Condition description */}
<GridItem>
<Text as="p" textStyle="body-regular" textAlign="left">
Condition description
Other condition description
</Text>
</GridItem>
<GridItem>
Expand Down
Loading

0 comments on commit 43f6edb

Please sign in to comment.