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 7db3c4ce
authored
2024-07-01 13:52:47 +0530
by
jaymehta
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
.
1 parent
90695a54
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
740 additions
and
250 deletions
components/admin/Enquiries.js
components/admin/EnquiryDetailModal.js
components/admin/GiftcardListing.js
components/admin/ReviewsListing.js
components/admin/VendorDetails.js
components/admin/VendorListing.js
components/listing/ListingInner.js
components/listing/ListingItems.js
components/vendor/ActivityListingRBAC.js
pages/activities/[id].js
pages/admin/enquiries/index.js
pages/admin/vendors/index.js
pages/listing.js
redux/actions/activityAction.js
redux/actions/enquiryAction.js
redux/actions/vendorActions.js
redux/constants/enquiryConstants.js
redux/reducers/enquiryReducer.js
redux/reducers/reducers.js
redux/reducers/userReducers.js
redux/reducers/vendorReducers.js
components/admin/Enquiries.js
View file @
7db3c4c
import
React
from
'react'
import
{
EyeTwoTone
}
from
"@ant-design/icons"
;
import
{
Space
,
Table
,
Tag
}
from
"antd"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
Modal
}
from
"react-bootstrap"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
getEnquiriesByAdmin
}
from
"../../redux/actions/enquiryAction"
;
import
EnquiryDetailModal
from
"./EnquiryDetailModal"
;
const
Enquiries
=
()
=>
{
const
Enquiries
=
()
=>
{
const
{
enquiriesByAdmin
}
=
useSelector
(
state
=>
state
.
enquiriesByAdmin
);
const
dispatch
=
useDispatch
();
const
[
data
,
setdata
]
=
useState
();
const
[
columns
,
setcolumns
]
=
useState
();
const
[
details
,
setdetails
]
=
useState
();
const
[
detailsModal
,
setdetailsModal
]
=
useState
(
false
);
useEffect
(()
=>
{
dispatch
(
getEnquiriesByAdmin
());
},
[]);
useEffect
(()
=>
{
setcolumns
([
{
title
:
"Name"
,
dataIndex
:
"name"
,
key
:
"name"
},
{
title
:
"Date"
,
dataIndex
:
"date"
,
key
:
"date"
},
{
title
:
"Quantity"
,
dataIndex
:
"quantity"
,
key
:
"quantity"
},
{
title
:
"Status"
,
dataIndex
:
"status"
,
key
:
"status"
,
render
:
tag
=>
(
<
span
>
{
tag
==
"pending"
?
(
<
Tag
color
=
{
"red"
}
key
=
{
tag
}
>
{
tag
.
toUpperCase
()}
<
/Tag
>
)
:
(
<
Tag
color
=
{
"blue"
}
key
=
{
tag
}
>
{
tag
===
"closed"
?
"closed"
:
tag
.
toUpperCase
()}
<
/Tag
>
)}
<
/span
>
)
},
{
title
:
"Activity Name"
,
dataIndex
:
"experienceName"
,
key
:
"experienceName"
},
{
title
:
"Vendor name"
,
dataIndex
:
"vendorName"
,
key
:
"vendorName"
},
{
title
:
"See details"
,
render
:
(
_
,
record
)
=>
(
<
Space
size
=
"middle"
>
{
/* <a>Invite {record.name}</a> */
}
<
EyeTwoTone
style
=
{{
fontSize
:
"22px"
}}
onClick
=
{()
=>
{
setdetailsModal
(
true
);
// setactivityId(record.key);
setdetails
({
experience
:
record
.
experience
,
vendor
:
record
.
vendor
,
endUser
:
record
.
endUser
});
// router.push(`/vendor/activities/${record.key}`);
// console.log(record);
}}
/
>
<
/Space
>
),
width
:
"10%"
}
]);
if
(
enquiriesByAdmin
&&
enquiriesByAdmin
.
data
.
length
>
0
)
{
setdata
(
enquiriesByAdmin
.
data
.
map
(
item
=>
{
return
{
key
:
item
.
id
,
date
:
item
.
attributes
.
date
,
quantity
:
item
.
attributes
.
quantity
,
status
:
item
.
attributes
.
status
,
endUser
:
item
.
attributes
.
end_user
,
experience
:
item
.
attributes
.
experience
,
name
:
item
.
attributes
.
end_user
.
data
.
attributes
.
name
,
experienceName
:
item
.
attributes
.
experience
.
data
?.
attributes
.
name
,
vendorName
:
item
.
attributes
.
vendor
.
data
.
attributes
.
name
,
vendor
:
item
.
attributes
.
vendor
};
})
);
}
// const dataSource = [
// {
// key: "1",
// name: "Mike",
// age: 32,
// address: "10 Downing Street"
// },
// {
// key: "2",
// name: "John",
// age: 42,
// address: "10 Downing Street"
// }
// ];
// const columns = [
// {
// title: "Name",
// dataIndex: "name",
// key: "name"
// },
// {
// title: "Age",
// dataIndex: "age",
// key: "age"
// },
// {
// title: "Address",
// dataIndex: "address",
// key: "address"
// }
// ];
},
[
enquiriesByAdmin
]);
console
.
log
(
"enquiriesByAdmin"
,
enquiriesByAdmin
);
console
.
log
(
"data"
,
details
)
return
(
return
(
<
div
>
Enquiries
<
/div
>
<
div
>
)
<
Table
dataSource
=
{
data
}
columns
=
{
columns
}
/
>
}
<
Modal
show
=
{
detailsModal
}
onHide
=
{()
=>
setdetailsModal
(
false
)}
>
<
Modal
.
Header
>
Enquiry
details
<
/Modal.Header
>
<
Modal
.
Body
>
<
EnquiryDetailModal
data
=
{
details
}
setdetailsModal
=
{
setdetailsModal
}
/
>
<
/Modal.Body
>
<
/Modal
>
<
/div
>
);
};
export
default
Enquiries
\ No newline at end of file
\ No newline at end of file
export
default
Enquiries
;
components/admin/EnquiryDetailModal.js
0 → 100644
View file @
7db3c4c
import
React
,
{
Fragment
}
from
"react"
;
import
{
FaAngleLeft
}
from
"react-icons/fa"
;
const
EnquiryDetailModal
=
({
data
,
setdetailsModal
})
=>
{
return
(
<
div
>
<
Fragment
>
<
div
className
=
"vendorDetails"
>
<
div
className
=
"row"
>
<
div
className
=
"col-12 col-lg-12"
>
<
div
className
=
"d-flex align-items-center justify-content-between"
>
<
div
className
=
"backDiv"
>
<
span
className
=
"backArrow"
>
<
FaAngleLeft
onClick
=
{()
=>
{
setdetailsModal
(
false
);
}}
/
>
<
/span
>
<
span
>
Vendors
List
<
/span
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"col-8 col-lg-8 mt-4"
>
{
/* <h4>End user</h4> */
}
<
div
className
=
"row"
>
<
div
className
=
"col-12 col-lg-5"
>
<
p
className
=
"phead"
>
User
details
<
/p
>
{
/* <div className="row">
<p className="col-12 col-lg-6">Business PAN No.</p>
<p className="col-12 col-lg-6">{detail[0].attributes.pan}</p>
</div> */
}
{
/* <div className="row">
<p className="col-12 col-lg-6">PAN</p>
<p className="col-12 col-lg-6 pview">View</p>
</div> */
}
<
div
className
=
"row"
>
<
p
className
=
"col-12 col-lg-6"
>
Name
<
/p
>
<
p
className
=
"col-12 col-lg-6"
>
{
data
.
endUser
.
data
.
attributes
.
name
}
<
/p
>
<
/div
>
{
/* <div className="row">
<p className="col-12 col-lg-6">GST Certificate</p>
<p className="col-12 col-lg-6 pview">View</p>
</div> */
}
<
div
className
=
"row"
>
<
p
className
=
"col-12 col-lg-6"
>
Email
<
/p
>
<
p
className
=
"col-12 col-lg-6"
>
{
data
.
endUser
.
data
.
attributes
.
email
}
<
/p
>
<
/div
>
<
div
className
=
"row"
>
<
p
className
=
"col-12 col-lg-6"
>
Phone
<
/p
>
<
p
className
=
"col-12 col-lg-6"
>
{
data
.
endUser
.
data
.
attributes
.
phone
}
<
/p
>
<
/div
>
{
/* <div className="row">
<p className="col-12 col-lg-6">Vendor website:</p>
<p className="col-12 col-lg-6">{detail[0].attributes.businessName}</p>
</div> */
}
<
/div
>
<
div
className
=
"col-12 col-lg-7 borderLeft"
>
<
p
className
=
"phead"
>
Activity
<
/p
>
<
div
className
=
"row"
>
<
p
className
=
"col-12 col-lg-4"
>
Activity
Name
<
/p
>
<
p
className
=
"col-12 col-lg-8"
>
{
data
.
experience
.
data
.
attributes
.
name
}
<
/p
>
<
/div
>
<
div
className
=
"row"
>
<
p
className
=
"col-12 col-lg-4"
>
Link
<
/p
>
<
p
className
=
"col-12 col-lg-8"
>
<
a
href
=
{
data
.
experience
.
data
.
attributes
.
link
}
target
=
"_blank"
>
{
data
.
experience
.
data
.
attributes
.
link
}
<
/a
>
<
/p
>
<
/div
>
<
div
className
=
"row"
>
<
p
className
=
"col-12 col-lg-4"
>
Activity
Name
<
/p
>
<
p
className
=
"col-12 col-lg-8"
>
{
data
.
experience
.
data
.
attributes
.
name
}
<
/p
>
<
/div
>
<
div
className
=
"row"
>
<
p
className
=
"col-12 col-lg-4"
>
Country
<
/p
>
<
p
className
=
"col-12 col-lg-8"
>
United
States
<
/p
>
<
/div
>
<
/div
>
<
div
className
=
"col-12 col-lg-7 borderLeft"
>
<
p
className
=
"phead"
>
Vendor
Details
<
/p
>
<
div
className
=
"row"
>
<
p
className
=
"col-12 col-lg-4"
>
Vendor
Name
<
/p
>
<
p
className
=
"col-12 col-lg-8"
>
{
data
.
vendor
.
data
.
attributes
.
name
}
<
/p
>
<
/div
>
{
/* <div className="row">
<p className="col-12 col-lg-4">Link</p>
<p className="col-12 col-lg-8">
<a href={data.experience.data.attributes.link} target="_blank">
{data.experience.data.attributes.link}
</a>
</p>
</div> */
}
<
div
className
=
"row"
>
<
p
className
=
"col-12 col-lg-4"
>
Vendor
email
<
/p
>
<
p
className
=
"col-12 col-lg-8"
>
{
data
.
vendor
.
data
.
attributes
.
email
}
<
/p
>
<
/div
>
<
div
className
=
"row"
>
<
p
className
=
"col-12 col-lg-4"
>
Vendor
Phone
<
/p
>
<
p
className
=
"col-12 col-lg-8"
>
{
data
.
vendor
.
data
.
attributes
.
phone
}
<
/p
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
{
/* {showActivityDetailsModal && <ActivityDetailsModal show={showActivityDetailsModal} handleClose={handleCloseActivityDetails} activityDetailInfo={activityDetailInfo} />}
{showRejectModal && <RejectModal show={showRejectModal} handleClose={handleCloseRejectModal} detail={detail} setShowDetail={setShowDetail} />} */
}
<
/Fragment
>
<
/div
>
);
};
export
default
EnquiryDetailModal
;
components/admin/GiftcardListing.js
View file @
7db3c4c
...
@@ -6,8 +6,8 @@ import { DownCircleOutlined, MoreOutlined } from "@ant-design/icons";
...
@@ -6,8 +6,8 @@ import { DownCircleOutlined, MoreOutlined } from "@ant-design/icons";
import
{
getSession
}
from
"next-auth/react"
;
import
{
getSession
}
from
"next-auth/react"
;
import
{
toast
}
from
"react-toastify"
;
import
{
toast
}
from
"react-toastify"
;
const
GiftcardListing
=
()
=>
{
const
GiftcardListing
=
()
=>
{
const
[
session
,
setSession
]
=
useState
()
const
[
session
,
setSession
]
=
useState
()
;
const
[
update
,
setupdate
]
=
useState
(
false
)
const
[
update
,
setupdate
]
=
useState
(
false
)
;
useEffect
(()
=>
{
useEffect
(()
=>
{
const
fetchSession
=
async
()
=>
{
const
fetchSession
=
async
()
=>
{
setSession
(
await
getSession
());
setSession
(
await
getSession
());
...
@@ -17,41 +17,46 @@ const GiftcardListing = () => {
...
@@ -17,41 +17,46 @@ const GiftcardListing = () => {
},
[]);
},
[]);
const
[
giftData
,
setGiftData
]
=
useState
([]);
const
[
giftData
,
setGiftData
]
=
useState
([]);
useEffect
(()
=>
{
useEffect
(()
=>
{
axios
.
get
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/gift-cards`
).
then
((
res
)
=>
{
axios
let
giftDatas
=
.
get
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/gift-cards`
)
res
.
data
&&
.
then
(
res
=>
{
res
.
data
.
data
.
map
((
data
)
=>
{
let
giftDatas
=
return
{
res
.
data
&&
key
:
data
.
id
,
res
.
data
.
data
.
map
(
data
=>
{
amount
:
data
?.
attributes
?.
amount
,
return
{
senderEmail
:
data
?.
attributes
?.
senderEmail
,
key
:
data
.
id
,
receiverEmail
:
data
?.
attributes
?.
receiverEmail
,
amount
:
data
?.
attributes
?.
amount
,
status
:
data
?.
attributes
?.
status
,
senderEmail
:
data
?.
attributes
?.
senderEmail
,
}
receiverEmail
:
data
?.
attributes
?.
receiverEmail
,
})
status
:
data
?.
attributes
?.
status
,
setGiftData
(
giftDatas
)
senderName
:
data
?.
attributes
?.
senderName
,
}).
catch
((
err
)
=>
{
receiverName
:
data
?.
attributes
?.
receiverName
console
.
log
(
err
)
};
})
});
},
[
update
])
setGiftData
(
giftDatas
);
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
},
[
update
]);
const
changeStatusFn
=
async
({
id
,
data
})
=>
{
const
changeStatusFn
=
async
({
id
,
data
})
=>
{
const
config
=
{
const
config
=
{
headers
:
{
headers
:
{
"Content-Type"
:
"application/json"
,
"Content-Type"
:
"application/json"
,
Authorization
:
`Bearer
${
session
.
jwt
}
`
Authorization
:
`Bearer
${
session
.
jwt
}
`
}
}
}
}
;
const
giftdata
=
{
const
giftdata
=
{
data
data
}
}
;
const
response
=
await
axios
.
put
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/gift-cards/
${
id
}
`
,
giftdata
,
config
)
const
response
=
await
axios
.
put
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/gift-cards/
${
id
}
`
,
giftdata
,
config
)
;
if
(
response
.
status
==
200
)
{
if
(
response
.
status
==
200
)
{
toast
.
success
(
"Status changed"
)
toast
.
success
(
"Status changed"
)
;
setupdate
(
!
update
)
setupdate
(
!
update
)
;
}
}
console
.
log
(
"response gift card"
,
response
);
console
.
log
(
"response gift card"
,
response
);
}
}
;
const
columns
=
[
const
columns
=
[
{
{
title
:
"Sender Email Address"
,
title
:
"Sender Email Address"
,
...
@@ -60,93 +65,105 @@ const GiftcardListing = () => {
...
@@ -60,93 +65,105 @@ const GiftcardListing = () => {
render
:
text
=>
<
a
>
{
text
}
<
/a
>
render
:
text
=>
<
a
>
{
text
}
<
/a
>
},
},
{
{
title
:
"Sender Name"
,
dataIndex
:
"senderName"
,
key
:
"senderName"
,
render
:
text
=>
<
a
>
{
text
}
<
/a
>
},
{
title
:
"Receiver Email Address"
,
title
:
"Receiver Email Address"
,
dataIndex
:
"receiverEmail"
,
dataIndex
:
"receiverEmail"
,
key
:
"receiverEmail"
,
key
:
"receiverEmail"
,
render
:
text
=>
<
a
>
{
text
}
<
/a
>
render
:
text
=>
<
a
>
{
text
}
<
/a
>
},
},
{
{
title
:
"Receiver Name"
,
dataIndex
:
"receiverName"
,
key
:
"receiverName"
,
render
:
text
=>
<
a
>
{
text
}
<
/a
>
},
{
title
:
"Amount"
,
title
:
"Amount"
,
dataIndex
:
"amount"
,
dataIndex
:
"amount"
,
key
:
"amount"
,
key
:
"amount"
,
render
:
text
=>
<
a
>
{
text
}
<
/a
>
render
:
text
=>
<
a
>
{
text
}
<
/a
>
},
{
title
:
"Status"
,
dataIndex
:
"status"
,
key
:
"status"
,
render
:
tag
=>
(
<
span
>
{
tag
==
"rejected"
?
(
<
Tag
color
=
{
"red"
}
key
=
{
tag
}
>
{
tag
.
toUpperCase
()}
<
/Tag
>
)
:
(
<
Tag
color
=
{
"blue"
}
key
=
{
tag
}
>
{
tag
===
"fulfilled"
?
"APPROVED"
:
tag
.
toUpperCase
()}
<
/Tag
>
)}
<
/span
>
)
},
{
title
:
'Actions'
,
width
:
100
,
dataIndex
:
'key'
,
key
:
'key'
,
render
:
(
_
,
record
)
=>
(
<
Space
size
=
"middle"
>
{
/* <a>Invite {record.name}</a> */
}
<
Dropdown
menu
=
{{
items
:
[
{
key
:
"1"
,
label
:
(
<
a
rel
=
"noopener noreferrer"
onClick
=
{
async
()
=>
{
console
.
log
(
"record"
,
record
);
await
changeStatusFn
({
id
:
record
.
key
,
data
:
{
status
:
"fulfilled"
}
})
// setrejectionId(record.key);
// adminActions({ type: "reject", activityId: record.key });
}}
>
Approve
<
/a
>
)
},
{
key
:
"2"
,
label
:
(
<
a
target
=
"_blank"
rel
=
"noopener noreferrer"
onClick
=
{
async
()
=>
{
console
.
log
(
"record"
,
record
);
await
changeStatusFn
({
id
:
record
.
key
,
data
:
{
status
:
"rejected"
}
})
// setrejectionId(record.key);
// adminActions({ type: "reject", activityId: record.key });
}}
>
Reject
<
/a
>
)
}
]
}}
placement
=
"bottomLeft"
trigger
=
{[
'click'
]}
>
<
button
className
=
"btn border-0"
>
<
DownCircleOutlined
style
=
{{
fontSize
:
"20px"
,
color
:
"#08c"
}}
onClick
=
{()
=>
{
}}
/
>
<
/button
>
<
/Dropdown
>
<
/Space
>
)
}
}
]
// {
// title: "Status",
// dataIndex: "status",
// key: "status",
// render: tag => (
// <span>
// {tag == "rejected" ? (
// <Tag color={"red"} key={tag}>
// {tag.toUpperCase()}
// </Tag>
// ) : (
// <Tag color={"blue"} key={tag}>
// {tag === "fulfilled" ? "APPROVED" : tag.toUpperCase()}
// </Tag>
// )}
// </span>
// )
// },
// {
// title: "Actions",
// width: 100,
// dataIndex: "key",
// key: "key",
// render: (_, record) => (
// <Space size="middle">
// {/* <a>Invite {record.name}</a> */}
// <Dropdown
// menu={{
// items: [
// {
// key: "1",
// label: (
// <a
// rel="noopener noreferrer"
// onClick={async () => {
// console.log("record", record);
// await changeStatusFn({ id: record.key, data: { status: "fulfilled" } });
// // setrejectionId(record.key);
// // adminActions({ type: "reject", activityId: record.key });
// }}
// >
// Approve
// </a>
// )
// },
// {
// key: "2",
// label: (
// <a
// target="_blank"
// rel="noopener noreferrer"
// onClick={async () => {
// console.log("record", record);
// await changeStatusFn({ id: record.key, data: { status: "rejected" } });
// // setrejectionId(record.key);
// // adminActions({ type: "reject", activityId: record.key });
// }}
// >
// Reject
// </a>
// )
// }
// ]
// }}
// placement="bottomLeft"
// trigger={["click"]}
// >
// <button className="btn border-0">
// <DownCircleOutlined style={{ fontSize: "20px", color: "#08c" }} onClick={() => {}} />
// </button>
// </Dropdown>
// </Space>
// )
// }
];
console
.
log
(
"giftData"
,
giftData
);
return
(
return
(
<
Fragment
>
<
Fragment
>
<
div
className
=
"p-5 h-100"
>
<
div
className
=
"p-5 h-100"
>
...
...
components/admin/ReviewsListing.js
View file @
7db3c4c
...
@@ -5,7 +5,6 @@ import { Loader } from "react-bootstrap-typeahead";
...
@@ -5,7 +5,6 @@ import { Loader } from "react-bootstrap-typeahead";
import
{
FaAngleLeft
}
from
"react-icons/fa"
;
import
{
FaAngleLeft
}
from
"react-icons/fa"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
toast
}
from
"react-toastify"
;
import
{
toast
}
from
"react-toastify"
;
// import { getActivitiesByFilters } from "../../redux/actions/activityAction";
import
{
deleteReview
,
getReviewsAction
}
from
"../../redux/actions/reviewsAction"
;
import
{
deleteReview
,
getReviewsAction
}
from
"../../redux/actions/reviewsAction"
;
const
ReviewsListing
=
({
activityId
,
setshowReviews
,
isVendor
})
=>
{
const
ReviewsListing
=
({
activityId
,
setshowReviews
,
isVendor
})
=>
{
...
...
components/admin/VendorDetails.js
View file @
7db3c4c
...
@@ -119,6 +119,10 @@ const VendorDetails = ({ id, backClick, setShowDetail, showDetail, detail }) =>
...
@@ -119,6 +119,10 @@ const VendorDetails = ({ id, backClick, setShowDetail, showDetail, detail }) =>
<
p
className
=
"col-12 col-lg-6"
>
Business
Name
<
/p
>
<
p
className
=
"col-12 col-lg-6"
>
Business
Name
<
/p
>
<
p
className
=
"col-12 col-lg-6"
>
{
detail
[
0
].
attributes
.
businessName
}
<
/p
>
<
p
className
=
"col-12 col-lg-6"
>
{
detail
[
0
].
attributes
.
businessName
}
<
/p
>
<
/div
>
<
/div
>
{
/* <div className="row">
<p className="col-12 col-lg-6">Vendor website:</p>
<p className="col-12 col-lg-6">{detail[0].attributes.businessName}</p>
</div> */
}
<
/div
>
<
/div
>
<
div
className
=
"col-12 col-lg-7 borderLeft"
>
<
div
className
=
"col-12 col-lg-7 borderLeft"
>
<
p
className
=
"phead"
>
Business
Address
<
/p
>
<
p
className
=
"phead"
>
Business
Address
<
/p
>
...
...
components/admin/VendorListing.js
View file @
7db3c4c
import
{
CheckOutlined
,
DeleteTwoTone
,
EyeTwoTone
,
StopOutlined
,
StopTwoTone
}
from
"@ant-design/icons"
;
import
{
CheckOutlined
,
DeleteTwoTone
,
EyeTwoTone
,
S
earchOutlined
,
S
topOutlined
,
StopTwoTone
}
from
"@ant-design/icons"
;
import
{
Space
,
Table
,
Tag
}
from
"antd"
;
import
{
Input
,
Space
,
Table
,
Tag
}
from
"antd"
;
import
{
getSession
}
from
"next-auth/react"
;
import
{
getSession
}
from
"next-auth/react"
;
import
{
useRouter
}
from
"next/router"
;
import
{
useRouter
}
from
"next/router"
;
import
{
Fragment
,
useEffect
,
useState
}
from
"react"
;
import
{
Fragment
,
useEffect
,
use
Ref
,
use
State
}
from
"react"
;
import
{
Button
,
Image
}
from
"react-bootstrap"
;
import
{
Button
,
Image
}
from
"react-bootstrap"
;
import
Highlighter
from
"react-highlight-words"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
loadUser
}
from
"../../redux/actions/userActions"
;
import
{
loadUser
}
from
"../../redux/actions/userActions"
;
import
{
getAllVendors
}
from
"../../redux/actions/vendorActions"
;
import
{
getAllVendors
}
from
"../../redux/actions/vendorActions"
;
...
@@ -12,6 +13,8 @@ import VendorDetails from "./VendorDetails";
...
@@ -12,6 +13,8 @@ import VendorDetails from "./VendorDetails";
const
VendorListing
=
()
=>
{
const
VendorListing
=
()
=>
{
// Hooks
// Hooks
const
searchInput
=
useRef
(
null
);
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
const
router
=
useRouter
();
const
router
=
useRouter
();
// useState
// useState
...
@@ -22,13 +25,125 @@ const VendorListing = () => {
...
@@ -22,13 +25,125 @@ const VendorListing = () => {
const
[
data
,
setData
]
=
useState
([]);
const
[
data
,
setData
]
=
useState
([]);
const
[
showDetail
,
setShowDetail
]
=
useState
(
false
);
const
[
showDetail
,
setShowDetail
]
=
useState
(
false
);
const
[
detail
,
setDetail
]
=
useState
();
const
[
detail
,
setDetail
]
=
useState
();
const
[
searchedColumn
,
setSearchedColumn
]
=
useState
(
""
);
const
[
searchText
,
setSearchText
]
=
useState
(
""
);
const
handleReset
=
clearFilters
=>
{
clearFilters
();
setSearchText
(
""
);
};
// selectors
// selectors
const
{
loadedUser
}
=
useSelector
(
state
=>
state
.
loadedUser
);
const
{
loadedUser
}
=
useSelector
(
state
=>
state
.
loadedUser
);
const
{
allVendors
,
loading
:
vendorLoading
,
totalCount
}
=
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
);
};
};
const
handleSearch
=
(
selectedKeys
,
confirm
,
dataIndex
)
=>
{
console
.
log
(
"selectedKeys"
,
selectedKeys
);
if
(
!
loadedUser
)
return
;
dispatch
(
getAllVendors
({
pageNumber
:
1
,
pageSize
:
10
,
str
:
selectedKeys
[
0
]
}));
confirm
();
setSearchText
(
selectedKeys
[
0
]);
setSearchedColumn
(
dataIndex
);
};
const
getColumnSearchProps
=
dataIndex
=>
({
filterDropdown
:
({
setSelectedKeys
,
selectedKeys
,
confirm
,
clearFilters
,
close
})
=>
(
<
div
style
=
{{
padding
:
8
}}
onKeyDown
=
{
e
=>
e
.
stopPropagation
()}
>
<
Input
ref
=
{
searchInput
}
placeholder
=
{
`Search
${
dataIndex
}
`
}
value
=
{
selectedKeys
[
0
]}
onChange
=
{
e
=>
{
console
.
log
(
"jere"
,
e
.
target
.
value
);
if
(
e
.
target
.
value
==
""
)
{
handleReset
(
clearFilters
);
}
setSelectedKeys
(
e
.
target
.
value
?
[
e
.
target
.
value
]
:
[]);
}}
onPressEnter
=
{()
=>
handleSearch
(
selectedKeys
,
confirm
,
dataIndex
)}
style
=
{{
marginBottom
:
8
,
display
:
"block"
}}
/
>
<
Space
>
<
Button
type
=
"primary"
onClick
=
{()
=>
handleSearch
(
selectedKeys
,
confirm
,
dataIndex
)}
icon
=
{
<
SearchOutlined
/>
}
size
=
"small"
style
=
{{
width
:
90
}}
>
Search
<
/Button
>
<
Button
onClick
=
{()
=>
clearFilters
&&
handleReset
(
clearFilters
)}
size
=
"small"
style
=
{{
width
:
90
}}
>
Reset
<
/Button
>
<
Button
type
=
"link"
size
=
"small"
onClick
=
{()
=>
{
confirm
({
closeDropdown
:
false
});
setSearchText
(
selectedKeys
[
0
]);
setSearchedColumn
(
dataIndex
);
}}
>
Filter
<
/Button
>
<
Button
type
=
"link"
size
=
"small"
onClick
=
{()
=>
{
close
();
}}
>
close
<
/Button
>
<
/Space
>
<
/div
>
),
filterIcon
:
filtered
=>
(
<
SearchOutlined
style
=
{{
color
:
filtered
?
"#1677ff"
:
undefined
}}
/
>
),
onFilter
:
(
value
,
record
)
=>
record
[
dataIndex
].
toString
().
toLowerCase
().
includes
(
value
.
toLowerCase
()),
onFilterDropdownOpenChange
:
visible
=>
{
if
(
visible
)
{
setTimeout
(()
=>
searchInput
.
current
?.
select
(),
100
);
}
},
render
:
text
=>
searchedColumn
===
dataIndex
?
(
<
Highlighter
highlightStyle
=
{{
backgroundColor
:
"#ffc069"
,
padding
:
0
}}
searchWords
=
{[
searchText
]}
autoEscape
textToHighlight
=
{
text
?
text
.
toString
()
:
""
}
/
>
)
:
(
text
)
});
// Session
// Session
// useEffect(() => {
// useEffect(() => {
...
@@ -61,11 +176,6 @@ const VendorListing = () => {
...
@@ -61,11 +176,6 @@ const VendorListing = () => {
},
[]);
},
[]);
// console.log("session", loadedUser);
// console.log("session", loadedUser);
useEffect
(()
=>
{
if
(
!
loadedUser
)
return
;
dispatch
(
getAllVendors
({
pageNumber
:
1
,
pageSize
:
10
}));
},
[
loadedUser
]);
const
[
tableCurrentPage
,
settableCurrentPage
]
=
useState
(
1
);
const
[
tableCurrentPage
,
settableCurrentPage
]
=
useState
(
1
);
const
[
tableItemsPerPage
,
settableItemsPerPage
]
=
useState
(
10
);
const
[
tableItemsPerPage
,
settableItemsPerPage
]
=
useState
(
10
);
...
@@ -73,7 +183,7 @@ const VendorListing = () => {
...
@@ -73,7 +183,7 @@ const VendorListing = () => {
console
.
log
(
"params"
,
pagination
,
filters
,
sorter
,
extra
);
console
.
log
(
"params"
,
pagination
,
filters
,
sorter
,
extra
);
settableCurrentPage
(
pagination
.
current
);
settableCurrentPage
(
pagination
.
current
);
settableItemsPerPage
(
pagination
.
pageSize
);
settableItemsPerPage
(
pagination
.
pageSize
);
dispatch
(
getAllVendors
({
pageNumber
:
pagination
.
current
,
pageSize
:
pagination
.
pageSize
}));
dispatch
(
getAllVendors
({
pageNumber
:
pagination
.
current
,
pageSize
:
pagination
.
pageSize
,
str
:
searchText
}));
};
};
console
.
log
(
"allVendors"
,
allVendors
);
console
.
log
(
"allVendors"
,
allVendors
);
...
@@ -89,30 +199,40 @@ const VendorListing = () => {
...
@@ -89,30 +199,40 @@ const VendorListing = () => {
// useEffect
// useEffect
useEffect
(()
=>
{
useEffect
(()
=>
{
setLoading
(
true
);
//
setLoading(true);
let
initialData
=
let
initialData
=
allVendors
&&
allVendors
&&
allVendors
.
map
(
item
=>
{
allVendors
.
map
(
item
=>
{
console
.
log
(
"item"
,
item
.
attributes
.
user
.
data
);
//
console.log("item", item.attributes.user.data);
return
{
return
{
key
:
item
.
id
,
key
:
item
.
id
,
name
:
item
.
attributes
.
name
,
name
:
item
.
attributes
.
name
,
businessName
:
item
.
attributes
.
businessName
,
businessName
:
item
.
attributes
.
businessName
,
status
:
[
item
.
attributes
.
user
.
data
?.
attributes
.
approved
],
status
:
[
item
.
attributes
.
user
.
data
?.
attributes
.
approved
],
confirmed
:
item
.
attributes
.
user
.
data
?.
attributes
.
confirmed
confirmed
:
item
.
attributes
.
user
.
data
?.
attributes
.
confirmed
,
email
:
item
.
attributes
.
email
,
phone
:
item
.
attributes
.
phone
};
};
});
});
console
.
log
(
"initialData"
,
initialData
);
console
.
log
(
"initialData"
,
initialData
);
setData
(
initialData
);
setData
(
initialData
);
setLoading
(
false
);
//
setLoading(false);
},
[
allVendors
]);
},
[
allVendors
]);
const
columns
=
[
const
columns
=
[
// {
// title: "Vendor ID",
// dataIndex: "vendorId",
// key: "vendorId",
// render: text => <a>{text}</a>,
// ...getColumnSearchProps("vendorId")
// },
{
{
title
:
"Name"
,
title
:
"Name"
,
dataIndex
:
"name"
,
dataIndex
:
"name"
,
key
:
"name"
,
key
:
"name"
,
render
:
text
=>
<
a
>
{
text
}
<
/a
>
render
:
text
=>
<
a
>
{
text
}
<
/a>
,
...
getColumnSearchProps
(
"name"
)
},
},
{
{
title
:
"Business Name"
,
title
:
"Business Name"
,
...
@@ -120,15 +240,25 @@ const VendorListing = () => {
...
@@ -120,15 +240,25 @@ const VendorListing = () => {
key
:
"businessName"
key
:
"businessName"
},
},
{
{
title
:
"
OTP verified
"
,
title
:
"
Phone
"
,
dataIndex
:
"
confirmed
"
,
dataIndex
:
"
phone
"
,
key
:
"
confirmed"
,
key
:
"
phone"
render
:
(
_
,
{
confirmed
})
=>
(
},
<>
{
<>
{
confirmed
?
<
CheckOutlined
/>
:
<
StopOutlined
/>
}
<
/
>
title
:
"Email"
,
<
/
>
dataIndex
:
"email"
,
)
key
:
"email"
},
},
// {
// title: "OTP verified",
// dataIndex: "confirmed",
// key: "confirmed",
// render: (_, { confirmed }) => (
// <>
// <>{confirmed ? <CheckOutlined /> : <StopOutlined />}</>
// </>
// )
// },
{
{
title
:
"Approved"
,
title
:
"Approved"
,
key
:
"status"
,
key
:
"status"
,
...
...
components/listing/ListingInner.js
View file @
7db3c4c
...
@@ -100,7 +100,7 @@ const ListingInner = ({ allActivitiesData, loading, totalCount }) => {
...
@@ -100,7 +100,7 @@ const ListingInner = ({ allActivitiesData, loading, totalCount }) => {
dispatch
(
dispatch
(
getActivitiesByFilters
({
getActivitiesByFilters
({
subCategory
:
filters
.
subCategory
,
subCategory
:
filters
.
subCategory
,
category
:
filters
.
category
?
filters
.
category
:
router
.
query
.
category
,
category
:
filters
.
category
,
activityType
:
filters
.
activityType
,
activityType
:
filters
.
activityType
,
fromDate
:
filters
.
fromDate
,
fromDate
:
filters
.
fromDate
,
toDate
:
filters
.
toDate
,
toDate
:
filters
.
toDate
,
...
...
components/listing/ListingItems.js
View file @
7db3c4c
...
@@ -117,7 +117,7 @@ const ListingItems = ({ allActivitiesData, loading, gridClass, totalCount }) =>
...
@@ -117,7 +117,7 @@ const ListingItems = ({ allActivitiesData, loading, gridClass, totalCount }) =>
};
};
console
.
log
(
"page"
,
page
);
console
.
log
(
"page"
,
page
);
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
getActivitiesByFilters
({
c
urrentPage
:
page
}));
dispatch
(
getActivitiesByFilters
({
c
ategory
:
router
.
query
.
category
}));
},
[]);
},
[]);
const
calculateRating
=
data
=>
{
const
calculateRating
=
data
=>
{
...
...
components/vendor/ActivityListingRBAC.js
View file @
7db3c4c
...
@@ -4,7 +4,7 @@ import { useDispatch, useSelector } from "react-redux";
...
@@ -4,7 +4,7 @@ import { useDispatch, useSelector } from "react-redux";
import
Highlighter
from
"react-highlight-words"
;
import
Highlighter
from
"react-highlight-words"
;
import
{
DeleteTwoTone
,
DownCircleOutlined
,
EditTwoTone
,
SearchOutlined
}
from
"@ant-design/icons"
;
import
{
DeleteTwoTone
,
DownCircleOutlined
,
EditTwoTone
,
SearchOutlined
}
from
"@ant-design/icons"
;
import
{
useRouter
}
from
"next/router"
;
import
{
useRouter
}
from
"next/router"
;
import
{
getActivitiesByVendor
}
from
"../../redux/actions/activityAction"
;
import
{
getActivitiesByVendor
,
getActivitiesForAdmin
}
from
"../../redux/actions/activityAction"
;
import
{
loadUser
,
updateActivityStatusAdmin
}
from
"../../redux/actions/userActions"
;
import
{
loadUser
,
updateActivityStatusAdmin
}
from
"../../redux/actions/userActions"
;
import
{
Modal
}
from
"react-bootstrap"
;
import
{
Modal
}
from
"react-bootstrap"
;
import
{
toast
}
from
"react-toastify"
;
import
{
toast
}
from
"react-toastify"
;
...
@@ -185,9 +185,8 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
...
@@ -185,9 +185,8 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
filters
:
categoryFilterArray
,
filters
:
categoryFilterArray
,
filterMode
:
"tree"
,
filterMode
:
"tree"
,
filterSearch
:
true
,
filterSearch
:
true
,
onFilter
:
(
value
,
record
)
=>
{
onFilter
:
(
value
,
record
)
=>
record
.
category
.
startsWith
(
value
),
console
.
log
(
value
);
// onFilter: (value, record) => record.category.startsWith(value),
},
width
:
"15%"
width
:
"15%"
},
},
{
{
...
@@ -234,15 +233,15 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
...
@@ -234,15 +233,15 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
case
"pending"
:
case
"pending"
:
color
=
"orange"
;
color
=
"orange"
;
break
;
break
;
case
"none"
:
case
"none"
:
color
=
"red"
;
color
=
"red"
;
break
;
break
;
case
"rejected"
:
case
"rejected"
:
color
=
"red"
;
color
=
"red"
;
break
;
break
;
default
:
default
:
break
;
break
;
}
}
...
...
pages/activities/[id].js
View file @
7db3c4c
...
@@ -28,7 +28,6 @@ export const getServerSideProps = wrapper.getServerSideProps(store => async ({ r
...
@@ -28,7 +28,6 @@ export const getServerSideProps = wrapper.getServerSideProps(store => async ({ r
await
store
.
dispatch
(
getActivityById
(
query
.
id
));
await
store
.
dispatch
(
getActivityById
(
query
.
id
));
await
store
.
dispatch
(
getFaqs
());
await
store
.
dispatch
(
getFaqs
());
await
store
.
dispatch
(
getReviewsAction
({
activityId
:
query
.
id
}))
await
store
.
dispatch
(
getReviewsAction
({
activityId
:
query
.
id
}))
// await store.dispatch(getActivitiesByFilters({category: query.category}))
return
{
return
{
props
:
{}
props
:
{}
...
...
pages/admin/enquiries/index.js
View file @
7db3c4c
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
Enquiries
from
"../../../components/admin/Enquiries"
;
import
{
GenericLayout
}
from
"../../../components/layout/Generics/GenericLayout"
;
import
{
GenericLayout
}
from
"../../../components/layout/Generics/GenericLayout"
;
import
{
wrapper
}
from
"../../../redux/store"
;
import
{
wrapper
}
from
"../../../redux/store"
;
export
default
function
Enquiries
()
{
export
default
function
Enquiries
Page
()
{
return
(
return
(
<
GenericLayout
>
<
GenericLayout
>
<
Enquiries
/>
<
/GenericLayout
>
<
/GenericLayout
>
);
);
}
}
...
...
pages/admin/vendors/index.js
View file @
7db3c4c
import
React
from
"react"
;
import
React
,
{
useEffect
}
from
"react"
;
import
Layout
from
"../../../components/layout/Layout"
;
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"
;
...
@@ -6,8 +6,14 @@ import { wrapper } from "../../../redux/store";
...
@@ -6,8 +6,14 @@ import { wrapper } from "../../../redux/store";
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"
;
import
{
getAllVendors
}
from
"../../../redux/actions/vendorActions"
;
import
{
useDispatch
}
from
"react-redux"
;
export
default
function
VendorListingPage
()
{
export
default
function
VendorListingPage
()
{
const
dispatch
=
useDispatch
();
useEffect
(()
=>
{
dispatch
(
getAllVendors
({
pageNumber
:
1
,
pageSize
:
10
}));
},
[]);
return
(
return
(
// <Layout>
// <Layout>
// <div className="sidebarContainer">
// <div className="sidebarContainer">
...
...
pages/listing.js
View file @
7db3c4c
...
@@ -23,12 +23,9 @@ export default function ListingPage() {
...
@@ -23,12 +23,9 @@ export default function ListingPage() {
export
const
getServerSideProps
=
wrapper
.
getServerSideProps
(
store
=>
async
({
req
,
query
})
=>
{
export
const
getServerSideProps
=
wrapper
.
getServerSideProps
(
store
=>
async
({
req
,
query
})
=>
{
try
{
try
{
console
.
log
(
"query"
,
query
);
console
.
log
(
"query"
,
query
);
await
store
.
dispatch
(
getActivitiesByFilters
({
currentPage
:
query
.
page
}));
//
await store.dispatch(getActivitiesByFilters({ currentPage: query.page }));
await
store
.
dispatch
(
getAllCategories
());
await
store
.
dispatch
(
getAllCategories
());
await
store
.
dispatch
(
getSubCategoriesByCategoryId
());
await
store
.
dispatch
(
getSubCategoriesByCategoryId
());
// if (query.category) {
// await store.dispatch(getActivitiesByFilters({ currentPage: query.page, category: query.category }));
// }
return
{
return
{
props
:
{}
props
:
{}
// Next.js will attempt to re-generate the page:
// Next.js will attempt to re-generate the page:
...
...
redux/actions/activityAction.js
View file @
7db3c4c
...
@@ -61,102 +61,100 @@ export const createActivity = data => async dispatch => {
...
@@ -61,102 +61,100 @@ export const createActivity = data => async dispatch => {
}
}
};
};
export
const
getActivitiesByVendor
=
export
const
getActivitiesByVendor
=
()
=>
async
dispatch
=>
{
()
=>
// console.log("data", data);
async
dispatch
=>
{
const
session
=
await
getSession
();
// console.log("data", data);
console
.
log
(
"session"
,
session
);
const
session
=
await
getSession
();
try
{
console
.
log
(
"session"
,
session
);
const
vendorConfig
=
{
try
{
headers
:
{
const
vendorConfig
=
{
"Content-Type"
:
"application/json"
,
headers
:
{
Authorization
:
`Bearer
${
session
.
jwt
}
`
"Content-Type"
:
"application/json"
,
}
Authorization
:
`Bearer
${
session
.
jwt
}
`
};
}
const
vendorQuery
=
{
};
filters
:
{
const
vendorQuery
=
{
user
:
{
filters
:
{
id
:
{
$eq
:
session
.
id
}
user
:
{
id
:
{
$eq
:
session
.
id
}
}
}
}
};
}
};
const
vendorQueryString
=
qs
.
stringify
(
vendorQuery
,
{
const
vendorQueryString
=
qs
.
stringify
(
vendorQuery
,
{
encodeValuesOnly
:
true
encodeValuesOnly
:
true
});
});
const
vendorResponse
=
await
axios
.
get
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/vendors/?
${
vendorQueryString
}
`
,
vendorConfig
);
const
vendorResponse
=
await
axios
.
get
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/vendors/?
${
vendorQueryString
}
`
,
vendorConfig
);
console
.
log
(
"vendorResponse"
,
vendorResponse
.
data
.
data
[
0
].
id
);
console
.
log
(
"vendorResponse"
,
vendorResponse
.
data
.
data
[
0
].
id
);
// const loggedinVendor = await getLoggedInVendor()
// const loggedinVendor = await getLoggedInVendor()
// console.log("loggedinVendor", loggedinVendor);
// console.log("loggedinVendor", loggedinVendor);
if
(
!
session
)
{
if
(
!
session
)
{
return
"You are not authenticated, please log in."
;
return
"You are not authenticated, please log in."
;
}
}
dispatch
({
dispatch
({
type
:
GET_ACTIVITIES_REQUEST
,
type
:
GET_ACTIVITIES_REQUEST
,
loading
:
true
loading
:
true
});
});
const
config
=
{
const
config
=
{
headers
:
{
headers
:
{
"Content-Type"
:
"application/json"
"Content-Type"
:
"application/json"
// Authorization: `Bearer ${session.jwt}`
// Authorization: `Bearer ${session.jwt}`
}
}
};
};
const
query
=
{
const
query
=
{
filters
:
{
filters
:
{
vendor
:
{
vendor
:
{
id
:
{
id
:
{
$eq
:
vendorResponse
.
data
.
data
[
0
].
id
$eq
:
vendorResponse
.
data
.
data
[
0
].
id
}
}
}
},
}
pagination
:
{
},
pageSize
:
1000
,
pagination
:
{
// page: pageNumber
pageSize
:
1000
},
// page: pageNumber
populate
:
[
},
"masterMonths"
,
populate
:
[
"subCategory"
,
"masterMonths"
,
"subCategory.category"
,
"subCategory"
,
"timeSlots"
,
"subCategory.category"
,
"masterPincode"
,
"timeSlots"
,
"vendor"
,
"masterPincode"
,
"category"
,
"vendor"
,
"imagesComponent"
,
"category"
,
"imagesComponent.image"
,
"imagesComponent"
,
"image"
,
"imagesComponent.image"
,
"termsConditions"
,
"image"
,
"cancellationPolicy"
,
"termsConditions"
,
"reviews"
"cancellationPolicy"
,
]
"reviews"
};
]
const
queryString
=
qs
.
stringify
(
query
,
{
};
encodeValuesOnly
:
true
const
queryString
=
qs
.
stringify
(
query
,
{
});
encodeValuesOnly
:
true
// let activityData = {
});
// data: {
// let activityData = {
// ...data
// data: {
// }
// ...data
// };
// }
console
.
log
(
query
);
// };
const
response
=
await
axios
.
get
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/experiences?
${
queryString
}
`
,
config
);
console
.
log
(
query
);
console
.
log
(
"Response"
,
response
.
data
);
const
response
=
await
axios
.
get
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/experiences?
${
queryString
}
`
,
config
);
dispatch
({
console
.
log
(
"Response"
,
response
.
data
);
type
:
GET_ACTIVITIES_SUCCESS
,
dispatch
({
payload
:
response
.
data
type
:
GET_ACTIVITIES_SUCCESS
,
});
payload
:
response
.
data
return
response
.
data
;
});
}
catch
(
error
)
{
return
response
.
data
;
dispatch
({
}
catch
(
error
)
{
type
:
GET_ACTIVITIES_FAIL
,
dispatch
({
payload
:
error
.
response
.
data
type
:
GET_ACTIVITIES_FAIL
,
});
payload
:
error
.
response
.
data
}
});
};
}
};
export
const
getActivityById
=
id
=>
async
dispatch
=>
{
export
const
getActivityById
=
id
=>
async
dispatch
=>
{
try
{
try
{
...
@@ -253,7 +251,7 @@ export const updateActivityById =
...
@@ -253,7 +251,7 @@ export const updateActivityById =
};
};
export
const
getActivitiesForAdmin
=
export
const
getActivitiesForAdmin
=
({
vendorId
,
pageNumber
=
1
,
pageSize
=
10
})
=>
({
vendorId
,
pageNumber
=
1
,
pageSize
=
10
,
category
})
=>
async
dispatch
=>
{
async
dispatch
=>
{
try
{
try
{
dispatch
({
dispatch
({
...
@@ -296,7 +294,9 @@ export const getActivitiesForAdmin =
...
@@ -296,7 +294,9 @@ export const getActivitiesForAdmin =
"reviews"
"reviews"
]
]
};
};
if
(
category
)
{
// query.filters["category"] = { name: { $eq: category } };
}
const
queryString
=
qs
.
stringify
(
query
,
{
const
queryString
=
qs
.
stringify
(
query
,
{
encodeValuesOnly
:
true
encodeValuesOnly
:
true
});
});
...
...
redux/actions/enquiryAction.js
View file @
7db3c4c
...
@@ -5,6 +5,9 @@ import {
...
@@ -5,6 +5,9 @@ import {
ENQUIRY_SUBMIT_FAIL
,
ENQUIRY_SUBMIT_FAIL
,
ENQUIRY_SUBMIT_REQUEST
,
ENQUIRY_SUBMIT_REQUEST
,
ENQUIRY_SUBMIT_SUCCESS
,
ENQUIRY_SUBMIT_SUCCESS
,
GET_ENQUIRIES_BY_ADMIN_FAIL
,
GET_ENQUIRIES_BY_ADMIN_REQUEST
,
GET_ENQUIRIES_BY_ADMIN_SUCCESS
,
GET_ENQUIRIES_BY_VENDOR_FAIL
,
GET_ENQUIRIES_BY_VENDOR_FAIL
,
GET_ENQUIRIES_BY_VENDOR_REQUEST
,
GET_ENQUIRIES_BY_VENDOR_REQUEST
,
GET_ENQUIRIES_BY_VENDOR_SUCCESS
GET_ENQUIRIES_BY_VENDOR_SUCCESS
...
@@ -104,6 +107,47 @@ export const getEnquiriesByVendor = () => async dispatch => {
...
@@ -104,6 +107,47 @@ export const getEnquiriesByVendor = () => async dispatch => {
}
}
};
};
export
const
getEnquiriesByAdmin
=
()
=>
async
dispatch
=>
{
try
{
dispatch
({
type
:
GET_ENQUIRIES_BY_ADMIN_REQUEST
,
loading
:
true
});
const
session
=
await
getSession
();
if
(
!
session
)
{
return
;
}
const
config
=
{
headers
:
{
"Content-type"
:
"application/json"
,
Authorization
:
`Bearer
${
session
.
jwt
}
`
}
};
const
query
=
{
filters
:
{},
populate
:
[
"vendor"
,
"experience"
,
"end_user"
]
};
const
queryString
=
qs
.
stringify
(
query
,
{
encodeValuesOnly
:
true
});
const
response
=
await
axios
.
get
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/enquires/?
${
queryString
}
`
,
config
);
dispatch
({
type
:
GET_ENQUIRIES_BY_ADMIN_SUCCESS
,
payload
:
response
.
data
,
loading
:
false
});
}
catch
(
error
)
{
dispatch
({
type
:
GET_ENQUIRIES_BY_ADMIN_FAIL
,
payload
:
error
.
response
.
data
});
}
};
export
const
changeEnquiryStatus
=
async
({
status
,
id
})
=>
{
export
const
changeEnquiryStatus
=
async
({
status
,
id
})
=>
{
try
{
try
{
const
session
=
await
getSession
();
const
session
=
await
getSession
();
...
...
redux/actions/vendorActions.js
View file @
7db3c4c
...
@@ -188,7 +188,7 @@ export const getVendorDetails = () => async dispatch => {
...
@@ -188,7 +188,7 @@ export const getVendorDetails = () => async dispatch => {
};
};
export
const
getAllVendors
=
export
const
getAllVendors
=
({
pageNumber
=
1
,
pageSize
=
10
})
=>
({
pageNumber
=
1
,
pageSize
=
10
,
str
})
=>
async
dispatch
=>
{
async
dispatch
=>
{
const
session
=
await
getSession
();
const
session
=
await
getSession
();
try
{
try
{
...
@@ -207,13 +207,13 @@ export const getAllVendors =
...
@@ -207,13 +207,13 @@ export const getAllVendors =
return
;
return
;
}
}
const
query
=
{
const
query
=
{
//
filters: {
filters
:
{
//
user: {
//
user: {
//
id: {
//
id: {
//
$eq: session.id
//
$eq: session.id
//
}
//
}
//
}
//
}
//
},
},
populate
:
[
"user"
,
"experiences"
,
"brandLogo"
],
populate
:
[
"user"
,
"experiences"
,
"brandLogo"
],
sort
:
[
"createdAt:desc"
],
sort
:
[
"createdAt:desc"
],
pagination
:
{
pagination
:
{
...
@@ -221,6 +221,10 @@ export const getAllVendors =
...
@@ -221,6 +221,10 @@ export const getAllVendors =
page
:
pageNumber
page
:
pageNumber
}
}
};
};
if
(
str
)
{
query
.
filters
[
"name"
]
=
{
$contains
:
str
};
}
// console.log("here 3", query);
// console.log("here 3", query);
const
queryString
=
qs
.
stringify
(
query
,
{
const
queryString
=
qs
.
stringify
(
query
,
{
...
...
redux/constants/enquiryConstants.js
View file @
7db3c4c
...
@@ -6,6 +6,10 @@ export const GET_ENQUIRIES_BY_VENDOR_REQUEST = "GET_ENQUIRIES_BY_VENDOR_REQUEST"
...
@@ -6,6 +6,10 @@ export const GET_ENQUIRIES_BY_VENDOR_REQUEST = "GET_ENQUIRIES_BY_VENDOR_REQUEST"
export
const
GET_ENQUIRIES_BY_VENDOR_SUCCESS
=
"GET_ENQUIRIES_BY_VENDOR_SUCCESS"
;
export
const
GET_ENQUIRIES_BY_VENDOR_SUCCESS
=
"GET_ENQUIRIES_BY_VENDOR_SUCCESS"
;
export
const
GET_ENQUIRIES_BY_VENDOR_FAIL
=
"GET_ENQUIRIES_BY_VENDOR_FAIL"
;
export
const
GET_ENQUIRIES_BY_VENDOR_FAIL
=
"GET_ENQUIRIES_BY_VENDOR_FAIL"
;
export
const
GET_ENQUIRIES_BY_ADMIN_REQUEST
=
"GET_ENQUIRIES_BY_ADMIN_REQUEST"
;
export
const
GET_ENQUIRIES_BY_ADMIN_SUCCESS
=
"GET_ENQUIRIES_BY_ADMIN_SUCCESS"
;
export
const
GET_ENQUIRIES_BY_ADMIN_FAIL
=
"GET_ENQUIRIES_BY_ADMIN_FAIL"
;
export
const
CLEAR_ERRORS
=
"CLEAR_ERRORS"
;
export
const
CLEAR_ERRORS
=
"CLEAR_ERRORS"
;
// export const TOGGLE_SUCCESS
// export const TOGGLE_SUCCESS
\ No newline at end of file
\ No newline at end of file
redux/reducers/enquiryReducer.js
View file @
7db3c4c
...
@@ -2,6 +2,9 @@ import {
...
@@ -2,6 +2,9 @@ import {
ENQUIRY_SUBMIT_FAIL
,
ENQUIRY_SUBMIT_FAIL
,
ENQUIRY_SUBMIT_REQUEST
,
ENQUIRY_SUBMIT_REQUEST
,
ENQUIRY_SUBMIT_SUCCESS
,
ENQUIRY_SUBMIT_SUCCESS
,
GET_ENQUIRIES_BY_ADMIN_FAIL
,
GET_ENQUIRIES_BY_ADMIN_REQUEST
,
GET_ENQUIRIES_BY_ADMIN_SUCCESS
,
GET_ENQUIRIES_BY_VENDOR_FAIL
,
GET_ENQUIRIES_BY_VENDOR_FAIL
,
GET_ENQUIRIES_BY_VENDOR_REQUEST
,
GET_ENQUIRIES_BY_VENDOR_REQUEST
,
GET_ENQUIRIES_BY_VENDOR_SUCCESS
GET_ENQUIRIES_BY_VENDOR_SUCCESS
...
@@ -36,7 +39,7 @@ export const getEnquiriesReducer = (state = { enquiriesByVendor: null }, action)
...
@@ -36,7 +39,7 @@ export const getEnquiriesReducer = (state = { enquiriesByVendor: null }, action)
switch
(
action
.
type
)
{
switch
(
action
.
type
)
{
case
GET_ENQUIRIES_BY_VENDOR_REQUEST
:
case
GET_ENQUIRIES_BY_VENDOR_REQUEST
:
return
{
return
{
loading
:
true
,
loading
:
true
};
};
case
GET_ENQUIRIES_BY_VENDOR_SUCCESS
:
case
GET_ENQUIRIES_BY_VENDOR_SUCCESS
:
return
{
return
{
...
@@ -53,3 +56,25 @@ export const getEnquiriesReducer = (state = { enquiriesByVendor: null }, action)
...
@@ -53,3 +56,25 @@ export const getEnquiriesReducer = (state = { enquiriesByVendor: null }, action)
return
state
;
return
state
;
}
}
};
};
export
const
getEnquiriesByVendorReducer
=
(
state
=
{
enquiriesByAdmin
:
null
},
action
)
=>
{
switch
(
action
.
type
)
{
case
GET_ENQUIRIES_BY_ADMIN_REQUEST
:
return
{
loading
:
true
};
case
GET_ENQUIRIES_BY_ADMIN_SUCCESS
:
return
{
loading
:
false
,
enquiriesByAdmin
:
action
.
payload
};
case
GET_ENQUIRIES_BY_ADMIN_FAIL
:
return
{
loading
:
false
,
error
:
action
.
payload
.
error
.
message
};
default
:
return
state
;
}
};
redux/reducers/reducers.js
View file @
7db3c4c
...
@@ -2,7 +2,7 @@ import { combineReducers } from "redux";
...
@@ -2,7 +2,7 @@ import { combineReducers } from "redux";
import
{
projectReducer
,
projectsReducer
,
similarProjectsReducer
}
from
"./projectsReducer"
;
import
{
projectReducer
,
projectsReducer
,
similarProjectsReducer
}
from
"./projectsReducer"
;
import
{
townshipReducer
,
townshipsReducer
}
from
"./townshipsReducer"
;
import
{
townshipReducer
,
townshipsReducer
}
from
"./townshipsReducer"
;
import
{
authReducer
,
forgotPasswordReducer
,
getEndUserReducer
,
loadedUserReducer
,
resetPasswordReducer
,
userReducer
}
from
"./userReducers"
;
import
{
authReducer
,
forgotPasswordReducer
,
getEndUserReducer
,
loadedUserReducer
,
resetPasswordReducer
,
userReducer
}
from
"./userReducers"
;
import
{
enquiryReducer
,
getEnquiriesReducer
}
from
"./enquiryReducer"
;
import
{
enquiryReducer
,
getEnquiries
ByVendorReducer
,
getEnquiries
Reducer
}
from
"./enquiryReducer"
;
import
{
displayEnquireNowReducer
}
from
"./enquireNowModalReducer"
;
import
{
displayEnquireNowReducer
}
from
"./enquireNowModalReducer"
;
import
{
getAllVendorsReducer
,
getVendorDetailsReducer
,
loggedInVendorReducer
,
updateVendorReducer
}
from
"./vendorReducers"
;
import
{
getAllVendorsReducer
,
getVendorDetailsReducer
,
loggedInVendorReducer
,
updateVendorReducer
}
from
"./vendorReducers"
;
import
{
createActivityReducer
,
getActivitiesReducer
,
getActivityByIdReducer
,
getWishlistsReducer
,
setActivityFilterReducer
,
updateActivityByIdReducer
}
from
"./activitiesReducer"
;
import
{
createActivityReducer
,
getActivitiesReducer
,
getActivityByIdReducer
,
getWishlistsReducer
,
setActivityFilterReducer
,
updateActivityByIdReducer
}
from
"./activitiesReducer"
;
...
@@ -48,6 +48,7 @@ const reducers = combineReducers({
...
@@ -48,6 +48,7 @@ const reducers = combineReducers({
faqs
:
getAllFaqsReducer
,
faqs
:
getAllFaqsReducer
,
reviews
:
reviewsReducer
,
reviews
:
reviewsReducer
,
giftCard
:
giftCardReducer
,
giftCard
:
giftCardReducer
,
enquiriesByAdmin
:
getEnquiriesByVendorReducer
,
});
});
export
default
reducers
;
export
default
reducers
;
redux/reducers/userReducers.js
View file @
7db3c4c
...
@@ -189,7 +189,7 @@ export const resetPasswordReducer = (state = {}, action) => {
...
@@ -189,7 +189,7 @@ export const resetPasswordReducer = (state = {}, action) => {
// Load user reducer
// Load user reducer
export
const
getEndUserReducer
=
(
state
=
{
loading
:
tru
e
,
success
:
false
,
endUser
:
null
},
action
)
=>
{
export
const
getEndUserReducer
=
(
state
=
{
loading
:
fals
e
,
success
:
false
,
endUser
:
null
},
action
)
=>
{
switch
(
action
.
type
)
{
switch
(
action
.
type
)
{
case
GET_END_USER_REQUEST
:
case
GET_END_USER_REQUEST
:
return
{
return
{
...
...
redux/reducers/vendorReducers.js
View file @
7db3c4c
...
@@ -109,7 +109,7 @@ export const getVendorDetailsReducer = (state = { loading: true, success: false,
...
@@ -109,7 +109,7 @@ export const getVendorDetailsReducer = (state = { loading: true, success: false,
}
}
};
};
export
const
getAllVendorsReducer
=
(
state
=
{
loading
:
tru
e
,
success
:
false
,
allVendors
:
null
},
action
)
=>
{
export
const
getAllVendorsReducer
=
(
state
=
{
loading
:
fals
e
,
success
:
false
,
allVendors
:
null
},
action
)
=>
{
switch
(
action
.
type
)
{
switch
(
action
.
type
)
{
case
GET_ALL_VENDORS_REQUEST
:
case
GET_ALL_VENDORS_REQUEST
:
return
{
return
{
...
...
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