Skip to content

Commit

Permalink
Merge pull request #69 from LerianStudio/feature/entity-data-table
Browse files Browse the repository at this point in the history
♻️ Created EntityDataTable
  • Loading branch information
caioaletroca authored Dec 4, 2024
2 parents afe3a3a + a053c26 commit 62486c2
Show file tree
Hide file tree
Showing 16 changed files with 678 additions and 635 deletions.
8 changes: 6 additions & 2 deletions locales/extracted/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@
"common.logoAlt": "Your organization logo",
"common.metadata": "Metadata",
"common.name": "Name",
"common.nextPage": "Next page",
"common.noOptions": "No options found.",
"common.portfolio": "Portfolio",
"common.previousPage": "Previous page",
"common.records": "records",
"common.remove": "Remove",
"common.requiredFields": "(*) required fields.",
Expand Down Expand Up @@ -159,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",
Expand All @@ -170,6 +169,7 @@
"ledgers.assets.sheet.edit.title": "Edit {assetName}",
"ledgers.assets.sheet.tabs.details": "Assets Details",
"ledgers.assets.sheet.title": "New Asset",
"ledgers.assets.showing": "Showing {count} {number, plural, =0 {assets} one {asset} other {assets}}.",
"ledgers.assets.subtitle": "Currency or assets of any nature traded on this Ledger.",
"ledgers.assets.title": "Assets",
"ledgers.columnsTable.tooltipCopyText": "Click to copy",
Expand All @@ -192,17 +192,20 @@
"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.",
"ledgers.products.sheet.edit.title": "Edit {productName}",
"ledgers.products.sheet.tabs.details": "Product Details",
"ledgers.products.sheet.title": "New Product",
"ledgers.products.showing": "Showing {count} {number, plural, =0 {products} one {product} other {products}}.",
"ledgers.products.subtitle": "Clustering or allocation of customers at different levels.",
"ledgers.products.title": "Products",
"ledgers.sheet.tabs.details": "Ledger Details",
"ledgers.sheetCreate.description": "Fill in the data of the Ledger you wish to create.",
"ledgers.sheetCreate.title": "New Ledger",
"ledgers.showing": "Showing {count} {number, plural, =0 {ledgers} one {ledger} other {ledgers}}.",
"ledgers.subtitle": "Visualize and edit the Ledgers of your Organization.",
"ledgers.tab.accounts": "Accounts",
"ledgers.tab.assets": "Assets",
Expand Down Expand Up @@ -244,6 +247,7 @@
"organizations.organizationView.breadcrumbs.settings": "Settings",
"organizations.organizationView.newOrganization.title": "New Organization",
"organizations.organizationView.notFound": "Organization not found.",
"organizations.showing": "Showing {count} {number, plural, =0 {organizations} one {organization} other {organizations}}.",
"organizations.subtitle": "View and manage Organizations.",
"organizations.title": "Settings",
"organizations.toast.create.success": "Organization created!",
Expand Down
12 changes: 8 additions & 4 deletions locales/extracted/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
"common.copyMessage": "Copiado para a área de transferência!",
"common.expand": "Ampliar",
"common.inactive": "Inativo",
"common.nextPage": "Próxima Página",
"common.previousPage": "Página Anterior",
"common.tooltipCopyText": "Toque para copiar",
"entity.metadata.key": "Chave",
"entity.metadata.value": "Valor",
Expand Down Expand Up @@ -278,10 +276,16 @@
"ledgers.assets.sheet.tabs.details": "Detalhes do Ativo",
"ledgers.portfolio.sheet.tabs.details": "Detalhes do Portfólio",
"ledgers.products.sheet.tabs.details": "Detalhes do Produto",
"notFound.backToHome": "Voltar para Home",
"ledgers.sheet.tabs.details": "Detalhes do Ledger",
"common.records": "registros",
"ledgers.tab.accounts": "Contas",
"ledgers.tab.portfolios": "Portfólios",
"settings.tab.portfolios": "Portfólios"
"settings.tab.portfolios": "Portfólios",
"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}}.",
"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}}.",
"organizations.showing": "Mostrando {count} {number, plural, =0 {organizações} one {organização} other {organizações}}."
}
38 changes: 28 additions & 10 deletions src/app/(routes)/ledgers/[id]/accounts/accounts-tab-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import useCustomToast from '@/hooks/use-custom-toast'
import { AccountType } from '@/types/accounts-type'
import { AccountSheet } from './accounts-sheet'
import { AccountsDataTable } from './accounts-data-table'
import { EntityDataTable } from '@/components/entity-data-table'

