Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
leximpact-dotations-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 dotations aux communes
leximpact-dotations-ui
Commits
ccd44f21
Commit
ccd44f21
authored
1 month ago
by
sandcha
Browse files
Options
Downloads
Patches
Plain Diff
Ordonnance les dotations des strates selon l'ordre de la section loi
parent
1f64d4cd
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!24
Corrige l'affichage sur petit écran, corrige l'ordre d'affichage des impacts et permet la suppression de carte communale
Pipeline
#21527
failed
1 month ago
Stage: install
Stage: check
Stage: deploy
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/lib/api.ts
+1
-1
1 addition, 1 deletion
src/lib/api.ts
src/lib/components/impact/Table.svelte
+143
-119
143 additions, 119 deletions
src/lib/components/impact/Table.svelte
src/lib/dotations.ts
+11
-1
11 additions, 1 deletion
src/lib/dotations.ts
with
155 additions
and
121 deletions
src/lib/api.ts
+
1
−
1
View file @
ccd44f21
...
...
@@ -6,7 +6,7 @@ import type { Dotation, DotationSummaryTotal } from "$lib/dotations"
export
type
ApiCommuneRequest
=
Commune
// identification principale via Commune.codeInseeCommune
export
type
ApiCommuneResponse
=
Commune
&
{
error
?:
string
}
// Commune où tous les champs optionnels devraient être remplis
type
DotationImpact
=
{
export
type
DotationImpact
=
{
dotation
:
Dotation
// nom (acronyme)
proportionEntitesEligibles
:
number
// pourcentage
dotationMoyenneParHabitant
:
number
// euros
...
...
This diff is collapsed.
Click to expand it.
src/lib/components/impact/Table.svelte
+
143
−
119
View file @
ccd44f21
...
...
@@ -8,8 +8,9 @@
getDotationIconName
,
Trend
,
getTrendIconPath
,
getDotations
,
}
from
"
$lib/dotations
"
import
type
{
StrateImpact
}
from
"
$lib/api
"
import
type
{
StrateImpact
,
DotationImpact
}
from
"
$lib/api
"
import
{
amendementExists
,
getAmendementStrates
}
from
"
$lib/state.svelte
"
import
{
IMPACT_INCLUDE_DOTATION_COMMUNES_NOUVELLES_STRATES
}
from
"
$lib/config
"
...
...
@@ -22,7 +23,23 @@
}
=
$props
()
const
EMPTY_STRING_UNICODE
=
"
\
u00A0
\
u00A0
\
u00A0
"
// export const unexpectedValue = "-"
function
orderDotationsImpacts
(
dotationsImpacts
:
DotationImpact
[],
dotationsReferenceOrder
:
Dotation
[],
):
DotationImpact
[]
{
const
ordre
=
dotationsReferenceOrder
.
reduce
(
(
accumulatedResult
,
valeur
,
index
)
=>
({
...
accumulatedResult
,
[
valeur
]:
index
,
}),
{}
as
Record
<
(
typeof
Dotation
)[
keyof
typeof
Dotation
],
number
>
,
)
return
[...
dotationsImpacts
].
sort
(
(
a
,
b
)
=>
ordre
[
a
.
dotation
]
-
ordre
[
b
.
dotation
],
)
}
</script>
<table
...
...
@@ -105,8 +122,14 @@
</td>
<!-- par dotation -->
{
#if
row
.
dotationsImpacts
}
{
@
const
orderedDotationsImpacts
=
orderDotationsImpacts
(
row
.
dotationsImpacts
,
getDotations
(),
)
}
<td
class=
"w-20 text-left"
>
{
#each
row
.
d
otationsImpacts
as
dotationImpact
,
index
}
{
#each
orderedD
otationsImpacts
as
dotationImpact
,
index
}
{
#if
IMPACT_INCLUDE_DOTATION_COMMUNES_NOUVELLES_STRATES
||
dotationImpact
.
dotation
!==
Dotation
.
DCN
}
{
#if
index
>
0
}
<!-- une sous-ligne par dotation -->
...
...
@@ -125,7 +148,7 @@
</td>
<td>
{
#each
row
.
d
otationsImpacts
as
dotationImpact
,
index
}
{
#each
orderedD
otationsImpacts
as
dotationImpact
,
index
}
{
#if
IMPACT_INCLUDE_DOTATION_COMMUNES_NOUVELLES_STRATES
||
dotationImpact
.
dotation
!==
Dotation
.
DCN
}
{
#if
index
>
0
}
<!-- une sous-ligne par dotation -->
...
...
@@ -163,7 +186,7 @@
</td>
<td>
{
#each
row
.
d
otationsImpacts
as
dotationImpact
,
index
}
{
#each
orderedD
otationsImpacts
as
dotationImpact
,
index
}
{
#if
IMPACT_INCLUDE_DOTATION_COMMUNES_NOUVELLES_STRATES
||
dotationImpact
.
dotation
!==
Dotation
.
DCN
}
{
#if
index
>
0
}
<!-- une sous-ligne par dotation -->
...
...
@@ -200,7 +223,7 @@
</td>
<td>
{
#each
row
.
d
otationsImpacts
as
dotationImpact
,
index
}
{
#each
orderedD
otationsImpacts
as
dotationImpact
,
index
}
{
#if
IMPACT_INCLUDE_DOTATION_COMMUNES_NOUVELLES_STRATES
||
dotationImpact
.
dotation
!==
Dotation
.
DCN
}
{
#if
index
>
0
}
<!-- une sous-ligne par dotation -->
...
...
@@ -235,6 +258,7 @@
{
/if
}
{
/each
}
</td>
{
/if
}
</tr>
{
/each
}
</tbody>
...
...
This diff is collapsed.
Click to expand it.
src/lib/dotations.ts
+
11
−
1
View file @
ccd44f21
const
UNDEFINED_DOTATION_ICON
=
"
ri-file-warning-line
"
// https://remixicon.com/icon/file-warning-line
export
enum
Dotation
{
DF
=
"
DF
"
,
DSR
=
"
DSR
"
,
DSU
=
"
DSU
"
,
DF
=
"
DF
"
,
DCN
=
"
DCN
"
}
// Renvoie dans un ordre fixe les valeurs de l'énuméré Dotation (un enum n'étant pas ordonnancé)
export
function
getDotations
():
Array
<
typeof
Dotation
[
keyof
typeof
Dotation
]
>
{
return
[
Dotation
.
DSR
,
Dotation
.
DSU
,
Dotation
.
DF
,
Dotation
.
DCN
]
}
export
enum
Trend
{
Up
,
Down
,
...
...
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