Skip to content
Snippets Groups Projects
Commit 6d12827f authored by sandcha's avatar sandcha
Browse files

Ordonnance les dotations des vas types communaux selon l'ordre de la section loi

parent d84cf09c
Branches
No related tags found
1 merge request!24Corrige l'affichage sur petit écran, corrige l'ordre d'affichage des impacts et permet la suppression de carte communale
Pipeline #21528 failed
......@@ -9,6 +9,7 @@
getTrendIconPath,
type DotationSummaryCommune,
fromEvolutionToTrend,
DOTATIONS_ORDER,
} from "$lib/dotations"
import {
amendementExists,
......@@ -158,19 +159,23 @@
/>
{/if}
</div>
{#each summaryDotations as summaryDotation, indexDotation}
<!-- par dotation -->
{#if IMPACT_INCLUDE_DOTATION_COMMUNES_NOUVELLES_CAS_TYPE || summaryDotation.dotation !== Dotation.DCN}
{#each DOTATIONS_ORDER as dotation}
{@const summaryDotation = summaryDotations.find(
(sd) => sd.dotation === dotation,
)}
{#if summaryDotation && (IMPACT_INCLUDE_DOTATION_COMMUNES_NOUVELLES_CAS_TYPE || summaryDotation.dotation !== Dotation.DCN)}
{@const amendementSummaryDotationsCommune =
getAmendementCommuneDotations()}
{@const amendementDotationCommune = amendementSummaryDotationsCommune
? amendementSummaryDotationsCommune[indexDotation]
? amendementSummaryDotationsCommune.find(
(asd) => asd.dotation === dotation,
)
: summaryDotation}
{@const changeInDotationCommuneEligibilite =
amendementDotationCommune.eligible !== summaryDotation.eligible}
amendementDotationCommune?.eligible !== summaryDotation.eligible}
{@const changeInDotationCommuneMontant =
amendementDotationCommune.montantDotation !==
amendementDotationCommune?.montantDotation !==
summaryDotation.montantDotation}
<div>
......@@ -195,7 +200,7 @@
{#if changeInDotationCommuneEligibilite}
&nbsp;&nbsp;
<span class="bg-le-jaune">
{amendementDotationCommune.eligible
{amendementDotationCommune?.eligible
? "éligible"
: "non éligible"}
</span>
......@@ -214,7 +219,7 @@
{#if changeInDotationCommuneMontant}
&nbsp;&nbsp;
<span class="bg-le-jaune">
{amendementDotationCommune.montantDotation?.toLocaleString(
{amendementDotationCommune?.montantDotation?.toLocaleString(
"fr-FR",
)}&nbsp;&nbsp;&nbsp;/hab.
</span>
......
......@@ -11,7 +11,7 @@
type DotationTotalReform,
type DotationSummaryTotal,
getDotationIconName,
getDotations,
DOTATIONS_ORDER,
} from "$lib/dotations"
let {
......@@ -19,13 +19,12 @@
}: {
totalParDotation: DotationSummaryTotal
} = $props()
const dotationsOrder: Dotation[] = getDotations()
</script>
<div class="flex w-full flex-row divide-x overflow-x-auto text-center">
{#each dotationsOrder as dotation}
{#each DOTATIONS_ORDER as dotation}
{#if dotation in totalParDotation}
<!-- TODO s'assurer de prendre ce que renvoie l'API web même si ce n'est pas dans la liste pré-définie de dotations de l'application ? -->
{@const totalCommunes = totalParDotation[dotation]}
{@const baseEligibles = (totalCommunes as DotationTotalBase).eligibles}
{@const amendementTotal = getAmendementTotal()[dotation]}
......
......@@ -8,7 +8,7 @@
getDotationIconName,
Trend,
getTrendIconPath,
getDotations,
DOTATIONS_ORDER,
} from "$lib/dotations"
import type { StrateImpact, DotationImpact } from "$lib/api"
import { amendementExists, getAmendementStrates } from "$lib/state.svelte"
......@@ -125,7 +125,7 @@
{#if row.dotationsImpacts}
{@const orderedDotationsImpacts = orderDotationsImpacts(
row.dotationsImpacts,
getDotations(),
DOTATIONS_ORDER,
)}
<td class="w-20 text-left">
......
......@@ -8,7 +8,7 @@ export enum Dotation {
}
// 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]> {
function getDotations(): Array<typeof Dotation[keyof typeof Dotation]> {
return [
Dotation.DSR,
Dotation.DSU,
......@@ -17,6 +17,8 @@ export function getDotations(): Array<typeof Dotation[keyof typeof Dotation]> {
]
}
export const DOTATIONS_ORDER = getDotations()
export enum Trend {
Up,
Down,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment