diff --git a/src/components/billtracker/CreateBillDrawer.tsx b/src/components/billtracker/CreateBillDrawer.tsx new file mode 100644 index 0000000..6152c90 --- /dev/null +++ b/src/components/billtracker/CreateBillDrawer.tsx @@ -0,0 +1,70 @@ +"use client" +import { + DrawerClose, + DrawerContent, + DrawerFooter, + DrawerHeader, + DrawerTitle, +} from "~/components/ui/drawer" +import { z } from "zod" +import { zodResolver } from "@hookform/resolvers/zod" +import { useForm } from "react-hook-form" +import { Input } from "~/components/ui/input" +import { Button } from "~/components/ui/button" +import { + Form, + FormControl, + FormDescription, + FormField, + FormItem, + FormLabel, + FormMessage, +} from "~/components/ui/form" + +type CreateBillDrawerProps = { + date: Date; +}; + +const formSchema = z.object({ + billType: z.enum(["Rent", "Power", "Internet", "Gas", "Water", "Phone Bill", "Cable", + "Security Deposit", "Other"]), + billDescription: z.string().optional(), + amount: z.number(), + recurrence: z.enum(["Monthly", "Bi-weekly", "Weekly", "Annually"]).optional(), + includeUserInSplit: z.boolean().optional(), + roommates: z.array(z.object({ + userID: z.string(), + includeInSplit: z.boolean(), + })).optional(), +}); + +export default function CreateBillDrawer({date}: CreateBillDrawerProps) { + const form = useForm>({ + resolver: zodResolver(formSchema), + defaultValues: { + billType: "Rent", + recurrence: "Monthly", + includeUserInSplit: true, + }, + }); + return ( + + + + {date.toDateString()} + + +
+
+

Test

+
+
+

Test

+
+
+ + + +
+ ); +} diff --git a/src/components/billtracker/CreateBillForm.tsx b/src/components/billtracker/CreateBillForm.tsx index 3a6f80a..3bf3121 100644 --- a/src/components/billtracker/CreateBillForm.tsx +++ b/src/components/billtracker/CreateBillForm.tsx @@ -1,4 +1,10 @@ import React from "react"; +import { + Drawer, + DrawerTrigger, +} from "~/components/ui/drawer" +import CreateBillDrawer from "~/components/billtracker/CreateBillDrawer" +import { Button } from "~/components/ui/button" type CreateBillFormProps = { date: Date; @@ -21,7 +27,14 @@ export default function CreateBillForm({date, setIsOpen}: CreateBillFormProps) { x -

Create Bill

+ + + + + + ); } diff --git a/src/server/db/schema.ts b/src/server/db/schema.ts index 4ea3db2..cd4b59e 100644 --- a/src/server/db/schema.ts +++ b/src/server/db/schema.ts @@ -237,7 +237,6 @@ export const bills = pgTable( createdAt: timestamp("createdAt").notNull().defaultNow(), dueDate: timestamp("dueDate").notNull(), amount: numeric("amount").notNull(), - currency: text("currency").notNull().default("USD"), recurrence: billRecurrenceEnum("recurrence"), attachmentUrl: text("attachmentUrl"), }