Skip to content
Snippets Groups Projects
Commit d24f805a authored by Emmanuel Raviart's avatar Emmanuel Raviart Committed by Toufic Batache
Browse files

WIP

parent 4d46ffbf
No related branches found
No related tags found
1 merge request!174Ajout des demandes du calcul budget
......@@ -66,14 +66,14 @@ export interface BudgetQuantileByCalculationName {
}
export interface BudgetSimulation {
errors: unknown[]
result: {
errors?: unknown[]
result?: {
amendement: BudgetCalculationResult
base: BudgetCalculationResult
plf: BudgetCalculationResult
revaluation: BudgetCalculationResult
}
hash: string
hash?: string
isPublic: boolean
}
......
......@@ -6,6 +6,8 @@
Transition,
TransitionChild,
} from "@rgossiaux/svelte-headlessui"
import { getContext } from "svelte"
import type { Writable } from "svelte/store"
import { browser } from "$app/environment"
import { goto } from "$app/navigation"
......@@ -17,14 +19,15 @@
} from "$lib/matomo"
import type { ParametricReform } from "$lib/reforms"
import type { CachedSimulation } from "$lib/simulations"
import { budgetEditableParametersName } from "$lib/variables"
export let displayMode: DisplayMode
export let isOpen = false
const budgetSimulation = getContext("budgetSimulation") as Writable<
BudgetSimulation | undefined
>
let cachedSimulations: CachedSimulation[] = []
const parametricReform = getContext(
"parametricReform",
) as Writable<ParametricReform>
$: if (browser && isOpen) {
fetchCachedSimulations()
......@@ -173,7 +176,8 @@
</div>
<div class="flex flex-col gap-10 bg-gray-100 p-5 border-t mt-10">
<div>
{#if $page.data.canDemandBudgetSimulation}
<section>
<h2 class="w-full text-left text-2xl font-bold">
Demandez le calcul de votre réforme au service
LexImpact&nbsp;:
......@@ -190,34 +194,8 @@
<div
class="flex md:flex-row flex-col w-full px-0 md:px-10 items-center gap-5"
>
==== BASE ====
Voir la simulation<iconify-icon
class="align-[-0.25rem] text-xl"
icon="ri-arrow-right-line"
/>
</a>
</div>
{/if}
<div class="flex flex-col gap-10 bg-gray-100 p-5 border-t mt-10">
{#if currentSimulationCache === undefined}
<div>
<h2 class="w-full text-left text-2xl font-bold">
Demandez le calcul de votre réforme au service
LexImpact&nbsp;:
</h2>
<p class="w-full text-base font-normal leading-6 mt-1.5 mb-5">
Après vérification par nos services, si elle est calculable
avec les données dont nous disposons et répond au secret
statistique, la simulation sera rendue publique. Vous serez
alors informé par e-mail :
</p>
<span class="font-bold text-sm py-2 pl-10"
>Votre adresse e-mail :</span
>
<div
class="flex md:flex-row flex-col w-full px-0 md:px-10 items-center gap-5"
==== BASE ====
class="flex rounded-t-md border-b-2 border-b-black bg-white px-2 grow max-w-lg"
>
<input
autocomplete="off"
......@@ -227,40 +205,20 @@
type="search"
/>
</div>
<div>
<a
class="flex items-center gap-2 py-2 px-5 shadow-lg bg-white hover:bg-gray-100 active:bg-gray-200 rounded-md border-2 border-le-bleu text-le-bleu text-sm font-bold tracking-[0.085em] uppercase"
data-sveltekit-reload
href={`/auth/login?redirect=${encodeURIComponent(
$page.url.toString(),
)}`}
title="Envoyer votre réforme budgétaire avec cet e-mail"
>
Demander&nbsp;le&nbsp;calcul <iconify-icon
class="ml-2 align-[-0.25rem] text-xl"
icon="ri-send-plane-2-line"
/>
==== BASE ====
</div>
<div>
<a
<button
class="flex items-center gap-2 py-2 px-5 shadow-lg bg-white hover:bg-gray-100 active:bg-gray-200 rounded-md border-2 border-le-bleu text-le-bleu text-sm font-bold tracking-[0.085em] uppercase"
data-sveltekit-reload
href={`/auth/login?redirect=${encodeURIComponent(
$page.url.toString(),
)}`}
title="Envoyer votre réforme budgétaire avec cet e-mail"
type="submit"
>
Demander&nbsp;le&nbsp;calcul <iconify-icon
class="ml-2 align-[-0.25rem] text-xl"
icon="ri-send-plane-2-line"
/>
</a>
</div>
</div>
==== BASE ====
</div>
</button>
</div>
</section>
{/if}
{#if cachedSimulations !== undefined && cachedSimulations.length > 0}
<div class="flex flex-col items-center">
<h2 class="w-full text-left text-xl font-bold">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment