Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
leximpact-socio-fiscal-ui
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 socio-fiscal
leximpact-socio-fiscal-ui
Commits
d79c833b
Commit
d79c833b
authored
Apr 24, 2023
by
Emmanuel Raviart
Committed by
Toufic Batache
May 12, 2023
Browse files
Options
Downloads
Patches
Plain Diff
Show linked variables & their values
parent
26ead7a5
No related branches found
No related tags found
1 merge request
!140
Refonte de l'UI - Partie 1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lib/components/test_cases/TestCaseView.svelte
+347
-345
347 additions, 345 deletions
src/lib/components/test_cases/TestCaseView.svelte
src/lib/decompositions.ts
+41
-41
41 additions, 41 deletions
src/lib/decompositions.ts
with
388 additions
and
386 deletions
src/lib/components/test_cases/TestCaseView.svelte
+
347
−
345
View file @
d79c833b
<script
lang=
"ts"
>
import
type
{
DecompositionReference
,
Waterfall
}
from
"
@openfisca/json-model
"
import
{
Popover
}
from
"
flowbite-svelte
"
import
{
getContext
}
from
"
svelte
"
import
type
{
Writable
}
from
"
svelte/store
"
import
{
Popover
}
from
"
flowbite-svelte
"
import
type
{
CalculationByName
,
CalculationName
}
from
"
$lib/calculations
"
import
Spinner
from
"
$lib/components/Spinner.svelte
"
import
OilSpendingBill
from
"
$lib/components/test_cases/OilSpendingBill.svelte
"
import
TestCaseSummary
from
"
$lib/components/test_cases/TestCaseSummary.svelte
"
import
ValueChange
from
"
$lib/components/ValueChange.svelte
"
import
VariableValueChange
from
"
$lib/components/variables/VariableValueChange.svelte
"
import
WaterfallView
from
"
$lib/components/WaterfallView.svelte
"
import
type
{
DecompositionByName
,
...
...
@@ -23,6 +24,7 @@
oilTypes
,
variableSummaryByName
,
type
ValuesByCalculationNameByVariableName
,
variableSummaryByNameByReformName
,
}
from
"
$lib/variables
"
export
let
decompositionByName
:
DecompositionByName
...
...
@@ -81,24 +83,6 @@
}
return
total
}
const
tabs
=
[
{
title
:
"
Impact dispositif
"
,
icon
:
"
material-symbols:location-on
"
,
tab
:
"
impact_dispositif
"
,
},
{
title
:
"
Impacts directs
"
,
icon
:
"
ri:mastercard-line
"
,
tab
:
"
impacts_directs
"
,
},
{
title
:
"
Impacts globaux
"
,
icon
:
"
ph:globe-simple-bold
"
,
tab
:
"
impacts_globaux
"
,
},
]
</script>
<div
...
...
@@ -122,79 +106,6 @@
/>
</div>
<div
class=
"flex overflow-hidden bg-gray-100"
>
{
#each
tabs
as
tabData
}
<a
class=
"flex gap-2 px-8 py-4 uppercase text-gray-600"
class:bg-white=
{
displayMode
.
tab
===
tabData
.
tab
}
class:shadow-md=
{
displayMode
.
tab
===
tabData
.
tab
}
class:shadow-inner=
{
displayMode
.
tab
!==
tabData
.
tab
}
href=
{
newSimulationUrl
(
{
...
displayMode
,
tab
:
tabData
.
tab
,
}
)}
>
<iconify-icon
icon=
{
tabData
.
icon
}
class=
"text-2xl"
/>
{
tabData
.
title
}
</a>
{
/each
}
</div>
{
#if
displayMode
.
tab
===
undefined
||
displayMode
.
tab
===
"
impact_dispositif
"
}
<div
class=
"w-full bg-white px-8 py-7"
>
{
#if
displayMode
.
parametersVariableName
!==
undefined
&&
decompositionByName
[
displayMode
.
parametersVariableName
]
!==
undefined
}
<div
class=
"flex flex-col gap-3"
>
<p
class=
"text-xl font-bold"
>
{
decompositionByName
[
displayMode
.
parametersVariableName
]
.
short_label
??
decompositionByName
[
displayMode
.
parametersVariableName
].
label
??
displayMode
.
parametersVariableName
}
:
</p>
<div
class=
"flex flex-wrap items-start gap-2 text-4xl font-semibold"
>
<ValueChange
legend
unitName=
"currency-EUR"
valueByCalculationName=
{
{
amendment
:
Object
.
keys
(
$parametricReform
).
length
===
0
?
undefined
:
Math
.
abs
(
evaluationByName
[
displayMode
.
parametersVariableName
]
?.
calculationEvaluationByName
[
"
amendment
"
]
?.
deltaAtVectorIndex
??
0
,
),
bill
:
$billName
===
undefined
?
undefined
:
Math
.
abs
(
evaluationByName
[
displayMode
.
parametersVariableName
]
?.
calculationEvaluationByName
[
"
bill
"
]
?.
deltaAtVectorIndex
??
0
,
),
law
:
Math
.
abs
(
evaluationByName
[
displayMode
.
parametersVariableName
]
?.
calculationEvaluationByName
[
"
law
"
]?.
deltaAtVectorIndex
??
0
,
),
}
}
/>
</div>
{
#each
variableSummaryByName
[
displayMode
.
parametersVariableName
].
linked_added_variables
as
linkedVariable
}
<span>
dont
{
variableSummaryByName
[
linkedVariable
]?.
short_label
??
variableSummaryByName
[
linkedVariable
]?.
label
??
linkedVariable
}
:
</span>
{
/each
}
</div>
{
:
else
}
<span>
Aucun paramètre séléctionné.
</span>
{
/if
}
</div>
{
/if
}
{
#if
displayMode
.
tab
===
"
impacts_globaux
"
}
<div
class=
"bg-white"
>
{
#if
variableSummaryByName
!==
undefined
}
<div
class=
"flex justify-between bg-gray-100"
>
...
...
@@ -219,52 +130,35 @@
<div
class=
"flex justify-between gap-4"
>
<div
class=
"pt-3"
>
<!--MONTANT DISPOSITIF SELECTIONNE-->
{
#if
displayMode
.
parametersVariableName
!==
undefined
&&
decompositionByName
[
displayMode
.
parametersVariableName
]
!==
undefined
}
{
#if
displayMode
.
parametersVariableName
!==
undefined
}
<!-- Note: A reform variable is always more complete than a variable before reform. -->
{
@
const
variableSummary
=
$billName
===
undefined
?
variableSummaryByName
[
displayMode
.
parametersVariableName
]
:
variableSummaryByNameByReformName
[
$billName
][
displayMode
.
parametersVariableName
]
}
{
#if
variableSummary
!==
undefined
}
<div
class=
"mb-6 flex-col"
>
<p
class=
"mb-3 text-xl font-bold"
>
{
decompositionByName
[
displayMode
.
parametersVariableName
]
.
short_label
??
decompositionByName
[
displayMode
.
parametersVariableName
].
label
??
{
variableSummary
.
short_label
??
variableSummary
.
label
??
displayMode
.
parametersVariableName
}
:
</p>
<div
class=
"flex flex-wrap items-start gap-2 text-4xl font-semibold"
>
<ValueChange
<VariableValueChange
{
evaluationByName
}
legend
unitName=
"currency-EUR"
valueByCalculationName=
{
{
amendment
:
Object
.
keys
(
$parametricReform
).
length
===
0
?
undefined
:
Math
.
abs
(
evaluationByName
[
displayMode
.
parametersVariableName
]?.
calculationEvaluationByName
[
"
amendment
"
]
?.
deltaAtVectorIndex
??
0
,
),
bill
:
$billName
===
undefined
?
undefined
:
Math
.
abs
(
evaluationByName
[
displayMode
.
parametersVariableName
]?.
calculationEvaluationByName
[
"
bill
"
]
?.
deltaAtVectorIndex
??
0
,
),
law
:
Math
.
abs
(
evaluationByName
[
displayMode
.
parametersVariableName
]?.
calculationEvaluationByName
[
"
law
"
]
?.
deltaAtVectorIndex
??
0
,
),
}
}
name=
{
displayMode
.
parametersVariableName
}
/>
</div>
</div>
{
/if
}
{
/if
}
{
#if
!
displayMode
.
compact
||
(
displayMode
.
compact
&&
displayMode
.
parametersVariableName
===
undefined
)
}
<div
...
...
@@ -302,7 +196,7 @@
Object
.
keys
(
$parametricReform
).
length
===
0
?
undefined
:
calculateTotal
(
$
evaluationByName
Array
[
situationIndex
]
,
evaluationByName
,
"
amendment
"
,
$waterfall
.
root
,
$waterfall
.
total
,
...
...
@@ -311,13 +205,13 @@
$billName
===
undefined
?
undefined
:
calculateTotal
(
$
evaluationByName
Array
[
situationIndex
]
,
evaluationByName
,
"
bill
"
,
$waterfall
.
root
,
$waterfall
.
total
,
),
law
:
calculateTotal
(
$
evaluationByName
Array
[
situationIndex
]
,
evaluationByName
,
"
law
"
,
$waterfall
.
root
,
$waterfall
.
total
,
...
...
@@ -340,8 +234,118 @@
{
/if
}
</div>
{
#if
displayMode
.
parametersVariableName
!==
undefined
}
<!-- Note: A reform variable is always more complete than a variable before reform. -->
{
@
const
variableSummary
=
$billName
===
undefined
?
variableSummaryByName
[
displayMode
.
parametersVariableName
]
:
variableSummaryByNameByReformName
[
$billName
][
displayMode
.
parametersVariableName
]
}
{
#if
variableSummary
!==
undefined
}
{
#if
variableSummary
.
linked_added_variables
!==
undefined
}
<section>
<h4
class=
"font-semibold"
>
Dispositifs additionnés pour le calcul
</h4>
<ul>
{
#each
variableSummary
.
linked_added_variables
as
linkedVariableName
}
{
@
const
linkedVariableSummary
=
$billName
===
undefined
?
variableSummaryByName
[
linkedVariableName
]
:
variableSummaryByNameByReformName
[
$billName
][
linkedVariableName
]
}
<li>
<a
class=
"cursor-pointer text-base hover:underline"
href=
{
newSimulationUrl
(
{
...
displayMode
,
parametersVariableName
:
linkedVariableName
,
}
)}
data-sveltekit-noscroll
>
{
linkedVariableSummary
.
short_label
??
linkedVariableSummary
.
label
??
linkedVariableName
}
</a
>
:
<VariableValueChange
{
evaluationByName
}
name=
{
linkedVariableName
}
/>
</li>
{
/each
}
</ul>
</section>
{
/if
}
{
#if
variableSummary
.
linked_other_variables
!==
undefined
}
<section>
<h4
class=
"font-semibold"
>
Dispositifs pris en compte
</h4>
<ul>
{
#each
variableSummary
.
linked_other_variables
as
linkedVariableName
}
{
@
const
linkedVariableSummary
=
$billName
===
undefined
?
variableSummaryByName
[
linkedVariableName
]
:
variableSummaryByNameByReformName
[
$billName
][
linkedVariableName
]
}
<li>
<a
class=
"cursor-pointer text-base hover:underline"
href=
{
newSimulationUrl
(
{
...
displayMode
,
parametersVariableName
:
linkedVariableName
,
}
)}
data-sveltekit-noscroll
>
{
linkedVariableSummary
.
short_label
??
linkedVariableSummary
.
label
??
linkedVariableName
}
</a
>
:
<VariableValueChange
{
evaluationByName
}
name=
{
linkedVariableName
}
/>
</li>
{
/each
}
</ul>
</section>
{
/if
}
{
#if
variableSummary
.
linked_output_variables
!==
undefined
}
<section>
<h4
class=
"font-semibold"
>
Dispositifs dépendants
</h4>
<ul>
{
#each
variableSummary
.
linked_output_variables
as
linkedVariableName
}
{
@
const
linkedVariableSummary
=
$billName
===
undefined
?
variableSummaryByName
[
linkedVariableName
]
:
variableSummaryByNameByReformName
[
$billName
][
linkedVariableName
]
}
<li>
<a
class=
"cursor-pointer text-base hover:underline"
href=
{
newSimulationUrl
(
{
...
displayMode
,
parametersVariableName
:
linkedVariableName
,
}
)}
data-sveltekit-noscroll
>
{
linkedVariableSummary
.
short_label
??
linkedVariableSummary
.
label
??
linkedVariableName
}
</a
>
:
<VariableValueChange
{
evaluationByName
}
name=
{
linkedVariableName
}
/>
</li>
{
/each
}
</ul>
</section>
{
/if
}
{
/if
}
{
/if
}
<!--TICKET DE CARBURANT-->
{
#if
displayMode
.
parametersVariableName
===
"
taxes_tous_carburants
"
||
(
displayMode
.
parametersVariableName
!==
undefined
&&
oilTypes
.
some
(
(
oilType
)
=>
displayMode
.
parametersVariableName
.
includes
(
oilType
),
))
}
{
#if
displayMode
.
parametersVariableName
===
"
taxes_tous_carburants
"
||
(
displayMode
.
parametersVariableName
!==
undefined
&&
oilTypes
.
some
(
(
oilType
)
=>
displayMode
.
parametersVariableName
?
.
includes
(
oilType
),
))
}
<div
class=
"w-1/2"
>
{
#each
oilSpendings
as
{
depenseTtcVariableName
,
nombreLitresVariableName
,
prixTtcLitreVariableName
,
ticpeVariableName
,
tvaVariableName
}}
<
OilSpendingBill
...
...
@@ -376,8 +380,7 @@
<iconify-icon
class=
"mr-1 align-[-0.2rem] text-xl"
icon=
"ri-arrow-right-s-line"
/><span
class=
"tracking-wider"
>
Voir tous les dispositifs
</span
>
/><span
class=
"tracking-wider"
>
Voir tous les dispositifs
</span>
</a>
{
:
else
}
<a
...
...
@@ -481,15 +484,14 @@
href=
"https://openfisca.org/fr/"
target=
"_blank"
rel=
"noreferrer"
>
OpenFisca
</a
>
.
<br
/>
OpenFisca est un logiciel open source et contributif
qui
permet de traduire la législation en code informatique. La
cellule
LexImpact de l'Assemblée nationale est un des
contributeurs du
logiciel.
>
.
<br
/>
OpenFisca est un logiciel open source et contributif
qui
permet de traduire la législation en code informatique. La
cellule
LexImpact de l'Assemblée nationale est un des
contributeurs du
logiciel.
</span>
</span>
</Popover>
</div>
{
/if
}
</div>
{
/if
}
</div>
This diff is collapsed.
Click to expand it.
src/lib/decompositions.ts
+
41
−
41
View file @
d79c833b
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