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 93ce6ebc
authored
2024-05-27 10:31:33 +0530
by
jaymehta
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
.
1 parent
9e140f94
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
79 additions
and
15 deletions
components/admin/Reviews.js
components/admin/ReviewsListing.js
components/detail/Detail.js
components/detail/GuestReviews.js
components/layout/VendorDashboardSidebar.js
pages/admin/reviews/index.js
pages/vendor/reviews/index.js
redux/actions/activityAction.js
services/imageHandling.js
components/admin/Reviews.js
View file @
93ce6eb
...
...
@@ -5,7 +5,7 @@ import { useDispatch, useSelector } from "react-redux";
import
{
getActivitiesByFilters
}
from
"../../redux/actions/activityAction"
;
import
ReviewsListing
from
"./ReviewsListing"
;
const
Reviews
=
()
=>
{
const
Reviews
=
(
{
isVendor
}
)
=>
{
const
dispatch
=
useDispatch
();
const
searchInput
=
useRef
(
null
);
const
[
searchText
,
setSearchText
]
=
useState
(
""
);
...
...
@@ -127,7 +127,7 @@ const Reviews = () => {
return
{
key
:
item
.
id
,
name
:
item
.
attributes
.
name
,
reviewsCount
:
item
.
attributes
.
reviews
.
data
.
length
reviewsCount
:
item
.
attributes
.
reviews
?
.
data
.
length
// tags: ["nice", "developer"]
};
})
...
...
@@ -165,7 +165,7 @@ const Reviews = () => {
width
:
"10%"
}
]);
},
[]);
},
[
allActivitiesData
]);
useEffect
(()
=>
{
setdata
(
allActivitiesData
&&
...
...
@@ -174,7 +174,7 @@ const Reviews = () => {
return
{
key
:
item
.
id
,
name
:
item
.
attributes
.
name
,
reviewsCount
:
item
.
attributes
.
reviews
.
data
.
length
reviewsCount
:
item
.
attributes
.
reviews
?
.
data
.
length
// tags: ["nice", "developer"]
};
})
...
...
@@ -184,7 +184,9 @@ const Reviews = () => {
return
(
<
Fragment
>
<
div
className
=
"row"
>
{
!
showReviews
?
<
Table
columns
=
{
columns
}
dataSource
=
{
data
}
/> : <ReviewsListing setshowReviews={setshowReviews} activityId={activityId} /
>
}
<
/div
>
<
div
className
=
"row"
>
{
!
showReviews
?
<
Table
columns
=
{
columns
}
dataSource
=
{
data
}
/> : <ReviewsListing setshowReviews={setshowReviews} activityId={activityId} isVendor={isVendor} /
>
}
<
/div
>
<
/Fragment
>
);
};
...
...
components/admin/ReviewsListing.js
View file @
93ce6eb
...
...
@@ -8,7 +8,7 @@ import { toast } from "react-toastify";
// import { getActivitiesByFilters } from "../../redux/actions/activityAction";
import
{
deleteReview
,
getReviewsAction
}
from
"../../redux/actions/reviewsAction"
;
const
ReviewsListing
=
({
activityId
,
setshowReviews
})
=>
{
const
ReviewsListing
=
({
activityId
,
setshowReviews
,
isVendor
})
=>
{
const
dispatch
=
useDispatch
();
useEffect
(()
=>
{
dispatch
(
getReviewsAction
({
activityId
}));
...
...
@@ -22,12 +22,13 @@ const ReviewsListing = ({ activityId, setshowReviews }) => {
<
div
className
=
"col-12 col-lg-12"
>
<
div
className
=
"d-flex align-items-center justify-content-between"
>
<
div
className
=
"backDiv"
>
<
span
className
=
"backArrow"
>
<
FaAngleLeft
<
span
className
=
"backArrow"
onClick
=
{()
=>
{
setshowReviews
(
false
);
}}
/
>
>
<
FaAngleLeft
/>
<
/span
>
<
span
>
Reviews
:
<
/span
>
<
/div
>
...
...
@@ -49,6 +50,7 @@ const ReviewsListing = ({ activityId, setshowReviews }) => {
<
Accordion
.
Body
>
<
div
className
=
"m-1"
>
Rating
:
{
item
.
attributes
.
rating
}
<
/div
>
<
div
className
=
"m-1"
>
Review
:
{
item
.
attributes
.
comments
}
<
/div
>
{
!
isVendor
&&
(
<
div
>
<
Button
className
=
"btnAdd btnReject m-0"
...
...
@@ -60,6 +62,7 @@ const ReviewsListing = ({ activityId, setshowReviews }) => {
Delete
review
<
/Button
>
<
/div
>
)}
<
/Accordion.Body
>
<
/Accordion.Item
>
);
...
...
components/detail/Detail.js
View file @
93ce6eb
...
...
@@ -13,7 +13,6 @@ import Image from "next/image";
import
DetailSchedule
from
"./DetailSchedule"
;
const
Detail
=
()
=>
{
const
router
=
useRouter
();
const
dispatch
=
useDispatch
();
const
{
allActivitiesData
}
=
useSelector
(
state
=>
state
.
allActivitiesData
);
...
...
@@ -25,7 +24,7 @@ const Detail = () => {
dispatch
(
getActivitiesByFilters
({
category
:
activityById
?.
data
.
attributes
.
category
?.
data
?.
id
}));
},
[
activityById
]);
console
.
log
(
"faqs=>"
,
faqs
)
console
.
log
(
"faqs=>"
,
faqs
)
;
console
.
log
(
"activityById"
,
activityById
);
console
.
log
(
"loadedUser"
,
loadedUser
);
return
(
...
...
components/detail/GuestReviews.js
View file @
93ce6eb
...
...
@@ -5,6 +5,7 @@ import { Button, Modal } from "react-bootstrap";
import
{
useSelector
}
from
"react-redux"
;
import
StarRatings
from
"react-star-ratings"
;
import
{
postReviewEndUser
}
from
"../../redux/actions/reviewsAction"
;
import
{
dateFormatFn
}
from
"../../services/imageHandling"
;
const
GuestReviews
=
({
activityById
})
=>
{
const
[
rating
,
setRating
]
=
useState
(
0
);
...
...
@@ -55,7 +56,7 @@ const GuestReviews = ({ activityById }) => {
<
div
className
=
"guest-reviews-detail"
>
<
div
className
=
"head"
>
<
div
className
=
"name"
>
{
data
.
attributes
.
endUser
.
data
.
attributes
.
name
}
<
/div
>
<
div
className
=
"month"
>
{
dat
a
.
attributes
.
createdAt
}
<
/div
>
<
div
className
=
"month"
>
{
dat
eFormatFn
(
data
.
attributes
.
createdAt
)
}
<
/div
>
<
/div
>
<
StarRatings
className
=
"col-3 mx-2"
...
...
components/layout/VendorDashboardSidebar.js
View file @
93ce6eb
...
...
@@ -45,6 +45,14 @@ const Sidebar = () => {
<
/div
>
<
/span
>
<
/li
>
<
li
className
=
{
router
.
pathname
===
"/vendor/reviews"
?
"active"
:
""
}
>
<
span
className
=
"d-flex"
>
<
Image
alt
=
""
width
=
{
22
}
height
=
{
15
}
src
=
"/images/vendor/icon-orders.svg"
/>
<
div
className
=
"mx-2 text-center"
>
<
Link
href
=
"/vendor/reviews"
>
Reviews
<
/Link
>
<
/div
>
<
/span
>
<
/li
>
<
/ul
>
<
/div
>
);
...
...
pages/admin/reviews/index.js
View file @
93ce6eb
...
...
@@ -12,7 +12,7 @@ const ReviewsPage = () => {
<
div
className
=
"sidebarContainer"
>
<
Sidebar
/>
<
div
className
=
"content"
>
<
Reviews
/>
<
Reviews
isVendor
=
{
false
}
/
>
<
/div
>
<
/div
>
<
/Layout
>
...
...
pages/vendor/reviews/index.js
0 → 100644
View file @
93ce6eb
import
React
,
{
useEffect
}
from
"react"
;
import
{
useDispatch
}
from
"react-redux"
;
import
Reviews
from
"../../../components/admin/Reviews"
;
import
Layout
from
"../../../components/layout/Layout"
;
import
Sidebar
from
"../../../components/layout/VendorDashboardSidebar"
;
import
{
getActivitiesByVendor
}
from
"../../../redux/actions/activityAction"
;
import
{
wrapper
}
from
"../../../redux/store"
;
const
ReviewsPage
=
()
=>
{
const
dispatch
=
useDispatch
();
useEffect
(()
=>
{
dispatch
(
getActivitiesByVendor
());
},
[]);
return
(
<
div
>
<
Layout
>
<
div
className
=
"sidebarContainer"
>
<
Sidebar
/>
<
div
className
=
"content"
>
<
Reviews
isVendor
=
{
true
}
/
>
<
/div
>
<
/div
>
<
/Layout
>
<
/div
>
);
};
export
default
ReviewsPage
;
/** For server side rendering */
export
const
getServerSideProps
=
wrapper
.
getServerSideProps
(
store
=>
async
({
req
,
query
})
=>
{
// await store.dispatch(loadUser());
// await store.dispatch(getActivitiesByVendor());
// await store.dispatch(getAllVendors());
// await store.dispatch(loadUser());
// await store.dispatch(getActivitiesByVendor());
// await store.dispatch(getAllCategories());
// await store.dispatch(getAllSubCategories());
return
{
props
:
{}
};
});
redux/actions/activityAction.js
View file @
93ce6eb
...
...
@@ -86,7 +86,7 @@ export const getActivitiesByVendor = () => async dispatch => {
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()
// console.log("loggedinVendor", loggedinVendor);
if
(
!
session
)
{
...
...
@@ -112,7 +112,7 @@ export const getActivitiesByVendor = () => async dispatch => {
}
}
},
populate
:
[
"masterMonths"
,
"subCategory"
,
"subCategory.category"
,
"timeSlots"
,
"masterPincode"
,
"vendor"
,
"image"
,
"category"
]
populate
:
[
"masterMonths"
,
"subCategory"
,
"subCategory.category"
,
"timeSlots"
,
"masterPincode"
,
"vendor"
,
"image"
,
"category"
,
"reviews"
]
};
const
queryString
=
qs
.
stringify
(
query
,
{
encodeValuesOnly
:
true
...
...
services/imageHandling.js
View file @
93ce6eb
...
...
@@ -61,3 +61,11 @@ export const sanitizeTimeRange = ({ data }) => {
return
formattedDate
;
// const endDate = new Date(data[1].$d);
};
export
const
dateFormatFn
=
rawDate
=>
{
const
date
=
new
Date
(
rawDate
);
const
year
=
date
.
getFullYear
();
const
month
=
String
(
date
.
getMonth
()
+
1
).
padStart
(
2
,
"0"
);
// Months are zero-indexed
const
day
=
String
(
date
.
getDate
()).
padStart
(
2
,
"0"
);
return
`
${
year
}
-
${
month
}
-
${
day
}
`
;
};
\ 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