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() {
}
const
addSection
=
()
=>
{
setState
({
sections
:
[...
state
.
sections
,
{
name
:
"Nouvelle section"
,
categories
:
[]
}]
});
setState
({
...
state
,
sections
:
[...
state
.
sections
,
{
name
:
"Nouvelle section"
,
categories
:
[]
}]
});
}
const
deleteSection
=
i
=>
()
=>
{
...
...
@@ -82,6 +82,7 @@ function App() {
let
sections
=
Object
.
assign
(
state
.
sections
);
sections
[
i
]
=
update
;
setState
({
...
state
,
sections
:
sections
});
}
...
...
src/Category.jsx
View file @
588043b9
...
...
@@ -66,8 +66,8 @@ export default function Category(props) {
<
Typography
className=
{
classes
.
heading
}
>
{
category
.
name
}
</
Typography
>
</
ExpansionPanelSummary
>
<
ExpansionPanelDetails
>
<
Grid
container
>
<
Grid
item
xs=
{
12
}
md=
{
10
}
>
<
Grid
container
spacing=
{
2
}
>
<
Grid
item
xs=
{
12
}
md=
{
8
}
>
<
TextField
id=
"name"
label=
"Nom de la categorie"
...
...
@@ -79,6 +79,20 @@ export default function Category(props) {
fullWidth
/>
</
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
}
>
{
category
.
subCategories
.
map
((
sc
,
i
)
=>
...
...
src/Section.jsx
View file @
588043b9
...
...
@@ -36,7 +36,7 @@ export default function SimpleExpansionPanel(props) {
}
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
=>
()
=>
{
...
...
src/SubCategory.jsx
View file @
588043b9
...
...
@@ -54,12 +54,6 @@ export default function SubCategory(props) {
</
ExpansionPanelSummary
>
<
ExpansionPanelDetails
>
<
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
}
>
<
TextField
id=
"name"
...
...
@@ -72,20 +66,22 @@ export default function SubCategory(props) {
fullWidth
/>
</
Grid
>
<
Grid
item
xs=
{
12
}
md=
{
4
}
>
<
TextField
id=
"coeff"
label=
"Coefficient"
value=
{
subCategory
.
coeff
}
onChange=
{
handleChange
}
type=
"number"
InputLabelProps=
{
{
shrink
:
true
,
}
}
margin=
"normal"
variant=
"outlined"
/>
</
Grid
>
{
subCategory
.
type
===
""
&&
<
Grid
item
xs=
{
12
}
md=
{
4
}
>
<
TextField
id=
"coeff"
label=
"Coefficient"
value=
{
subCategory
.
coeff
}
onChange=
{
handleChange
}
type=
"number"
InputLabelProps=
{
{
shrink
:
true
,
}
}
margin=
"normal"
variant=
"outlined"
/>
</
Grid
>
}
<
Grid
item
xs=
{
12
}
md=
{
3
}
>
<
FormControlLabel
value=
"top"
...
...
@@ -116,31 +112,34 @@ export default function SubCategory(props) {
labelPlacement=
"top"
/>
</
Grid
>
<
Grid
item
xs=
{
12
}
md=
{
5
}
>
<
TextField
id=
"upper"
label=
"Label valeur haute"
value=
{
subCategory
.
upper
}
onChange=
{
handleChange
}
className=
{
classes
.
textField
}
margin=
"normal"
variant=
"outlined"
fullWidth
/>
</
Grid
>
<
Grid
item
xs=
{
12
}
md=
{
5
}
>
<
TextField
id=
"lower"
label=
"Label valeur basse"
value=
{
subCategory
.
lower
}
onChange=
{
handleChange
}
className=
{
classes
.
textField
}
margin=
"normal"
variant=
"outlined"
fullWidth
/>
</
Grid
>
{
subCategory
.
type
===
""
&&
<>
<
Grid
item
xs=
{
12
}
md=
{
5
}
>
<
TextField
id=
"upper"
label=
"Label valeur haute"
value=
{
subCategory
.
upper
}
onChange=
{
handleChange
}
className=
{
classes
.
textField
}
margin=
"normal"
variant=
"outlined"
fullWidth
/>
</
Grid
>
<
Grid
item
xs=
{
12
}
md=
{
5
}
>
<
TextField
id=
"lower"
label=
"Label valeur basse"
value=
{
subCategory
.
lower
}
onChange=
{
handleChange
}
className=
{
classes
.
textField
}
margin=
"normal"
variant=
"outlined"
fullWidth
/>
</
Grid
>
</>
}
<
Grid
item
xs=
{
12
}
md=
{
10
}
>
<
Danger
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