diff --git a/.nvmrc b/.nvmrc
new file mode 100644
index 00000000..62df50f1
--- /dev/null
+++ b/.nvmrc
@@ -0,0 +1 @@
+14.17.0
diff --git a/components/admin/permit-holders/Header.tsx b/components/admin/permit-holders/Header.tsx
index 33b93ad3..8553ec85 100644
--- a/components/admin/permit-holders/Header.tsx
+++ b/components/admin/permit-holders/Header.tsx
@@ -1,3 +1,4 @@
+import { useRouter } from 'next/router';
import {
Alert,
AlertIcon,
@@ -18,6 +19,7 @@ import { ChevronDownIcon, ChevronLeftIcon } from '@chakra-ui/icons'; // Chakra U
import Link from 'next/link'; // Link
import { ApplicantStatus } from '@lib/graphql/types';
import PermitHolderStatusBadge from '@components/admin/PermitHolderStatusBadge';
+import ConfirmDeleteApplicantModal from '@components/admin/permit-holders/table/ConfirmDeleteApplicantModal';
import SetPermitHolderToInactiveModal from '@components/admin/permit-holders/table/ConfirmSetInactiveModal';
import SetPermitHolderToActiveModal from '@components/admin/permit-holders/table/ConfirmSetActiveModal';
import AdditionalNotesModal from '@components/admin/permit-holders/additional-notes/Modal';
@@ -37,6 +39,8 @@ export default function PermitHolderHeader({
applicant: { id, name, status, inactiveReason, notes },
refetch,
}: PermitHolderHeaderProps) {
+ const router = useRouter();
+
// Set Permit Holder Inactive/Active modal state
const {
isOpen: isSetPermitHolderStatusModalOpen,
@@ -44,6 +48,13 @@ export default function PermitHolderHeader({
onClose: onCloseSetPermitHolderStatusModal,
} = useDisclosure();
+ // Delete applicant modal state
+ const {
+ isOpen: isDeleteApplicantModalOpen,
+ onOpen: onOpenDeleteApplicantModal,
+ onClose: onCloseDeleteApplicantModal,
+ } = useDisclosure();
+
// Additional notes modal state
const {
isOpen: isNotesModalOpen,
@@ -97,6 +108,13 @@ export default function PermitHolderHeader({
>
{`Set as ${status === 'ACTIVE' ? 'Inactive' : 'Active'}`}
+
@@ -143,6 +161,17 @@ export default function PermitHolderHeader({
onClose={onCloseSetPermitHolderStatusModal}
/>
)}
+ {
+ /* Do not refetch, redirect to permit holders page */
+ }}
+ onClose={() => {
+ onCloseDeleteApplicantModal();
+ router.push('/admin/permit-holders');
+ }}
+ />
{/* Additional notes modal */}
- Gender: {gender === 'OTHER' ? otherGender : titlecase(gender)}
+ Gender: {gender === 'OTHER' && otherGender ? otherGender : titlecase(gender)}
diff --git a/components/admin/permit-holders/permit-holder-information/EditModal.tsx b/components/admin/permit-holders/permit-holder-information/EditModal.tsx
index b6af3fd7..ba6c1734 100644
--- a/components/admin/permit-holders/permit-holder-information/EditModal.tsx
+++ b/components/admin/permit-holders/permit-holder-information/EditModal.tsx
@@ -76,6 +76,7 @@ export default function EditUserInformationModal({
}}
validationSchema={permitHolderInformationSchema}
onSubmit={handleSubmit}
+ validateOnMount
>
{({ values, isValid }) => (