-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Target Date Field added to withdrawals forms. (#1611)
* Target Date Field added to withdrawals forms. -Field added in both createForm.tsx and editForm.tsx. -Added targetDate in gql/withdrawals.d.ts types. -Created SelectDate.tsx file for the custom element. * fixed-formatting * Validation-targetDate-fields-wthdrawals/transfers Eddited targetDate in withdrawals.d.ts to required Eddited targetDate in transfer.d.ts to required Fixed validationSchema in ../withdrawals/CreateForm.tsx and EditForm.tsx - validation permits usage of previous date now Fixed validationSchema in ../transfers/CreateForm.tsx and EditForm.tsx - validation permits usage of previous date now * Ran yarn format, yarn test, yarn build -minor issues fixed- forgotten save of EditForm.tsx
- Loading branch information
Showing
7 changed files
with
69 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react' | ||
import { useField } from 'formik' | ||
import { useTranslation } from 'next-i18next' | ||
|
||
import { TextFieldProps } from '@mui/material' | ||
|
||
import { translateError } from 'common/form/useForm' | ||
import { TranslatableField } from 'common/form/validation' | ||
import FormTextField from 'components/common/form/FormTextField' | ||
|
||
type Props = { | ||
name: string | ||
} & TextFieldProps | ||
|
||
export default function SelectDate({ name, ...textFieldProps }: Props) { | ||
const { t } = useTranslation('withdrawals') | ||
|
||
const [field, meta] = useField(name) | ||
|
||
const helperText = meta.touched ? translateError(meta.error as TranslatableField, t) : '' | ||
|
||
return ( | ||
<FormTextField | ||
{...textFieldProps} | ||
{...field} | ||
type="date" | ||
variant="outlined" | ||
fullWidth | ||
InputLabelProps={{ shrink: true }} | ||
error={Boolean(meta.error) && Boolean(meta.touched)} | ||
label={t('targetDate')} | ||
helperText={helperText} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters