Amélioration des pages de documentations pour rend non applicable
- ajout des traductions - ajout d'une notice "désactivée par" quand une règle est désactivée par un régime d'exception actifpull/615/head
parent
1ffb97c2f6
commit
6344d2f2e1
|
@ -8,18 +8,20 @@ import './Algorithm.css'
|
|||
import { ShowValuesProvider } from './ShowValuesContext'
|
||||
|
||||
let Conditions = ({
|
||||
'rendu non applicable': disabledBy,
|
||||
parentDependency,
|
||||
'applicable si': applicable,
|
||||
'non applicable si': notApplicable
|
||||
}) => {
|
||||
let listElements = [
|
||||
parentDependency?.nodeValue === false && (
|
||||
<li key="parentDependency">
|
||||
<span css="background: yellow">
|
||||
<T>Désactivée</T>
|
||||
</span>{' '}
|
||||
<T>car dépend de</T> {makeJsx(parentDependency)}
|
||||
</li>
|
||||
<ShowIfDisabled dependency={parentDependency} key="parent dependency" />
|
||||
),
|
||||
...disabledBy?.explanation?.isDisabledBy?.map(
|
||||
(dependency, i) =>
|
||||
dependency?.nodeValue === true && (
|
||||
<ShowIfDisabled dependency={dependency} key={`dependency ${i}`} />
|
||||
)
|
||||
),
|
||||
applicable && <li key="applicable">{makeJsx(applicable)}</li>,
|
||||
notApplicable && <li key="non applicable">{makeJsx(notApplicable)}</li>
|
||||
|
@ -35,6 +37,17 @@ let Conditions = ({
|
|||
) : null
|
||||
}
|
||||
|
||||
function ShowIfDisabled({ dependency }) {
|
||||
return (
|
||||
<li>
|
||||
<span css="background: yellow">
|
||||
<T>Désactivée</T>
|
||||
</span>{' '}
|
||||
<T>car dépend de</T> {makeJsx(dependency)}
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
export default compose(withTranslation())(
|
||||
class Algorithm extends React.Component {
|
||||
render() {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { T } from 'Components'
|
||||
import PeriodSwitch from 'Components/PeriodSwitch'
|
||||
import withColours from 'Components/utils/withColours'
|
||||
import withLanguage from 'Components/utils/withLanguage'
|
||||
import withSitePaths from 'Components/utils/withSitePaths'
|
||||
|
@ -31,7 +32,6 @@ import Examples from './Examples'
|
|||
import RuleHeader from './Header'
|
||||
import References from './References'
|
||||
import './Rule.css'
|
||||
import PeriodSwitch from 'Components/PeriodSwitch'
|
||||
|
||||
let LazySource = React.lazy(() => import('./RuleSource'))
|
||||
|
||||
|
@ -166,7 +166,9 @@ export default compose(
|
|||
/>
|
||||
{displayedRule['rend non applicable'] && (
|
||||
<section id="non-applicable">
|
||||
<h3>Rend non applicable : </h3>
|
||||
<h3>
|
||||
<T>Rend non applicable les règles suivantes</T> :{' '}
|
||||
</h3>
|
||||
<ul>
|
||||
{displayedRule['rend non applicable'].map(ruleName => (
|
||||
<li key={ruleName}>
|
||||
|
|
|
@ -117,7 +117,7 @@ rend non applicable:
|
|||
description: |
|
||||
Permet de désactiver l'application de certaines règles pour la situation saisie.
|
||||
|
||||
> Ce mécanisme est utile pour encoder les régimes d'exceptions (par exemple le [régime des impatriés]()) sans avoir à modifier la définition des règles de base.
|
||||
> Ce mécanisme est utile pour encoder les régimes d'exceptions (par exemple le [régime des impatriés](/documentation/contrat-salarié/régime-des-impatriés)) sans avoir à modifier la définition des règles de base.
|
||||
|
||||
barème:
|
||||
type: numeric
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { T } from 'Components'
|
||||
import { ShowValuesConsumer } from 'Components/rule/ShowValuesContext'
|
||||
import RuleLink from 'Components/RuleLink'
|
||||
import evaluate from 'Engine/evaluateRule'
|
||||
|
@ -130,12 +131,12 @@ export default (rules, rule, parsedRules) => {
|
|||
|
||||
parsedRules[rule.dottedName]['rendu non applicable'] = {
|
||||
evaluate: (cache, situation, parsedRules, node) => {
|
||||
const nodeValue = node.explanation.isDisabledBy
|
||||
.map(disablerNode =>
|
||||
evaluateNode(cache, situation, parsedRules, disablerNode)
|
||||
)
|
||||
.some(x => x.nodeValue === true)
|
||||
return rewriteNode(node, nodeValue, node.explanation, {})
|
||||
const isDisabledBy = node.explanation.isDisabledBy.map(disablerNode =>
|
||||
evaluateNode(cache, situation, parsedRules, disablerNode)
|
||||
)
|
||||
const nodeValue = isDisabledBy.some(x => x.nodeValue === true)
|
||||
const explanation = { ...node.explanation, isDisabledBy }
|
||||
return { ...node, explanation, nodeValue }
|
||||
},
|
||||
jsx: (nodeValue, { isDisabledBy }) => {
|
||||
return (
|
||||
|
@ -143,12 +144,12 @@ export default (rules, rule, parsedRules) => {
|
|||
<>
|
||||
<h3>Exception{isDisabledBy.length > 1 && 's'}</h3>
|
||||
<p>
|
||||
Cette règle ne s'applique pas pour :{' '}
|
||||
<T>Cette règle ne s'applique pas pour</T> :{' '}
|
||||
{isDisabledBy.map((rule, i) => (
|
||||
<>
|
||||
<React.Fragment key={i}>
|
||||
{i > 0 && ', '}
|
||||
<RuleLink dottedName={rule.dottedName} />
|
||||
</>
|
||||
</React.Fragment>
|
||||
))}
|
||||
</p>
|
||||
</>
|
||||
|
|
|
@ -764,6 +764,8 @@ Année d'activité: Years of activity
|
|||
Commerçant, artisan, ou libéral ?: Trader, craftsman, or liberal?
|
||||
Revenir à la documentation: Go back to documentation
|
||||
Voir le code source: See the source code
|
||||
Rend non applicable les règles suivantes: Makes the following rules not applicable
|
||||
Cette règle ne s'applique pas pour: This rule does not apply for
|
||||
|
||||
pour les accidents de trajet/travail et maladie pro: for commuting accidents, work accidents and professional illness
|
||||
jour: day
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
- nom: contribution
|
||||
formule: impôt
|
||||
test: règle désactivé
|
||||
test: règle désactivée
|
||||
exemples:
|
||||
- nom: evasion fiscale
|
||||
situation:
|
||||
|
|
Loading…
Reference in New Issue