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
a48f617d
Commit
a48f617d
authored
Jul 17, 2019
by
Théophile BORNON
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
if coeff = 0 then hide
if type text coeff = 0
parent
def607a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
SubCategory.jsx
src/SubCategory.jsx
+13
-3
No files found.
src/SubCategory.jsx
View file @
a48f617d
...
...
@@ -40,8 +40,12 @@ function SubCategory(props) {
else
if
(
e
.
target
.
type
===
"number"
&&
parseInt
(
e
.
target
.
value
)
>=
1
)
setCoefficient
({
id
:
subCategory
.
id
,
coeff
:
parseInt
(
e
.
target
.
value
)
});
else
if
(
e
.
target
.
type
===
"checkbox"
)
if
(
e
.
target
.
id
===
"type"
)
if
(
e
.
target
.
id
===
"type"
)
{
update
=
{
...
subCategory
,
type
:
(
e
.
target
.
checked
?
"text"
:
""
)
};
if
(
e
.
target
.
checked
)
setCoefficient
({
id
:
subCategory
.
id
,
coeff
:
0
});
else
setCoefficient
({
id
:
subCategory
.
id
,
coeff
:
1
});
}
else
update
=
{
...
subCategory
,
[
e
.
target
.
id
]:
e
.
target
.
checked
};
...
...
@@ -51,7 +55,7 @@ function SubCategory(props) {
const
deleteSubCategory
=
()
=>
{
if
(
window
.
confirm
(
"Êtes vous sûr de vouloir supprimer cette sous catégorie ?"
))
{
setCoefficient
({
id
:
subCategory
.
id
,
coeff
:
0
})
setCoefficient
({
id
:
subCategory
.
id
,
coeff
:
0
})
deleteElement
(
subCategory
.
id
)
}
}
...
...
@@ -65,7 +69,13 @@ function SubCategory(props) {
aria
-
controls=
"panel1a-content"
id=
"panel1a-header"
>
<
Typography
className=
{
classes
.
heading
}
>
{
subCategory
.
name
}
(
{
Math
.
round
(
subCategory
.
coeff
/
props
.
totalCoeff
*
10000
)
/
100
}
%)
</
Typography
>
<
Typography
className=
{
classes
.
heading
}
>
{
subCategory
.
name
}
{
subCategory
.
coeff
===
0
&&
<>
(
{
Math
.
round
(
subCategory
.
coeff
/
props
.
totalCoeff
*
10000
)
/
100
}
%)
</>
}
</
Typography
>
</
ExpansionPanelSummary
>
<
ExpansionPanelDetails
>
...
...
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