Skip to content
Snippets Groups Projects
Commit 86ea4f39 authored by Emmanuel Raviart's avatar Emmanuel Raviart
Browse files

Remove non-budget code.

parent 269aa804
No related branches found
No related tags found
No related merge requests found
Pipeline #991 skipped
<script lang="ts">
import type { Variable } from "@openfisca/json-model"
import { getVariableFormula } from "@openfisca/json-model"
import type { Situation } from "$lib/situations"
import VariableInput from "./VariableInput.svelte"
export let date: string
export let inputInstantsByVariableName: {
[name: string]: Set<string>
}
export let inputs: Variable[]
export let situation: Situation
export let variable: Variable
export let year: number
let openDirectInputs = true
$: directVariablesName = new Set(
getVariableFormula(variable, date)?.variables ?? [],
)
$: directInputs = inputs.filter((input) =>
directVariablesName.has(input.name),
)
$: openAllInputs = directInputs.length === 0
</script>
<h2 class="font-bold text-xl pt-3 pb-2">
Définir d'autres caractéristiques <br />
influentes sur :
</h2>
<h1
class="bg-le-gris-dispositif-light font-serif text-center mb-3 p-2 rounded-md text-lg"
>
<p class="font-medium">{variable.label ?? variable.name}</p>
<a
class="mx-1 py-1 underline hover:text-le-bleu bg text-gray-600 text-sm pl-5"
href="/variables/{variable.name}">Source</a
>
</h1>
{#if directInputs.length > 0}
<section class="bg-gray-100 pb-3 mb-3">
<h2
class="text-gray-500 flex font-medium tracking-wide justify-between p-2 text-lg"
>
<span>Caractéristiques écrites dans la formule du dispositif</span>
<button on:click={() => (openDirectInputs = !openDirectInputs)}>
{#if openDirectInputs}
<!-- Material Icons name: Expand Less -->
<svg
aria-hidden="true"
class="block h-6 stroke-current w-6"
fill="black"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
><path d="M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z" /></svg
>
{:else}
<!-- Material Icons name: Expand More -->
<svg
aria-hidden="true"
class="block h-6 stroke-current w-6"
fill="black"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
><path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z" /></svg
>
{/if}
</button>
</h2>
{#if openDirectInputs}
<ul>
{#each directInputs as input}
<li>
<VariableInput
bind:inputInstantsByVariableName
bind:situation
variable={input}
{year}
/>
</li>
{/each}
</ul>
{/if}
</section>
{/if}
{#if inputs.length > 0}
<section class="bg-gray-100 pb-3 mb-3">
<h2
class=" text-gray-500 flex font-medium tracking-wide justify-between p-2 text-lg"
>
<span>Caractéristiques directement influentes</span>
<button on:click={() => (openAllInputs = !openAllInputs)}>
{#if openAllInputs}
<!-- Material Icons name: Expand Less -->
<svg
aria-hidden="true"
class="block h-6 fill-current stroke-current text-gray-500 w-6"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
><path d="M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z" /></svg
>
{:else}
<!-- Material Icons name: Expand More -->
<svg
aria-hidden="true"
class="block h-6 fill-current stroke-current text-gray-500 w-6"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
><path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z" /></svg
>
{/if}
</button>
</h2>
{#if openAllInputs}
<ul>
{#each inputs as input}
<li>
<VariableInput
bind:inputInstantsByVariableName
bind:situation
variable={input}
{year}
/>
</li>
{/each}
</ul>
{/if}
</section>
{/if}
......@@ -13,14 +13,9 @@
buildDecompositionByNameFromCore,
decompositionCoreByName,
} from "$lib/decompositions"
import { entityByKey } from "$lib/entities"
import type { Reform } from "$lib/reforms"
import type { Situation } from "$lib/situations"
import type { VariableValues } from "$lib/variables"
const billName: Writable<string | undefined> = writable("PLF LFI")
setContext("billName", billName)
const decompositionByName = writable(
buildDecompositionByNameFromCore(decompositionCoreByName),
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment