-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(transaction): add transaction actions
- Loading branch information
Showing
17 changed files
with
253 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
app/transactions/create/(common)/components/UserEditForm/TransactionEditForm.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use client' | ||
|
||
import { TransactionMutateForm } from '@/modules/transactions/components' | ||
import { useSearchParams } from 'next/navigation' | ||
import { FC } from 'react' | ||
|
||
export const TransactionEditForm: FC<{}> = () => { | ||
const searchParams = useSearchParams() | ||
let type = searchParams.get('type') | ||
const transaction = { | ||
type | ||
} as { | ||
type: 'credit' | 'debit' | ||
} | ||
return <TransactionMutateForm transaction={transaction} /> | ||
} |
2 changes: 2 additions & 0 deletions
2
app/transactions/create/(common)/components/UserEditForm/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './TransactionEditForm'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { Metadata } from 'next' | ||
import { TransactionEditForm } from './(common)/components/UserEditForm/TransactionEditForm' | ||
|
||
export const metadata: Metadata = { | ||
title: 'Lending', | ||
// description: '...', | ||
} | ||
|
||
export default function BorrowCreatePage() { | ||
return ( | ||
<div className="container"> | ||
<TransactionEditForm /> | ||
</div> | ||
) | ||
} |
25 changes: 25 additions & 0 deletions
25
app/transactions/edit/(common)/components/UserEditForm/TransactionEditForm.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use client' | ||
|
||
import useQueryFilter from '@/hooks/useQueryFilter/useQueryFilter' | ||
import { TransactionMutateForm } from '@/modules/transactions/components' | ||
import { useSearchParams } from 'next/navigation' | ||
import { FC } from 'react' | ||
|
||
export const TransactionEditForm: FC<{}> = () => { | ||
const searchParams = useSearchParams() | ||
let id = searchParams.get('id') as any | ||
id = typeof id === 'string' ? parseInt(id) : null | ||
const { isLoading, data: transactions } = useQueryFilter( | ||
'transactions', | ||
{ | ||
where: { id }, | ||
} | ||
) | ||
|
||
if (isLoading) { | ||
return <div>Loading...</div> | ||
} | ||
const transaction = transactions ? transactions?.[0] : undefined | ||
|
||
return <TransactionMutateForm transaction={transaction} /> | ||
} |
2 changes: 2 additions & 0 deletions
2
app/transactions/edit/(common)/components/UserEditForm/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './TransactionEditForm'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { Metadata } from 'next' | ||
import { TransactionEditForm } from './(common)/components/UserEditForm/TransactionEditForm' | ||
|
||
export const metadata: Metadata = { | ||
title: 'Lending', | ||
// description: '...', | ||
} | ||
|
||
export default function BorrowCreatePage() { | ||
return ( | ||
<div className="container"> | ||
<TransactionEditForm /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.