Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
Form Generator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Théophile BORNON
Form Generator
Commits
588043b9
Commit
588043b9
authored
Jul 15, 2019
by
Théophile BORNON
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
udpate
parent
3aab3e6d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
49 deletions
+63
-49
App.js
src/App.js
+2
-1
Category.jsx
src/Category.jsx
+16
-2
Section.jsx
src/Section.jsx
+1
-1
SubCategory.jsx
src/SubCategory.jsx
+44
-45
No files found.
src/App.js
View file @
588043b9
...
@@ -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
});
});
}
}
...
...
src/Category.jsx
View file @
588043b9
...
@@ -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
)
=>
...
...
src/Section.jsx
View file @
588043b9
...
@@ -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
=>
()
=>
{
...
...
src/SubCategory.jsx
View file @
588043b9
...
@@ -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,20 +66,22 @@ export default function SubCategory(props) {
...
@@ -72,20 +66,22 @@ export default function SubCategory(props) {
fullWidth
fullWidth
/>
/>
</
Grid
>
</
Grid
>
<
Grid
item
xs=
{
12
}
md=
{
4
}
>
{
subCategory
.
type
===
""
&&
<
TextField
<
Grid
item
xs=
{
12
}
md=
{
4
}
>
id=
"coeff"
<
TextField
label=
"Coefficient"
id=
"coeff"
value=
{
subCategory
.
coeff
}
label=
"Coefficient"
onChange=
{
handleChange
}
value=
{
subCategory
.
coeff
}
type=
"number"
onChange=
{
handleChange
}
InputLabelProps=
{
{
type=
"number"
shrink
:
true
,
InputLabelProps=
{
{
}
}
shrink
:
true
,
margin=
"normal"
}
}
variant=
"outlined"
margin=
"normal"
/>
variant=
"outlined"
</
Grid
>
/>
</
Grid
>
}
<
Grid
item
xs=
{
12
}
md=
{
3
}
>
<
Grid
item
xs=
{
12
}
md=
{
3
}
>
<
FormControlLabel
<
FormControlLabel
value=
"top"
value=
"top"
...
@@ -116,31 +112,34 @@ export default function SubCategory(props) {
...
@@ -116,31 +112,34 @@ export default function SubCategory(props) {
labelPlacement=
"top"
labelPlacement=
"top"
/>
/>
</
Grid
>
</
Grid
>
<
Grid
item
xs=
{
12
}
md=
{
5
}
>
{
subCategory
.
type
===
""
&&
<
TextField
<>
id=
"upper"
<
Grid
item
xs=
{
12
}
md=
{
5
}
>
label=
"Label valeur haute"
<
TextField
value=
{
subCategory
.
upper
}
id=
"upper"
onChange=
{
handleChange
}
label=
"Label valeur haute"
className=
{
classes
.
textField
}
value=
{
subCategory
.
upper
}
margin=
"normal"
onChange=
{
handleChange
}
variant=
"outlined"
className=
{
classes
.
textField
}
fullWidth
margin=
"normal"
/>
variant=
"outlined"
</
Grid
>
fullWidth
<
Grid
item
xs=
{
12
}
md=
{
5
}
>
/>
<
TextField
</
Grid
>
id=
"lower"
<
Grid
item
xs=
{
12
}
md=
{
5
}
>
label=
"Label valeur basse"
<
TextField
value=
{
subCategory
.
lower
}
id=
"lower"
onChange=
{
handleChange
}
label=
"Label valeur basse"
className=
{
classes
.
textField
}
value=
{
subCategory
.
lower
}
margin=
"normal"
onChange=
{
handleChange
}
variant=
"outlined"
className=
{
classes
.
textField
}
fullWidth
margin=
"normal"
/>
variant=
"outlined"
</
Grid
>
fullWidth
/>
</
Grid
>
</>
}
<
Grid
item
xs=
{
12
}
md=
{
10
}
>
<
Grid
item
xs=
{
12
}
md=
{
10
}
>
<
Danger
<
Danger
size=
"small"
size=
"small"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment