fix: update folder account filtering and set default folder ID for imported accounts
This commit is contained in:
@@ -56,7 +56,10 @@ function FolderTreeItem({
|
|||||||
}: FolderTreeItemProps) {
|
}: FolderTreeItemProps) {
|
||||||
const [isExpanded, setIsExpanded] = useState(true)
|
const [isExpanded, setIsExpanded] = useState(true)
|
||||||
|
|
||||||
const folderAccounts = accounts.filter((a) => a.folderId === folder.id)
|
// Pour le dossier racine, inclure aussi les comptes sans dossier (folderId: null)
|
||||||
|
const folderAccounts = accounts.filter((a) =>
|
||||||
|
a.folderId === folder.id || (folder.parentId === null && a.folderId === null)
|
||||||
|
)
|
||||||
const childFolders = allFolders.filter((f) => f.parentId === folder.id)
|
const childFolders = allFolders.filter((f) => f.parentId === folder.id)
|
||||||
const hasChildren = childFolders.length > 0 || folderAccounts.length > 0
|
const hasChildren = childFolders.length > 0 || folderAccounts.length > 0
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export function OFXImportDialog({ children, onImportComplete }: OFXImportDialogP
|
|||||||
bankId: parsed.bankId,
|
bankId: parsed.bankId,
|
||||||
accountNumber: parsed.accountId,
|
accountNumber: parsed.accountId,
|
||||||
type: parsed.accountType as Account["type"],
|
type: parsed.accountType as Account["type"],
|
||||||
folderId: null,
|
folderId: "folder-root",
|
||||||
balance: parsed.balance,
|
balance: parsed.balance,
|
||||||
currency: parsed.currency,
|
currency: parsed.currency,
|
||||||
lastImport: new Date().toISOString(),
|
lastImport: new Date().toISOString(),
|
||||||
|
|||||||
Reference in New Issue
Block a user