2017-01-10 18:22:44 +00:00
|
|
|
import React, { Component } from 'react'
|
2017-02-09 12:58:12 +00:00
|
|
|
import classNames from 'classnames'
|
2017-02-13 12:28:49 +00:00
|
|
|
import {Link} from 'react-router'
|
2017-01-10 18:22:44 +00:00
|
|
|
|
|
|
|
export default class Results extends Component {
|
|
|
|
render() {
|
|
|
|
let {analysedSituation} = this.props
|
|
|
|
return (
|
|
|
|
<section id="results">
|
2017-01-18 08:48:46 +00:00
|
|
|
<h2>Vos obligations</h2>
|
2017-01-10 18:22:44 +00:00
|
|
|
<ul>
|
2017-02-10 14:12:00 +00:00
|
|
|
{analysedSituation.map(
|
|
|
|
({name, type, derived: {missingVariables, computedValue}}) =>
|
2017-02-09 12:58:12 +00:00
|
|
|
do {
|
|
|
|
let
|
|
|
|
unsatisfied = missingVariables && missingVariables.length,
|
|
|
|
irrelevant = !unsatisfied && computedValue == null;
|
|
|
|
<li key={name} className={classNames({unsatisfied, number: !unsatisfied && !irrelevant})}>
|
|
|
|
<h3>{type} {name}</h3>
|
|
|
|
<p>
|
|
|
|
{unsatisfied ?
|
|
|
|
'En attente de vos réponses...'
|
|
|
|
: irrelevant ?
|
|
|
|
"Vous n'êtes pas concernés"
|
|
|
|
:computedValue + '€'
|
|
|
|
}
|
|
|
|
</p>
|
2017-02-13 12:28:49 +00:00
|
|
|
<Link to={"/regle/" + name} className="explore">
|
|
|
|
<button>
|
|
|
|
Explorer <i className="fa fa-cogs" aria-hidden="true"></i>
|
|
|
|
</button>
|
|
|
|
</Link>
|
2017-02-09 12:58:12 +00:00
|
|
|
</li>
|
|
|
|
}
|
2017-01-10 18:22:44 +00:00
|
|
|
)}
|
|
|
|
</ul>
|
|
|
|
</section>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|