Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
leximpact-client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leximpact
Simulateur dotations aux communes
leximpact-client
Commits
fa059da1
Commit
fa059da1
authored
4 years ago
by
Loïc Poullain
Browse files
Options
Downloads
Patches
Plain Diff
[DF] Mention ecretement
parent
64212440
No related branches found
No related tags found
1 merge request
!101
Corriger bug variations montants DSR/DSU et ajouter mention écrêtement
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.eslintrc.json
+1
-0
1 addition, 0 deletions
.eslintrc.json
components/dotations/articles/montant-dsr-dsu/majoration-minoration-section/majoration-minoration-text/MajorationMinorationText.tsx
+38
-13
38 additions, 13 deletions
...n/majoration-minoration-text/MajorationMinorationText.tsx
with
39 additions
and
13 deletions
.eslintrc.json
+
1
−
0
View file @
fa059da1
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
}
}
},
},
"rules"
:
{
"rules"
:
{
"class-methods-use-this"
:
"off"
,
"import/extensions"
:
[
"import/extensions"
:
[
"error"
,
"error"
,
"ignorePackages"
,
"ignorePackages"
,
...
...
This diff is collapsed.
Click to expand it.
components/dotations/articles/montant-dsr-dsu/majoration-minoration-section/majoration-minoration-text/MajorationMinorationText.tsx
+
38
−
13
View file @
fa059da1
...
@@ -35,15 +35,7 @@ type PropsFromRedux = ConnectedProps<typeof connector>;
...
@@ -35,15 +35,7 @@ type PropsFromRedux = ConnectedProps<typeof connector>;
class
MajorationMinorationText
extends
PureComponent
<
PropsFromRedux
>
{
class
MajorationMinorationText
extends
PureComponent
<
PropsFromRedux
>
{
static
isMajoration
(
dsr
:
number
,
dsu
:
number
):
boolean
{
getMontantsText
(
dsr
:
number
,
dsu
:
number
):
string
{
return
dsr
>
0
||
dsu
>
0
;
}
static
inMillions
(
n
:
number
):
string
{
return
`
${
formatNumber
(
Math
.
sign
(
n
)
*
n
)}
million
${
Math
.
abs
(
n
)
>
1
?
"
s
"
:
""
}
`
;
}
static
getMontantsText
(
dsr
:
number
,
dsu
:
number
):
string
{
// eslint-disable-next-line prefer-template
// eslint-disable-next-line prefer-template
return
(
this
.
isMajoration
(
dsr
,
dsu
)
?
"
augmentent au moins
"
:
"
baissent
"
)
return
(
this
.
isMajoration
(
dsr
,
dsu
)
?
"
augmentent au moins
"
:
"
baissent
"
)
+
(
dsr
!==
dsu
?
"
, respectivement, de
"
:
"
de
"
)
+
(
dsr
!==
dsu
?
"
, respectivement, de
"
:
"
de
"
)
...
@@ -53,12 +45,19 @@ class MajorationMinorationText extends PureComponent<PropsFromRedux> {
...
@@ -53,12 +45,19 @@ class MajorationMinorationText extends PureComponent<PropsFromRedux> {
+
(
dsr
===
dsu
?
"
chacun
"
:
""
);
+
(
dsr
===
dsu
?
"
chacun
"
:
""
);
}
}
// eslint-disable-next-line class-methods-use-this
isMajoration
(
dsr
:
number
,
dsu
:
number
):
boolean
{
return
dsr
>
0
||
dsu
>
0
;
}
inMillions
(
n
:
number
):
string
{
return
`
${
formatNumber
(
Math
.
sign
(
n
)
*
n
)}
million
${
Math
.
abs
(
n
)
>
1
?
"
s
"
:
""
}
`
;
}
variationsHaveNotTheSameSign
({
dsr
,
dsu
}:
{
dsr
:
number
,
dsu
:
number
}):
boolean
{
variationsHaveNotTheSameSign
({
dsr
,
dsu
}:
{
dsr
:
number
,
dsu
:
number
}):
boolean
{
return
(
dsr
>
0
&&
dsu
<
0
)
||
(
dsu
>
0
&&
dsr
<
0
);
return
(
dsr
>
0
&&
dsu
<
0
)
||
(
dsu
>
0
&&
dsr
<
0
);
}
}
render
()
{
render
()
{
const
{
amendement
,
plf
,
removeVariation
}
=
this
.
props
;
const
{
amendement
,
plf
,
removeVariation
}
=
this
.
props
;
const
plfHasVariations
=
plf
.
dsr
!==
0
||
plf
.
dsu
!==
0
;
const
plfHasVariations
=
plf
.
dsr
!==
0
||
plf
.
dsu
!==
0
;
...
@@ -103,7 +102,7 @@ class MajorationMinorationText extends PureComponent<PropsFromRedux> {
...
@@ -103,7 +102,7 @@ class MajorationMinorationText extends PureComponent<PropsFromRedux> {
[
styles
.
replacedWithAmendement
]:
plfAndAmendementAreDifferent
,
[
styles
.
replacedWithAmendement
]:
plfAndAmendementAreDifferent
,
[
styles
.
bold
]:
true
,
[
styles
.
bold
]:
true
,
})
}
>
})
}
>
{
MajorationMinorationText
.
getMontantsText
(
plf
.
dsr
,
plf
.
dsu
)
}
{
this
.
getMontantsText
(
plf
.
dsr
,
plf
.
dsu
)
}
</
span
>
</
span
>
)
)
}
}
...
@@ -114,7 +113,7 @@ class MajorationMinorationText extends PureComponent<PropsFromRedux> {
...
@@ -114,7 +113,7 @@ class MajorationMinorationText extends PureComponent<PropsFromRedux> {
[
styles
.
bold
]:
true
,
[
styles
.
bold
]:
true
,
})
}
>
})
}
>
{
"
"
}
{
"
"
}
{
MajorationMinorationText
.
getMontantsText
(
amendement
.
dsr
,
amendement
.
dsu
)
}
{
this
.
getMontantsText
(
amendement
.
dsr
,
amendement
.
dsu
)
}
</
span
>
</
span
>
)
)
}
}
...
@@ -130,6 +129,32 @@ class MajorationMinorationText extends PureComponent<PropsFromRedux> {
...
@@ -130,6 +129,32 @@ class MajorationMinorationText extends PureComponent<PropsFromRedux> {
</
span
>
</
span
>
)
)
}
}
{
plfHasVariations
&&
this
.
isMajoration
(
plf
.
dsr
,
plf
.
dsu
)
&&
(
<
span
className
=
{
classNames
({
[
styles
.
plfValue
]:
true
,
[
styles
.
replacedWithAmendement
]:
!
this
.
isMajoration
(
amendement
.
dsr
,
amendement
.
dsu
),
})
}
>
{
"
"
}
Cette augmentation est financée par les minorations prévues
à l
'
article L. 2334-7-1.
</
span
>
)
}
{
amendementHasVariations
&&
!
this
.
isMajoration
(
plf
.
dsr
,
plf
.
dsu
)
&&
this
.
isMajoration
(
amendement
.
dsr
,
amendement
.
dsu
)
&&
(
<
span
className
=
{
classNames
({
[
styles
.
amendementValue
]:
true
,
})
}
>
{
"
"
}
Cette augmentation est financée par les minorations prévues
à l
'
article L. 2334-7-1.
</
span
>
)
}
{
{
amendementHasVariations
&&
(
amendementHasVariations
&&
(
<
Fragment
>
<
Fragment
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment