feat(expenses): implement responsive dialog for expense management and create expense provider

- Added ResponsiveDialog component for handling responsive dialogs in the UI.
- Created ExpensesProvider to manage state and API interactions for expenses.
- Developed ExpensesTabContent to display expenses with filtering options and dialogs for new and pay expense actions.
- Implemented ExpensesTable for rendering expense data in a tabular format with actions.
- Added dialogs for creating new expenses and paying existing ones with form validation.
- Introduced PeriodicExpenseForm for managing periodic expenses with month selection.
- Created PeriodicExpensesTabContent to manage and display periodic expenses with create/edit functionality.
- Added GenerateCurrentMonthDialog for confirming monthly expense generation.
- Implemented PeriodicExpensesTable for displaying periodic expenses with edit and delete actions.
This commit is contained in:
Jose Selesan
2026-05-29 10:29:20 -03:00
parent bd5e29236b
commit e1786f7384
39 changed files with 4338 additions and 6435 deletions

View File

@@ -0,0 +1,34 @@
-- CreateEnum
CREATE TYPE "PaymentStatus" AS ENUM ('PENDING', 'PAYED');
-- CreateTable
CREATE TABLE "periodic_expenses" (
"id" SERIAL NOT NULL,
"description" VARCHAR(50) NOT NULL,
"defaultDueDay" INTEGER NOT NULL,
"defaultAmount" MONEY NOT NULL,
"periods" INTEGER[],
"isDeleted" BOOLEAN NOT NULL DEFAULT false,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "periodic_expenses_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "expenses" (
"id" SERIAL NOT NULL,
"description" VARCHAR(50) NOT NULL,
"periodicExpenseId" INTEGER,
"year" INTEGER NOT NULL,
"month" INTEGER NOT NULL,
"amount" MONEY NOT NULL,
"amountPayed" MONEY,
"status" "PaymentStatus" NOT NULL DEFAULT 'PENDING',
"dueDate" TIMESTAMP(3) NOT NULL,
"paymentDate" TIMESTAMP(3),
CONSTRAINT "expenses_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "expenses" ADD CONSTRAINT "expenses_periodicExpenseId_fkey" FOREIGN KEY ("periodicExpenseId") REFERENCES "periodic_expenses"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View File

@@ -41,4 +41,41 @@ model QuoteHistory {
type QuoteType
@@map("quotes_history")
}
// Expenses
enum PaymentStatus {
PENDING
PAYED
}
model PeriodicExpense {
id Int @id @default(autoincrement())
description String @db.VarChar(50)
defaultDueDay Int
defaultAmount Decimal @db.Money
periods Int[]
isDeleted Boolean @default(false)
createdAt DateTime @default(now())
expenses Expense[]
@@map("periodic_expenses")
}
model Expense {
id Int @id @default(autoincrement())
description String @db.VarChar(50)
periodicExpense PeriodicExpense? @relation(fields: [periodicExpenseId], references: [id])
periodicExpenseId Int?
year Int
month Int
amount Decimal @db.Money
amountPayed Decimal? @db.Money
status PaymentStatus @default(PENDING)
dueDate DateTime
paymentDate DateTime?
@@map("expenses")
}