diff --git a/packages/server/src/lib/Transformer/Transformer.ts b/packages/server/src/lib/Transformer/Transformer.ts index 20efb4415..23613f748 100644 --- a/packages/server/src/lib/Transformer/Transformer.ts +++ b/packages/server/src/lib/Transformer/Transformer.ts @@ -164,6 +164,10 @@ export class Transformer { return date ? moment(date).format(this.dateFormat) : ''; } + protected formatDateFromNow(date){ + return date ? moment(date).fromNow(true) : ''; + } + /** * * @param number diff --git a/packages/server/src/services/Cashflow/CashflowAccountTransformer.ts b/packages/server/src/services/Cashflow/CashflowAccountTransformer.ts index e89104655..c78730041 100644 --- a/packages/server/src/services/Cashflow/CashflowAccountTransformer.ts +++ b/packages/server/src/services/Cashflow/CashflowAccountTransformer.ts @@ -8,7 +8,12 @@ export class CashflowAccountTransformer extends Transformer { * @returns {string[]} */ public includeAttributes = (): string[] => { - return ['formattedAmount']; + return [ + 'formattedAmount', + 'lastFeedsUpdatedAt', + 'lastFeedsUpdatedAtFormatted', + 'lastFeedsUpdatedFromNow', + ]; }; /** @@ -29,7 +34,7 @@ export class CashflowAccountTransformer extends Transformer { /** * Retrieve formatted account amount. - * @param {IAccount} invoice + * @param {IAccount} invoice * @returns {string} */ protected formattedAmount = (account: IAccount): string => { @@ -37,4 +42,22 @@ export class CashflowAccountTransformer extends Transformer { currencyCode: account.currencyCode, }); }; + + /** + * Retrieves the last feeds update at formatted date. + * @param {IAccount} account + * @returns {string} + */ + protected lastFeedsUpdatedAtFormatted(account: IAccount): string { + return this.formatDate(account.lastFeedsUpdatedAt); + } + + /** + * Retrieves the last feeds updated from now. + * @param {IAccount} account + * @returns {string} + */ + protected lastFeedsUpdatedFromNow(account: IAccount): string { + return this.formatDateFromNow(account.lastFeedsUpdatedAt); + } } diff --git a/packages/webapp/src/components/BankAccounts/index.tsx b/packages/webapp/src/components/BankAccounts/index.tsx index 98e411a4c..02f5f5697 100644 --- a/packages/webapp/src/components/BankAccounts/index.tsx +++ b/packages/webapp/src/components/BankAccounts/index.tsx @@ -62,6 +62,7 @@ export function BankAccount({ balance, loading = false, updatedBeforeText, + uncategorizedTransactionsCount, ...restProps }) { return ( @@ -77,17 +78,19 @@ export function BankAccount({ - {false && ( + {uncategorizedTransactionsCount > 0 && ( + )} + {updatedBeforeText && ( + )} - diff --git a/packages/webapp/src/containers/CashFlow/AccountTransactions/ExcludedTransactions/_utils.tsx b/packages/webapp/src/containers/CashFlow/AccountTransactions/ExcludedTransactions/_utils.tsx index d82f902bb..23a08b7e9 100644 --- a/packages/webapp/src/containers/CashFlow/AccountTransactions/ExcludedTransactions/_utils.tsx +++ b/packages/webapp/src/containers/CashFlow/AccountTransactions/ExcludedTransactions/_utils.tsx @@ -37,12 +37,13 @@ export function useExcludedTransactionsColumns() { () => [ { Header: 'Date', - accessor: 'formatted_date', + accessor: 'formatted_date', width: 110, }, { Header: 'Description', accessor: descriptionAccessor, + textOverview: true, }, { Header: 'Payee', diff --git a/packages/webapp/src/containers/CashFlow/CashFlowAccounts/CashflowAccountsGrid.tsx b/packages/webapp/src/containers/CashFlow/CashFlowAccounts/CashflowAccountsGrid.tsx index 297c26eb0..8c8315e84 100644 --- a/packages/webapp/src/containers/CashFlow/CashFlowAccounts/CashflowAccountsGrid.tsx +++ b/packages/webapp/src/containers/CashFlow/CashFlowAccounts/CashflowAccountsGrid.tsx @@ -123,7 +123,12 @@ function CashflowBankAccount({ code={account.code} balance={!isNull(account.amount) ? account.formatted_amount : '-'} type={account.account_type} - updatedBeforeText={getUpdatedBeforeText(account.createdAt)} + updatedBeforeText={ + account.last_feeds_updated_from_now + ? `Updated ${account.last_feeds_updated_from_now} ago` + : '' + } + uncategorizedTransactionsCount={account.uncategorized_transactions} />