Adding Rules and Prices to mutation calls
This commit is contained in:
1 parent
ff3d5ffff0
commit
b8e1f67108
4 files changed
+59
-39
No files matched your search
@@ -145,6 +145,8 @@ class Create extends React.Component {
|
||||
finishDatetime: finishDatetime.valueOf() / 1000,
|
||||
formulaId,
|
||||
plotterId,
|
||||
prizes,
|
||||
rules,
|
||||
},
|
||||
},
|
||||
})}
|
||||
@@ -169,6 +171,8 @@ class Create extends React.Component {
|
||||
finishDatetime: finishDatetime.valueOf() / 1000,
|
||||
formulaId,
|
||||
plotterId,
|
||||
prizes,
|
||||
rules,
|
||||
},
|
||||
},
|
||||
})}
|
||||
|
||||
@@ -19,7 +19,9 @@ import styles from '../styles';
|
||||
|
||||
class Basic extends React.Component {
|
||||
render() {
|
||||
const { classes, event, edit } = this.props;
|
||||
const {
|
||||
classes, event, edit, saveChanges,
|
||||
} = this.props;
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Typography className={classes.typography} variant='body1' gutterBottom align='left'>
|
||||
@@ -102,7 +104,7 @@ class Basic extends React.Component {
|
||||
>
|
||||
Go to technical tab
|
||||
</Button>
|
||||
<Button className={classes.bottomButton} type='submit' variant='contained' color='secondary'>
|
||||
<Button className={classes.bottomButton} onClick={() => saveChanges()} variant='contained' color='secondary'>
|
||||
Or Create event
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
@@ -58,7 +58,9 @@ class Technical extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { classes, event, edit } = this.props;
|
||||
const {
|
||||
classes, event, edit, saveChanges,
|
||||
} = this.props;
|
||||
const {
|
||||
isNewPlotterOpen, isNewFormulaOpen, isNewRuleOpen, isNewPrizeOpen,
|
||||
} = this.state;
|
||||
@@ -182,7 +184,7 @@ class Technical extends React.Component {
|
||||
|
||||
<Grid container justify='center' >
|
||||
<Grid item>
|
||||
<Button className={classes.bottomButton} type='submit' variant='contained' color='secondary'>
|
||||
<Button className={classes.bottomButton} onClick={ () => saveChanges() } variant='contained' color='secondary'>
|
||||
Create the event
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
@@ -84,7 +84,7 @@ class Queried extends React.Component {
|
||||
}
|
||||
}
|
||||
>
|
||||
{hostEvent => (
|
||||
{editHosted => (
|
||||
<div className={classes.root}>
|
||||
<AppBar position='static' color='default'>
|
||||
<Tabs
|
||||
@@ -124,10 +124,20 @@ class Queried extends React.Component {
|
||||
<Typography className={classes.typography} variant='h5' gutterBottom>
|
||||
Create a new event
|
||||
</Typography>
|
||||
<form
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
hostEvent({
|
||||
{value === 0 && <TabContainer>
|
||||
<Basic
|
||||
event={{
|
||||
id,
|
||||
title,
|
||||
subtitle,
|
||||
description,
|
||||
startDatetime,
|
||||
finishDatetime,
|
||||
prizes,
|
||||
rules,
|
||||
}}
|
||||
edit={(newType, newVal) => this.handleEventChange(newType, newVal)}
|
||||
saveChanges={() => editHosted({
|
||||
variables: {
|
||||
eventId: id,
|
||||
event: {
|
||||
@@ -140,36 +150,38 @@ class Queried extends React.Component {
|
||||
plotterId,
|
||||
},
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
{value === 0 && <TabContainer>
|
||||
<Basic
|
||||
event={{
|
||||
id,
|
||||
title,
|
||||
subtitle,
|
||||
description,
|
||||
startDatetime,
|
||||
finishDatetime,
|
||||
}}
|
||||
edit={(newType, newVal) => this.handleEventChange(newType, newVal)}
|
||||
/>
|
||||
</TabContainer>}
|
||||
{value === 1 && <TabContainer>
|
||||
<Technical
|
||||
event={{
|
||||
formulaId,
|
||||
plotterId,
|
||||
prizes,
|
||||
rules,
|
||||
}}
|
||||
edit={(newType, newVal) => this.handleEventChange(newType, newVal)}
|
||||
/>
|
||||
</TabContainer>}
|
||||
{value === 2 && <TabContainer><TeamsServer /></TabContainer>}
|
||||
{value === 3 && <TabContainer><PresentationPage /></TabContainer>}
|
||||
</form>
|
||||
})}
|
||||
/>
|
||||
</TabContainer>}
|
||||
{value === 1 && <TabContainer>
|
||||
<Technical
|
||||
event={{
|
||||
formulaId,
|
||||
plotterId,
|
||||
prizes,
|
||||
rules,
|
||||
}}
|
||||
edit={(newType, newVal) => this.handleEventChange(newType, newVal)}
|
||||
saveChanges={() => editHosted({
|
||||
variables: {
|
||||
eventId: id,
|
||||
event: {
|
||||
title,
|
||||
subtitle,
|
||||
description,
|
||||
startDatetime: startDatetime.valueOf() / 1000,
|
||||
finishDatetime: finishDatetime.valueOf() / 1000,
|
||||
formulaId,
|
||||
plotterId,
|
||||
prizes,
|
||||
rules,
|
||||
},
|
||||
},
|
||||
})}
|
||||
/>
|
||||
</TabContainer>}
|
||||
{value === 2 && <TabContainer><TeamsServer /></TabContainer>}
|
||||
{value === 3 && <TabContainer><PresentationPage /></TabContainer>}
|
||||
</Paper>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user