Commit 588043b9 authored by Théophile BORNON's avatar Théophile BORNON

udpate

parent 3aab3e6d
...@@ -70,7 +70,7 @@ function App() { ...@@ -70,7 +70,7 @@ function App() {
} }
const addSection = () => { const addSection = () => {
setState({ sections: [...state.sections, { name: "Nouvelle section", categories: [] }] }); setState({ ...state, sections: [...state.sections, { name: "Nouvelle section", categories: [] }] });
} }
const deleteSection = i => () => { const deleteSection = i => () => {
...@@ -82,6 +82,7 @@ function App() { ...@@ -82,6 +82,7 @@ function App() {
let sections = Object.assign(state.sections); let sections = Object.assign(state.sections);
sections[i] = update; sections[i] = update;
setState({ setState({
...state,
sections: sections sections: sections
}); });
} }
......
...@@ -66,8 +66,8 @@ export default function Category(props) { ...@@ -66,8 +66,8 @@ export default function Category(props) {
<Typography className={classes.heading}>{category.name}</Typography> <Typography className={classes.heading}>{category.name}</Typography>
</ExpansionPanelSummary> </ExpansionPanelSummary>
<ExpansionPanelDetails> <ExpansionPanelDetails>
<Grid container> <Grid container spacing={2}>
<Grid item xs={12} md={10}> <Grid item xs={12} md={8}>
<TextField <TextField
id="name" id="name"
label="Nom de la categorie" label="Nom de la categorie"
...@@ -79,6 +79,20 @@ export default function Category(props) { ...@@ -79,6 +79,20 @@ export default function Category(props) {
fullWidth fullWidth
/> />
</Grid> </Grid>
<Grid item xs={12} md={4}>
<TextField
id="coeff"
label="Coefficient"
value={category.coeff}
onChange={handleChange}
type="number"
InputLabelProps={{
shrink: true,
}}
margin="normal"
variant="outlined"
/>
</Grid>
<Grid item xs={12} md={10}> <Grid item xs={12} md={10}>
{category.subCategories.map((sc, i) => {category.subCategories.map((sc, i) =>
......
...@@ -36,7 +36,7 @@ export default function SimpleExpansionPanel(props) { ...@@ -36,7 +36,7 @@ export default function SimpleExpansionPanel(props) {
} }
const addCategory = () => { const addCategory = () => {
setSection({ ...section, categories: [...section.categories, { name: "Nouvelle catégorie", subCategories: [] }] }) setSection({ ...section, categories: [...section.categories, { name: "Nouvelle catégorie", coeff: 1, subCategories: [] }] })
} }
const deleteCategory = i => () => { const deleteCategory = i => () => {
......
...@@ -54,12 +54,6 @@ export default function SubCategory(props) { ...@@ -54,12 +54,6 @@ export default function SubCategory(props) {
</ExpansionPanelSummary> </ExpansionPanelSummary>
<ExpansionPanelDetails> <ExpansionPanelDetails>
<Grid container justify="flex-end" alignItems="center" className={classes.root} spacing={2}> <Grid container justify="flex-end" alignItems="center" className={classes.root} spacing={2}>
<Grid item xs={12} md={10}>
<Divider />
<Typography variant="h6" component="h5">
{subCategory.name}
</Typography>
</Grid>
<Grid item xs={12} md={10}> <Grid item xs={12} md={10}>
<TextField <TextField
id="name" id="name"
...@@ -72,6 +66,7 @@ export default function SubCategory(props) { ...@@ -72,6 +66,7 @@ export default function SubCategory(props) {
fullWidth fullWidth
/> />
</Grid> </Grid>
{subCategory.type === "" &&
<Grid item xs={12} md={4}> <Grid item xs={12} md={4}>
<TextField <TextField
id="coeff" id="coeff"
...@@ -86,6 +81,7 @@ export default function SubCategory(props) { ...@@ -86,6 +81,7 @@ export default function SubCategory(props) {
variant="outlined" variant="outlined"
/> />
</Grid> </Grid>
}
<Grid item xs={12} md={3}> <Grid item xs={12} md={3}>
<FormControlLabel <FormControlLabel
value="top" value="top"
...@@ -116,6 +112,8 @@ export default function SubCategory(props) { ...@@ -116,6 +112,8 @@ export default function SubCategory(props) {
labelPlacement="top" labelPlacement="top"
/> />
</Grid> </Grid>
{subCategory.type === "" &&
<>
<Grid item xs={12} md={5}> <Grid item xs={12} md={5}>
<TextField <TextField
id="upper" id="upper"
...@@ -140,7 +138,8 @@ export default function SubCategory(props) { ...@@ -140,7 +138,8 @@ export default function SubCategory(props) {
fullWidth fullWidth
/> />
</Grid> </Grid>
</>
}
<Grid item xs={12} md={10}> <Grid item xs={12} md={10}>
<Danger <Danger
size="small" size="small"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment