Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sweepstake
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arjun Jhukal
sweepstake
Commits
e45b44cb
Commit
e45b44cb
authored
Oct 17, 2025
by
Arjun Jhukal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated the multiple filter logic and integrated filter at transaction
parent
59a2480e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
173 additions
and
53 deletions
+173
-53
SelectField.tsx
src/components/atom/SelectField.tsx
+3
-1
TableHeader.tsx
src/components/molecules/TableHeader.tsx
+136
-39
Activities.tsx
...pages/dashboard/adminDashboard/activityLog/Activities.tsx
+9
-7
TransactionTable.tsx
...dashboard/adminDashboard/transaction/TransactionTable.tsx
+13
-2
transaction.ts
src/services/transaction.ts
+4
-2
config.ts
src/types/config.ts
+8
-2
No files found.
src/components/atom/SelectField.tsx
View file @
e45b44cb
...
...
@@ -20,6 +20,7 @@ interface SelectFieldProps {
options
:
Option
[];
error
?:
boolean
;
touched
?:
boolean
;
placeholder
?:
string
;
}
export
default
function
SelectField
({
...
...
@@ -32,6 +33,7 @@ export default function SelectField({
options
,
error
,
touched
,
placeholder
}:
SelectFieldProps
)
{
const
theme
=
useThemeContext
();
return
(
...
...
@@ -47,7 +49,7 @@ export default function SelectField({
onBlur=
{
onBlur
}
className=
"w-full border text-[14px] border-gray-300 rounded-lg px-3 py-2 focus:border-primary outline-0"
>
<
option
value=
""
>
Select the Type of Game
</
option
>
<
option
value=
""
>
{
placeholder
||
"-- choose any one --"
}
</
option
>
{
options
.
map
((
option
)
=>
(
<
option
key=
{
option
.
value
}
value=
{
option
.
value
}
>
{
option
.
name
}
...
...
src/components/molecules/TableHeader.tsx
View file @
e45b44cb
This diff is collapsed.
Click to expand it.
src/components/pages/dashboard/adminDashboard/activityLog/Activities.tsx
View file @
e45b44cb
...
...
@@ -5,6 +5,8 @@ import { User, Lock, ArrowUp, ArrowDown } from '@wandersonalwes/iconsax-react';
import
React
,
{
useMemo
}
from
'react'
;
import
{
useReactTable
,
getCoreRowModel
,
getPaginationRowModel
,
getSortedRowModel
,
ColumnDef
}
from
'@tanstack/react-table'
;
import
{
Pagination
,
Box
}
from
'@mui/material'
;
import
{
TransactionStatusProps
}
from
'../transaction/TransactionTable'
;
import
{
StatusOptions
}
from
'@/types/config'
;
interface
Activity
{
id
:
number
;
...
...
@@ -168,11 +170,12 @@ export default function Activities() {
const
[
search
,
setSearch
]
=
React
.
useState
(
""
);
const
[
page
,
setPage
]
=
React
.
useState
(
1
);
const
[
status
,
setStatus
]
=
React
.
useState
<
TransactionStatusProps
|
undefined
>
();
const
[
pageSize
,
setPageSize
]
=
React
.
useState
(
10
);
const
[
activityType
,
setActivityType
]
=
React
.
useState
(
"all"
);
const
[
sorting
,
setSorting
]
=
React
.
useState
<
any
>
([]);
// Filter data based on search and activity type
const
filteredData
=
useMemo
(()
=>
{
return
activities
.
filter
(
activity
=>
{
const
matchesSearch
=
search
===
""
||
...
...
@@ -308,18 +311,17 @@ export default function Activities() {
const
totalPages
=
Math
.
ceil
(
filteredData
.
length
/
pageSize
);
return
(
<
div
className=
"border-gray border-solid border-[1px] rounded-[8px] lg:rounded-[16px]"
>
<
TableHeader
search=
{
search
}
setSearch=
{
setSearch
}
filterMethod=
{
activityType
}
setFilterMethod=
{
(
value
)
=>
{
setActivityType
(
value
);
setPage
(
1
);
}
}
filterOptions=
{
activityTypes
}
filters=
{
[
{
value
:
activityType
,
setValue
:
setActivityType
,
options
:
activityTypes
,
placeholder
:
"Filter by type"
},
{
value
:
status
||
""
,
setValue
:
(
value
)
=>
setStatus
(
value
as
TransactionStatusProps
),
options
:
StatusOptions
,
placeholder
:
"Filter by status"
}
]
}
onDownloadCSV=
{
()
=>
{
}
}
/>
...
...
src/components/pages/dashboard/adminDashboard/transaction/TransactionTable.tsx
View file @
e45b44cb
...
...
@@ -2,6 +2,7 @@
import
TableHeader
from
'@/components/molecules/TableHeader'
;
import
CustomTable
from
'@/components/organism/Table'
;
import
{
useGetAllTransactionQuery
}
from
'@/services/transaction'
;
import
{
StatusOptions
}
from
'@/types/config'
;
import
{
SingleDepositProps
}
from
'@/types/transaction'
;
import
{
formatDateTime
}
from
'@/utils/formatDateTime'
;
import
{
getInitials
}
from
'@/utils/getInitials'
;
...
...
@@ -16,12 +17,14 @@ import {
import
{
ArrowDown
,
ArrowUp
}
from
'@wandersonalwes/iconsax-react'
;
import
React
,
{
useMemo
,
useState
}
from
'react'
;
export
type
TransactionStatusProps
=
"success"
|
"failed"
|
"pending"
;
export
default
function
TransactionTable
({
user_id
,
game_id
,
search
,
setSearch
}:
{
user_id
?:
string
;
game_id
?:
number
,
search
:
string
,
setSearch
?:
(
newvalue
:
string
)
=>
void
})
{
const
[
sorting
,
setSorting
]
=
useState
<
{
id
:
string
;
desc
:
boolean
}[]
>
([]);
const
[
page
,
setPage
]
=
useState
(
1
);
const
[
pageSize
,
setPageSize
]
=
useState
(
10
);
const
[
rowSelection
,
setRowSelection
]
=
useState
({});
const
[
status
,
setStatus
]
=
React
.
useState
<
TransactionStatusProps
|
undefined
>
();
const
queryArgs
=
useMemo
(
()
=>
({
page
,
...
...
@@ -29,8 +32,9 @@ export default function TransactionTable({ user_id, game_id, search, setSearch }
search
:
search
||
""
,
game_id
,
user_id
,
status
}),
[
page
,
pageSize
,
search
,
game_id
,
user_id
]
[
page
,
pageSize
,
search
,
game_id
,
user_id
,
status
]
);
const
{
data
,
isLoading
:
loadingTransaction
}
=
useGetAllTransactionQuery
(
queryArgs
);
...
...
@@ -149,7 +153,14 @@ export default function TransactionTable({ user_id, game_id, search, setSearch }
return
(
<
div
className=
"border-gray border-solid border-[1px] rounded-[8px] lg:rounded-[16px]"
>
<
TableHeader
search=
{
search
}
setSearch=
{
setSearch
&&
setSearch
}
onDownloadCSV=
{
()
=>
{
}
}
/>
<
TableHeader
search=
{
search
}
setSearch=
{
setSearch
&&
setSearch
}
onDownloadCSV=
{
()
=>
{
}
}
filters=
{
[
{
value
:
status
||
""
,
setValue
:
(
value
)
=>
setStatus
(
value
as
TransactionStatusProps
),
options
:
StatusOptions
,
placeholder
:
"Filter by status"
}
]
}
/>
<>
<
CustomTable
...
...
src/services/transaction.ts
View file @
e45b44cb
...
...
@@ -2,6 +2,7 @@ import { createApi } from "@reduxjs/toolkit/query/react";
import
{
baseQuery
}
from
"./baseQuery"
;
import
{
DepositListProps
,
DepositProps
,
DepositResponseProps
,
DepositUrlProps
}
from
"@/types/transaction"
;
import
{
QueryParams
}
from
"@/types/config"
;
import
{
TransactionStatusProps
}
from
"@/components/pages/dashboard/adminDashboard/transaction/TransactionTable"
;
export
const
transactionApi
=
createApi
({
reducerPath
:
"transactionApi"
,
...
...
@@ -52,14 +53,15 @@ export const transactionApi = createApi({
},
providesTags
:
[
"Withdrawl"
]
}),
getAllTransaction
:
builder
.
query
<
DepositListProps
,
QueryParams
&
{
user_id
?:
string
|
number
;
game_id
?:
string
|
number
}
>
({
query
:
({
search
,
page
,
per_page
,
user_id
,
game_id
})
=>
{
getAllTransaction
:
builder
.
query
<
DepositListProps
,
QueryParams
&
{
status
?:
TransactionStatusProps
;
user_id
?:
string
|
number
;
game_id
?:
string
|
number
}
>
({
query
:
({
search
,
page
,
per_page
,
user_id
,
game_id
,
status
})
=>
{
const
params
=
new
URLSearchParams
();
if
(
search
)
params
.
append
(
'search'
,
search
);
if
(
page
)
params
.
append
(
'page'
,
page
.
toString
());
if
(
per_page
)
params
.
append
(
'page_size'
,
per_page
.
toString
());
if
(
user_id
)
params
.
append
(
'user'
,
user_id
.
toString
());
if
(
game_id
)
params
.
append
(
'game'
,
game_id
.
toString
());
if
(
status
)
params
.
append
(
'status'
,
status
.
toString
());
const
queryString
=
params
.
toString
();
return
{
url
:
`/api/admin/transactions
${
queryString
?
`?
${
queryString
}
`
:
''
}
`
,
...
...
src/types/config.ts
View file @
e45b44cb
...
...
@@ -38,4 +38,10 @@ export interface QueryParams {
per_page
?:
number
;
search
?:
string
;
status
?:
string
;
}
\ No newline at end of file
}
export
const
StatusOptions
=
[
{
label
:
"Success"
,
value
:
"success"
},
{
label
:
"Pending"
,
value
:
"pending"
},
{
label
:
"Failed"
,
value
:
"failed"
},
]
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment