import React from 'react'; import { Mutation } from 'react-apollo'; import { DateTime } from 'luxon'; import { Paper, Typography, AppBar, Tabs, Tab, } from '@material-ui/core'; import { Face as BasicIcon, Alarm as TechnicalIcon, Group as TeamAndServerIcon, PresentToAll as PresentationIcon, } from '@material-ui/icons'; import { withStyles } from '@material-ui/core/styles'; import styles from './styles'; import { Basic, PresentationPage, TeamsServer, Technical, } from './Tabs'; import { hostedEventsCalls } from '../../../GraphQL/Calls'; function TabContainer(props) { return ( {props.children} ); } class Create extends React.Component { constructor(props) { super(props); this.state = { value: 0, name: '', description: '', startDatetime: DateTime.local().plus({ days: 1 }).startOf('day'), finishDatetime: DateTime.local().plus({ days: 8 }).startOf('day'), formulaId: '', plotterId: '', }; } handleTabChange = (event, value) => { this.setState({ value }); } handleEventChange = (newType, newVal) => { this.setState({ [newType]: newVal }); } render() { const { name, description, startDatetime, finishDatetime, value, formulaId, plotterId, } = this.state; const { classes } = this.props; return ( { this.props.history.push(`/events/edit/${data.events_CreateEvent.id}`); } } > {hostEvent => (
} /> } /> } disabled /> } disabled /> Create a new event
{ e.preventDefault(); hostEvent({ variables: { event: { name, description, startDatetime: startDatetime.valueOf() / 1000, finishDatetime: finishDatetime.valueOf() / 1000, formulaId, plotterId, }, }, }); }} > {value === 0 && this.handleEventChange(newType, newVal)} /> } {value === 1 && this.handleEventChange(newType, newVal)} /> } {value === 2 && } {value === 3 && }
)}
); } } export default withStyles(styles)(Create);