Commit fda0d903 authored by Théophile BORNON's avatar Théophile BORNON

hide percent if text area

parent 987ffb3a
...@@ -41,7 +41,11 @@ function SubCategory(props) { ...@@ -41,7 +41,11 @@ function SubCategory(props) {
setCoefficient({ id: subCategory.id, coeff: parseInt(e.target.value) }); setCoefficient({ id: subCategory.id, coeff: parseInt(e.target.value) });
else if (e.target.type === "checkbox") else if (e.target.type === "checkbox")
if (e.target.id === "type") { if (e.target.id === "type") {
update = { ...subCategory, type: (e.target.checked ? "text" : "") }; update = {
...subCategory,
coeff: e.target.checked ? 0 : 1,
type: (e.target.checked ? "text" : "")
};
if (e.target.checked) setCoefficient({ id: subCategory.id, coeff: 0 }); if (e.target.checked) setCoefficient({ id: subCategory.id, coeff: 0 });
else setCoefficient({ id: subCategory.id, coeff: 1 }); else setCoefficient({ id: subCategory.id, coeff: 1 });
...@@ -69,7 +73,7 @@ function SubCategory(props) { ...@@ -69,7 +73,7 @@ function SubCategory(props) {
aria-controls="panel1a-content" aria-controls="panel1a-content"
id="panel1a-header" id="panel1a-header"
> >
<Typography className={classes.heading}>{subCategory.name} <Typography className={classes.heading}>{subCategory.name}
{subCategory.coeff !== 0 && {subCategory.coeff !== 0 &&
<> <>
({Math.round(subCategory.coeff / props.totalCoeff * 10000) / 100} %) ({Math.round(subCategory.coeff / props.totalCoeff * 10000) / 100} %)
......
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