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 395e7636
authored
2024-06-28 16:48:25 +0530
by
jaymehta
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
.
1 parent
9d3f8c00
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
293 additions
and
306 deletions
components/admin/ActivityDetailGallaryModal.js
components/admin/ActivityDetailsModal.js
components/admin/RejectModal.js
components/admin/VendorDetails.js
components/admin/VendorListing.js
components/vendor/ActivityListingRBAC.js
pages/admin/activities/index.js
pages/admin/reviews/index.js
pages/admin/vendors/index.js
pages/vendor/activities/[id].js
pages/vendor/activities/index.js
pages/vendor/reviews/index.js
redux/actions/activityAction.js
redux/actions/vendorActions.js
redux/reducers/vendorReducers.js
components/admin/ActivityDetailGallaryModal.js
View file @
395e763
import
{
Empty
,
Modal
}
from
"antd"
import
{
Empty
,
Modal
}
from
"antd"
;
import
Image
from
"next/image"
import
{
cleanImage
}
from
"../../services/imageHandling.js"
;
import
{
cleanImage
}
from
'../../services/imageHandling.js'
const
ActivityDetailGallaryModal
=
({
activityDetailInfo
})
=>
{
const
ActivityDetailGallaryModal
=
({
activityDetailInfo
})
=>
{
return
(
return
(
<>
<>
{
activityDetailInfo
[
0
].
attributes
.
imagesComponent
.
length
>
0
?
(
<
div
className
=
"p-4"
>
<
div
className
=
"row"
>
{
activityDetailInfo
[
0
].
attributes
.
imagesComponent
.
map
((
data
,
index
)
=>
(
<
div
className
=
"col-4"
key
=
{
index
}
>
<
img
className
=
"img-fluid"
height
=
{
400
}
width
=
{
400
}
alt
=
""
src
=
{
cleanImage
(
data
.
image
.
data
?.
attributes
)}
/
>
<
/div
>
))}
<
/div
>
<
/div
>
)
:
(
<
div
className
=
"d-flex align-items-center justify-content-center"
style
=
{{
height
:
"60vh"
}}
>
<
Empty
image
=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/
>
<
/div
>
)}
<
/
>
);
};
{
activityDetailInfo
[
0
].
attributes
.
imagesComponent
.
length
>
0
?
<
div
className
=
"p-4"
>
<
div
className
=
"row"
>
{
activityDetailInfo
[
0
].
attributes
.
imagesComponent
.
map
((
data
,
index
)
=>
(
<
div
className
=
"col-4"
key
=
{
index
}
>
<
Image
className
=
"img-fluid"
height
=
{
400
}
width
=
{
400
}
alt
=
""
src
=
{
cleanImage
(
data
.
image
.
data
.
attributes
)}
/
>
<
/div
>
))}
<
/div
>
<
/div
>
:
<
div
className
=
"d-flex align-items-center justify-content-center"
style
=
{{
height
:
'60vh'
}}
>
<
Empty
image
=
{
Empty
.
PRESENTED_IMAGE_SIMPLE
}
/
>
<
/div
>
}
<
/
>
)
}
export
default
ActivityDetailGallaryModal
\ No newline at end of file
\ No newline at end of file
export
default
ActivityDetailGallaryModal
;
components/admin/ActivityDetailsModal.js
View file @
395e763
...
@@ -154,7 +154,7 @@ const ActivityDetailsModal = ({ show, handleClose, activityDetailInfo }) => {
...
@@ -154,7 +154,7 @@ const ActivityDetailsModal = ({ show, handleClose, activityDetailInfo }) => {
<
div
className
=
"col-12 col-lg-6 "
>
<
div
className
=
"col-12 col-lg-6 "
>
<
p
<
p
className
=
"pview cursor-pointer"
className
=
"pview cursor-pointer"
onClick
=
{()
=>
getUrls
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}${
activityDetailInfo
[
0
]?.
attributes
?.
cancellationPolicy
?.
data
?.
attributes
?.
url
}
`)}
onClick
=
{()
=>
getUrls
(
`
${
activityDetailInfo
[
0
]?.
attributes
?.
cancellationPolicy
?.
data
?.
attributes
?.
url
}
`)}
>
>
View
View
</p>
</p>
...
@@ -168,7 +168,7 @@ const ActivityDetailsModal = ({ show, handleClose, activityDetailInfo }) => {
...
@@ -168,7 +168,7 @@ const ActivityDetailsModal = ({ show, handleClose, activityDetailInfo }) => {
</div>
</div>
<div className="col-12 col-lg-6">
<div className="col-12 col-lg-6">
<p className="pview cursor-pointer"
<p className="pview cursor-pointer"
onClick={() => getUrls(`
$
{
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
$
{
activityDetailInfo
[
0
]?.
attributes
?.
termsConditions
?.
data
?.
attributes
?.
url
}
`)}
onClick={() => getUrls(`
$
{
activityDetailInfo
[
0
]?.
attributes
?.
termsConditions
?.
data
?.
attributes
?.
url
}
`)}
>
>
View
View
</p>
</p>
...
...
components/admin/RejectModal.js
View file @
395e763
...
@@ -54,7 +54,7 @@ const RejectModal = ({ show, handleClose, detail, setShowDetail }) => {
...
@@ -54,7 +54,7 @@ const RejectModal = ({ show, handleClose, detail, setShowDetail }) => {
let
response
=
await
updateApprovalStatusAdmin
({
status
:
"rejected"
,
userId
:
detail
[
0
].
attributes
.
user
.
data
.
id
,
rejectionReason
:
data
.
rejectionReason
});
let
response
=
await
updateApprovalStatusAdmin
({
status
:
"rejected"
,
userId
:
detail
[
0
].
attributes
.
user
.
data
.
id
,
rejectionReason
:
data
.
rejectionReason
});
console
.
log
(
response
.
data
);
console
.
log
(
response
.
data
);
await
dispatch
(
getAllVendors
());
await
dispatch
(
getAllVendors
(
{}
));
handleClose
()
handleClose
()
setShowDetail
(
false
);
setShowDetail
(
false
);
}}
}}
...
...
components/admin/VendorDetails.js
View file @
395e763
...
@@ -6,7 +6,7 @@ import Image from "next/image";
...
@@ -6,7 +6,7 @@ import Image from "next/image";
import
RejectModal
from
"./RejectModal"
;
import
RejectModal
from
"./RejectModal"
;
import
ActivityListingRBAC
from
"../vendor/ActivityListingRBAC"
;
import
ActivityListingRBAC
from
"../vendor/ActivityListingRBAC"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
getActivities
ByVendor
,
getActivities
ForAdmin
}
from
"../../redux/actions/activityAction"
;
import
{
getActivitiesForAdmin
}
from
"../../redux/actions/activityAction"
;
import
{
Tag
}
from
"antd"
;
import
{
Tag
}
from
"antd"
;
import
{
updateApprovalStatusAdmin
}
from
"../../redux/actions/userActions"
;
import
{
updateApprovalStatusAdmin
}
from
"../../redux/actions/userActions"
;
import
{
getAllVendors
}
from
"../../redux/actions/vendorActions"
;
import
{
getAllVendors
}
from
"../../redux/actions/vendorActions"
;
...
@@ -25,6 +25,16 @@ const VendorDetails = ({ id, backClick, setShowDetail, showDetail, detail }) =>
...
@@ -25,6 +25,16 @@ const VendorDetails = ({ id, backClick, setShowDetail, showDetail, detail }) =>
dispatch
(
getActivitiesForAdmin
({
vendorId
:
detail
[
0
].
id
}));
dispatch
(
getActivitiesForAdmin
({
vendorId
:
detail
[
0
].
id
}));
},
[
allVendors
]);
},
[
allVendors
]);
const
[
tableCurrentPage
,
settableCurrentPage
]
=
useState
(
1
);
const
[
tableItemsPerPage
,
settableItemsPerPage
]
=
useState
(
10
);
const
onChange
=
(
pagination
,
filters
,
sorter
,
extra
)
=>
{
console
.
log
(
"params"
,
pagination
,
filters
,
sorter
,
extra
);
settableCurrentPage
(
pagination
.
current
);
settableItemsPerPage
(
pagination
.
pageSize
);
dispatch
(
getActivitiesForAdmin
({
vendorId
:
detail
[
0
].
id
,
pageNumber
:
pagination
.
current
,
pageSize
:
pagination
.
pageSize
}));
};
console
.
log
(
"detail"
,
detail
);
console
.
log
(
"detail"
,
detail
);
const
[
showActivityDetailsModal
,
setShowActivityDetailsModal
]
=
useState
(
false
);
const
[
showActivityDetailsModal
,
setShowActivityDetailsModal
]
=
useState
(
false
);
const
[
showRejectModal
,
setShowRejectModal
]
=
useState
(
false
);
const
[
showRejectModal
,
setShowRejectModal
]
=
useState
(
false
);
...
@@ -157,7 +167,7 @@ const VendorDetails = ({ id, backClick, setShowDetail, showDetail, detail }) =>
...
@@ -157,7 +167,7 @@ const VendorDetails = ({ id, backClick, setShowDetail, showDetail, detail }) =>
onClick
=
{
async
()
=>
{
onClick
=
{
async
()
=>
{
await
updateApprovalStatusAdmin
({
status
:
"approved"
,
userId
:
detail
[
0
].
attributes
.
user
.
data
.
id
});
await
updateApprovalStatusAdmin
({
status
:
"approved"
,
userId
:
detail
[
0
].
attributes
.
user
.
data
.
id
});
toast
.
success
(
"User approved"
);
toast
.
success
(
"User approved"
);
await
dispatch
(
getAllVendors
());
await
dispatch
(
getAllVendors
(
{}
));
}}
}}
>
>
Approve
Approve
...
@@ -175,7 +185,13 @@ const VendorDetails = ({ id, backClick, setShowDetail, showDetail, detail }) =>
...
@@ -175,7 +185,13 @@ const VendorDetails = ({ id, backClick, setShowDetail, showDetail, detail }) =>
<
/div
>
<
/div
>
<
div
className
=
"col-12 col-lg-12 mt-4"
>
<
div
className
=
"col-12 col-lg-12 mt-4"
>
<
h4
className
=
"mb-1"
>
Activities
<
/h4
>
<
h4
className
=
"mb-1"
>
Activities
<
/h4
>
<
ActivityListingRBAC
setactivityDetailInfo
=
{
setactivityDetailInfo
}
setShowActivityDetailsModal
=
{
setShowActivityDetailsModal
}
/
>
<
ActivityListingRBAC
setactivityDetailInfo
=
{
setactivityDetailInfo
}
setShowActivityDetailsModal
=
{
setShowActivityDetailsModal
}
onChange
=
{
onChange
}
tableCurrentPage
=
{
tableCurrentPage
}
tableItemsPerPage
=
{
tableItemsPerPage
}
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
...
...
components/admin/VendorListing.js
View file @
395e763
...
@@ -25,7 +25,7 @@ const VendorListing = () => {
...
@@ -25,7 +25,7 @@ const VendorListing = () => {
// selectors
// selectors
const
{
loadedUser
}
=
useSelector
(
state
=>
state
.
loadedUser
);
const
{
loadedUser
}
=
useSelector
(
state
=>
state
.
loadedUser
);
const
{
allVendors
}
=
useSelector
(
state
=>
state
.
allVendors
);
const
{
allVendors
,
loading
:
vendorLoading
,
totalCount
}
=
useSelector
(
state
=>
state
.
allVendors
);
const
toggleMenu
=
index
=>
{
const
toggleMenu
=
index
=>
{
setShowMenuIndex
(
index
===
showMenuIndex
?
null
:
index
);
setShowMenuIndex
(
index
===
showMenuIndex
?
null
:
index
);
};
};
...
@@ -63,9 +63,19 @@ const VendorListing = () => {
...
@@ -63,9 +63,19 @@ const VendorListing = () => {
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
loadedUser
)
return
;
if
(
!
loadedUser
)
return
;
dispatch
(
getAllVendors
());
dispatch
(
getAllVendors
(
{
pageNumber
:
1
,
pageSize
:
10
}
));
},
[
loadedUser
]);
},
[
loadedUser
]);
const
[
tableCurrentPage
,
settableCurrentPage
]
=
useState
(
1
);
const
[
tableItemsPerPage
,
settableItemsPerPage
]
=
useState
(
10
);
const
onChange
=
(
pagination
,
filters
,
sorter
,
extra
)
=>
{
console
.
log
(
"params"
,
pagination
,
filters
,
sorter
,
extra
);
settableCurrentPage
(
pagination
.
current
);
settableItemsPerPage
(
pagination
.
pageSize
);
dispatch
(
getAllVendors
({
pageNumber
:
pagination
.
current
,
pageSize
:
pagination
.
pageSize
}));
};
console
.
log
(
"allVendors"
,
allVendors
);
console
.
log
(
"allVendors"
,
allVendors
);
const
[
vendorId
,
setVendorId
]
=
useState
(
null
);
const
[
vendorId
,
setVendorId
]
=
useState
(
null
);
const
[
showVendorDetails
,
setShowVendorDetails
]
=
useState
(
false
);
const
[
showVendorDetails
,
setShowVendorDetails
]
=
useState
(
false
);
...
@@ -190,7 +200,17 @@ const VendorListing = () => {
...
@@ -190,7 +200,17 @@ const VendorListing = () => {
)
:
(
)
:
(
<
div
>
<
div
>
{
!
showDetail
?
(
{
!
showDetail
?
(
<
Table
loading
=
{
loading
}
columns
=
{
columns
}
dataSource
=
{
data
}
/
>
<
Table
loading
=
{
vendorLoading
}
columns
=
{
columns
}
dataSource
=
{
data
}
onChange
=
{
onChange
}
pagination
=
{{
current
:
tableCurrentPage
,
pageSize
:
tableItemsPerPage
,
total
:
totalCount
}}
/
>
)
:
(
)
:
(
// <VendorDetailModal />
// <VendorDetailModal />
<
VendorDetails
setShowDetail
=
{
setShowDetail
}
showDetail
=
{
showDetail
}
detail
=
{
detail
}
/
>
<
VendorDetails
setShowDetail
=
{
setShowDetail
}
showDetail
=
{
showDetail
}
detail
=
{
detail
}
/
>
...
@@ -201,96 +221,6 @@ const VendorListing = () => {
...
@@ -201,96 +221,6 @@ const VendorListing = () => {
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/Fragment
>
<
/Fragment
>
// <Fragment>
// {!showVendorDetails && (
// <div className="row">
// <div className="col-12 col-lg-12">
// <div className="rightContent">
// <div className="d-flex align-items-center justify-content-between px-2 mb-2">
// <div>
// <h2>Vendors</h2>
// <p>View all the vendors</p>
// </div>
// <div>
// <Button type="button" variant="" className="btnAdd m-0">
// <Image alt="" width="16" height="16" src="/images/vendor/icon-filter.svg" className="me-2" /> Filter
// </Button>
// </div>
// </div>
// <Table responsive className="listingTable">
// <thead>
// <tr>
// <th>
// <label className="check-container mb-0 ps-2" htmlFor="checkh">
// <input type="checkbox" id="checkh" className="check-box" />
// <span className="checkmark"></span>
// </label>
// </th>
// <th>Vendor</th>
// <th>Vendor Id</th>
// <th>Contact Person</th>
// <th>Phone Number</th>
// <th>Email Address</th>
// <th>Status</th>
// <th></th>
// </tr>
// </thead>
// <tbody>
// {array.map((data, index) => (
// <tr key={index}>
// <td>
// <label className="check-container mb-0 ps-2" htmlFor={`check${index}`}>
// <input type="checkbox" id={`check${index}`} className="check-box" />
// <span className="checkmark"></span>
// </label>
// </td>
// <td>
// <span
// onClick={() => {
// setVendorId(1);
// handleShowVendorDetails();
// }}
// >
// M S Adventure
// </span>
// </td>
// <td>VN_ET9797</td>
// <td>Ridge Johnson</td>
// <td>+91 9865 43210</td>
// <td>adventuretrails@example.com</td>
// <td>
// <div className={`statusDiv ${index % 2 ? "inactive" : "active"}`}>{index % 2 ? "Inactive" : "Active"}</div>
// </td>
// <td>
// <div className="actions">
// <div className="ellipse" onClick={() => toggleMenu(index)}>
// <Image alt="" width={20} height={20} src="/images/vendor/icon-more-vertical.svg" />
// </div>
// {showMenuIndex === index && (
// <div className="menu">
// <ul>
// <li>View</li>
// <li>Deactivate</li>
// <li>Delete</li>
// </ul>
// </div>
// )}
// </div>
// </td>
// </tr>
// ))}
// <tr>
// <td colSpan={7}>Showing Results 10 of 1567</td>
// </tr>
// </tbody>
// </Table>
// </div>
// </div>
// </div>
// )}
// {vendorId && showVendorDetails && <VendorDetails id={vendorId} backClick={handleCloseVendorDetails} />}
// </Fragment>
);
);
};
};
...
...
components/vendor/ActivityListingRBAC.js
View file @
395e763
...
@@ -9,16 +9,16 @@ import { loadUser, updateActivityStatusAdmin } from "../../redux/actions/userAct
...
@@ -9,16 +9,16 @@ import { loadUser, updateActivityStatusAdmin } from "../../redux/actions/userAct
import
{
Modal
}
from
"react-bootstrap"
;
import
{
Modal
}
from
"react-bootstrap"
;
import
{
toast
}
from
"react-toastify"
;
import
{
toast
}
from
"react-toastify"
;
const
onChange
=
(
pagination
,
filters
,
sorter
,
extra
)
=>
{
//
const onChange = (pagination, filters, sorter, extra) => {
console
.
log
(
"params"
,
pagination
,
filters
,
sorter
,
extra
);
//
console.log("params", pagination, filters, sorter, extra);
};
//
};
export
const
ActivityListingRBAC
=
({
setactivityDetailInfo
,
setShowActivityDetailsModal
})
=>
{
export
const
ActivityListingRBAC
=
({
setactivityDetailInfo
,
setShowActivityDetailsModal
,
onChange
,
tableCurrentPage
,
tableItemsPerPage
})
=>
{
const
router
=
useRouter
();
const
router
=
useRouter
();
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
// let columns = []
// let columns = []
// useSelectors
// useSelectors
const
{
allActivitiesData
}
=
useSelector
(
state
=>
state
.
allActivitiesData
);
const
{
allActivitiesData
,
loading
,
totalCount
}
=
useSelector
(
state
=>
state
.
allActivitiesData
);
const
{
loadedUser
}
=
useSelector
(
state
=>
state
.
loadedUser
);
const
{
loadedUser
}
=
useSelector
(
state
=>
state
.
loadedUser
);
const
{
categories
}
=
useSelector
(
state
=>
state
.
categories
);
const
{
categories
}
=
useSelector
(
state
=>
state
.
categories
);
const
{
subCategories
}
=
useSelector
(
state
=>
state
.
subCategories
);
const
{
subCategories
}
=
useSelector
(
state
=>
state
.
subCategories
);
...
@@ -431,7 +431,18 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
...
@@ -431,7 +431,18 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
};
};
return
(
return
(
<
div
className
=
"p-5"
>
<
div
className
=
"p-5"
>
<
Table
rowSelection
=
{
rowSelection
}
columns
=
{
columns
}
dataSource
=
{
data
}
onChange
=
{
onChange
}
/
>
<
Table
loading
=
{
loading
}
rowSelection
=
{
rowSelection
}
columns
=
{
columns
}
dataSource
=
{
data
}
onChange
=
{
onChange
}
pagination
=
{{
current
:
tableCurrentPage
,
pageSize
:
tableItemsPerPage
,
total
:
totalCount
}}
/
>
<
Modal
<
Modal
show
=
{
rejectPopUp
}
show
=
{
rejectPopUp
}
onHide
=
{()
=>
{
onHide
=
{()
=>
{
...
...
pages/admin/activities/index.js
View file @
395e763
...
@@ -21,22 +21,37 @@ export default function ActivityListingPage() {
...
@@ -21,22 +21,37 @@ export default function ActivityListingPage() {
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
getActivitiesForAdmin
({}));
dispatch
(
getActivitiesForAdmin
({
pageNumber
:
1
}));
},
[]);
},
[]);
const
[
tableCurrentPage
,
settableCurrentPage
]
=
useState
(
1
);
const
[
tableItemsPerPage
,
settableItemsPerPage
]
=
useState
(
10
);
const
onChange
=
(
pagination
,
filters
,
sorter
,
extra
)
=>
{
console
.
log
(
"params"
,
pagination
,
filters
,
sorter
,
extra
);
settableCurrentPage
(
pagination
.
current
);
settableItemsPerPage
(
pagination
.
pageSize
);
dispatch
(
getActivitiesForAdmin
({
pageNumber
:
pagination
.
current
,
pageSize
:
pagination
.
pageSize
}));
};
return
(
return
(
<
GenericLayout
>
<
GenericLayout
>
{
/* <Layout> */
}
{
/* <Layout> */
}
{
/* <div className="sidebarContainer"> */
}
{
/* <div className="sidebarContainer"> */
}
{
/* <Sidebar /> */
}
{
/* <Sidebar /> */
}
{
/* <div className="content"> */
}
{
/* <div className="content"> */
}
{
/* <ActivityListing /> */
}
{
/* <ActivityListing /> */
}
<
ActivityListingRBAC
setactivityDetailInfo
=
{
setactivityDetailInfo
}
setShowActivityDetailsModal
=
{
setShowActivityDetailsModal
}
/
>
<
ActivityListingRBAC
{
showActivityDetailsModal
&&
(
setactivityDetailInfo
=
{
setactivityDetailInfo
}
<
ActivityDetailsModal
show
=
{
showActivityDetailsModal
}
handleClose
=
{
handleCloseActivityDetails
}
activityDetailInfo
=
{
activityDetailInfo
}
/
>
setShowActivityDetailsModal
=
{
setShowActivityDetailsModal
}
)}
onChange
=
{
onChange
}
{
/* </div> */
}
tableCurrentPage
=
{
tableCurrentPage
}
{
/* </div> */
}
tableItemsPerPage
=
{
tableItemsPerPage
}
{
/* </Layout> */
}
/
>
{
showActivityDetailsModal
&&
<
ActivityDetailsModal
show
=
{
showActivityDetailsModal
}
handleClose
=
{
handleCloseActivityDetails
}
activityDetailInfo
=
{
activityDetailInfo
}
/>
}
{
/* </div> */
}
{
/* </div> */
}
{
/* </Layout> */
}
<
/GenericLayout
>
<
/GenericLayout
>
);
);
}
}
...
...
pages/admin/reviews/index.js
View file @
395e763
...
@@ -29,7 +29,6 @@ export default ReviewsPage;
...
@@ -29,7 +29,6 @@ export default ReviewsPage;
export
const
getServerSideProps
=
wrapper
.
getServerSideProps
(
store
=>
async
({
req
,
query
})
=>
{
export
const
getServerSideProps
=
wrapper
.
getServerSideProps
(
store
=>
async
({
req
,
query
})
=>
{
// await store.dispatch(loadUser());
// await store.dispatch(loadUser());
await
store
.
dispatch
(
getActivitiesByFilters
({}));
await
store
.
dispatch
(
getActivitiesByFilters
({}));
// await store.dispatch(getAllVendors());
// await store.dispatch(loadUser());
// await store.dispatch(loadUser());
// await store.dispatch(getActivitiesByVendor());
// await store.dispatch(getActivitiesByVendor());
// await store.dispatch(getAllCategories());
// await store.dispatch(getAllCategories());
...
...
pages/admin/vendors/index.js
View file @
395e763
...
@@ -3,7 +3,6 @@ import Layout from "../../../components/layout/Layout";
...
@@ -3,7 +3,6 @@ import Layout from "../../../components/layout/Layout";
import
Sidebar
from
"../../../components/layout/AdminDashboardSidebar"
;
import
Sidebar
from
"../../../components/layout/AdminDashboardSidebar"
;
import
VendorListing
from
"../../../components/admin/VendorListing"
;
import
VendorListing
from
"../../../components/admin/VendorListing"
;
import
{
wrapper
}
from
"../../../redux/store"
;
import
{
wrapper
}
from
"../../../redux/store"
;
import
{
getAllVendors
}
from
"../../../redux/actions/vendorActions"
;
import
{
loadUser
}
from
"../../../redux/actions/userActions"
;
import
{
loadUser
}
from
"../../../redux/actions/userActions"
;
import
{
getAllCategories
,
getAllSubCategories
}
from
"../../../redux/actions/categoriesAction"
;
import
{
getAllCategories
,
getAllSubCategories
}
from
"../../../redux/actions/categoriesAction"
;
import
{
GenericLayout
}
from
"../../../components/layout/Generics/GenericLayout"
;
import
{
GenericLayout
}
from
"../../../components/layout/Generics/GenericLayout"
;
...
@@ -29,7 +28,6 @@ export default function VendorListingPage() {
...
@@ -29,7 +28,6 @@ export default function VendorListingPage() {
// // get the locations data.
// // get the locations data.
// await store.dispatch(loadUser());
// await store.dispatch(loadUser());
// await store.dispatch(getAllVendors());
// return {
// return {
// props: {}
// props: {}
...
@@ -39,7 +37,6 @@ export default function VendorListingPage() {
...
@@ -39,7 +37,6 @@ export default function VendorListingPage() {
/** For server side rendering */
/** For server side rendering */
export
const
getServerSideProps
=
wrapper
.
getServerSideProps
(
store
=>
async
({
req
,
query
})
=>
{
export
const
getServerSideProps
=
wrapper
.
getServerSideProps
(
store
=>
async
({
req
,
query
})
=>
{
// await store.dispatch(loadUser());
// await store.dispatch(loadUser());
// await store.dispatch(getAllVendors());
await
store
.
dispatch
(
loadUser
());
await
store
.
dispatch
(
loadUser
());
// await store.dispatch(getActivitiesByVendor());
// await store.dispatch(getActivitiesByVendor());
await
store
.
dispatch
(
getAllCategories
());
await
store
.
dispatch
(
getAllCategories
());
...
...
pages/vendor/activities/[id].js
View file @
395e763
...
@@ -6,7 +6,6 @@ import React from "react";
...
@@ -6,7 +6,6 @@ import React from "react";
// import { ToastContainer } from "react-bootstrap";
// import { ToastContainer } from "react-bootstrap";
import
Sidebar
from
"../../../components/layout/VendorDashboardSidebar"
;
import
Sidebar
from
"../../../components/layout/VendorDashboardSidebar"
;
import
ActivityDetails
from
"../../../components/vendor/ActivityDetails"
;
import
ActivityDetails
from
"../../../components/vendor/ActivityDetails"
;
import
ActivityListingRBAC
from
"../../../components/vendor/ActivityListingRBAC"
;
import
UpdateActivity
from
"../../../components/vendor/UpdateActivity"
;
import
UpdateActivity
from
"../../../components/vendor/UpdateActivity"
;
import
{
getActivitiesByVendor
,
getActivityById
}
from
"../../../redux/actions/activityAction"
;
import
{
getActivitiesByVendor
,
getActivityById
}
from
"../../../redux/actions/activityAction"
;
import
{
getAllCategories
,
getAllSubCategories
}
from
"../../../redux/actions/categoriesAction"
;
import
{
getAllCategories
,
getAllSubCategories
}
from
"../../../redux/actions/categoriesAction"
;
...
@@ -19,17 +18,6 @@ const EditActivityDetail = () => {
...
@@ -19,17 +18,6 @@ const EditActivityDetail = () => {
<
GenericLayout
>
<
GenericLayout
>
<
ActivityDetails
isUpdate
=
{
true
}
/
>
<
ActivityDetails
isUpdate
=
{
true
}
/
>
<
/GenericLayout
>
<
/GenericLayout
>
// <Layout>
// <ToastContainer position="bottom-right"></ToastContainer>
// <div className="sidebarContainer">
// <Sidebar />
// <div className="content">
// <ActivityListingRBAC />
// <ActivityDetails isUpdate={true} />
// <UpdateActivity />
// </div>
// </div>
// </Layout>
);
);
};
};
...
...
pages/vendor/activities/index.js
View file @
395e763
...
@@ -16,15 +16,24 @@ export default function ActivityListingPage() {
...
@@ -16,15 +16,24 @@ export default function ActivityListingPage() {
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
getActivitiesByVendor
());
dispatch
(
getActivitiesByVendor
());
dispatch
(
loadUser
())
dispatch
(
loadUser
())
;
},
[]);
},
[]);
const
[
tableCurrentPage
,
settableCurrentPage
]
=
useState
(
1
);
const
[
tableItemsPerPage
,
settableItemsPerPage
]
=
useState
(
10
);
const
onChange
=
(
pagination
,
filters
,
sorter
,
extra
)
=>
{
console
.
log
(
"params"
,
pagination
,
filters
,
sorter
,
extra
);
settableCurrentPage
(
pagination
.
current
);
settableItemsPerPage
(
pagination
.
pageSize
);
dispatch
(
getActivitiesByVendor
());
};
return
(
return
(
<
GenericLayout
>
<
GenericLayout
>
{
/* <div className="sidebarContainer">
{
/* <div className="sidebarContainer">
<Sidebar />
<Sidebar />
<div className="content"> */
}
<div className="content"> */
}
<
ActivityListingRBAC
/>
<
ActivityListingRBAC
onChange
=
{
onChange
}
tableCurrentPage
=
{
tableCurrentPage
}
tableItemsPerPage
=
{
tableItemsPerPage
}
/
>
{
/* </div>
{
/* </div>
</div> */
}
</div> */
}
<
/GenericLayout
>
<
/GenericLayout
>
...
...
pages/vendor/reviews/index.js
View file @
395e763
...
@@ -31,7 +31,6 @@ export default ReviewsPage;
...
@@ -31,7 +31,6 @@ export default ReviewsPage;
export
const
getServerSideProps
=
wrapper
.
getServerSideProps
(
store
=>
async
({
req
,
query
})
=>
{
export
const
getServerSideProps
=
wrapper
.
getServerSideProps
(
store
=>
async
({
req
,
query
})
=>
{
// await store.dispatch(loadUser());
// await store.dispatch(loadUser());
// await store.dispatch(getActivitiesByVendor());
// await store.dispatch(getActivitiesByVendor());
// await store.dispatch(getAllVendors());
// await store.dispatch(loadUser());
// await store.dispatch(loadUser());
// await store.dispatch(getActivitiesByVendor());
// await store.dispatch(getActivitiesByVendor());
// await store.dispatch(getAllCategories());
// await store.dispatch(getAllCategories());
...
...
redux/actions/activityAction.js
View file @
395e763
...
@@ -61,99 +61,102 @@ export const createActivity = data => async dispatch => {
...
@@ -61,99 +61,102 @@ export const createActivity = data => async dispatch => {
}
}
};
};
export
const
getActivitiesByVendor
=
()
=>
async
dispatch
=>
{
export
const
getActivitiesByVendor
=
// console.log("data", data);
()
=>
const
session
=
await
getSession
();
async
dispatch
=>
{
console
.
log
(
"session"
,
session
);
// console.log("data", data);
try
{
const
session
=
await
getSession
();
const
vendorConfig
=
{
console
.
log
(
"session"
,
session
);
headers
:
{
try
{
"Content-Type"
:
"application/json"
,
const
vendorConfig
=
{
Authorization
:
`Bearer
${
session
.
jwt
}
`
headers
:
{
}
"Content-Type"
:
"application/json"
,
};
Authorization
:
`Bearer
${
session
.
jwt
}
`
const
vendorQuery
=
{
filters
:
{
user
:
{
id
:
{
$eq
:
session
.
id
}
}
}
}
};
};
const
vendorQuery
=
{
filters
:
{
const
vendorQueryString
=
qs
.
stringify
(
vendorQuery
,
{
user
:
{
encodeValuesOnly
:
true
id
:
{
$eq
:
session
.
id
}
});
}
}
};
const
vendorResponse
=
await
axios
.
get
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/vendors/?
${
vendorQueryString
}
`
,
vendorConfig
);
const
vendorQueryString
=
qs
.
stringify
(
vendorQuery
,
{
encodeValuesOnly
:
true
});
console
.
log
(
"vendorResponse"
,
vendorResponse
.
data
.
data
[
0
].
id
);
const
vendorResponse
=
await
axios
.
get
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/vendors/?
${
vendorQueryString
}
`
,
vendorConfig
);
// const loggedinVendor = await getLoggedInVendor()
// console.log("loggedinVendor", loggedinVendor);
if
(
!
session
)
{
return
"You are not authenticated, please log in."
;
}
dispatch
({
type
:
GET_ACTIVITIES_REQUEST
,
loading
:
true
});
const
config
=
{
console
.
log
(
"vendorResponse"
,
vendorResponse
.
data
.
data
[
0
].
id
);
headers
:
{
// const loggedinVendor = await getLoggedInVendor()
"Content-Type"
:
"application/json"
// console.log("loggedinVendor", loggedinVendor);
// Authorization: `Bearer ${session.jwt}`
if
(
!
session
)
{
return
"You are not authenticated, please log in."
;
}
}
};
dispatch
({
type
:
GET_ACTIVITIES_REQUEST
,
loading
:
true
});
const
query
=
{
const
config
=
{
filters
:
{
headers
:
{
vendor
:
{
"Content-Type"
:
"application/json"
id
:
{
// Authorization: `Bearer ${session.jwt}`
$eq
:
vendorResponse
.
data
.
data
[
0
].
id
}
}
}
},
};
pagination
:
{
pageSize
:
1000
const
query
=
{
},
filters
:
{
populate
:
[
vendor
:
{
"masterMonths"
,
id
:
{
"subCategory"
,
$eq
:
vendorResponse
.
data
.
data
[
0
].
id
"subCategory.category"
,
}
"timeSlots"
,
}
"masterPincode"
,
},
"vendor"
,
pagination
:
{
"category"
,
pageSize
:
1000
,
"imagesComponent"
,
// page: pageNumber
"imagesComponent.image"
,
},
"image"
,
populate
:
[
"termsConditions"
,
"masterMonths"
,
"cancellationPolicy"
,
"subCategory"
,
"reviews"
"subCategory.category"
,
]
"timeSlots"
,
};
"masterPincode"
,
const
queryString
=
qs
.
stringify
(
query
,
{
"vendor"
,
encodeValuesOnly
:
true
"category"
,
});
"imagesComponent"
,
// let activityData = {
"imagesComponent.image"
,
// data: {
"image"
,
// ...data
"termsConditions"
,
// }
"cancellationPolicy"
,
// };
"reviews"
console
.
log
(
query
);
]
const
response
=
await
axios
.
get
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/experiences?
${
queryString
}
`
,
config
);
};
console
.
log
(
"Response"
,
response
.
data
);
const
queryString
=
qs
.
stringify
(
query
,
{
dispatch
({
encodeValuesOnly
:
true
type
:
GET_ACTIVITIES_SUCCESS
,
});
payload
:
response
.
data
// let activityData = {
});
// data: {
return
response
.
data
;
// ...data
}
catch
(
error
)
{
// }
dispatch
({
// };
type
:
GET_ACTIVITIES_FAIL
,
console
.
log
(
query
);
payload
:
error
.
response
.
data
const
response
=
await
axios
.
get
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/experiences?
${
queryString
}
`
,
config
);
});
console
.
log
(
"Response"
,
response
.
data
);
}
dispatch
({
};
type
:
GET_ACTIVITIES_SUCCESS
,
payload
:
response
.
data
});
return
response
.
data
;
}
catch
(
error
)
{
dispatch
({
type
:
GET_ACTIVITIES_FAIL
,
payload
:
error
.
response
.
data
});
}
};
export
const
getActivityById
=
id
=>
async
dispatch
=>
{
export
const
getActivityById
=
id
=>
async
dispatch
=>
{
try
{
try
{
...
@@ -250,7 +253,7 @@ export const updateActivityById =
...
@@ -250,7 +253,7 @@ export const updateActivityById =
};
};
export
const
getActivitiesForAdmin
=
export
const
getActivitiesForAdmin
=
({
vendorId
})
=>
({
vendorId
,
pageNumber
=
1
,
pageSize
=
10
})
=>
async
dispatch
=>
{
async
dispatch
=>
{
try
{
try
{
dispatch
({
dispatch
({
...
@@ -274,10 +277,11 @@ export const getActivitiesForAdmin =
...
@@ -274,10 +277,11 @@ export const getActivitiesForAdmin =
}
}
},
},
pagination
:
{
pagination
:
{
pageSize
:
1000
pageSize
:
pageSize
,
page
:
pageNumber
},
},
populate
:
[
populate
:
[
"masterMonths"
,
//
"masterMonths",
"subCategory"
,
"subCategory"
,
"subCategory.category"
,
"subCategory.category"
,
"timeSlots"
,
"timeSlots"
,
...
@@ -286,7 +290,7 @@ export const getActivitiesForAdmin =
...
@@ -286,7 +290,7 @@ export const getActivitiesForAdmin =
"category"
,
"category"
,
"imagesComponent"
,
"imagesComponent"
,
"imagesComponent.image"
,
"imagesComponent.image"
,
"image"
,
//
"image",
"termsConditions"
,
"termsConditions"
,
"cancellationPolicy"
,
"cancellationPolicy"
,
"reviews"
"reviews"
...
@@ -303,7 +307,7 @@ export const getActivitiesForAdmin =
...
@@ -303,7 +307,7 @@ export const getActivitiesForAdmin =
// };
// };
const
response
=
await
axios
.
get
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/experiences?
${
queryString
}
`
,
config
);
const
response
=
await
axios
.
get
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/experiences?
${
queryString
}
`
,
config
);
//
console.log("Response", response.data);
console
.
log
(
"Response"
,
response
.
data
);
dispatch
({
dispatch
({
type
:
GET_ACTIVITIES_SUCCESS
,
type
:
GET_ACTIVITIES_SUCCESS
,
payload
:
response
.
data
payload
:
response
.
data
...
...
redux/actions/vendorActions.js
View file @
395e763
...
@@ -137,7 +137,7 @@ export const getLoggedInVendor = () => async dispatch => {
...
@@ -137,7 +137,7 @@ export const getLoggedInVendor = () => async dispatch => {
export
const
getVendorDetails
=
()
=>
async
dispatch
=>
{
export
const
getVendorDetails
=
()
=>
async
dispatch
=>
{
const
session
=
await
getSession
();
const
session
=
await
getSession
();
if
(
!
session
)
{
if
(
!
session
)
{
return
return
;
}
}
try
{
try
{
dispatch
({
dispatch
({
...
@@ -187,53 +187,60 @@ export const getVendorDetails = () => async dispatch => {
...
@@ -187,53 +187,60 @@ export const getVendorDetails = () => async dispatch => {
}
}
};
};
export
const
getAllVendors
=
()
=>
async
dispatch
=>
{
export
const
getAllVendors
=
const
session
=
await
getSession
();
({
pageNumber
=
1
,
pageSize
=
10
})
=>
try
{
async
dispatch
=>
{
dispatch
({
const
session
=
await
getSession
();
type
:
GET_ALL_VENDORS_REQUEST
try
{
});
dispatch
({
type
:
GET_ALL_VENDORS_REQUEST
});
// console.log("here 1", session);
// console.log("here 1", session);
const
config
=
{
const
config
=
{
headers
:
{
headers
:
{
"Content-Type"
:
"Application/json"
,
"Content-Type"
:
"Application/json"
,
Authorization
:
`Bearer
${
session
.
jwt
}
`
Authorization
:
`Bearer
${
session
.
jwt
}
`
}
};
if
(
!
session
)
{
return
;
}
}
};
const
query
=
{
// console.log("here 2");
// filters: {
if
(
!
session
)
{
// user: {
return
;
// id: {
}
// $eq: session.id
const
query
=
{
// }
// filters: {
// }
// user: {
// },
// id: {
populate
:
[
"user"
,
"experiences"
,
"brandLogo"
],
// $eq: session.id
sort
:
[
"createdAt:desc"
],
// }
pagination
:
{
// }
pageSize
:
pageSize
,
// },
page
:
pageNumber
populate
:
[
"user"
,
"experiences"
,
"brandLogo"
],
}
sort
:
[
"createdAt:desc"
]
};
};
// console.log("here 3", query);
// console.log("here 3", query);
const
queryString
=
qs
.
stringify
(
query
,
{
const
queryString
=
qs
.
stringify
(
query
,
{
encodeValuesOnly
:
true
encodeValuesOnly
:
true
});
});
console
.
log
(
"session"
,
session
,
session
.
id
);
// console.log("session", session, session.id);
const
response
=
await
axios
.
get
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/vendors/?
${
queryString
}
`
,
config
);
const
response
=
await
axios
.
get
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/vendors/?
${
queryString
}
`
,
config
);
console
.
log
(
"response"
,
response
);
console
.
log
(
"response"
,
response
);
dispatch
({
dispatch
({
type
:
GET_ALL_VENDORS_SUCCESS
,
type
:
GET_ALL_VENDORS_SUCCESS
,
payload
:
response
.
data
.
data
payload
:
response
.
data
.
data
,
});
totalCount
:
response
.
data
.
meta
.
pagination
.
total
,
resultsPerPage
:
response
.
data
.
meta
.
pagination
.
pageSize
});
return
response
.
data
.
data
[
0
];
return
response
.
data
.
data
[
0
];
}
catch
(
error
)
{
}
catch
(
error
)
{
dispatch
({
dispatch
({
type
:
GET_ALL_VENDORS_FAIL
,
type
:
GET_ALL_VENDORS_FAIL
,
payload
:
error
.
response
.
data
payload
:
error
.
response
.
data
});
});
}
}
};
};
redux/reducers/vendorReducers.js
View file @
395e763
import
{
UPDATE_VENDOR_DETAILS_FAIL
,
UPDATE_VENDOR_DETAILS_REQUEST
,
UPDATE_VENDOR_DETAILS_SUCCESS
,
CLEAR_ERRORS
,
GET_LOGGED_IN_VENDOR_REQUEST
,
GET_LOGGED_IN_VENDOR_SUCCESS
,
GET_LOGGED_IN_VENDOR_FAIL
,
GET_VENDOR_DETAILS_FAIL
,
GET_VENDOR_DETAILS_SUCCESS
,
GET_VENDOR_DETAILS_REQUEST
,
GET_ALL_VENDORS_REQUEST
,
GET_ALL_VENDORS_SUCCESS
,
GET_ALL_VENDORS_FAIL
}
from
"../constants/vendorConstants"
;
import
{
UPDATE_VENDOR_DETAILS_FAIL
,
UPDATE_VENDOR_DETAILS_REQUEST
,
UPDATE_VENDOR_DETAILS_SUCCESS
,
CLEAR_ERRORS
,
GET_LOGGED_IN_VENDOR_REQUEST
,
GET_LOGGED_IN_VENDOR_SUCCESS
,
GET_LOGGED_IN_VENDOR_FAIL
,
GET_VENDOR_DETAILS_FAIL
,
GET_VENDOR_DETAILS_SUCCESS
,
GET_VENDOR_DETAILS_REQUEST
,
GET_ALL_VENDORS_REQUEST
,
GET_ALL_VENDORS_SUCCESS
,
GET_ALL_VENDORS_FAIL
}
from
"../constants/vendorConstants"
;
// Load user reducer
// Load user reducer
export
const
loggedInVendorReducer
=
(
state
=
{
loading
:
true
,
success
:
false
,
loggedInVendor
:
null
},
action
)
=>
{
export
const
loggedInVendorReducer
=
(
state
=
{
loading
:
true
,
success
:
false
,
loggedInVendor
:
null
},
action
)
=>
{
...
@@ -100,13 +113,15 @@ export const getAllVendorsReducer = (state = { loading: true, success: false, al
...
@@ -100,13 +113,15 @@ export const getAllVendorsReducer = (state = { loading: true, success: false, al
switch
(
action
.
type
)
{
switch
(
action
.
type
)
{
case
GET_ALL_VENDORS_REQUEST
:
case
GET_ALL_VENDORS_REQUEST
:
return
{
return
{
loading
:
true
,
loading
:
true
};
};
case
GET_ALL_VENDORS_SUCCESS
:
case
GET_ALL_VENDORS_SUCCESS
:
return
{
return
{
loading
:
false
,
loading
:
false
,
allVendors
:
action
.
payload
allVendors
:
action
.
payload
,
totalCount
:
action
.
totalCount
,
resultsPerPage
:
action
.
resultsPerPage
};
};
case
GET_ALL_VENDORS_FAIL
:
case
GET_ALL_VENDORS_FAIL
:
...
@@ -124,4 +139,4 @@ export const getAllVendorsReducer = (state = { loading: true, success: false, al
...
@@ -124,4 +139,4 @@ export const getAllVendorsReducer = (state = { loading: true, success: false, al
default
:
default
:
return
state
;
return
state
;
}
}
};
\ No newline at end of file
\ No newline at end of file
};
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