diff --git a/locales/extracted/en.json b/locales/extracted/en.json index 0e52d0ff..25a7de42 100644 --- a/locales/extracted/en.json +++ b/locales/extracted/en.json @@ -157,6 +157,7 @@ "ledgers.account.sheet.edit.title": "Edit {accountName}", "ledgers.account.sheet.tabs.details": "Account Details", "ledgers.accounts.createFirst": "Create first account", + "ledgers.accounts.showing": "Showing {count} {number, plural, =0 {accounts} one {account} other {accounts}}.", "ledgers.accounts.subtitle": "{count} {count, plural, =0 {accounts found} one {account found} other {accounts found}}", "ledgers.accounts.title": "Accounts", "ledgers.assets.createButton": "Create your first Asset", @@ -191,6 +192,7 @@ "ledgers.portfolio.sheet.title": "New Portfolio", "ledgers.portfolio.subtitle": "{count} {count, plural, =0 {portfolios found} one {portfolio found} other {portfolios found}}", "ledgers.portfolio.title": "Portfolios", + "ledgers.portfolios.showing": "Showing {count} {number, plural, =0 {portfolios} one {portifolio} other {portfolios}}.", "ledgers.products.emptyResource": "You haven't created any Products yet", "ledgers.products.sheet.description": "Fill in the details of the Product you want to create.", "ledgers.products.sheet.edit.description": "View and edit product fields.", diff --git a/locales/extracted/pt.json b/locales/extracted/pt.json index a6167d1d..bf5d193b 100644 --- a/locales/extracted/pt.json +++ b/locales/extracted/pt.json @@ -284,5 +284,7 @@ "notFound.backToHome": "Voltar para Home", "ledgers.assets.showing": "Mostrando {count} {number, plural, =0 {ativos} one {ativo} other {ativos}}.", "ledgers.products.showing": "Mostrando {count} {number, plural, =0 {produtos} one {produto} other {produtos}}.", - "ledgers.showing": "Mostrando {count} {number, plural, =0 {ledgers} one {ledger} other {ledgers}}." -} \ No newline at end of file + "ledgers.showing": "Mostrando {count} {number, plural, =0 {ledgers} one {ledger} other {ledgers}}.", + "ledgers.accounts.showing": "Mostrando {count} {number, plural, =0 {contas} one {conta} other {contas}}.", + "ledgers.portfolios.showing": "Mostrando {count} {number, plural, =0 {portfólios} one {portfólio} other {portfólios}}." +} diff --git a/src/app/(routes)/ledgers/[id]/accounts/accounts-tab-content.tsx b/src/app/(routes)/ledgers/[id]/accounts/accounts-tab-content.tsx index 533e6c52..f3ac0054 100644 --- a/src/app/(routes)/ledgers/[id]/accounts/accounts-tab-content.tsx +++ b/src/app/(routes)/ledgers/[id]/accounts/accounts-tab-content.tsx @@ -224,16 +224,33 @@ export const AccountsTabContent = () => { - {accountsList && ( - - )} + + {accountsList && ( + + )} + + + {intl.formatMessage( + { + id: 'ledgers.accounts.showing', + defaultMessage: + 'Showing {count} {number, plural, =0 {accounts} one {account} other {accounts}}.' + }, + { + number: accountsList?.length, + count: {accountsList?.length} + } + )} + + + ) } diff --git a/src/app/(routes)/ledgers/[id]/portfolios/portfolios-tab-content.tsx b/src/app/(routes)/ledgers/[id]/portfolios/portfolios-tab-content.tsx index 985f47ec..38ea91a8 100644 --- a/src/app/(routes)/ledgers/[id]/portfolios/portfolios-tab-content.tsx +++ b/src/app/(routes)/ledgers/[id]/portfolios/portfolios-tab-content.tsx @@ -46,6 +46,7 @@ import { } from '@/components/ui/tooltip' import useCustomToast from '@/hooks/use-custom-toast' import { Arrow } from '@radix-ui/react-tooltip' +import { EntityDataTable } from '@/components/entity-data-table' export const PortfoliosTabContent = () => { const intl = useIntl() @@ -164,172 +165,194 @@ export const PortfoliosTabContent = () => { - {!isNil(portfoliosData?.items) && portfoliosData?.items.length > 0 && ( - - - - - - {intl.formatMessage({ - id: 'common.id', - defaultMessage: 'ID' - })} - - - {intl.formatMessage({ - id: 'common.name', - defaultMessage: 'Name' - })} - - - {intl.formatMessage({ - id: 'common.metadata', - defaultMessage: 'Metadata' - })} - - - {intl.formatMessage({ - id: 'common.accounts', - defaultMessage: 'Accounts' - })} - - - {intl.formatMessage({ - id: 'common.actions', - defaultMessage: 'Actions' - })} - - - - - {table.getRowModel().rows.map((portfolio) => { - const metadataCount = Object.entries( - portfolio.original.metadata || [] - ).length - const displayId = - portfolio.original.id && portfolio.original.id.length > 8 - ? `${truncateString(portfolio.original.id, 8)}` - : portfolio.original.id + + {!isNil(portfoliosData?.items) && portfoliosData?.items.length > 0 && ( + +
+ + + + {intl.formatMessage({ + id: 'common.id', + defaultMessage: 'ID' + })} + + + {intl.formatMessage({ + id: 'common.name', + defaultMessage: 'Name' + })} + + + {intl.formatMessage({ + id: 'common.metadata', + defaultMessage: 'Metadata' + })} + + + {intl.formatMessage({ + id: 'common.accounts', + defaultMessage: 'Accounts' + })} + + + {intl.formatMessage({ + id: 'common.actions', + defaultMessage: 'Actions' + })} + + + + + {table.getRowModel().rows.map((portfolio) => { + const metadataCount = Object.entries( + portfolio.original.metadata || [] + ).length + const displayId = + portfolio.original.id && portfolio.original.id.length > 8 + ? `${truncateString(portfolio.original.id, 8)}` + : portfolio.original.id - return ( - - - - - - handleCopyToClipboard( - portfolio.original.id, - intl.formatMessage({ - id: 'ledgers.toast.copyId', - defaultMessage: - 'The id has been copied to your clipboard.' - }) - ) + return ( + + + + + + handleCopyToClipboard( + portfolio.original.id, + intl.formatMessage({ + id: 'ledgers.toast.copyId', + defaultMessage: + 'The id has been copied to your clipboard.' + }) + ) + } + > +

+ {displayId} +

+
+ +

+ {portfolio.original.id} +

+

+ {intl.formatMessage({ + id: 'ledgers.columnsTable.tooltipCopyText', + defaultMessage: 'Click to copy' + })} +

+ +
+
+
+
+ {portfolio.original.name} + + {metadataCount === 0 ? ( + + ) : ( + intl.formatMessage( + { + id: 'common.table.metadata', + defaultMessage: + '{number, plural, =0 {-} one {# record} other {# records}}' + }, + { + number: metadataCount } - > -

- {displayId} -

-
- -

- {portfolio.original.id} -

-

- {intl.formatMessage({ - id: 'ledgers.columnsTable.tooltipCopyText', - defaultMessage: 'Click to copy' - })} -

- -
-
-
-
- {portfolio.original.name} - - {metadataCount === 0 ? ( - - ) : ( - intl.formatMessage( + ) + )} + + + {intl.formatMessage( { - id: 'common.table.metadata', + id: 'common.table.accounts', defaultMessage: - '{number, plural, =0 {-} one {# record} other {# records}}' + '{number, plural, =0 {No accounts} one {# account} other {# accounts}}' }, { - number: metadataCount + number: portfolio.original.accounts?.length || 0 } - ) - )} - - - {intl.formatMessage( - { - id: 'common.table.accounts', - defaultMessage: - '{number, plural, =0 {No accounts} one {# account} other {# accounts}}' - }, - { - number: portfolio.original.accounts?.length || 0 - } - )} - + )} + - - - - - - - - handleEdit({ - ...portfolio.original, - entityId: portfolio.original.id, - status: { - ...portfolio.original.status, - description: - portfolio.original.status.description ?? '' - } - } as PortfolioResponseDto) - } - > - {intl.formatMessage({ - id: `common.edit`, - defaultMessage: 'Edit' - })} - - - { - handleDialogOpen(portfolio?.original?.id!) - }} - > - {intl.formatMessage({ - id: `common.delete`, - defaultMessage: 'Delete' - })} - - - - -
+ + + + + + + + handleEdit({ + ...portfolio.original, + entityId: portfolio.original.id, + status: { + ...portfolio.original.status, + description: + portfolio.original.status.description ?? + '' + } + } as PortfolioResponseDto) + } + > + {intl.formatMessage({ + id: `common.edit`, + defaultMessage: 'Edit' + })} + + + { + handleDialogOpen(portfolio?.original?.id!) + }} + > + {intl.formatMessage({ + id: `common.delete`, + defaultMessage: 'Delete' + })} + + + + + + ) + })} +
+
+
+ )} + + + {intl.formatMessage( + { + id: 'ledgers.portfolios.showing', + defaultMessage: + 'Showing {count} {number, plural, =0 {portfolios} one {portifolio} other {portfolios}}.' + }, + { + number: portfoliosData?.items?.length, + count: ( + + {portfoliosData?.items?.length} + ) - })} - - - - )} + } + )} + + + ) }