diff --git a/source/components/Results.js b/source/components/Results.js index 3ae8f546b..9ef6b4c91 100644 --- a/source/components/Results.js +++ b/source/components/Results.js @@ -9,7 +9,7 @@ import './Results.css' import {clearDict} from 'Engine/traverse' import {encodeRuleName} from 'Engine/rules' import {getObjectives} from 'Engine/generateQuestions' -import RuleValueVignette from './RuleValueVignette' +import RuleValueVignette from './rule/RuleValueVignette' @withRouter @connect( diff --git a/source/components/rule/Rule.css b/source/components/rule/Rule.css index bb169b599..6990cac65 100644 --- a/source/components/rule/Rule.css +++ b/source/components/rule/Rule.css @@ -96,6 +96,16 @@ text-align: center; } +#ruleValue { + margin-left: 3em; + font-weight: 600; +} + + +/* + Règles CSS d'affichage des algorithmes +*/ + #rule-rules { display: inline-flex; justify-content: start; @@ -114,7 +124,6 @@ } #algorithm { - margin-top: 3em; margin-right: 10em; } .dictionaryPanelWrapper { diff --git a/source/components/rule/Rule.js b/source/components/rule/Rule.js index ffe286451..e31eb1da3 100644 --- a/source/components/rule/Rule.js +++ b/source/components/rule/Rule.js @@ -14,6 +14,7 @@ import References from './References' import Algorithm from './Algorithm' import Examples from './Examples' import Helmet from 'react-helmet' +import {humanFigure} from './RuleValueVignette' @connect( state => ({ @@ -54,12 +55,15 @@ export default class Rule extends Component { // } let - situationExists = !R.isEmpty(this.props.form) + conversationStarted = !R.isEmpty(this.props.form), + situationExists = conversationStarted || this.state.example != null let {type, name, description} = this.rule, destinataire = R.path([type, 'destinataire'])(this.rule), - destinataireData = possiblesDestinataires[destinataire] + destinataireData = possiblesDestinataires[destinataire], + situationOrExampleRule = R.path(['example', 'rule'])(this.state) || this.rule, + ruleValue = situationOrExampleRule.nodeValue return (
@@ -80,17 +84,18 @@ export default class Rule extends Component {

Destinataire

{!destinataireData ? -

Non renseigné

- :
- - {destinataireData.image && - } - {!destinataireData.image && -
{destinataire}
- } -
- {destinataireData.nom &&
{destinataireData.nom}
} -
+

Non renseigné

+ : +
+ + {destinataireData.image && + } + {!destinataireData.image && +
{destinataire}
+ } +
+ {destinataireData.nom &&
{destinataireData.nom}
} +
}
@@ -99,10 +104,21 @@ export default class Rule extends Component { {this.renderReferences(this.rule)}
+
+

Résultat

+

+ {ruleValue == 0 + ? 'Règle non applicable' + : ruleValue == null + ? 'Situation incomplète' + : humanFigure(2)(ruleValue) + ' €'} +

+
+
- + value => fmt(value.toFixed(decimalDigits)) +export let humanFigure = decimalDigits => value => fmt(value.toFixed(decimalDigits)) import './RuleValueVignette.css' export default ({