Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Jay Mehta
/
zango-frontend
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Registry
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 3ddd0dc9
authored
2024-07-10 20:43:42 +0530
by
Ravindra Kanojiya
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of
https://git.logicloop.io/jaymehta/zango-frontend
2 parents
6ddb1e0d
7ac5e063
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
131 additions
and
56 deletions
components/admin/VendorDetails.js
components/admin/VendorListing.js
components/gift-card/GiftCard.js
components/listing/ListingFilter.js
components/vendor/ActivityDetails.js
components/vendor/ActivityListingRBAC.js
pages/admin/activities/index.js
redux/actions/activityAction.js
redux/actions/vendorActions.js
components/admin/VendorDetails.js
View file @
3ddd0dc
...
...
@@ -74,7 +74,7 @@ const VendorDetails = ({ id, backClick, setShowDetail, showDetail, detail }) =>
default
:
break
;
}
return
<
Tag
color
=
{
color
}
>
{
message
.
toUpperCase
()}
<
/Tag>
;
return
<
Tag
color
=
{
color
}
>
{
message
?
.
toUpperCase
()}
<
/Tag>
;
};
return
(
<
Fragment
>
...
...
@@ -107,6 +107,12 @@ const VendorDetails = ({ id, backClick, setShowDetail, showDetail, detail }) =>
<p className="col-12 col-lg-6">PAN</p>
<p className="col-12 col-lg-6 pview">View</p>
</div> */
}
{
detail
[
0
].
attributes
.
uniqueVendorId
&&
(
<
div
className
=
"row"
>
<
p
className
=
"col-12 col-lg-6"
>
Vendor
ID
<
/p
>
<
p
className
=
"col-12 col-lg-6"
>
{
detail
[
0
].
attributes
.
uniqueVendorId
}
<
/p
>
<
/div
>
)}
<
div
className
=
"row"
>
<
p
className
=
"col-12 col-lg-6"
>
EIN
Number
<
/p
>
<
p
className
=
"col-12 col-lg-6"
>
{
detail
[
0
].
attributes
.
einNumber
}
<
/p
>
...
...
components/admin/VendorListing.js
View file @
3ddd0dc
...
...
@@ -40,7 +40,9 @@ const VendorListing = () => {
const
handleSearch
=
(
selectedKeys
,
confirm
,
dataIndex
)
=>
{
console
.
log
(
"selectedKeys"
,
selectedKeys
);
if
(
!
loadedUser
)
return
;
setTimeout
(()
=>
{
dispatch
(
getAllVendors
({
pageNumber
:
1
,
pageSize
:
10
,
str
:
selectedKeys
[
0
]
}));
},
500
);
confirm
();
setSearchText
(
selectedKeys
[
0
]);
setSearchedColumn
(
dataIndex
);
...
...
@@ -91,7 +93,7 @@ const VendorListing = () => {
>
Reset
<
/Button
>
<
Button
{
/*
<Button
type="link"
size="small"
onClick={() => {
...
...
@@ -103,7 +105,7 @@ const VendorListing = () => {
}}
>
Filter
<
/Button
>
</Button>
*/
}
<
Button
type
=
"link"
size
=
"small"
...
...
@@ -211,7 +213,8 @@ const VendorListing = () => {
status
:
[
item
.
attributes
.
user
.
data
?.
attributes
.
approved
],
confirmed
:
item
.
attributes
.
user
.
data
?.
attributes
.
confirmed
,
email
:
item
.
attributes
.
email
,
phone
:
item
.
attributes
.
phone
phone
:
item
.
attributes
.
phone
,
vendorId
:
item
.
attributes
.
uniqueVendorId
};
});
console
.
log
(
"initialData"
,
initialData
);
...
...
@@ -228,11 +231,11 @@ const VendorListing = () => {
// ...getColumnSearchProps("vendorId")
// },
{
title
:
"
Name
"
,
dataIndex
:
"
name
"
,
key
:
"
name
"
,
title
:
"
Vendor ID
"
,
dataIndex
:
"
vendorId
"
,
key
:
"
vendorId
"
,
render
:
text
=>
<
a
>
{
text
}
<
/a>
,
...
getColumnSearchProps
(
"
name
"
)
...
getColumnSearchProps
(
"
vendorId
"
)
},
{
title
:
"Business Name"
,
...
...
components/gift-card/GiftCard.js
View file @
3ddd0dc
...
...
@@ -299,6 +299,7 @@ const GiftCard = () => {
onClick
=
{
async
()
=>
{
setloading
(
true
);
if
(
!
session
)
{
setloading
(
false
);
toast
.
warning
(
"Please log in to buy a gift card."
);
return
;
}
...
...
components/listing/ListingFilter.js
View file @
3ddd0dc
...
...
@@ -75,6 +75,7 @@ const ListingFilter = () => {
dispatch
(
setActivityFilters
({
filters
:
{
priceLowerLimit
:
0
,
priceUpperLimit
:
5000
}
}));
setsliderLowerValue
(
0
);
setsliderUpperValue
(
5000
);
window
.
location
.
reload
();
}}
>
Reset
...
...
components/vendor/ActivityDetails.js
View file @
3ddd0dc
...
...
@@ -234,7 +234,7 @@ const ActivityDetails = ({ isUpdate, loadedUser }) => {
console
.
log
(
"activityPeriodState"
,
activityPeriodState
);
return
(
<
Fragment
>
{
loadedUser
&&
loadedUser
.
approved
==
"approved"
?
(
{
true
?
(
<
div
className
=
"container p-5"
>
<
div
className
=
"row"
>
<
div
className
=
"col-12 col-lg-8"
>
...
...
components/vendor/ActivityListingRBAC.js
View file @
3ddd0dc
import
React
,
{
useEffect
,
useRef
,
useState
}
from
"react"
;
import
{
Button
,
Dropdown
,
Input
,
Space
,
Table
,
Tag
}
from
"antd"
;
import
{
Button
,
Dropdown
,
Input
,
Space
,
Switch
,
Table
,
Tag
}
from
"antd"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
Highlighter
from
"react-highlight-words"
;
import
{
DeleteTwoTone
,
DownCircleOutlined
,
EditTwoTone
,
SearchOutlined
}
from
"@ant-design/icons"
;
...
...
@@ -8,12 +8,14 @@ import { getActivitiesByVendor, getActivitiesForAdmin } from "../../redux/action
import
{
loadUser
,
updateActivityStatusAdmin
}
from
"../../redux/actions/userActions"
;
import
{
Modal
}
from
"react-bootstrap"
;
import
{
toast
}
from
"react-toastify"
;
import
{
getSession
}
from
"next-auth/react"
;
import
axios
from
"axios"
;
// const onChange = (pagination, filters, sorter, extra) => {
// console.log("params", pagination, filters, sorter, extra);
// };
export
const
ActivityListingRBAC
=
({
setactivityDetailInfo
,
setShowActivityDetailsModal
,
onChange
,
tableCurrentPage
,
tableItemsPerPage
})
=>
{
export
const
ActivityListingRBAC
=
({
setactivityDetailInfo
,
setShowActivityDetailsModal
,
onChange
,
tableCurrentPage
,
tableItemsPerPage
,
setfilterValue
})
=>
{
const
router
=
useRouter
();
const
dispatch
=
useDispatch
();
// let columns = []
...
...
@@ -22,7 +24,6 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
const
{
loadedUser
}
=
useSelector
(
state
=>
state
.
loadedUser
);
const
{
categories
}
=
useSelector
(
state
=>
state
.
categories
);
const
{
subCategories
}
=
useSelector
(
state
=>
state
.
subCategories
);
// console.log("loadedUser", loadedUser);
// useStates
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
([]);
const
[
columns
,
setcolumns
]
=
useState
([]);
...
...
@@ -32,15 +33,28 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
const
[
searchedColumn
,
setSearchedColumn
]
=
useState
(
""
);
const
[
rejectionReasonText
,
setrejectionReasonText
]
=
useState
(
""
);
const
[
rejectionId
,
setrejectionId
]
=
useState
(
""
);
const
[
session
,
setSession
]
=
useState
();
// functions
const
onSelectChange
=
newSelectedRowKeys
=>
{
console
.
log
(
"selectedRowKeys changed: "
,
newSelectedRowKeys
);
setSelectedRowKeys
(
newSelectedRowKeys
);
};
useEffect
(()
=>
{
const
fetchSession
=
async
()
=>
{
setSession
(
await
getSession
());
};
fetchSession
();
// dispatch(getLoggedInVendor());
},
[]);
// console.log("session", session);
const
searchInput
=
useRef
(
null
);
const
handleSearch
=
(
selectedKeys
,
confirm
,
dataIndex
)
=>
{
console
.
log
(
"dataIndex"
,
selectedKeys
[
0
]);
setfilterValue
(
selectedKeys
[
0
]);
setTimeout
(()
=>
{
dispatch
(
getActivitiesForAdmin
({
vendorName
:
selectedKeys
[
0
],
pageNumber
:
tableCurrentPage
,
pageSize
:
tableItemsPerPage
}));
},
500
);
confirm
();
setSearchText
(
selectedKeys
[
0
]);
setSearchedColumn
(
dataIndex
);
...
...
@@ -89,7 +103,7 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
>
Reset
<
/Button
>
<
Button
{
/*
<Button
type="link"
size="small"
onClick={() => {
...
...
@@ -101,7 +115,7 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
}}
>
Filter
<
/Button
>
</Button>
*/
}
<
Button
type
=
"link"
size
=
"small"
...
...
@@ -165,6 +179,7 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
location
:
item
.
attributes
.
masterPincode
.
data
.
attributes
.
name
,
price
:
item
.
attributes
.
pricePerPerson
,
place
:
item
.
attributes
.
activityType
,
mostBooked
:
item
.
attributes
.
mostBooked
,
gift
:
item
.
attributes
.
giftSomeone
?
"Yes"
:
"No"
,
status
:
[
item
.
attributes
.
approved
]
};
...
...
@@ -205,9 +220,34 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
width
:
"15%"
},
{
title
:
"Location"
,
dataIndex
:
"location"
,
width
:
"15%"
title
:
"Most popular"
,
dataIndex
:
"mostBooked"
,
width
:
"15%"
,
render
:
(
_
,
item
)
=>
(
<>
{
<
Switch
checked
=
{
item
.
mostBooked
}
onClick
=
{()
=>
{
console
.
log
(
"here"
);
}}
onChange
=
{
async
e
=>
{
// /api/experience/update-most-booked
const
config
=
{
headers
:
{
"Content-Type"
:
"application/json"
,
Authorization
:
`Bearer
${
session
.
jwt
}
`
}
};
const
response
=
await
axios
.
post
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/experience/update-most-booked`
,
{
mostBooked
:
e
,
id
:
item
.
key
},
config
);
dispatch
(
getActivitiesForAdmin
({
pageNumber
:
tableCurrentPage
,
pageSize
:
tableItemsPerPage
}));
// console.log("response", response);
}}
/
>
}
<
/
>
)
},
{
title
:
"Price"
,
...
...
@@ -276,42 +316,42 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
View
Details
<
/a
>
)
},
{
key
:
"2"
,
label
:
(
<
a
rel
=
"noopener noreferrer"
onClick
=
{()
=>
{
setrejectionId
(
record
.
key
);
adminActions
({
type
:
"reject"
,
activityId
:
record
.
key
});
}}
>
Reject
<
/a
>
)
},
{
key
:
"3"
,
label
:
(
<
a
target
=
"_blank"
rel
=
"noopener noreferrer"
onClick
=
{()
=>
{
// setrejectionId(record.key);
adminActions
({
type
:
"approve"
,
activityId
:
record
.
key
});
}}
>
Approve
<
/a
>
)
}
// {
// key: "2",
// label: (
// <a
// rel="noopener noreferrer"
// onClick={() => {
// setrejectionId(record.key);
// adminActions({ type: "reject", activityId: record.key });
// }}
// >
// Reject
// </a>
// )
// },
// {
// key: "3",
// label: (
// <a
// target="_blank"
// rel="noopener noreferrer"
// onClick={() => {
// // setrejectionId(record.key);
// adminActions({ type: "approve", activityId: record.key });
// }}
// >
// Approve
// </a>
// )
// }
]
}}
placement
=
"bottomLeft"
>
<
Button
style
=
{{
border
:
"none"
}}
>
<
DownCircleOutlined
style
=
{{
fontSize
:
"20px"
,
color
:
"#08c"
}}
onClick
=
{()
=>
{
}}
/
>
<
DownCircleOutlined
style
=
{{
fontSize
:
"20px"
,
color
:
"#08c"
}}
onClick
=
{()
=>
{}}
/
>
<
/Button
>
<
/Dropdown
>
<
/Space
>
...
...
@@ -346,9 +386,28 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
width
:
"15%"
},
{
title
:
"
Location
"
,
title
:
"
Most popular
"
,
dataIndex
:
"location"
,
width
:
"15%"
width
:
"15%"
,
render
:
(
_
,
{
status
})
=>
(
<>
{
status
==
"approved"
&&
(
<
Tag
color
=
{
"green"
}
key
=
{
1
}
>
Approved
<
/Tag
>
)}
{
status
==
"pending"
&&
(
<
Tag
color
=
{
"orange"
}
key
=
{
1
}
>
Pending
<
/Tag
>
)}
{
status
==
"rejected"
&&
(
<
Tag
color
=
{
"red"
}
key
=
{
1
}
>
Rejected
<
/Tag
>
)}
<
/
>
)
},
{
title
:
"Price"
,
...
...
@@ -469,7 +528,6 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
<
div
className
=
"p-5"
>
<
Table
loading
=
{
loading
}
rowSelection
=
{
rowSelection
}
columns
=
{
columns
}
dataSource
=
{
data
}
onChange
=
{
onChange
}
...
...
pages/admin/activities/index.js
View file @
3ddd0dc
...
...
@@ -26,12 +26,13 @@ export default function ActivityListingPage() {
const
[
tableCurrentPage
,
settableCurrentPage
]
=
useState
(
1
);
const
[
tableItemsPerPage
,
settableItemsPerPage
]
=
useState
(
10
);
const
[
filterValue
,
setfilterValue
]
=
useState
();
const
onChange
=
(
pagination
,
filters
,
sorter
,
extra
)
=>
{
const
onChange
=
(
pagination
,
filters
,
sorter
,
extra
,
searchText
)
=>
{
console
.
log
(
"params"
,
pagination
,
filters
,
sorter
,
extra
);
settableCurrentPage
(
pagination
.
current
);
settableItemsPerPage
(
pagination
.
pageSize
);
dispatch
(
getActivitiesForAdmin
({
pageNumber
:
pagination
.
current
,
pageSize
:
pagination
.
pageSize
}));
dispatch
(
getActivitiesForAdmin
({
pageNumber
:
pagination
.
current
,
pageSize
:
pagination
.
pageSize
,
vendorName
:
filterValue
}));
};
return
(
...
...
@@ -42,6 +43,7 @@ export default function ActivityListingPage() {
{
/* <div className="content"> */
}
{
/* <ActivityListing /> */
}
<
ActivityListingRBAC
setfilterValue
=
{
setfilterValue
}
setactivityDetailInfo
=
{
setactivityDetailInfo
}
setShowActivityDetailsModal
=
{
setShowActivityDetailsModal
}
onChange
=
{
onChange
}
...
...
redux/actions/activityAction.js
View file @
3ddd0dc
...
...
@@ -251,7 +251,7 @@ export const updateActivityById =
};
export
const
getActivitiesForAdmin
=
({
vendorId
,
pageNumber
=
1
,
pageSize
=
10
,
category
})
=>
({
vendorId
,
pageNumber
=
1
,
pageSize
=
10
,
category
,
vendorName
})
=>
async
dispatch
=>
{
try
{
dispatch
({
...
...
@@ -272,6 +272,9 @@ export const getActivitiesForAdmin =
id
:
{
$eq
:
vendorId
}
},
name
:
{
$contains
:
vendorName
}
},
pagination
:
{
...
...
@@ -337,7 +340,8 @@ export const getActivitiesForEndUser = () => async dispatch => {
const
query
=
{
filters
:
{
approved
:
{
$eq
:
"approved"
}
approved
:
{
$eq
:
"approved"
},
mostBooked
:
{
$eq
:
true
}
},
sort
:
[{
createdAt
:
"asc"
}],
pagination
:
{
...
...
redux/actions/vendorActions.js
View file @
3ddd0dc
...
...
@@ -223,7 +223,7 @@ export const getAllVendors =
};
if
(
str
)
{
query
.
filters
[
"
name
"
]
=
{
$contains
:
str
};
query
.
filters
[
"
uniqueVendorId
"
]
=
{
$contains
:
str
};
}
// console.log("here 3", query);
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment