/* @flow */ import type { FicheDePaie } from 'Types/ResultViewTypes' import withColours from 'Components/utils/withColours' import withLanguage from 'Components/utils/withLanguage' import Value from 'Components/Value' import { findRuleByDottedName, getRuleFromAnalysis } from 'Engine/rules' import { compose } from 'ramda' import React, { Fragment } from 'react' import { Trans } from 'react-i18next' import { connect } from 'react-redux' import { analysisWithDefaultsSelector, parsedRulesSelector } from 'Selectors/analyseSelectors' import { analysisToCotisationsSelector } from 'Selectors/ficheDePaieSelectors' import './PaySlip.css' import { Line, SalaireBrutSection, SalaireNetSection } from './PaySlipSections' import RuleLink from './RuleLink' type ConnectedPropTypes = ?FicheDePaie & { colours: { lightestColour: string } } export default compose( withColours, connect(state => ({ cotisations: analysisToCotisationsSelector(state), analysis: analysisWithDefaultsSelector(state), parsedRules: parsedRulesSelector(state) })), withLanguage )( ({ colours: { lightestColour }, cotisations, analysis, parsedRules }: ConnectedPropTypes) => { let getRule = getRuleFromAnalysis(analysis) const heuresSupplémentaires = getRule( 'contrat salarié . temps de travail . heures supplémentaires' ) return (
{heuresSupplémentaires.nodeValue > 0 && ( )}
{/* Section cotisations */}

Cotisations sociales

Part employeur

Part salariale

{cotisations.map(([brancheDottedName, cotisationList]) => { let branche = findRuleByDottedName(parsedRules, brancheDottedName) return (
{cotisationList.map(cotisation => ( {cotisation.montant.partPatronale} {cotisation.montant.partSalariale} ))}
) })} {/* Total cotisation */}
Total des retenues
{/* Salaire chargé */}
{/* Section salaire net */}
) } )