Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Some bank account details hidden #618

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/server/src/lib/Transformer/Transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ export class CashflowAccountTransformer extends Transformer {
* @returns {string[]}
*/
public includeAttributes = (): string[] => {
return ['formattedAmount'];
return [
'formattedAmount',
'lastFeedsUpdatedAt',
'lastFeedsUpdatedAtFormatted',
'lastFeedsUpdatedFromNow',
];
};

/**
Expand All @@ -29,12 +34,30 @@ export class CashflowAccountTransformer extends Transformer {

/**
* Retrieve formatted account amount.
* @param {IAccount} invoice
* @param {IAccount} invoice
* @returns {string}
*/
protected formattedAmount = (account: IAccount): string => {
return formatNumber(account.amount, {
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);
}
}
15 changes: 9 additions & 6 deletions packages/webapp/src/components/BankAccounts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export function BankAccount({
balance,
loading = false,
updatedBeforeText,
uncategorizedTransactionsCount,
...restProps
}) {
return (
Expand All @@ -77,17 +78,19 @@ export function BankAccount({
</BankAccountHeader>

<BankAccountMeta>
{false && (
{uncategorizedTransactionsCount > 0 && (
<BankAccountMetaLine
title={intl.get('cash_flow.transactions_for_review')}
value={'0'}
value={uncategorizedTransactionsCount}
className={clsx({ [Classes.SKELETON]: loading })}
/>
)}
{updatedBeforeText && (
<BankAccountMetaLine
title={updatedBeforeText}
className={clsx({ [Classes.SKELETON]: loading })}
/>
)}
<BankAccountMetaLine
title={updatedBeforeText}
className={clsx({ [Classes.SKELETON]: loading })}
/>
</BankAccountMeta>

<BankAccountBalance amount={balance} loading={loading} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
/>
</CashflowAccountAnchor>
</ContextMenu2>
Expand Down
Loading