Select Git revision
VariableReferredInputs.svelte
-
Permettre de retourner au simulateur affaires sociales depuis la nav bar en cliquant sur le logo "LexImpact affaires sociales"
Permettre de retourner au simulateur affaires sociales depuis la nav bar en cliquant sur le logo "LexImpact affaires sociales"
VariableReferredInputs.svelte 3.47 KiB
<script lang="ts">
import type { Variable } from "@openfisca/ast"
import {
getVariableFormula,
getVariableLatestFormulaDate,
newVariableRepositoryUrl,
} from "@openfisca/ast"
import { session } from "$app/stores"
import VariableReferredInput from "./VariableReferredInput.svelte"
export let date: string
export let inputs: Variable[]
export let variable: Variable
let openDirectInputs = true
$: directVariablesName = new Set(
getVariableFormula(variable, date)?.variables ?? [],
)
$: directInputs = inputs.filter((input) =>
directVariablesName.has(input.name),
)
$: latestFormulaDate = getVariableLatestFormulaDate(variable)
$: metadata = $session.metadata
$: 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 sm:p-1 md:p-2 rounded-md "
>
<p class="font-medium">{variable.label ?? variable.name}</p>
</h1>
{#if directInputs.length > 0}
<section>
<h2
class="bg-gray-100 flex font-medium justify-between p-2 sm:p-1 md:p-2 text-gray-800 text-lg"
>
<span>Paramètres référents directs</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
>