From 8872749142402dbce1c07b84996da19c9e81e94f Mon Sep 17 00:00:00 2001 From: Stefan Moraru Date: Mon, 2 Dec 2024 16:46:00 +0200 Subject: [PATCH 1/3] refactor(statusInvoiceMapping): remove overdue status case --- src/components/customers/CustomerInvoicesList.tsx | 3 +-- src/components/invoices/InvoicesList.tsx | 3 +-- src/core/constants/statusInvoiceMapping.ts | 6 ------ 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/components/customers/CustomerInvoicesList.tsx b/src/components/customers/CustomerInvoicesList.tsx index 3df112dce..932b85a44 100644 --- a/src/components/customers/CustomerInvoicesList.tsx +++ b/src/components/customers/CustomerInvoicesList.tsx @@ -236,7 +236,7 @@ export const CustomerInvoicesList: FC = ({ key: 'paymentStatus', minWidth: 120, title: translate('text_63b5d225b075850e0fe489f4'), - content: ({ status, paymentStatus, paymentOverdue, paymentDisputeLostAt }) => { + content: ({ status, paymentStatus, paymentDisputeLostAt }) => { if (status !== InvoiceStatusTypeEnum.Finalized) { return null } @@ -254,7 +254,6 @@ export const CustomerInvoicesList: FC = ({ {...paymentStatusMapping({ status, paymentStatus, - paymentOverdue, })} endIcon={!!paymentDisputeLostAt ? 'warning-unfilled' : undefined} /> diff --git a/src/components/invoices/InvoicesList.tsx b/src/components/invoices/InvoicesList.tsx index 96c1da2a7..40d8b3652 100644 --- a/src/components/invoices/InvoicesList.tsx +++ b/src/components/invoices/InvoicesList.tsx @@ -305,7 +305,7 @@ const InvoicesList = ({ key: 'paymentStatus', title: translate('text_6419c64eace749372fc72b40'), minWidth: 80, - content: ({ status, paymentStatus, paymentOverdue, paymentDisputeLostAt }) => { + content: ({ status, paymentStatus, paymentDisputeLostAt }) => { if (status !== InvoiceStatusTypeEnum.Finalized) { return null } @@ -323,7 +323,6 @@ const InvoicesList = ({ {...paymentStatusMapping({ status, paymentStatus, - paymentOverdue, })} endIcon={!!paymentDisputeLostAt ? 'warning-unfilled' : undefined} /> diff --git a/src/core/constants/statusInvoiceMapping.ts b/src/core/constants/statusInvoiceMapping.ts index cfcb49432..5a26b2f2f 100644 --- a/src/core/constants/statusInvoiceMapping.ts +++ b/src/core/constants/statusInvoiceMapping.ts @@ -23,16 +23,10 @@ export const invoiceStatusMapping = ({ export const paymentStatusMapping = ({ status, paymentStatus, - paymentOverdue, }: { status: InvoiceStatusTypeEnum paymentStatus: InvoicePaymentStatusTypeEnum - paymentOverdue?: boolean }): StatusProps => { - if (paymentOverdue) { - return { label: 'overdue', type: StatusType.danger } - } - if (status === InvoiceStatusTypeEnum.Finalized) { switch (paymentStatus) { case InvoicePaymentStatusTypeEnum.Pending: From 1d71d9a610f50f68f8a1e42c825549fc2a140931 Mon Sep 17 00:00:00 2001 From: Stefan Moraru Date: Mon, 2 Dec 2024 16:46:23 +0200 Subject: [PATCH 2/3] feat(InvoicesList): add overdue column --- src/components/invoices/InvoicesList.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/invoices/InvoicesList.tsx b/src/components/invoices/InvoicesList.tsx index 40d8b3652..c49a7970f 100644 --- a/src/components/invoices/InvoicesList.tsx +++ b/src/components/invoices/InvoicesList.tsx @@ -3,6 +3,7 @@ import { useEffect, useRef } from 'react' import { generatePath, useNavigate, useSearchParams } from 'react-router-dom' import { + Chip, InfiniteScroll, QuickFilters, Status, @@ -330,6 +331,14 @@ const InvoicesList = ({ ) }, }, + { + key: 'paymentOverdue', + title: translate('text_666c5b12fea4aa1e1b26bf55'), + content: ({ paymentOverdue }) => + paymentOverdue && ( + + ), + }, { key: 'customer.name', title: translate('text_65201c5a175a4b0238abf29a'), From f7f930429e07849629bd28d6132a3e5d6a56c40e Mon Sep 17 00:00:00 2001 From: Stefan Moraru Date: Mon, 2 Dec 2024 16:46:49 +0200 Subject: [PATCH 3/3] feat(CustomerInvoicesList): add overdue column --- src/components/customers/CustomerInvoicesList.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/customers/CustomerInvoicesList.tsx b/src/components/customers/CustomerInvoicesList.tsx index 932b85a44..ac8d03410 100644 --- a/src/components/customers/CustomerInvoicesList.tsx +++ b/src/components/customers/CustomerInvoicesList.tsx @@ -3,7 +3,7 @@ import { FC, useRef } from 'react' import { generatePath, useNavigate } from 'react-router-dom' import styled from 'styled-components' -import { InfiniteScroll, Status, Table, Tooltip, Typography } from '~/components/designSystem' +import { Chip, InfiniteScroll, Status, Table, Tooltip, Typography } from '~/components/designSystem' import { addToast, hasDefinedGQLError } from '~/core/apolloClient' import { invoiceStatusMapping, paymentStatusMapping } from '~/core/constants/statusInvoiceMapping' import { intlFormatNumber } from '~/core/formats/intlFormatNumber' @@ -262,6 +262,16 @@ export const CustomerInvoicesList: FC = ({ }, } : null, + context === 'finalized' + ? { + key: 'paymentOverdue', + title: translate('text_666c5b12fea4aa1e1b26bf55'), + content: ({ paymentOverdue }) => + paymentOverdue && ( + + ), + } + : null, { key: 'issuingDate', minWidth: 104,