From 097b9a5f5176614a1b55dba219a7e25c2bd6795e Mon Sep 17 00:00:00 2001 From: BaniHillabi Date: Mon, 9 Sep 2024 21:48:59 +0700 Subject: [PATCH] feat (frontend) : add type tim update for admin --- src/actions/Tim.ts | 3 ++ .../admin/tim/[id]/components/Form.tsx | 36 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/actions/Tim.ts b/src/actions/Tim.ts index a6c4800..df1acb4 100644 --- a/src/actions/Tim.ts +++ b/src/actions/Tim.ts @@ -2,15 +2,18 @@ import { revalidatePath } from "next/cache"; import { deleteTim, updateTim } from "@/queries/tim.query"; +import { Tipe } from "@prisma/client"; export async function updateTimForm(data: FormData, id: string) { const asal_sekolah = data.get("asal_sekolah") as string; + const tipe_tim = data.get("tipe_tim") as Tipe; try { await updateTim( { id }, { asal_sekolah: asal_sekolah, + tipe_tim: tipe_tim } ); revalidatePath("/", "layout"); diff --git a/src/app/(admin)/admin/tim/[id]/components/Form.tsx b/src/app/(admin)/admin/tim/[id]/components/Form.tsx index 98aaa06..92f46b3 100644 --- a/src/app/(admin)/admin/tim/[id]/components/Form.tsx +++ b/src/app/(admin)/admin/tim/[id]/components/Form.tsx @@ -27,6 +27,11 @@ export default function TimForm({ { label: "SMA", value: "SMA" }, ]; + const options_type = [ + { label: "12 Anggota", value: "SMALL" }, + { label: "15 Anggota", value: "NORMAL" }, + ]; + async function Update(data: FormData) { const toastId = toast.loading("Loading..."); const result = await updateTimForm(data, id!); @@ -111,6 +116,37 @@ export default function TimForm({ /> +
+ +