export const AccountsTabContent = () => {
const intl = useIntl()
Expand Down Expand Up @@ -223,16 +224,33 @@ export const AccountsTabContent = () => {
</EntityBox.Actions>
</EntityBox.Root>

{accountsList && (
<AccountsDataTable
accounts={{ items: accountsList }}
isLoading={isAccountsLoading}
table={table}
handleEdit={handleEdit}
onDelete={handleDialogOpen}
refetch={refetchAccounts}
/>
)}
<EntityDataTable.Root>
{accountsList && (
<AccountsDataTable
accounts={{ items: accountsList }}
isLoading={isAccountsLoading}
table={table}
handleEdit={handleEdit}
onDelete={handleDialogOpen}
refetch={refetchAccounts}
/>
)}
<EntityDataTable.Footer>
<EntityDataTable.FooterText>
{intl.formatMessage(
{
id: 'ledgers.accounts.showing',
defaultMessage:
'Showing {count} {number, plural, =0 {accounts} one {account} other {accounts}}.'
},
{
number: accountsList?.length,
count: <span className="font-bold">{accountsList?.length}</span>
}
)}
</EntityDataTable.FooterText>
</EntityDataTable.Footer>
</EntityDataTable.Root>
</React.Fragment>
)
}
43 changes: 32 additions & 11 deletions src/app/(routes)/ledgers/[id]/assets/assets-tab-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { useParams } from 'next/navigation'
import { useConfirmDialog } from '@/components/confirmation-dialog/use-confirm-dialog'
import ConfirmationDialog from '@/components/confirmation-dialog'
import useCustomToast from '@/hooks/use-custom-toast'
import { EntityDataTable } from '@/components/entity-data-table'

type AssetsTabContentProps = {
data: ILedgerType
Expand Down Expand Up @@ -142,18 +143,38 @@ export const AssetsTabContent = ({ data }: AssetsTabContentProps) => {

<AssetsSheet ledgerId={ledgerId} onSuccess={refetch} {...sheetProps} />

{isLoading && <AssetsSkeleton />}
<EntityDataTable.Root>
{isLoading && <AssetsSkeleton />}

{assets && (
<AssetsDataTable
assets={assets}
isLoading={isLoading}
table={table}
handleDialogOpen={handleDialogOpen}
handleEdit={handleEdit}
refetch={refetch}
/>
)}
{assets && (
<AssetsDataTable
assets={assets}
isLoading={isLoading}
table={table}
handleDialogOpen={handleDialogOpen}
handleEdit={handleEdit}
refetch={refetch}
/>
)}

<EntityDataTable.Footer>
<EntityDataTable.FooterText>
{intl.formatMessage(
{
id: 'ledgers.assets.showing',
defaultMessage:
'Showing {count} {number, plural, =0 {assets} one {asset} other {assets}}.'
},
{
number: assets?.items?.length,
count: (
<span className="font-bold">{assets?.items?.length}</span>
)
}
)}
</EntityDataTable.FooterText>
</EntityDataTable.Footer>
</EntityDataTable.Root>

<ConfirmationDialog
title={intl.formatMessage({
Expand Down
Loading

0 comments on commit 62486c2

Please sign in to comment.