mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-17 08:28:44 +00:00
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import { lazy } from 'react'
|
|
import { useGetStatementDetails } from '@/components/features/BankStatementImporter/import_utils'
|
|
import { Button } from '@/components/ui/button'
|
|
import { useDirection } from '@/components/ui/direction'
|
|
import ErrorBanner from '@/components/ui/error-banner'
|
|
import _ from '@/lib/translate'
|
|
import { useFrappeDocumentEventListener } from 'frappe-react-sdk'
|
|
import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react'
|
|
import { Link, useParams } from 'react-router'
|
|
|
|
const CSVImport = lazy(() => import('@/components/features/BankStatementImporter/CSV/CSVImport'))
|
|
|
|
const ViewBankStatementImportLog = () => {
|
|
|
|
const { id } = useParams<{ id: string }>()
|
|
|
|
const { data, isLoading, error } = useGetStatementDetails(id ?? "")
|
|
|
|
useFrappeDocumentEventListener("Bank Statement Import Log", id ?? "", () => {
|
|
})
|
|
|
|
const direction = useDirection()
|
|
|
|
if (!data || !data.message) {
|
|
return null
|
|
}
|
|
|
|
if (isLoading) {
|
|
return <div>Loading...</div>
|
|
}
|
|
|
|
if (error) {
|
|
return <div className='flex flex-col gap-4 px-4'>
|
|
<div>
|
|
<Button size='sm' variant='outline' asChild>
|
|
<Link to="/statement-importer">
|
|
{direction === 'ltr' ? <ChevronLeftIcon /> : <ChevronRightIcon />}
|
|
{_("Back")}
|
|
</Link>
|
|
</Button>
|
|
</div>
|
|
<ErrorBanner error={error} />
|
|
</div>
|
|
}
|
|
return <CSVImport data={data} />
|
|
}
|
|
|
|
export default ViewBankStatementImportLog |