diff --git a/prisma/migrations/20240310194006_add_notes_in_expense/migration.sql b/prisma/migrations/20240310194006_add_notes_in_expense/migration.sql new file mode 100644 index 00000000..2a12ce7e --- /dev/null +++ b/prisma/migrations/20240310194006_add_notes_in_expense/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "Expense" ADD COLUMN "notes" TEXT; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 394342de..f7389472 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -52,6 +52,7 @@ model Expense { splitMode SplitMode @default(EVENLY) createdAt DateTime @default(now()) documents ExpenseDocument[] + notes String? } model ExpenseDocument { diff --git a/src/components/expense-form.tsx b/src/components/expense-form.tsx index 86267916..df5563da 100644 --- a/src/components/expense-form.tsx +++ b/src/components/expense-form.tsx @@ -50,6 +50,7 @@ import { useForm } from 'react-hook-form' import { match } from 'ts-pattern' import { DeletePopup } from './delete-popup' import { extractCategoryFromTitle } from './expense-form-actions' +import { Textarea } from './ui/textarea' export type Props = { group: NonNullable>> @@ -180,6 +181,7 @@ export function ExpenseForm({ saveDefaultSplittingOptions: false, isReimbursement: expense.isReimbursement, documents: expense.documents, + notes: expense.notes ?? '', } : searchParams.get('reimbursement') ? { @@ -202,6 +204,7 @@ export function ExpenseForm({ splitMode: defaultSplittingOptions.splitMode, saveDefaultSplittingOptions: false, documents: [], + notes: '', } : { title: searchParams.get('title') ?? '', @@ -228,6 +231,7 @@ export function ExpenseForm({ }, ] : [], + notes: '', }, }) const [isCategoryLoading, setCategoryLoading] = useState(false) @@ -400,6 +404,18 @@ export function ExpenseForm({ )} /> + ( + + Notes + +