mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-18 17:08:42 +00:00
* feat: new banking module (#54720)
* feat: initial SPA setup for banking
* wip: bring over new banking module
* feat: added Espresso design tokens
* feat: button styles
* fix: add all ink colors
* wip: espresso design system changes
* feat: button and badge espresso components
* fix: button styling for reconcile
* feat: Espresso progress bar
* feat: Espresso toggle switch
* feat: Espresso tabs design
* fix: vertical tab support
* fix: button sizing across modals
* feat: Espresso style table layout
* feat: Espresso tooltip
* feat: Espresso elevations and checkbox
* feat: Dialog with Espresso styles
* feat: Espresso textarea
* fix: input styles
* fix: colors on bank picker
* fix: breadcrumb styling
* fix: bank picker styling
* feat: create doctypes and fields for bank reconciliation
* feat: APIs for banking
* fix: use date format parser
* fix: font styling to match Espresso
* wip: settings modal
* feat: settings dialog component
* fix: icons and invalid requests
* feat: preferences tab
* fix: adjust icon stroke width to 1.5
* feat: rule configuration in settings
* fix: remove sheet component
* feat: alert and error banner component
* feat: dropdown in Espresso
* feat: popover and select in Espresso
* fix: cleanup more styles
* fix: match size of link fields
* feat: command styling
* fix: remove unused style tokens
* fix: styles for global date picker dropdown
* fix: styles for match and reconcile
* feat: table Espresso component
* feat: remove all other design tokens
* fix: remove unused tokens
* fix: form elements
* fix: remove unused styles and fix filters in bank transaction list
* feat: fetch bank rec doctypes for filtering
* fix: record payment modal
* feat: support for dark mode switching
* fix: move bank logos to public folder
* feat: add support for RTL
* feat: support for RTL
* chore: send layout direction in dev boot
* fix: make checkbox work in RTL
* feat: dark mode support
* fix: dark mode style
* feat: bank logos in dark mode
* feat: dark mode bank logos
* chore: use dark mode bank logos everywhere
* chore: move rule evaluation to controller
* chore: add tests for bank transaction rules
* fix: move deps to fix actions errors
* fix: move tw-animate-css to deps
* fix: remove shadcn
* fix: do not open modal if no transactions selected
* fix: add translation strings
* feat: add banner on existing bank reconciliation tool
* feat: bank statement import
* fix: translations and layout directions
* fix: validation for transaction matching rule
* fix: styles
* fix: show conflicting transactions in alert
* fix: show help text for new banking module forms
* feat: show total debits and credits
* fix: dark mode colors in automatic config
* feat: add keyboard shortcuts help
* feat: added keyboard shortcut for settings
* fix: decrease size of progress bar
* chore: bump packages
* feat: add tests for statement import
* fix: settings dialog
* fix: show banner on small screens
* fix: show banner when no bank account set
(cherry picked from commit 6de5367f12)
# Conflicts:
# erpnext/accounts/doctype/bank_reconciliation_tool/bank_reconciliation_tool.py
* chore: resolve conflicts
* fix: add type hints to whitelisted methods
---------
Co-authored-by: Nikhil Kothari <nik.kothari22@live.com>
73 lines
3.6 KiB
TypeScript
73 lines
3.6 KiB
TypeScript
import { useMemo } from 'react'
|
|
import { ArrowDownRight, ArrowUpRight, Calendar } from 'lucide-react'
|
|
import { formatCurrency } from '@/lib/numbers'
|
|
import { formatDate } from '@/lib/date'
|
|
import { UnreconciledTransaction, useGetBankAccounts } from './utils'
|
|
import { getCompanyCurrency } from '@/lib/company'
|
|
import { Card, CardContent } from '@/components/ui/card'
|
|
import { cn } from '@/lib/utils'
|
|
import _ from '@/lib/translate'
|
|
import BankLogo from '@/components/common/BankLogo'
|
|
|
|
type Props = {
|
|
transaction: UnreconciledTransaction,
|
|
showAccount?: boolean,
|
|
account?: string
|
|
}
|
|
|
|
const SelectedTransactionDetails = ({ transaction, showAccount = false, account }: Props) => {
|
|
|
|
const isWithdrawal = transaction.withdrawal && transaction.withdrawal > 0
|
|
|
|
const { banks } = useGetBankAccounts()
|
|
|
|
const bank = useMemo(() => {
|
|
if (transaction.bank_account) {
|
|
return banks?.find((bank) => bank.name === transaction.bank_account)
|
|
}
|
|
return null
|
|
}, [transaction.bank_account, banks])
|
|
|
|
const amount = transaction.withdrawal ? transaction.withdrawal : transaction.deposit
|
|
|
|
const currency = transaction.currency || getCompanyCurrency(transaction.company ?? '')
|
|
|
|
return (
|
|
<Card className='py-4'>
|
|
<CardContent className='px-4'>
|
|
<div className='flex flex-col gap-2'>
|
|
<div className='flex justify-between'>
|
|
<div className='flex flex-col gap-2'>
|
|
<div className='flex flex-col gap-1'>
|
|
<BankLogo bank={bank} iconSize='30px' imageClassName='h-10 max-w-20' />
|
|
<span className='font-medium text-sm'>{transaction.bank_account}</span>
|
|
</div>
|
|
<div className='flex items-center gap-1'>
|
|
<Calendar size='16px' />
|
|
<span className='text-sm'>{formatDate(transaction.date, 'Do MMM YYYY')}</span>
|
|
</div>
|
|
</div>
|
|
<div className='flex flex-col gap-1'>
|
|
<div className={cn('flex items-center gap-1 text-end px-0 justify-end py-1 rounded-sm',
|
|
isWithdrawal ? 'text-ink-red-3' : 'text-ink-green-3'
|
|
)}>
|
|
{isWithdrawal ? <ArrowUpRight className="w-5 h-5 text-ink-red-3" /> : <ArrowDownRight className="w-5 h-5 text-ink-green-3" />}
|
|
<span className='text-sm font-semibold uppercase'>{isWithdrawal ? _('Spent') : _('Received')}</span>
|
|
</div>
|
|
<span className='font-semibold font-numeric text-lg text-end pe-0.5'>{formatCurrency(amount, currency)}</span>
|
|
{transaction.unallocated_amount && transaction.unallocated_amount !== amount ? <span className='text-ink-gray-5'>{_("Unallocated")}: {formatCurrency(transaction.unallocated_amount)}</span> : null}
|
|
</div>
|
|
</div>
|
|
<div className='flex flex-col gap-1'>
|
|
<span className='text-sm'>{transaction.description}</span>
|
|
{transaction.reference_number ? <span className='text-sm text-ink-gray-5'>{_("Ref")}: {transaction.reference_number}</span> : null}
|
|
{showAccount && account ? <span className='text-sm text-ink-gray-5'>{_("GL Account")}: {account}</span> : null}
|
|
</div>
|
|
|
|
</div>
|
|
</CardContent >
|
|
</Card >
|
|
)
|
|
}
|
|
|
|
export default SelectedTransactionDetails |