Skip to content
Snippets Groups Projects
Commit 8588dcd5 authored by Toufic Batache's avatar Toufic Batache
Browse files

Ajout de la page "toutes les simulations"

parent bc45f0f1
Branches
Tags
2 merge requests!158Bouton et modale simulation budget et autre évolution UI du budget,!157Ajout partage simulation budgétaire
Pipeline #10292 passed
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
import type { Writable } from "svelte/types/runtime/store" import type { Writable } from "svelte/types/runtime/store"
import { browser } from "$app/environment" import { browser } from "$app/environment"
import { goto } from "$app/navigation"
import { page } from "$app/stores" import { page } from "$app/stores"
import { hashObject } from "$lib/hash" import { hashObject } from "$lib/hash"
import type { ParametricReform } from "$lib/reforms" import type { ParametricReform } from "$lib/reforms"
...@@ -246,17 +247,16 @@ ...@@ -246,17 +247,16 @@
</tr> </tr>
{/each} {/each}
</table> </table>
<a <button
class="mt-2 flex items-center gap-3 py-2 px-5 hover:bg-gray-200 active:bg-gray-300 rounded-md underline text-gray-600 text-sm font-bold tracking-[0.085em] uppercase" class="mt-2 flex items-center gap-3 py-2 px-5 hover:bg-gray-200 active:bg-gray-300 rounded-md underline text-gray-600 text-sm font-bold tracking-[0.085em] uppercase"
data-sveltekit-reload
href="/"
title="Voir toutes les simulations" title="Voir toutes les simulations"
on:click={() => goto("/simulations_budget")}
> >
Voir toutes les simulations<iconify-icon Voir toutes les simulations<iconify-icon
class="align-[-0.25rem] text-xl" class="align-[-0.25rem] text-xl"
icon="ri-arrow-right-line" icon="ri-arrow-right-line"
/> />
</a> </button>
</div> </div>
{/if} {/if}
</div> </div>
......
<script lang="ts">
import { onMount } from "svelte"
import { goto } from "$app/navigation"
import type { CachedSimulation } from "$lib/simulations"
let cachedSimulations: CachedSimulation[] = []
onMount(async () => {
const res = await fetch("/simulations_budget/index", {
method: "POST",
})
if (!res.ok) {
console.error(`Error fetching cached simulations`)
return
}
const { index } = await res.json()
cachedSimulations = index
})
</script>
<main class="bg-graph-paper h-full flex items-center justify-center">
<div class="w-full h-full max-w-screen-md bg-white p-10">
<button
class="inline-flex items-center gap-2 py-2 px-5 bg-white hover:bg-gray-100 active:bg-gray-200 rounded-md border border-gray-700 text-gray-700 text-sm font-bold tracking-[0.085em] uppercase"
title="Retour au simulateur"
on:click={() => goto("/")}
>
<iconify-icon
class="align-[-0.25rem] text-xl"
icon="ri-arrow-left-line"
/>
<span class="ml-2">Retour au simulateur</span>
</button>
<h2 class="mt-10 w-full text-left text-xl font-bold">
Simulations budgétaires déjà disponibles&nbsp;:
</h2>
<table class="w-full text-sm mt-5">
{#each cachedSimulations as cachedSimulation}
<tr class="even:bg-white even:bg-opacity-30 odd:bg-gray-200">
<td class="pl-3 pr-10 py-2 text-start">{cachedSimulation.date}</td>
<td class="py-2 text-start font-bold font-serif"
>{cachedSimulation.title}</td
>
<td class="pl-10 pr-3 py-2 text-end"
><a
href="/simulations_budget/{cachedSimulation.hash}"
class="underline text-gray-600">Voir&nbsp;cette&nbsp;simulation</a
></td
>
</tr>
{/each}
</table>
</div>
</main>
...@@ -99,13 +99,13 @@ ...@@ -99,13 +99,13 @@
<main class="bg-polka-dots flex items-center justify-center"> <main class="bg-polka-dots flex items-center justify-center">
<div class="max-w-screen-md bg-white"> <div class="max-w-screen-md bg-white">
<button <a
class="ml-10 mt-5 inline-flex cursor-pointer items-center rounded bg-gray-200 p-2 pr-3 text-sm text-black shadow-md hover:bg-gray-300 active:bg-gray-400" class="ml-10 mt-5 inline-flex cursor-pointer items-center rounded bg-gray-200 p-2 pr-3 text-sm text-black shadow-md hover:bg-gray-300 active:bg-gray-400"
on:click={() => history.back()} href="/"
> >
<iconify-icon class="text-2xl" icon="ri-arrow-left-line" /> <iconify-icon class="text-2xl" icon="ri-arrow-left-line" />
<span class="ml-3">Retour au simulateur</span> <span class="ml-3">Retour au simulateur</span>
</button> </a>
<VariableView <VariableView
date={$date} date={$date}
editable editable
......
...@@ -28,10 +28,13 @@ const config = { ...@@ -28,10 +28,13 @@ const config = {
}, },
backgroundImage: { backgroundImage: {
/* Graph paper - Heropatterns.com échelle réduite */ /* Graph paper - Heropatterns.com échelle réduite */
"graph-paper": "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='50' height='50' viewBox='0 0 100 100'%3E%3Crect width='100%' height='100%' fill='%23fff'/%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23ded500' fill-opacity='0.4'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9zm-1 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 5V0H5v5H0v1h5v94h1V6h94V5H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E\")", "graph-paper":
"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='50' height='50' viewBox='0 0 100 100'%3E%3Crect width='100%' height='100%' fill='%23fff'/%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23ded500' fill-opacity='0.4'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h4v1h-4v9h4v1h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 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 5V0H5v5H0v1h5v94h1V6h94V5H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E\")",
/* Polka dots - Heropatterns.com échelle réduite */ /* Polka dots - Heropatterns.com échelle réduite */
"polka-dots": "url(\"data:image/svg+xml,%3Csvg width='8' height='8' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%' height='100%' fill='%23fff'/%3E%3Cg fill='%23ded500' fill-opacity='0.4' fill-rule='evenodd'%3E%3Ccircle cx='3' cy='3' r='3'/%3E%3Ccircle cx='13' cy='13' r='3'/%3E%3C/g%3E%3C/svg%3E\")", "polka-dots":
"diagonal-stripes": "url(\"data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 6 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='1' fill-rule='evenodd'%3E%3Cpath d='M5 0h1L0 6V5zM6 5v1H5z'/%3E%3C/g%3E%3C/svg%3E\")" "url(\"data:image/svg+xml,%3Csvg width='8' height='8' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%' height='100%' fill='%23fff'/%3E%3Cg fill='%23ded500' fill-opacity='0.4' fill-rule='evenodd'%3E%3Ccircle cx='3' cy='3' r='3'/%3E%3Ccircle cx='13' cy='13' r='3'/%3E%3C/g%3E%3C/svg%3E\")",
"diagonal-stripes":
"url(\"data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 6 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='1' fill-rule='evenodd'%3E%3Cpath d='M5 0h1L0 6V5zM6 5v1H5z'/%3E%3C/g%3E%3C/svg%3E\")",
}, },
blur: { blur: {
xs: "1.2px", xs: "1.2px",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment