Skip to content
Snippets Groups Projects
Commit 62d4dd88 authored by OpenFisca JSON Model CI's avatar OpenFisca JSON Model CI Committed by Emmanuel Raviart
Browse files

Add compact=true flag in queries of URL to hide waterfall.

parent 26fc9796
No related branches found
No related tags found
1 merge request!79Resolve "Créer squelette vue simplifiée cas type"
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
import type { DisplayMode } from "$lib/displays" import type { DisplayMode } from "$lib/displays"
import type { ParametricReform } from "$lib/reforms" import type { ParametricReform } from "$lib/reforms"
import type { Situation } from "$lib/situations" import type { Situation } from "$lib/situations"
import { newSimulationUrl } from "$lib/urls"
import { variableSummaryByName } from "$lib/variables" import { variableSummaryByName } from "$lib/variables"
export let decompositionByName: DecompositionByName export let decompositionByName: DecompositionByName
...@@ -91,8 +92,11 @@ ...@@ -91,8 +92,11 @@
<div id="situation_{situationIndex}_waterfall"> <div id="situation_{situationIndex}_waterfall">
{#if variableSummaryByName !== undefined} {#if variableSummaryByName !== undefined}
<div class="flex justify-between"> <div class="flex justify-between">
{#if !displayMode.compact}
<!--Onglets--> <!--Onglets-->
<div class="flex flex-col w-2/12 md:w-1/12 bg-gray-100 justify-between"> <div
class="flex flex-col w-2/12 md:w-1/12 bg-gray-100 justify-between"
>
{#each waterfalls as { icon, label, name }} {#each waterfalls as { icon, label, name }}
<button <button
class="flex items-center grow shadow-inner justify-around" class="flex items-center grow shadow-inner justify-around"
...@@ -123,6 +127,7 @@ ...@@ -123,6 +127,7 @@
</button> </button>
{/each} {/each}
</div> </div>
{/if}
<!--Impacts et waterfall--> <!--Impacts et waterfall-->
<div <div
class="{displayMode.parametersVariableName === class="{displayMode.parametersVariableName ===
...@@ -130,7 +135,9 @@ ...@@ -130,7 +135,9 @@
displayMode.parametersVariableName === 'csg_imposable_salaire' || displayMode.parametersVariableName === 'csg_imposable_salaire' ||
displayMode.parametersVariableName === 'irpp_economique' displayMode.parametersVariableName === 'irpp_economique'
? 'md:h-[calc(100vh-20rem)] 2xl:h-[calc(100vh-17rem)]' ? 'md:h-[calc(100vh-20rem)] 2xl:h-[calc(100vh-17rem)]'
: 'md:h-[calc(100vh-21rem)] 2xl:h-[calc(100vh-18rem)]'} w-10/12 md:w-11/12 px-1 md:px-3 overflow-y-auto " : 'md:h-[calc(100vh-21rem)] 2xl:h-[calc(100vh-18rem)]'} {displayMode.compact
? 'w-full'
: 'w-10/12 md:w-11/12'} px-1 md:px-3 overflow-y-auto "
> >
<div class="p-3 border-gray-400 flex-col relative pb-5"> <div class="p-3 border-gray-400 flex-col relative pb-5">
{#if Object.values($calculationByName).filter((calculation) => calculation.running && (calculation.situationIndex === undefined || calculation.situationIndex === situationIndex)).length > 0} {#if Object.values($calculationByName).filter((calculation) => calculation.running && (calculation.situationIndex === undefined || calculation.situationIndex === situationIndex)).length > 0}
...@@ -240,6 +247,17 @@ ...@@ -240,6 +247,17 @@
{/if} {/if}
</div> </div>
{#if displayMode.compact}
<a
class="block cursor-pointer text-base hover:underline"
href={newSimulationUrl({
...displayMode,
compact: undefined,
})}
sveltekit:noscroll
>Afficher toutes les cotisations et prestations</a
>
{:else}
<WaterfallView <WaterfallView
{decompositionByName} {decompositionByName}
{displayMode} {displayMode}
...@@ -250,6 +268,15 @@ ...@@ -250,6 +268,15 @@
{variableSummaryByName} {variableSummaryByName}
{year} {year}
/> />
<a
class="block cursor-pointer text-base hover:underline"
href={newSimulationUrl({
...displayMode,
compact: true,
})}
sveltekit:noscroll>Masquer les cotisations et prestations</a
>
{/if}
</div> </div>
</div> </div>
{/if} {/if}
......
export interface DisplayMode { export interface DisplayMode {
action?: string // TODO: Remove attribute "action".
mobileLaw?: boolean // For mobile, when not in edit mode: When true, show law, otherwise show impacts. mobileLaw?: boolean // For mobile, when not in edit mode: When true, show law, otherwise show impacts.
parameterName?: string parameterName?: string
parametersVariableName?: string parametersVariableName?: string
......
...@@ -15,12 +15,15 @@ export function newSelfTargetAProps(url: string): SelfTargetAProps { ...@@ -15,12 +15,15 @@ export function newSelfTargetAProps(url: string): SelfTargetAProps {
export function newSimulationUrl(displayMode: DisplayMode): string { export function newSimulationUrl(displayMode: DisplayMode): string {
const query: URLSearchParams = new URLSearchParams() const query: URLSearchParams = new URLSearchParams()
if (displayMode.mobileLaw) { if (displayMode.compact) {
query.append("law", "true") query.append("compact", "true")
} }
if (displayMode.edit !== undefined) { if (displayMode.edit !== undefined) {
query.append("edit", displayMode.edit.toString()) query.append("edit", displayMode.edit.toString())
} }
if (displayMode.mobileLaw) {
query.append("law", "true")
}
if ( if (
displayMode.testCasesIndex.length !== 1 || displayMode.testCasesIndex.length !== 1 ||
displayMode.testCasesIndex[0] !== 0 displayMode.testCasesIndex[0] !== 0
......
...@@ -221,6 +221,14 @@ ...@@ -221,6 +221,14 @@
const errors: { [key: string]: unknown } = {} const errors: { [key: string]: unknown } = {}
const remainingKeys = new Set(Object.keys(data)) const remainingKeys = new Set(Object.keys(data))
audit.attribute(
data,
"compact",
true,
errors,
remainingKeys,
auditQuerySingleton(auditTrimString, auditStringToBoolean),
)
audit.attribute( audit.attribute(
data, data,
"edit", "edit",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment