From ca39277492697c0326b0065905bd4338774a5b37 Mon Sep 17 00:00:00 2001 From: Mael Date: Thu, 24 Jan 2019 16:29:51 +0100 Subject: [PATCH] =?UTF-8?q?Indication=20du=20salaire=20=C3=A9quivalent=20t?= =?UTF-8?q?emps=20plein=20sur=20la=20question=20nb=20heures?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IndicationSalaireEquivalentTempsPlein.js | 20 +++++++++++++++++++ source/components/conversation/Input.js | 6 ++++++ 2 files changed, 26 insertions(+) create mode 100644 source/components/conversation/IndicationSalaireEquivalentTempsPlein.js diff --git a/source/components/conversation/IndicationSalaireEquivalentTempsPlein.js b/source/components/conversation/IndicationSalaireEquivalentTempsPlein.js new file mode 100644 index 000000000..a08aa61a1 --- /dev/null +++ b/source/components/conversation/IndicationSalaireEquivalentTempsPlein.js @@ -0,0 +1,20 @@ +import { React } from 'Components' +import { analysisWithDefaultsSelector } from 'Selectors/analyseSelectors' +import { connect } from 'react-redux' + +export default connect(state => ({ + analysis: analysisWithDefaultsSelector(state) +}))(({ analysis }) => { + let cache = analysis.cache + let salaire = cache['contrat salarié . salaire . brut de base'], + quotité = cache['contrat salarié . quotité de travail'], + équivalentTempsPlein = Math.round(salaire.nodeValue / quotité.nodeValue) + if (quotité.nodeValue === 1) return null + return ( +
+ Soit {équivalentTempsPlein} € bruts par mois en équivalent temps plein +
+ ) +}) diff --git a/source/components/conversation/Input.js b/source/components/conversation/Input.js index ccd5b813b..9cdff3ac5 100644 --- a/source/components/conversation/Input.js +++ b/source/components/conversation/Input.js @@ -9,6 +9,7 @@ import InputSuggestions from './InputSuggestions' import SendButton from './SendButton' import { connect } from 'react-redux' import { formValueSelector } from 'redux-form' +import IndicationSalaireEquivalentTempsPlein from 'Components/conversation/IndicationSalaireEquivalentTempsPlein' export default compose( FormDecorator('input'), @@ -81,6 +82,11 @@ export default compose( rulePeriod={this.props.rulePeriod} /> {inputError && {error}} + {dottedName === + 'contrat salarié . temps partiel . heures par semaine' && ( + + // If the need for this kind of computed indication to help the user answer the question correctly is encountered for other kind of questions, it should be abstracted in the engine + )} ) }