Affichage du type de salaire dans Mes réponses

pull/138/head
mama 2017-12-19 11:44:12 +01:00
parent a927a29712
commit d7748ff7b0
3 changed files with 23 additions and 14 deletions

View File

@ -6,7 +6,12 @@ import { connect } from 'react-redux'
import { withRouter, Redirect } from 'react-router-dom'
import { START_CONVERSATION } from '../actions'
import { rules, findRuleByName, decodeRuleName } from 'Engine/rules'
import {
rules,
findRuleByName,
findRuleByDottedName,
decodeRuleName
} from 'Engine/rules'
import './conversation/conversation.css'
import './Simulateur.css'
import Conversation from './conversation/Conversation'
@ -31,7 +36,7 @@ import Explanation from 'Components/Explanation'
analysis: state.analysis
}),
dispatch => ({
startConversation: (targetNames, fromScratch=false) =>
startConversation: (targetNames, fromScratch = false) =>
dispatch({ type: START_CONVERSATION, targetNames, fromScratch }),
resetForm: () => dispatch(reset('conversation')),
resetFormField: name => dispatch(change('conversation', name, ''))
@ -117,7 +122,11 @@ export default class extends Component {
}}
/>
<Results />
{done && <Explanation targetRules={R.path(['analysis', 'targets'], this.props)}/>}
{done && (
<Explanation
targetRules={R.path(['analysis', 'targets'], this.props)}
/>
)}
</div>
)
}
@ -130,10 +139,10 @@ export default class extends Component {
let step = makeQuestion(rules, targetNames)(question)
let fieldName =
(unfolded &&
inputInversions &&
R.path(step.dottedName.split('.'), inputInversions)) ||
step.dottedName
(inputInversions &&
R.path(step.dottedName.split('.'), inputInversions)) ||
step.dottedName,
fieldTitle = findRuleByDottedName(rules, fieldName).title
return (
<step.component
@ -143,6 +152,7 @@ export default class extends Component {
step={step}
situationGate={situationGate}
fieldName={fieldName}
fieldTitle={fieldTitle}
inverted={step.dottedName !== fieldName}
/>
)

View File

@ -144,10 +144,10 @@ export var FormDecorator = formType => RenderField =>
stepAction,
situationGate,
themeColours,
step: { title },
fieldName
step: { title, dottedName },
fieldName,
fieldTitle
} = this.props
let inversionTitle = R.path(['props', 'step', 'inversion', 'title'])(this)
let answer = situationGate(fieldName)
@ -155,13 +155,13 @@ export var FormDecorator = formType => RenderField =>
<div className="foldedQuestion">
<span className="borderWrapper">
<span className="title">
{capitalise0(inversionTitle || title)}
{capitalise0(fieldTitle || title)}
</span>
<span className="answer">{answer}</span>
</span>
<button
className="edit"
onClick={() => stepAction('unfold', fieldName)}
onClick={() => stepAction('unfold', dottedName)}
style={{ color: themeColours.textColourOnWhite }}
>
<i className="fa fa-pencil-square-o" aria-hidden="true" />

View File

@ -80,8 +80,7 @@ let buildPossibleInversion = (rule, flatRules, targetNames) => {
return {
inversions: yo,
question: rule.formule.inversion.question,
title: rule.formule.inversion.titre
question: rule.formule.inversion.question
}
}