mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-06-09 23:06:01 +00:00
feat: aprimora detalhes de lancamentos
This commit is contained in:
@@ -12,13 +12,17 @@ import {
|
||||
RiHistoryLine,
|
||||
RiMoreFill,
|
||||
RiPencilLine,
|
||||
RiRefund2Line,
|
||||
RiRefundLine,
|
||||
RiTimeLine,
|
||||
} from "@remixicon/react";
|
||||
import type { ColumnDef } from "@tanstack/react-table";
|
||||
import Image from "next/image";
|
||||
import Link from "next/link";
|
||||
import { DEFAULT_LANCAMENTOS_COLUMN_ORDER } from "@/features/transactions/column-order";
|
||||
import {
|
||||
CREDIT_CARD_PAYMENT_METHOD,
|
||||
SETTLEABLE_PAYMENT_METHODS,
|
||||
} from "@/features/transactions/constants";
|
||||
import {
|
||||
CategoryIconBadge,
|
||||
EstablishmentLogo,
|
||||
@@ -195,7 +199,7 @@ function buildColumns({
|
||||
|
||||
const isBoleto = paymentMethod === "Boleto" && dueDate;
|
||||
const dueDateLabel =
|
||||
isBoleto && dueDate ? `venc. ${formatDate(dueDate)}` : null;
|
||||
isBoleto && dueDate ? `Venc. ${formatDate(dueDate)}` : null;
|
||||
const hasNote = Boolean(note?.trim().length);
|
||||
const isLastInstallment =
|
||||
currentInstallment === installmentCount &&
|
||||
@@ -499,20 +503,8 @@ function buildColumns({
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Link
|
||||
href={href}
|
||||
className="inline-flex items-center gap-2 hover:underline"
|
||||
>
|
||||
{logoSrc && (
|
||||
<Image
|
||||
src={logoSrc}
|
||||
alt={`Logo de ${label}`}
|
||||
width={30}
|
||||
height={30}
|
||||
className="rounded-full"
|
||||
/>
|
||||
)}
|
||||
<span className="truncate">{label}</span>
|
||||
<Link href={href} className="hover:underline">
|
||||
{content}
|
||||
</Link>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">
|
||||
@@ -555,27 +547,14 @@ function buildColumns({
|
||||
<div className="flex items-center gap-2">
|
||||
{(() => {
|
||||
const paymentMethod = row.original.paymentMethod;
|
||||
const showSettlementButton = [
|
||||
"Pix",
|
||||
"Boleto",
|
||||
"Cartão de crédito",
|
||||
"Dinheiro",
|
||||
"Cartão de débito",
|
||||
"Transferência bancária",
|
||||
"Pré-Pago | VR/VA",
|
||||
].includes(paymentMethod);
|
||||
const isCreditCard = paymentMethod === CREDIT_CARD_PAYMENT_METHOD;
|
||||
const canToggleSettlement = (
|
||||
SETTLEABLE_PAYMENT_METHODS as readonly string[]
|
||||
).includes(paymentMethod);
|
||||
|
||||
if (!showSettlementButton) return null;
|
||||
if (!canToggleSettlement && !isCreditCard) return null;
|
||||
|
||||
const canToggleSettlement =
|
||||
paymentMethod === "Pix" ||
|
||||
paymentMethod === "Boleto" ||
|
||||
paymentMethod === "Dinheiro" ||
|
||||
paymentMethod === "Cartão de débito" ||
|
||||
paymentMethod === "Transferência bancária" ||
|
||||
paymentMethod === "Pré-Pago | VR/VA";
|
||||
|
||||
if (!canToggleSettlement) {
|
||||
if (isCreditCard) {
|
||||
const invoicePaid = Boolean(row.original.isSettled);
|
||||
return (
|
||||
<Tooltip>
|
||||
@@ -703,7 +682,7 @@ function buildColumns({
|
||||
|
||||
return (
|
||||
<DropdownMenuItem onSelect={() => handleRefund(item)}>
|
||||
<RiRefund2Line className="size-4" />
|
||||
<RiRefundLine className="size-4" />
|
||||
Reembolso
|
||||
</DropdownMenuItem>
|
||||
);
|
||||
@@ -719,7 +698,6 @@ function buildColumns({
|
||||
</DropdownMenuItem>
|
||||
)}
|
||||
|
||||
{/* Opções de Antecipação */}
|
||||
{row.original.userId === currentUserId &&
|
||||
row.original.condition === "Parcelado" &&
|
||||
row.original.seriesId && (
|
||||
|
||||
Reference in New Issue
Block a user