mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-05-09 11:01:45 +00:00
chore: ajustes de componentes, estilos, dependências e métricas do dashboard
- dashboard: melhorias em métricas, filtros de transações e overview de período - transactions: colunas, tabela e página com novos campos e ajustes de exibição - ui: card, table, navigation-menu, navbar, month-picker, logo-picker, theme-toggler - calculator: ajustes de display, keypad e estado - calendar: melhorias de grid e day-cell - insights: atualização de constantes - settings: pequenos ajustes - pnpm-lock: atualização de dependências - pdf.worker: atualização do worker Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -21,9 +21,11 @@ import { excludeTransactionsFromExcludedAccounts } from "@/features/dashboard/tr
|
||||
import {
|
||||
ACCOUNT_AUTO_INVOICE_NOTE_PREFIX,
|
||||
INITIAL_BALANCE_NOTE,
|
||||
isRefundNote,
|
||||
} from "@/shared/lib/accounts/constants";
|
||||
import { db } from "@/shared/lib/db";
|
||||
import { getAdminPayerId } from "@/shared/lib/payers/get-admin-id";
|
||||
import { TRANSFER_CATEGORY_NAME } from "@/shared/lib/transfers/constants";
|
||||
import {
|
||||
compareDateOnly,
|
||||
getBusinessDateString,
|
||||
@@ -58,6 +60,7 @@ type CurrentPeriodTransactionRow = {
|
||||
categoryId: string | null;
|
||||
categoryName: string | null;
|
||||
categoryType: string | null;
|
||||
accountId: string | null;
|
||||
cardLogo: string | null;
|
||||
accountLogo: string | null;
|
||||
accountExcludeInitialBalanceFromIncome: boolean | null;
|
||||
@@ -119,6 +122,9 @@ const shouldIncludeWithoutAutoInvoice = (note: string | null | undefined) =>
|
||||
const shouldIncludeWithoutAutoGenerated = (note: string | null | undefined) =>
|
||||
!isInitialBalanceNote(note) && !isAutoInvoiceNote(note);
|
||||
|
||||
const shouldIncludeWithoutRefund = (note: string | null | undefined) =>
|
||||
!isRefundNote(note);
|
||||
|
||||
const shouldIncludeInPaymentStatus = (row: CurrentPeriodTransactionRow) => {
|
||||
if (!shouldIncludeWithoutAutoInvoice(row.note)) {
|
||||
return false;
|
||||
@@ -183,6 +189,7 @@ const buildBillsSnapshot = (
|
||||
? row.boletoPaymentDate.toISOString().slice(0, 10)
|
||||
: null,
|
||||
isSettled: Boolean(row.isSettled),
|
||||
accountId: row.accountId ?? null,
|
||||
}))
|
||||
.sort((a, b) => {
|
||||
if (a.isSettled !== b.isSettled) {
|
||||
@@ -259,6 +266,14 @@ const buildPaymentStatusData = (
|
||||
}
|
||||
|
||||
const amount = toNumber(row.amount);
|
||||
const isRefund = isRefundNote(row.note);
|
||||
|
||||
if (isRefund) {
|
||||
const targetKey = row.isSettled === true ? "confirmed" : "pending";
|
||||
result.expenses[targetKey] -= Math.abs(amount);
|
||||
continue;
|
||||
}
|
||||
|
||||
const target =
|
||||
row.transactionType === TRANSACTION_TYPE_INCOME
|
||||
? result.income
|
||||
@@ -271,6 +286,8 @@ const buildPaymentStatusData = (
|
||||
}
|
||||
}
|
||||
|
||||
result.expenses.confirmed = Math.max(0, result.expenses.confirmed);
|
||||
result.expenses.pending = Math.max(0, result.expenses.pending);
|
||||
result.income.total = result.income.confirmed + result.income.pending;
|
||||
result.expenses.total = result.expenses.confirmed + result.expenses.pending;
|
||||
|
||||
@@ -495,7 +512,9 @@ const buildPurchasesByCategoryData = (
|
||||
!row.categoryName ||
|
||||
!row.categoryType ||
|
||||
!["despesa", "receita"].includes(row.categoryType) ||
|
||||
row.categoryName === TRANSFER_CATEGORY_NAME ||
|
||||
!shouldIncludeWithoutAutoGenerated(row.note) ||
|
||||
!shouldIncludeWithoutRefund(row.note) ||
|
||||
!shouldIncludeNamedItem(row.name)
|
||||
) {
|
||||
continue;
|
||||
@@ -564,6 +583,7 @@ export async function fetchDashboardCurrentPeriodOverview(
|
||||
categoryId: transactions.categoryId,
|
||||
categoryName: categories.name,
|
||||
categoryType: categories.type,
|
||||
accountId: transactions.accountId,
|
||||
cardLogo: cards.logo,
|
||||
accountLogo: financialAccounts.logo,
|
||||
accountExcludeInitialBalanceFromIncome:
|
||||
|
||||
Reference in New Issue
Block a user