diff --git a/website/src/App.tsx b/website/src/App.tsx index 1dcf224..d3cf3c2 100644 --- a/website/src/App.tsx +++ b/website/src/App.tsx @@ -96,6 +96,8 @@ export default function (props: JSX.HTMLAttributes) { rentang_suhu, }) .eq("id", lastHistori()?.id); + + await getLastHistori(); }; // const noSaveHistori = async () => { diff --git a/website/src/icons/RefreshIcon.tsx b/website/src/icons/RefreshIcon.tsx new file mode 100644 index 0000000..2a8ba3c --- /dev/null +++ b/website/src/icons/RefreshIcon.tsx @@ -0,0 +1,21 @@ +import IconProps from "./type"; + +export default function (props: IconProps) { + return ( + + + + ); +} diff --git a/website/src/icons/TrashIcon.tsx b/website/src/icons/TrashIcon.tsx new file mode 100644 index 0000000..dda590c --- /dev/null +++ b/website/src/icons/TrashIcon.tsx @@ -0,0 +1,21 @@ +import IconProps from "./type"; + +export default function (props: IconProps) { + return ( + + + + ); +} diff --git a/website/src/pages/Histori.tsx b/website/src/pages/Histori.tsx index 587d37f..85e0d95 100644 --- a/website/src/pages/Histori.tsx +++ b/website/src/pages/Histori.tsx @@ -3,9 +3,14 @@ import Table from "../components/Table"; import { Histori } from "../types/Histori"; import supabase from "../utils/supabase"; import { getDates } from "../utils/dates"; +import TrashIcon from "../icons/TrashIcon"; +import { KondisiTapai } from "../types/KondisiTapai"; +import RefreshIcon from "../icons/RefreshIcon"; export default function () { const [items, setItems] = createSignal([]); + const [dataPengujianAwal, setDataPengujianAwal] = + createSignal(); const getData = async () => { const { data } = await supabase @@ -14,9 +19,25 @@ export default function () { .order("created_at", { ascending: false }) .range(0, 10); + const { data: kondisi_tapai } = await supabase + .from("kondisi_tapai") + .select("created_time") + .order("created_time", { ascending: true }) + .limit(1); + + setDataPengujianAwal(kondisi_tapai![0] as KondisiTapai); setItems(data as Histori[]); }; + const deleteHistory = async (id: any) => { + const isOk = confirm("Anda yakin menghapus history?"); + + if (isOk) { + await supabase.from("histori_fermentasi").delete().eq("id", id); + await getData(); + } + }; + onMount(async () => { await getData(); }); @@ -28,8 +49,18 @@ export default function () {

Menampilkan hasil fermentasi yang telah dilakukan.

+
+ {" "} +
: Proses sedang berlangsung
+
[ getDates(item.created_at), Math.round((item.waktu_akhir - item.waktu_awal) / 3600) + " Jam", @@ -42,6 +73,18 @@ export default function () { > {item.berhasil ? "SUKSES" : "GAGAL"} , + !!dataPengujianAwal() && + dataPengujianAwal()!.created_time <= item.waktu_akhir ? ( + + ) : ( + + ), ])} class="my-5" >