Skip to content
Snippets Groups Projects
Verified Commit ba228072 authored by Defendi Alberto's avatar Defendi Alberto
Browse files

Moved picker provider in app.

parent c5894aa4
No related branches found
No related tags found
2 merge requests!85Implement the remaining api calls to make possible to link a driver shift with a reservation.,!75Resolve "Driver shift page where driver inserts shift."
...@@ -12,6 +12,8 @@ import { Unauthorized } from 'components/Unauthorized/Unauthorized'; ...@@ -12,6 +12,8 @@ import { Unauthorized } from 'components/Unauthorized/Unauthorized';
import { LandingPage } from 'components/LandingPage/LandingPage'; import { LandingPage } from 'components/LandingPage/LandingPage';
import { configureInterceptors } from 'api/axios/configureInterceptors'; import { configureInterceptors } from 'api/axios/configureInterceptors';
import { All } from 'roles/All'; import { All } from 'roles/All';
import DateFnsUtils from '@date-io/date-fns';
import MuiPickersUtilsProvider from '@material-ui/pickers/MuiPickersUtilsProvider';
/** /**
* Entry point of the app. * Entry point of the app.
...@@ -23,15 +25,20 @@ export const App: FC = () => { ...@@ -23,15 +25,20 @@ export const App: FC = () => {
return ( return (
<div data-testid="App"> <div data-testid="App">
<ThemeProvider theme={appTheme}> <ThemeProvider theme={appTheme}>
<Router> <MuiPickersUtilsProvider utils={DateFnsUtils}>
<Switch> <Router>
<Route exact path={NonAuthRoutes.home} component={LandingPage} /> <Switch>
<Route path={NonAuthRoutes.auth} component={AuthUser} /> <Route exact path={NonAuthRoutes.home} component={LandingPage} />
<Route path={AuthRoutes.dashboard} component={All(Dashboard)} /> <Route path={NonAuthRoutes.auth} component={AuthUser} />
<Route path={NonAuthRoutes.unauthorized} component={Unauthorized} /> <Route path={AuthRoutes.dashboard} component={All(Dashboard)} />
<Route component={NotFound} /> <Route
</Switch> path={NonAuthRoutes.unauthorized}
</Router> component={Unauthorized}
/>
<Route component={NotFound} />
</Switch>
</Router>
</MuiPickersUtilsProvider>
</ThemeProvider> </ThemeProvider>
</div> </div>
); );
......
...@@ -9,13 +9,8 @@ import { ...@@ -9,13 +9,8 @@ import {
Typography, Typography,
} from '@material-ui/core'; } from '@material-ui/core';
import { Control, Controller } from 'react-hook-form'; import { Control, Controller } from 'react-hook-form';
import { InputField } from 'components/Auth/InputField/InputField';
import { ReservationType } from 'types/ReservationType'; import { ReservationType } from 'types/ReservationType';
import DateFnsUtils from '@date-io/date-fns'; import { KeyboardDateTimePicker } from '@material-ui/pickers';
import {
MuiPickersUtilsProvider,
KeyboardDateTimePicker,
} from '@material-ui/pickers';
import { reservationPageStyle } from '../ReservationPage.style'; import { reservationPageStyle } from '../ReservationPage.style';
type TripStageProps = { type TripStageProps = {
...@@ -32,54 +27,52 @@ export const TripStage: FC<TripStageProps> = ({ control }: TripStageProps) => { ...@@ -32,54 +27,52 @@ export const TripStage: FC<TripStageProps> = ({ control }: TripStageProps) => {
}; };
return ( return (
<MuiPickersUtilsProvider utils={DateFnsUtils}> <Card>
<Card> {stage.map((field, index) => (
{stage.map((field, index) => ( <CardContent>
<CardContent> <Typography
<Typography variant="h6"
variant="h6" component="h3"
component="h3" className={classes.paddingBottomKlein}
className={classes.paddingBottomKlein} >
> Stage {index}
Stage {index} </Typography>
</Typography> <Controller
<Controller as={<input hidden />}
as={<input hidden />} name={`tripStages[${index}].number`}
name={`tripStages[${index}].number`} control={control}
control={control} defaultValue={index}
defaultValue={index} />
/> <Controller
<Controller as={<TextField variant="outlined" fullWidth label="Location" />}
as={<TextField variant="outlined" fullWidth label="Location" />} name={`tripStages[${index}].location.address`}
name={`tripStages[${index}].location.address`} control={control}
control={control} defaultValue={field}
defaultValue={field} />
/> <Controller
<Controller control={control}
control={control} name={`tripStages[${index}].estimatedBeAt`}
name={`tripStages[${index}].estimatedBeAt`} as={({ ref, ...rest }) => (
as={({ ref, ...rest }) => ( <KeyboardDateTimePicker
<KeyboardDateTimePicker margin="normal"
margin="normal" id="date-picker-dialog"
id="date-picker-dialog" label="Date and Hour"
label="Date and Hour" defaultValue={field}
defaultValue={field} format="dd/MM/yyyy"
format="dd/MM/yyyy" KeyboardButtonProps={{
KeyboardButtonProps={{ 'aria-label': 'Insert trip stage',
'aria-label': 'Insert trip stage', }}
}} {...rest}
{...rest} />
/> )}
)} />
/> </CardContent>
</CardContent> ))}
))} <CardActions>
<CardActions> <Button variant="outlined" onClick={addStage} type="button">
<Button variant="outlined" onClick={addStage} type="button"> Add stage
Add stage </Button>
</Button> </CardActions>
</CardActions> </Card>
</Card>
</MuiPickersUtilsProvider>
); );
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment