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 61d982d8
authored
2024-05-15 17:35:32 +0530
by
jaymehta
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
enquiries
1 parent
2fb6bccd
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
446 additions
and
96 deletions
components/detail/DetailGallery.js
components/detail/DetailInfo.js
components/gift-card/GiftCard.js
components/layout/VendorDashboardSidebar.js
components/vendor/ActivityListingRBAC.js
components/vendor/OrderListing.js
pages/vendor/orders/index.js → pages/vendor/enquiries/index.js
redux/actions/activityAction.js
redux/actions/enquiryAction.js
redux/actions/userActions.js
redux/constants/enquiryConstants.js
redux/reducers/enquiryReducer.js
redux/reducers/reducers.js
components/detail/DetailGallery.js
View file @
61d982d
...
@@ -95,6 +95,7 @@ const DetailGallery = ({ activityById }) => {
...
@@ -95,6 +95,7 @@ const DetailGallery = ({ activityById }) => {
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"row hide-on-mobile"
>
<
div
className
=
"row hide-on-mobile"
>
{
activityById
&&
(
<
div
className
=
"col-12"
>
<
div
className
=
"col-12"
>
<
ul
className
=
"availability-wrappper"
>
<
ul
className
=
"availability-wrappper"
>
<
li
>
<
li
>
...
@@ -146,6 +147,7 @@ const DetailGallery = ({ activityById }) => {
...
@@ -146,6 +147,7 @@ const DetailGallery = ({ activityById }) => {
<
/li
>
<
/li
>
<
/ul
>
<
/ul
>
<
/div
>
<
/div
>
)}
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/
>
<
/
>
...
...
components/detail/DetailInfo.js
View file @
61d982d
import
Image
from
"next/image"
;
import
Image
from
"next/image"
;
import
React
,
{
Fragment
,
useEffect
,
useState
}
from
"react"
;
import
React
,
{
Fragment
,
useEffect
,
useState
}
from
"react"
;
import
{
Button
}
from
"react-bootstrap"
;
import
{
Button
,
Modal
}
from
"react-bootstrap"
;
import
{
fadeIn
,
zoomIn
,
slideFromLeft
,
slideFromRight
}
from
"../animationvariants.js"
;
import
{
fadeIn
,
zoomIn
,
slideFromLeft
,
slideFromRight
}
from
"../animationvariants.js"
;
import
{
motion
}
from
"framer-motion"
;
import
{
motion
}
from
"framer-motion"
;
import
{
getSession
}
from
"next-auth/react"
;
import
{
getSession
}
from
"next-auth/react"
;
import
{
DatePicker
}
from
"antd"
;
import
{
DatePicker
,
Input
}
from
"antd"
;
import
{
date
}
from
"yup"
;
import
{
date
}
from
"yup"
;
import
{
sendEnquiry
}
from
"../../redux/actions/enquiryAction.js"
;
import
{
sendEnquiry
}
from
"../../redux/actions/enquiryAction.js"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
...
@@ -12,9 +12,10 @@ import { toast } from "react-toastify";
...
@@ -12,9 +12,10 @@ import { toast } from "react-toastify";
import
{
getCurrentEndUser
}
from
"../../redux/actions/userActions.js"
;
import
{
getCurrentEndUser
}
from
"../../redux/actions/userActions.js"
;
import
{
Loader
}
from
"react-bootstrap-typeahead"
;
import
{
Loader
}
from
"react-bootstrap-typeahead"
;
import
{
useRouter
}
from
"next/router.js"
;
import
{
useRouter
}
from
"next/router.js"
;
import
Link
from
"next/link.js"
;
const
DetailInfo
=
({
activityById
})
=>
{
const
DetailInfo
=
({
activityById
})
=>
{
const
router
=
useRouter
()
const
router
=
useRouter
()
;
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
getCurrentEndUser
());
dispatch
(
getCurrentEndUser
());
...
@@ -23,6 +24,9 @@ const DetailInfo = ({ activityById }) => {
...
@@ -23,6 +24,9 @@ const DetailInfo = ({ activityById }) => {
// const [session, setSession] = useState(null);
// const [session, setSession] = useState(null);
const
[
enqDate
,
setenqDate
]
=
useState
();
const
[
enqDate
,
setenqDate
]
=
useState
();
const
[
loading
,
setloading
]
=
useState
(
false
);
const
[
loading
,
setloading
]
=
useState
(
false
);
const
[
quantity
,
setquantity
]
=
useState
();
const
[
loginModal
,
setloginModal
]
=
useState
(
false
);
const
[
enquiryModal
,
setenquiryModal
]
=
useState
(
false
);
const
{
loadedUser
}
=
useSelector
(
state
=>
state
.
loadedUser
);
const
{
loadedUser
}
=
useSelector
(
state
=>
state
.
loadedUser
);
const
{
endUser
}
=
useSelector
(
state
=>
state
.
endUser
);
const
{
endUser
}
=
useSelector
(
state
=>
state
.
endUser
);
// useEffect(() => {
// useEffect(() => {
...
@@ -48,6 +52,7 @@ const DetailInfo = ({ activityById }) => {
...
@@ -48,6 +52,7 @@ const DetailInfo = ({ activityById }) => {
return
(
return
(
<
Fragment
>
<
Fragment
>
<
div
className
=
"row"
>
<
div
className
=
"row"
>
{
activityById
&&
(
<
div
className
=
"col-12"
>
<
div
className
=
"col-12"
>
<
div
className
=
"product-info"
>
<
div
className
=
"product-info"
>
<
div
className
=
"hide-on-mobile"
>
<
div
className
=
"hide-on-mobile"
>
...
@@ -115,21 +120,27 @@ const DetailInfo = ({ activityById }) => {
...
@@ -115,21 +120,27 @@ const DetailInfo = ({ activityById }) => {
<
div
className
=
"btn-row"
>
<
div
className
=
"btn-row"
>
<
Button
<
Button
disabled
=
{
loading
}
disabled
=
{
loading
}
onClick
=
{
async
()
=>
{
onClick
=
{()
=>
{
setloading
(
true
);
if
(
!
endUser
)
{
console
.
log
(
"hello"
);
setloginModal
(
true
);
let
res
=
await
sendEnquiry
({
activityId
:
activityById
.
data
.
id
,
userId
:
endUser
.
id
,
vendorId
:
activityById
.
data
.
attributes
.
vendor
.
data
.
id
});
}
else
{
console
.
log
(
"res"
,
res
);
setenquiryModal
(
true
);
toast
.
success
(
"Enquiry sent successfully, our team will get back to you shortly! Thank you!"
);
}
setloading
(
false
);
}}
}}
variant
=
"primary me-3"
variant
=
"primary me-3"
>
>
{
loading
?
<
Loader
/>
:
"Enquire Now"
}
{
loading
?
<
Loader
/>
:
"Enquire Now"
}
<
/Button
>
<
/Button
>
<
Button
onClick
=
{()
=>
{
<
Button
router
.
push
(
"/gift-card"
)
onClick
=
{()
=>
{
}}
variant
=
"secondary"
>
if
(
!
endUser
)
{
setloginModal
(
true
);
}
else
{
router
.
push
(
"/gift-card"
);
}
}}
variant
=
"secondary"
>
Gift
Now
Gift
Now
<
span
className
=
"image-container btn-gift"
>
<
span
className
=
"image-container btn-gift"
>
<
Image
layout
=
"fill"
className
=
"image img-fluid"
src
=
"/images/icons/gift-card-icon.svg"
/>
<
Image
layout
=
"fill"
className
=
"image img-fluid"
src
=
"/images/icons/gift-card-icon.svg"
/>
...
@@ -138,6 +149,7 @@ const DetailInfo = ({ activityById }) => {
...
@@ -138,6 +149,7 @@ const DetailInfo = ({ activityById }) => {
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
)}
<
/div
>
<
/div
>
<
div
className
=
"row hide-on-desktop"
>
<
div
className
=
"row hide-on-desktop"
>
<
div
className
=
"col-12"
>
<
div
className
=
"col-12"
>
...
@@ -187,6 +199,78 @@ const DetailInfo = ({ activityById }) => {
...
@@ -187,6 +199,78 @@ const DetailInfo = ({ activityById }) => {
<
/ul
>
<
/ul
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
Modal
show
=
{
enquiryModal
}
onHide
=
{()
=>
{
setenquiryModal
(
false
);
setquantity
();
}}
>
<
Modal
.
Header
>
Send
Enquiry
<
/Modal.Header
>
<
Modal
.
Body
>
<
div
>
Experience
Name
:
<
/div
>
<
div
className
=
""
style
=
{{
fontSize
:
"22px"
,
fontWeight
:
"bold"
}}
>
{
activityById
.
data
.
attributes
.
name
}
<
/div
>
<
div
className
=
"mt-2"
>
Full
Name
:
<
/div
>
<
div
className
=
""
style
=
{{
fontWeight
:
"bold"
}}
>
{
endUser
?.
attributes
.
name
}
<
/div
>
<
div
className
=
"mt-2"
>
Email
ID
:
<
/div
>
<
div
className
=
""
style
=
{{
fontSize
:
"22px"
,
fontWeight
:
"bold"
}}
>
{
endUser
?.
attributes
.
email
}
<
/div
>
<
div
className
=
"mt-2"
>
Quantity
:
<
/div
>
<
Input
type
=
"number"
onChange
=
{
e
=>
{
// console.log("e", e);
setquantity
(
e
.
target
.
value
);
}}
><
/Input
>
<
Button
disabled
=
{
loading
||
!
quantity
}
className
=
"mt-2"
onClick
=
{
async
()
=>
{
setloading
(
true
);
console
.
log
(
"hello"
);
let
res
=
await
sendEnquiry
({
activityId
:
activityById
.
data
.
id
,
userId
:
endUser
.
id
,
vendorId
:
activityById
.
data
.
attributes
.
vendor
.
data
.
id
,
quantity
});
console
.
log
(
"res"
,
res
);
toast
.
success
(
"Enquiry sent successfully, our team will get back to you shortly! Thank you!"
);
setloading
(
false
);
setenquiryModal
(
false
);
setquantity
();
}}
>
{
loading
?
<
Loader
/>
:
"Submit"
}
<
/Button
>
<
/Modal.Body
>
<
/Modal
>
<
Modal
show
=
{
loginModal
}
centered
onHide
=
{()
=>
{
setloginModal
(
false
);
}}
>
<
Modal
.
Header
closeButton
>
Please
Log
in
<
/Modal.Header
>
<
Modal
.
Body
>
<
div
className
=
"text-center d-flex justify-content-center row"
>
<
div
className
=
"col-12 m-2"
>
Please
login
to
avail
this
feature
.
<
/div
>
<
Button
className
=
"col-6 m-2"
onClick
=
{()
=>
{
router
.
push
(
"/login/user"
);
}}
>
Login
<
/Button
>
<
Link
className
=
"m-2"
href
=
{
"/signup/user"
}
>
Or
click
here
to
sign
up
.
<
/Link
>
<
/div
>
<
/Modal.Body
>
<
/Modal
>
<
/Fragment
>
<
/Fragment
>
);
);
};
};
...
...
components/gift-card/GiftCard.js
View file @
61d982d
...
@@ -8,6 +8,7 @@ import axios from "axios";
...
@@ -8,6 +8,7 @@ import axios from "axios";
import
{
toast
}
from
"react-toastify"
;
import
{
toast
}
from
"react-toastify"
;
import
{
Loader
}
from
"react-bootstrap-typeahead"
;
import
{
Loader
}
from
"react-bootstrap-typeahead"
;
import
{
finishVendorOtpVerification
}
from
"../../redux/actions/vendorActions"
;
import
{
finishVendorOtpVerification
}
from
"../../redux/actions/vendorActions"
;
import
{
useRouter
}
from
"next/router"
;
// import { getCurrentEndUser } from "../../redux/actions/userActions";
// import { getCurrentEndUser } from "../../redux/actions/userActions";
const
validationSchema
=
Yup
.
object
().
shape
({
const
validationSchema
=
Yup
.
object
().
shape
({
...
@@ -21,6 +22,7 @@ const validationSchema = Yup.object().shape({
...
@@ -21,6 +22,7 @@ const validationSchema = Yup.object().shape({
let
formik1
;
let
formik1
;
const
GiftCard
=
()
=>
{
const
GiftCard
=
()
=>
{
const
router
=
useRouter
()
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
// useEffect(() => {
// useEffect(() => {
// dispatch(getCurrentEndUser());
// dispatch(getCurrentEndUser());
...
@@ -389,11 +391,13 @@ const GiftCard = () => {
...
@@ -389,11 +391,13 @@ const GiftCard = () => {
<
div
className
=
"col-12"
>
<
div
className
=
"col-12"
>
<
div
className
=
"result-box"
>
<
div
className
=
"result-box"
>
<
p
>
<
p
>
“
Sorry
,
unable
to
process
the
Gift
Card
now
.
Gift
card
sent
for
approval
,
please
wait
till
the
vendor
contacts
you
<
br
/>
Th
is
feature
will
be
available
shortly
.
”
<
br
/>
Th
ank
you
.
<
/p
>
<
/p
>
<
div
>
<
div
>
<
button
className
=
"btn btn-primary"
type
=
"button"
onClick
=
{
handleclose
}
>
<
button
className
=
"btn btn-primary"
type
=
"button"
onClick
=
{()
=>
{
router
.
push
(
"/listing"
)
}}
>
Browse
Experiences
Browse
Experiences
<
/button
>
<
/button
>
<
/div
>
<
/div
>
...
...
components/layout/VendorDashboardSidebar.js
View file @
61d982d
import
Image
from
"next/image"
;
import
Image
from
"next/image"
;
import
Link
from
"next/link"
;
import
{
useRouter
}
from
"next/router"
;
import
{
useRouter
}
from
"next/router"
;
import
React
,
{
useState
}
from
"react"
;
import
React
,
{
useState
}
from
"react"
;
import
{
ToastContainer
}
from
"react-toastify"
;
import
{
ToastContainer
}
from
"react-toastify"
;
...
@@ -21,22 +22,28 @@ const Sidebar = () => {
...
@@ -21,22 +22,28 @@ const Sidebar = () => {
</button> */
}
</button> */
}
<
ul
>
<
ul
>
<
li
className
=
{
router
.
pathname
===
"/vendor/dashboard"
?
"active"
:
""
}
>
<
li
className
=
{
router
.
pathname
===
"/vendor/dashboard"
?
"active"
:
""
}
>
<
a
href
=
"/vendor/dashboard"
>
<
span
className
=
"d-flex"
>
<
Image
alt
=
""
width
=
{
22
}
height
=
{
15
}
src
=
"/images/vendor/icon-dashboard.svg"
/>
<
Image
className
=
""
alt
=
""
width
=
{
22
}
height
=
{
15
}
src
=
"/images/vendor/icon-dashboard.svg"
/>
<
span
>
Dashboard
<
/span
>
<
div
className
=
"mx-2 text-center"
>
<
/a
>
<
Link
href
=
"/vendor/dashboard"
>
Dashboard
<
/Link
>
<
/div
>
<
/span
>
<
/li
>
<
/li
>
<
li
className
=
{
router
.
pathname
===
"/vendor/
order
s"
?
"active"
:
""
}
>
<
li
className
=
{
router
.
pathname
===
"/vendor/
enquirie
s"
?
"active"
:
""
}
>
<
a
href
=
"/vendor/orders
"
>
<
span
className
=
"d-flex
"
>
<
Image
alt
=
""
width
=
{
22
}
height
=
{
15
}
src
=
"/images/vendor/icon-orders.svg"
/>
<
Image
alt
=
""
width
=
{
22
}
height
=
{
15
}
src
=
"/images/vendor/icon-orders.svg"
/>
<
span
>
Orders
<
/span
>
<
div
className
=
"mx-2 text-center"
>
<
/a
>
<
Link
href
=
"/vendor/enquiries"
>
Enquiries
<
/Link
>
<
/div
>
<
/span
>
<
/li
>
<
/li
>
<
li
className
=
{
router
.
pathname
===
"/vendor/activities"
?
"active"
:
""
}
>
<
li
className
=
{
router
.
pathname
===
"/vendor/activities"
?
"active"
:
""
}
>
<
a
href
=
"/vendor/activities
"
>
<
span
className
=
"d-flex
"
>
<
Image
alt
=
""
width
=
{
22
}
height
=
{
15
}
src
=
"/images/vendor/icon-activities.svg"
/>
<
Image
alt
=
""
width
=
{
22
}
height
=
{
15
}
src
=
"/images/vendor/icon-activities.svg"
/>
<
span
>
Activities
<
/span
>
<
div
className
=
"mx-2 text-center"
>
<
/a
>
<
Link
href
=
"/vendor/activities"
>
Activities
<
/Link
>
<
/div
>
<
/span
>
<
/li
>
<
/li
>
<
/ul
>
<
/ul
>
<
/div
>
<
/div
>
...
...
components/vendor/ActivityListingRBAC.js
View file @
61d982d
...
@@ -170,10 +170,10 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
...
@@ -170,10 +170,10 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
};
};
});
});
const
categoryFilterArray
=
categories
.
data
.
map
((
item
,
index
)
=>
{
const
categoryFilterArray
=
categories
?
.
data
.
map
((
item
,
index
)
=>
{
return
{
text
:
item
.
attributes
.
name
,
value
:
item
.
attributes
.
name
};
return
{
text
:
item
.
attributes
.
name
,
value
:
item
.
attributes
.
name
};
});
});
const
subCategoryFilterArray
=
subCategories
.
data
.
map
((
item
,
index
)
=>
{
const
subCategoryFilterArray
=
subCategories
?
.
data
.
map
((
item
,
index
)
=>
{
return
{
text
:
item
.
attributes
.
name
,
value
:
item
.
attributes
.
name
};
return
{
text
:
item
.
attributes
.
name
,
value
:
item
.
attributes
.
name
};
});
});
setdata
(
initialData
);
setdata
(
initialData
);
...
...
components/vendor/OrderListing.js
View file @
61d982d
import
{
Fragment
}
from
"react"
;
import
{
EyeOutlined
,
EyeTwoTone
}
from
"@ant-design/icons"
;
import
{
Button
,
Image
,
Table
}
from
"react-bootstrap"
;
import
{
Space
,
Table
,
Tag
}
from
"antd"
;
import
{
Fragment
,
useEffect
,
useState
}
from
"react"
;
import
{
Button
,
Image
,
Modal
}
from
"react-bootstrap"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
toast
}
from
"react-toastify"
;
import
{
getActivitiesByVendor
}
from
"../../redux/actions/activityAction"
;
import
{
changeEnquiryStatus
,
getEnquiriesByVendor
}
from
"../../redux/actions/enquiryAction"
;
const
OrderListing
=
()
=>
{
const
OrderListing
=
()
=>
{
const
array
=
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
]
const
dispatch
=
useDispatch
();
useEffect
(()
=>
{
dispatch
(
getEnquiriesByVendor
());
dispatch
(
getActivitiesByVendor
());
},
[]);
const
{
enquiriesByVendor
}
=
useSelector
(
state
=>
state
.
enquiriesByVendor
);
const
{
allActivitiesData
}
=
useSelector
(
state
=>
state
.
allActivitiesData
);
const
[
data
,
setData
]
=
useState
();
const
[
activityFilters
,
setactivityFilters
]
=
useState
();
const
[
enquiryDetails
,
setenquiryDetails
]
=
useState
();
const
[
showEnquiryModal
,
setshowEnquiryModal
]
=
useState
(
false
);
console
.
log
(
"enquiriesByVendor"
,
enquiriesByVendor
);
const
columns
=
[
{
title
:
"Activity name"
,
dataIndex
:
"activityName"
,
filters
:
activityFilters
,
// filterMode: "tree",
filterSearch
:
true
,
onFilter
:
(
value
,
record
)
=>
{
console
.
log
(
"value"
,
value
,
record
.
name
.
startsWith
(
value
));
return
record
.
activityName
.
startsWith
(
value
);
},
width
:
"25%"
},
{
title
:
"Name"
,
dataIndex
:
"name"
,
sorter
:
(
a
,
b
)
=>
a
.
age
-
b
.
age
,
width
:
"25%"
},
{
title
:
"Status"
,
dataIndex
:
"status"
,
filters
:
[
{
text
:
"pending"
,
value
:
"pending"
},
{
text
:
"closed"
,
value
:
"closed"
}
],
onFilter
:
(
value
,
record
)
=>
record
.
status
.
startsWith
(
value
),
filterSearch
:
true
,
width
:
"25%"
,
render
:
tag
=>
(
<
span
>
{
tag
==
"pending"
?
(
<
Tag
color
=
{
"red"
}
key
=
{
tag
}
>
{
tag
.
toUpperCase
()}
<
/Tag
>
)
:
(
<
Tag
color
=
{
"blue"
}
key
=
{
tag
}
>
{
tag
.
toUpperCase
()}
<
/Tag
>
)}
<
/span
>
)
},
{
title
:
"Quantity"
,
dataIndex
:
"quantity"
,
// filters: [
// {
// text: "London",
// value: "London"
// },
// {
// text: "New York",
// value: "New York"
// }
// ],
// onFilter: (value, record) => record.address.startsWith(value),
// filterSearch: true,
width
:
"15%"
},
{
title
:
"Action"
,
width
:
"25%"
,
render
:
(
_
,
record
)
=>
(
<
Space
size
=
"middle"
>
<
EyeTwoTone
onClick
=
{()
=>
{
setshowEnquiryModal
(
true
);
console
.
log
(
record
);
setenquiryDetails
(
enquiriesByVendor
.
filter
(
item
=>
item
.
id
==
record
.
key
));
}}
style
=
{{
fontSize
:
"22px"
}}
/
>
{
/* <a>Delete</a> */
}
<
/Space
>
)
}
];
useEffect
(()
=>
{
let
rawData
=
enquiriesByVendor
&&
enquiriesByVendor
.
map
(
item
=>
{
return
{
key
:
item
.
id
,
name
:
item
.
attributes
.
end_user
.
data
.
attributes
.
name
,
quantity
:
item
.
attributes
.
quantity
,
status
:
item
.
attributes
.
status
,
activityName
:
item
.
attributes
.
experience
.
data
.
attributes
.
name
};
});
setData
(
rawData
);
},
[
enquiriesByVendor
]);
useEffect
(()
=>
{
const
activityFiltersRaw
=
allActivitiesData
&&
allActivitiesData
.
data
.
map
(
item
=>
{
return
{
text
:
item
.
attributes
.
name
,
value
:
item
.
attributes
.
name
};
});
setactivityFilters
(
activityFiltersRaw
);
},
[
allActivitiesData
]);
const
onChange
=
(
pagination
,
filters
,
sorter
,
extra
)
=>
{
// console.log("params", pagination, filters, sorter, extra);
};
return
(
return
(
<
Fragment
>
<
Fragment
>
<
div
className
=
"row"
>
<
div
className
=
"row"
>
...
@@ -14,61 +148,52 @@ const OrderListing = () => {
...
@@ -14,61 +148,52 @@ const OrderListing = () => {
<
p
>
View
all
the
orders
<
/p
>
<
p
>
View
all
the
orders
<
/p
>
<
/div
>
<
/div
>
<
div
>
<
div
>
<
Button
type
=
"button"
variant
=
""
className
=
"btnAdd m-0"
>
{
/*
<Button type="button" variant="" className="btnAdd m-0">
<
Image
alt
=
""
width
=
"16"
height
=
"16"
src
=
"/images/vendor/icon-filter.svg"
className
=
"me-2"
/>
Filter
<Image alt="" width="16" height="16" src="/images/vendor/icon-filter.svg" className="me-2"
/> Filter
<
/Button
>
</Button> */
}
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
Table
responsive
className
=
"listingTable"
>
<
Table
columns
=
{
columns
}
dataSource
=
{
data
}
onChange
=
{
onChange
}
/
>
<
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
>
Order
ID
<
/th
>
<
th
>
Order
Date
<
/th
>
<
th
>
Items
<
/th
>
<
th
>
Total
Amount
<
/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
>
ID_8797878
<
/td
>
<
td
>
29
Jan
2024
<
/td
>
<
td
>
Edge
City
Climb
<
span
style
=
{{
color
:
"blue"
}}
>+
3
more
<
/span></
td
>
<
td
>
$
499
<
/td
>
<
td
><
div
className
=
"statusDiv processing"
>
Processing
<
/div></
td
>
<
td
><
Image
alt
=
""
width
=
{
20
}
height
=
{
20
}
src
=
"/images/vendor/icon-more-vertical.svg"
/><
/td
>
<
/tr
>
))}
<
tr
>
<
td
colSpan
=
{
7
}
>
Showing
Results
10
of
1567
<
/td
>
<
/tr
>
<
/tbody
>
<
/Table
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
Modal
show
=
{
showEnquiryModal
}
onHide
=
{()
=>
{
setshowEnquiryModal
(
false
);
}}
>
{
console
.
log
(
"enquiryDetails"
,
enquiryDetails
)}
<
Modal
.
Header
>
Enquiry
Details
<
/Modal.Header
>
<
Modal
.
Body
>
{
enquiryDetails
&&
enquiryDetails
.
length
>
0
&&
(
<>
<
div
className
=
"p-2"
>
Name
:
{
enquiryDetails
[
0
].
attributes
.
end_user
.
data
.
attributes
.
name
}
<
/div
>
<
div
className
=
"p-2"
>
Phone
number
:
{
enquiryDetails
[
0
].
attributes
.
end_user
.
data
.
attributes
.
phone
}
<
/div
>
<
div
className
=
"p-2"
>
Email
:
{
enquiryDetails
[
0
].
attributes
.
end_user
.
data
.
attributes
.
email
}
<
/div
>
<
div
className
=
"p-2"
>
Status
:
<
Tag
color
=
{
enquiryDetails
[
0
].
attributes
.
status
==
"pending"
?
"red"
:
"blueI"
}
>
{
enquiryDetails
[
0
].
attributes
.
status
.
toUpperCase
()}
<
/Tag
>
<
/div
>
<
Button
onClick
=
{
async
()
=>
{
if
(
enquiryDetails
[
0
].
attributes
.
status
==
"pending"
)
{
let
res
=
await
changeEnquiryStatus
({
status
:
"closed"
,
id
:
enquiryDetails
[
0
].
id
});
console
.
log
(
"res"
,
res
);
}
else
{
let
res
=
await
changeEnquiryStatus
({
status
:
"pending"
,
id
:
enquiryDetails
[
0
].
id
});
console
.
log
(
"res"
,
res
);
}
await
dispatch
(
getEnquiriesByVendor
());
toast
.
success
(
"Status changed"
);
setshowEnquiryModal
(
false
);
}}
>
Change
Status
<
/Button
>
<
/
>
)}
<
/Modal.Body
>
<
/Modal
>
<
/Fragment
>
<
/Fragment
>
);
);
};
};
...
...
pages/vendor/
order
s/index.js
→
pages/vendor/
enquirie
s/index.js
View file @
61d982d
...
@@ -6,8 +6,7 @@ import Sidebar from "../../../components/layout/VendorDashboardSidebar";
...
@@ -6,8 +6,7 @@ import Sidebar from "../../../components/layout/VendorDashboardSidebar";
// import { loadUser } from "../redux/actions/userActions";
// import { loadUser } from "../redux/actions/userActions";
// import { wrapper } from "../redux/store";
// import { wrapper } from "../redux/store";
export
default
function
OrderListingPage
()
{
const
OrderListingPage
=
()
=>
{
return
(
return
(
<
Layout
>
<
Layout
>
<
div
className
=
"sidebarContainer"
>
<
div
className
=
"sidebarContainer"
>
...
@@ -20,16 +19,15 @@ export default function OrderListingPage() {
...
@@ -20,16 +19,15 @@ export default function OrderListingPage() {
);
);
};
};
export
default
OrderListingPage
;
/** 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
})
=>
{
// Get the menu data.
// Get the menu data.
// get the locations data.
// get the locations data.
// await store.dispatch(getVendorDetails())
// await store.dispatch(loadUser());
return
{
return
{
props
:
{},
props
:
{}
};
};
});
});
redux/actions/activityAction.js
View file @
61d982d
...
@@ -82,7 +82,7 @@ export const getActivitiesByVendor = () => async dispatch => {
...
@@ -82,7 +82,7 @@ export const getActivitiesByVendor = () => async dispatch => {
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
)
{
...
...
redux/actions/enquiryAction.js
View file @
61d982d
import
axios
from
"axios"
;
import
axios
from
"axios"
;
import
{
CLEAR_ERRORS
,
ENQUIRY_SUBMIT_FAIL
,
ENQUIRY_SUBMIT_REQUEST
,
ENQUIRY_SUBMIT_SUCCESS
}
from
"../constants/enquiryConstants"
;
import
{
getSession
}
from
"next-auth/react"
;
import
{
CLEAR_ERRORS
,
ENQUIRY_SUBMIT_FAIL
,
ENQUIRY_SUBMIT_REQUEST
,
ENQUIRY_SUBMIT_SUCCESS
,
GET_ENQUIRIES_BY_VENDOR_FAIL
,
GET_ENQUIRIES_BY_VENDOR_REQUEST
,
GET_ENQUIRIES_BY_VENDOR_SUCCESS
}
from
"../constants/enquiryConstants"
;
import
qs
from
"qs"
;
export
const
sendEnquiry
=
async
({
activityId
,
userId
,
date
,
vendorId
})
=>
{
export
const
sendEnquiry
=
async
({
activityId
,
userId
,
date
,
vendorId
,
quantity
})
=>
{
const
data
=
{
const
data
=
{
data
:
{
data
:
{
experience
:
activityId
,
experience
:
activityId
,
end
U
ser
:
userId
,
end
_u
ser
:
userId
,
vendor
:
vendorId
,
vendor
:
vendorId
,
date
,
date
,
status
:
"pending"
status
:
"pending"
,
quantity
}
}
};
};
const
config
=
{
const
config
=
{
...
@@ -28,3 +39,85 @@ export const clearErrors = () => async dispatch => {
...
@@ -28,3 +39,85 @@ export const clearErrors = () => async dispatch => {
type
:
CLEAR_ERRORS
type
:
CLEAR_ERRORS
});
});
};
};
export
const
getEnquiriesByVendor
=
()
=>
async
dispatch
=>
{
try
{
const
session
=
await
getSession
();
if
(
!
session
)
{
return
;
}
const
vendorConfig
=
{
headers
:
{
"Content-Type"
:
"application/json"
,
Authorization
:
`Bearer
${
session
.
jwt
}
`
}
};
const
vendorQuery
=
{
filters
:
{
user
:
{
id
:
{
$eq
:
session
.
id
}
}
}
};
const
vendorQueryString
=
qs
.
stringify
(
vendorQuery
,
{
encodeValuesOnly
:
true
});
const
vendorResponse
=
await
axios
.
get
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/vendors/?
${
vendorQueryString
}
`
,
vendorConfig
);
console
.
log
(
"session"
,
vendorResponse
.
data
.
data
[
0
].
id
);
dispatch
({
type
:
GET_ENQUIRIES_BY_VENDOR_REQUEST
});
const
config
=
{
headers
:
{
"Content-type"
:
"application/json"
,
Authorization
:
`Bearer
${
session
.
jwt
}
`
}
};
const
query
=
{
filters
:
{
vendor
:
{
id
:
{
$eq
:
vendorResponse
.
data
.
data
[
0
].
id
}
}
},
populate
:
[
"vendor"
,
"experience"
,
"end_user"
]
};
const
queryString
=
qs
.
stringify
(
query
,
{
encodeValuesOnly
:
true
});
// console.log("querystring", query);
const
response
=
await
axios
.
get
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/enquires/?
${
queryString
}
`
,
config
);
console
.
log
(
"response"
,
response
);
dispatch
({
type
:
GET_ENQUIRIES_BY_VENDOR_SUCCESS
,
payload
:
response
.
data
.
data
});
}
catch
(
error
)
{
dispatch
({
type
:
GET_ENQUIRIES_BY_VENDOR_FAIL
,
payload
:
error
.
response
.
data
});
}
};
export
const
changeEnquiryStatus
=
async
({
status
,
id
})
=>
{
try
{
const
session
=
await
getSession
();
if
(
!
session
)
{
return
;
}
const
config
=
{
headers
:
{
"Content-type"
:
"application/json"
,
Authorization
:
`Bearer
${
session
.
jwt
}
`
}
};
const
response
=
await
axios
.
put
(
`
${
process
.
env
.
NEXT_PUBLIC_BACKEND_API_URL
}
/api/enquires/
${
id
}
`
,
{
data
:
{
status
}
},
config
);
return
response
.
data
;
}
catch
(
error
)
{}
};
redux/actions/userActions.js
View file @
61d982d
...
@@ -403,6 +403,9 @@ export const getCurrentEndUser = () => async dispatch => {
...
@@ -403,6 +403,9 @@ export const getCurrentEndUser = () => async dispatch => {
try
{
try
{
console
.
log
(
"here action"
);
console
.
log
(
"here action"
);
const
session
=
await
getSession
();
const
session
=
await
getSession
();
if
(
!
session
)
{
return
;
}
console
.
log
(
"session action"
,
session
);
console
.
log
(
"session action"
,
session
);
dispatch
({
dispatch
({
type
:
GET_END_USER_REQUEST
type
:
GET_END_USER_REQUEST
...
...
redux/constants/enquiryConstants.js
View file @
61d982d
...
@@ -2,6 +2,10 @@ export const ENQUIRY_SUBMIT_REQUEST = "ENQUIRY_SUBMIT_REQUEST";
...
@@ -2,6 +2,10 @@ export const ENQUIRY_SUBMIT_REQUEST = "ENQUIRY_SUBMIT_REQUEST";
export
const
ENQUIRY_SUBMIT_SUCCESS
=
"ENQUIRY_SUBMIT_SUCCESS"
;
export
const
ENQUIRY_SUBMIT_SUCCESS
=
"ENQUIRY_SUBMIT_SUCCESS"
;
export
const
ENQUIRY_SUBMIT_FAIL
=
"ENQUIRY_SUBMIT_FAIL"
;
export
const
ENQUIRY_SUBMIT_FAIL
=
"ENQUIRY_SUBMIT_FAIL"
;
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_FAIL
=
"GET_ENQUIRIES_BY_VENDOR_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 @
61d982d
import
{
ENQUIRY_SUBMIT_FAIL
,
ENQUIRY_SUBMIT_REQUEST
,
ENQUIRY_SUBMIT_SUCCESS
}
from
"../constants/enquiryConstants"
;
import
{
ENQUIRY_SUBMIT_FAIL
,
ENQUIRY_SUBMIT_REQUEST
,
ENQUIRY_SUBMIT_SUCCESS
,
GET_ENQUIRIES_BY_VENDOR_FAIL
,
GET_ENQUIRIES_BY_VENDOR_REQUEST
,
GET_ENQUIRIES_BY_VENDOR_SUCCESS
}
from
"../constants/enquiryConstants"
;
export
const
enquiryReducer
=
(
state
=
{
enquiry
:
null
},
action
)
=>
{
export
const
enquiryReducer
=
(
state
=
{
enquiry
:
null
},
action
)
=>
{
switch
(
action
.
type
)
{
switch
(
action
.
type
)
{
...
@@ -11,7 +18,7 @@ export const enquiryReducer = (state = { enquiry: null }, action) => {
...
@@ -11,7 +18,7 @@ export const enquiryReducer = (state = { enquiry: null }, action) => {
return
{
return
{
loading
:
false
,
loading
:
false
,
success
:
true
,
success
:
true
,
referral
:
action
.
payload
enquiry
:
action
.
payload
};
};
case
ENQUIRY_SUBMIT_FAIL
:
case
ENQUIRY_SUBMIT_FAIL
:
return
{
return
{
...
@@ -24,3 +31,25 @@ export const enquiryReducer = (state = { enquiry: null }, action) => {
...
@@ -24,3 +31,25 @@ export const enquiryReducer = (state = { enquiry: null }, action) => {
return
state
;
return
state
;
}
}
};
};
export
const
getEnquiriesReducer
=
(
state
=
{
enquiriesByVendor
:
null
},
action
)
=>
{
switch
(
action
.
type
)
{
case
GET_ENQUIRIES_BY_VENDOR_REQUEST
:
return
{
loading
:
true
,
};
case
GET_ENQUIRIES_BY_VENDOR_SUCCESS
:
return
{
loading
:
false
,
enquiriesByVendor
:
action
.
payload
};
case
GET_ENQUIRIES_BY_VENDOR_FAIL
:
return
{
loading
:
false
,
error
:
action
.
payload
.
error
.
message
};
default
:
return
state
;
}
};
redux/reducers/reducers.js
View file @
61d982d
...
@@ -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
}
from
"./enquiryReducer"
;
import
{
enquiryReducer
,
getEnquiriesReducer
}
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
,
updateActivityByIdReducer
}
from
"./activitiesReducer"
;
import
{
createActivityReducer
,
getActivitiesReducer
,
getActivityByIdReducer
,
updateActivityByIdReducer
}
from
"./activitiesReducer"
;
...
@@ -39,6 +39,7 @@ const reducers = combineReducers({
...
@@ -39,6 +39,7 @@ const reducers = combineReducers({
homeBanner
:
getAllHomeBannerReducer
,
homeBanner
:
getAllHomeBannerReducer
,
allVendors
:
getAllVendorsReducer
,
allVendors
:
getAllVendorsReducer
,
endUser
:
getEndUserReducer
,
endUser
:
getEndUserReducer
,
enquiriesByVendor
:
getEnquiriesReducer
,
});
});
export
default
reducers
;
export
default
reducers
;
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