From 8aed11bef7f34e878fef016fc319015fc2c296d0 Mon Sep 17 00:00:00 2001 From: prokawsar Date: Sun, 14 Jul 2024 21:09:18 +0600 Subject: [PATCH] Delete history --- src/lib/elements/Input.svelte | 2 +- src/routes/history/+page.svelte | 16 +++++++++++++++- src/routes/history/[id]/+page.svelte | 20 +++++++++++--------- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/lib/elements/Input.svelte b/src/lib/elements/Input.svelte index 6cdd1d3..d401cfb 100644 --- a/src/lib/elements/Input.svelte +++ b/src/lib/elements/Input.svelte @@ -26,6 +26,6 @@ diff --git a/src/routes/history/+page.svelte b/src/routes/history/+page.svelte index 1065579..1107e9c 100644 --- a/src/routes/history/+page.svelte +++ b/src/routes/history/+page.svelte @@ -1,10 +1,18 @@ @@ -24,7 +32,7 @@ {#if data.histories.length} {#each data.histories.reverse() as { name, id, final_price, papers, created_at }, i} {/each} diff --git a/src/routes/history/[id]/+page.svelte b/src/routes/history/[id]/+page.svelte index 200c43b..17acb58 100644 --- a/src/routes/history/[id]/+page.svelte +++ b/src/routes/history/[id]/+page.svelte @@ -4,7 +4,7 @@ import Result from '$lib/elements/Result.svelte' import { paperHistoryStore } from '$lib/stores' import dayjs from 'dayjs' - import type { CostHistoryType } from '$lib/utils/services' + import { calculateCost, type CostHistoryType } from '$lib/utils/services' const data: CostHistoryType[] = $paperHistoryStore.filter( (history) => history.id == $page.params.id @@ -29,18 +29,20 @@
{#if data.length} {#each data as history, i} - {#each history.papers as { length, width, thickness, rate }, i} -
-
+ {#each history.papers as { length, width, thickness, rate, id }, i} +
+
- +
+

+ = {calculateCost({ length, width, thickness, rate, id }).toFixed(2)} +

+
{/each}