-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #476 from MTES-MCT/date-validation-v2
feat: add simple date range validation on v2
- Loading branch information
Showing
13 changed files
with
186 additions
and
62 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
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
61 changes: 51 additions & 10 deletions
61
.../src/v2/features/mission-action/components/ui/mission-action-formik-date-range-picker.tsx
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 |
---|---|---|
@@ -1,15 +1,56 @@ | ||
import { FormikDateRangePicker, FormikDateRangePickerWithDateDateProps } from '@mtes-mct/monitor-ui' | ||
import { | ||
FormikDatePicker, FormikDatePickerWithDateDateProps, | ||
Label, THEME, | ||
} from '@mtes-mct/monitor-ui' | ||
import styled from 'styled-components' | ||
import {Stack} from "rsuite"; | ||
import Text from "@common/components/ui/text.tsx"; | ||
|
||
type MissionActionFormikDateRangePickerProps = Omit<FormikDatePickerWithDateDateProps, 'label'> & { | ||
errors: any | ||
} | ||
|
||
export const MissionActionFormikDateRangePicker = styled( | ||
(props: Omit<FormikDateRangePickerWithDateDateProps, 'label'>) => ( | ||
<FormikDateRangePicker | ||
isLight={true} | ||
withTime={true} | ||
isCompact={true} | ||
isRequired={true} | ||
label="Date et heure de début et de fin" | ||
{...props} | ||
/> | ||
(props: MissionActionFormikDateRangePickerProps) => ( | ||
<Stack direction={'column'} alignItems={'flex-start'}> | ||
<Stack.Item> | ||
<Label>Date et heure de début et de fin</Label> | ||
</Stack.Item> | ||
<Stack.Item> | ||
<Stack direction={'row'} spacing={'0.5rem'}> | ||
<Stack.Item> | ||
<FormikDatePicker | ||
{...props} | ||
isErrorMessageHidden={true} | ||
label={''} | ||
name={'startDateTimeUtc'} | ||
isRequired={true} | ||
withTime={true} | ||
isCompact={true} | ||
|
||
/> | ||
</Stack.Item> | ||
<Stack.Item alignSelf={'center'}> | ||
<Text as={'h4'}>au</Text> | ||
</Stack.Item> | ||
<Stack.Item> | ||
<FormikDatePicker | ||
{...props} | ||
isErrorMessageHidden={true} | ||
label={''} | ||
name={'endDateTimeUtc'} | ||
isRequired={true} | ||
withTime={true} | ||
isCompact={true} | ||
/> | ||
</Stack.Item> | ||
</Stack> | ||
</Stack.Item> | ||
<Stack.Item style={{marginTop: '0.2rem'}}> | ||
<Text as={'h3'} color={THEME.color.maximumRed}> | ||
{props.errors?.endDateTimeUtc ?? props.errors?.startDateTimeUtc ?? ''} | ||
</Text> | ||
</Stack.Item> | ||
</Stack> | ||
) | ||
)({}) |
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
Oops, something went wrong.