@@ -4,11 +4,14 @@ import {
44 FormHelperText ,
55 FormLabel ,
66 Grid ,
7+ Link ,
78 IconButton ,
89 MenuItem ,
910 Select ,
1011 TextField ,
11- Typography
12+ Typography ,
13+ Snackbar ,
14+ Alert
1215} from '@mui/material' ;
1316import { Box , Stack } from '@mui/system' ;
1417import { Control , Controller , FieldErrors , UseFormHandleSubmit , UseFormSetValue , UseFormWatch } from 'react-hook-form' ;
@@ -29,6 +32,8 @@ import NERSuccessButton from '../../../components/NERSuccessButton';
2932import { ReimbursementRequestFormInput } from './ReimbursementRequestForm' ;
3033import { useState } from 'react' ;
3134import { useToast } from '../../../hooks/toasts.hooks' ;
35+ import { Link as RouterLink } from 'react-router-dom' ;
36+ import { routes } from '../../../utils/routes' ;
3237import { codeAndRefundSourceName , expenseTypePipe } from '../../../utils/pipes' ;
3338
3439interface ReimbursementRequestFormViewProps {
@@ -52,6 +57,7 @@ interface ReimbursementRequestFormViewProps {
5257 submitText : string ;
5358 previousPage : string ;
5459 setValue : UseFormSetValue < ReimbursementRequestFormInput > ;
60+ hasSecureSettingsSet : boolean ;
5561}
5662
5763const ReimbursementRequestFormView : React . FC < ReimbursementRequestFormViewProps > = ( {
@@ -71,7 +77,8 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
7177 watch,
7278 submitText,
7379 previousPage,
74- setValue
80+ setValue,
81+ hasSecureSettingsSet
7582} ) => {
7683 const [ datePickerOpen , setDatePickerOpen ] = useState ( false ) ;
7784 const toast = useToast ( ) ;
@@ -108,6 +115,18 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
108115 handleSubmit ( onSubmit ) ( e ) ;
109116 } }
110117 >
118+ { ! hasSecureSettingsSet && (
119+ < Snackbar anchorOrigin = { { vertical : 'top' , horizontal : 'center' } } open = { true } >
120+ < Alert variant = "filled" severity = "warning" >
121+ Your secure settings must be set to create a reimbursement request, you can set them
122+ < Link style = { { color : 'blue' } } component = { RouterLink } to = { routes . SETTINGS } >
123+ { ' ' }
124+ here
125+ </ Link >
126+ .
127+ </ Alert >
128+ </ Snackbar >
129+ ) }
111130 < Grid container spacing = { 2 } >
112131 < Grid item container spacing = { 2 } md = { 6 } xs = { 12 } >
113132 < Grid item xs = { 12 } >
@@ -259,7 +278,7 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
259278 < NERFailButton variant = "contained" href = { previousPage } sx = { { mx : 1 } } >
260279 Cancel
261280 </ NERFailButton >
262- < NERSuccessButton variant = "contained" type = "submit" >
281+ < NERSuccessButton variant = "contained" type = "submit" disabled = { ! hasSecureSettingsSet } >
263282 { submitText }
264283 </ NERSuccessButton >
265284 </ Box >
0 commit comments