Commit 2bda2289 by jaymehta

.

1 parent fd123e8b
......@@ -154,7 +154,7 @@ const ActivityDetailsModal = ({ show, handleClose, activityDetailInfo }) => {
variant=""
className="btnAdd btnApprove m-0"
onClick={async () => {
await updateActivityStatusAdmin({ status: true, activityId: activityDetailInfo[0].id, rejectionReason: "" });
await updateActivityStatusAdmin({ status: "approved", activityId: activityDetailInfo[0].id, rejectionReason: "" });
toast.success("Activity approved.");
}}
>
......@@ -217,7 +217,7 @@ const ActivityDetailsModal = ({ show, handleClose, activityDetailInfo }) => {
className="btnAdd btnApprove m-0"
disabled={rejectionReasonText == ""}
onClick={async () => {
await updateActivityStatusAdmin({ status: false, activityId: activityDetailInfo[0].id, rejectionReason: rejectionReasonText });
await updateActivityStatusAdmin({ status: "rejected", activityId: activityDetailInfo[0].id, rejectionReason: rejectionReasonText });
// setrejectionId(null);
setrejectPopUp(false);
toast.success("Activity rejected.");
......
......@@ -173,7 +173,7 @@ const VendorListing = () => {
setDetail(allVendors.filter(item => item.id == record.key));
}}
/>
<StopTwoTone style={{ fontSize: "20px" }} twoToneColor="red" />
{/* <StopTwoTone style={{ fontSize: "20px" }} twoToneColor="red" /> */}
</Space>
)
}
......
......@@ -17,12 +17,12 @@ const Sidebar = () => {
Toggle Sidebar
</button> */}
<ul>
<li className={router.pathname === "/admin/orders" ? "active" : ""}>
{/* <li className={router.pathname === "/admin/orders" ? "active" : ""}>
<a href="/admin/orders">
<Image alt="" width={22} height={15} src="/images/vendor/icon-orders.svg" />
<span>Orders</span>
</a>
</li>
</li> */}
<li className={router.pathname === "/admin/activities" ? "active" : ""}>
<a href="/admin/activities">
<Image alt="" width={22} height={15} src="/images/vendor/icon-activities.svg" />
......
......@@ -5,7 +5,7 @@ import LetDiscover from "./LetDiscover";
import { useSelector } from "react-redux";
const Listing = () => {
const { allActivitiesData } = useSelector(sate => sate.allActivitiesData);
const { allActivitiesData, loading } = useSelector(sate => sate.allActivitiesData);
const { categories } = useSelector(sate => sate.categories);
const { subCategories } = useSelector(sate => sate.subCategories);
......@@ -16,7 +16,7 @@ const Listing = () => {
<Fragment>
<main>
<LetDiscover categories={categories} subCategories={subCategories}/>
<ListingInner allActivitiesData={allActivitiesData} />
<ListingInner allActivitiesData={allActivitiesData} loading={loading} />
<SignUpToExperienceOurPlatform />
</main>
</Fragment>
......
......@@ -5,7 +5,7 @@ import Image from "next/image";
import { getActivitiesByFilters, getWishlists, setActivityFilters } from "../../redux/actions/activityAction";
import { useDispatch, useSelector } from "react-redux";
const ListingInner = ({ allActivitiesData }) => {
const ListingInner = ({ allActivitiesData, loading }) => {
console.log("allActivitiesData", allActivitiesData);
const [isFilterViewOpen, setIsFilterViewOpen] = useState(false);
const [isGridViewOpen, setIsGridViewOpen] = useState(false);
......@@ -210,7 +210,7 @@ const ListingInner = ({ allActivitiesData }) => {
)}
<div className="col-md-9">
<ListingItems allActivitiesData={allActivitiesData} />
<ListingItems allActivitiesData={allActivitiesData} loading={loading} />
</div>
</div>
</div>
......
import { Empty } from "antd";
import Image from "next/image";
import { useRouter } from "next/router";
import React from "react";
import { Button } from "react-bootstrap";
import { Loader } from "react-bootstrap-typeahead";
import { useSelector } from "react-redux";
import { cleanImage } from "../../services/imageHandling";
import WishlistComponent from "../detail/WIshlistComponent";
const ListingItems = ({ allActivitiesData }) => {
const ListingItems = ({ allActivitiesData, loading }) => {
const { endUser } = useSelector(state => state.endUser);
console.log("endUser", endUser);
const router = useRouter();
return (
<>
<div className="listing-items">
<div className="row">
{allActivitiesData &&
allActivitiesData.data.map(data => {
return (
<div className="col-md-3">
<div className="item">
<div className="browse-experiences-item">
<div className="img-wrapper">
<span className="image-container">
<Image layout="fill" alt="" className="image img-fluid" src={cleanImage(data.attributes?.image?.data?.attributes)} />
</span>
<div className="top-rated">Top Rated</div>
</div>
<div className="info">
<div className="top-name">
<div className="title">{data?.attributes?.name}</div>
<div className="rating-wishlist">
<div className="rating">
{data?.attributes?.rating}
<span className="image-container">
<Image layout="fill" alt="" className="image img-fluid" src="/images/icons/star.svg" />
</span>
{allActivitiesData && !allActivitiesData.data.length == 0 ? (
<div className="listing-items">
{!loading ? (
<div className="row">
{allActivitiesData &&
allActivitiesData.data.map(data => {
return (
<div className="col-md-3">
<div className="item">
<div className="browse-experiences-item">
<div className="img-wrapper">
<span className="image-container">
<Image layout="fill" alt="" className="image img-fluid" src={cleanImage(data.attributes?.image?.data?.attributes)} />
</span>
<div className="top-rated">Top Rated</div>
</div>
<div className="info">
<div className="top-name">
<div className="title">{data?.attributes?.name}</div>
<div className="rating-wishlist">
<div className="rating">
{data?.attributes?.rating}
<span className="image-container">
<Image layout="fill" alt="" className="image img-fluid" src="/images/icons/star.svg" />
</span>
</div>
{endUser && <WishlistComponent activityId={data.id} userId={endUser.id} />}
</div>
</div>
<div className="discription">
{data.discription} <a href="">Read More</a>
</div>
<div className="price">
${data?.attributes?.pricePerPerson} <span className="off">{data?.attributes?.off}% OFF</span>
</div>
<div className="detail">
<div className="">For 1 Night</div>
<div className="">Includes taxes & Fees</div>
</div>
<div className="explore-now">
<Button
onClick={() => {
router.push(`/activities/${data.id}`);
}}
variant="primary"
>
Explore Now
</Button>
</div>
{endUser && <WishlistComponent activityId={data.id} userId={endUser.id} />}
</div>
</div>
<div className="discription">
{data.discription} <a href="">Read More</a>
</div>
<div className="price">
${data?.attributes?.pricePerPerson} <span className="off">{data?.attributes?.off}% OFF</span>
</div>
<div className="detail">
<div className="">For 1 Night</div>
<div className="">Includes taxes & Fees</div>
</div>
<div className="explore-now">
<Button
onClick={() => {
router.push(`/activities/${data.id}`);
}}
variant="primary"
>
Explore Now
</Button>
</div>
</div>
</div>
</div>
</div>
);
})}
);
})}
</div>
) : (
<Loader />
)}
</div>
</div>
) : (
<Empty />
)}
</>
);
};
......
......@@ -14,7 +14,7 @@ import { Select as AntSelect, Switch } from "antd";
// import { getMasterDays } from "../../redux/actions/activityAction";
import axios from "axios";
import { sanitizeTimeFormat, sanitizeTimeRange } from "../../services/imageHandling";
import { createActivity, updateActivityById } from "../../redux/actions/activityAction";
import { createActivity, getActivityById, updateActivityById } from "../../redux/actions/activityAction";
import { toast } from "react-toastify";
import { DatePicker, Space } from "antd";
import dayjs from "dayjs";
......@@ -185,7 +185,7 @@ const ActivityDetails = ({ isUpdate }) => {
subCategory: Yup.string().required("Sub Category is Required"),
activityName: Yup.string().required("Activity Name is Required"),
activityDescription: Yup.string().required("Activity Description is Required"),
location: Yup.string().required("Location is Required"),
location: Yup.string(),
addressLine1: Yup.string().required("Address is Required"),
addressLine2: Yup.string(),
pricePerPerson: Yup.string().required("Price Per Person is Required"),
......@@ -368,8 +368,11 @@ const ActivityDetails = ({ isUpdate }) => {
daysBoolean,
contactPersonForActivity: values.contactPersonForActivity,
duration: values.durationUnit.toString(),
approved: false
approved: "pending"
};
if (!ref.current.state.selected[0]) {
toast.error("Please select location!");
}
console.log("values 123", values);
if (isUpdate) {
console.log("router", router);
......@@ -387,6 +390,7 @@ const ActivityDetails = ({ isUpdate }) => {
// setMonths([]);
}
}
dispatch(getActivityById(router.query.id));
}}
>
<div className="activityDetails">
......@@ -409,6 +413,7 @@ const ActivityDetails = ({ isUpdate }) => {
console.log(categoryRef);
// console.log("subCategories", categoryRef.current.value);
await dispatch(getAllSubCategories(categoryRef.current.value));
setFieldValue("subCategory", "");
}}
onBlur={handleBlur}
>
......@@ -451,6 +456,7 @@ const ActivityDetails = ({ isUpdate }) => {
</span>
)}
</div>
{console.log("errors", errors)}
</div>
</div>
<div className="row">
......@@ -1032,7 +1038,7 @@ const ActivityDetails = ({ isUpdate }) => {
<div className="row">
<div className="col-6 col-lg-5">
<div className="input-group">
<Button type="submit" className="btn btn-primary btn-submit">
<Button type="submit" className="btn btn-primary btn-submit" disabled={Object.keys(errors).length > 0}>
Submit
</Button>
</div>
......
......@@ -331,11 +331,17 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
dataIndex: "status",
render: (_, { status }) => (
<>
{status ? (
{status == "approved" && (
<Tag color={"green"} key={1}>
Approved
</Tag>
) : (
)}
{status == "pending" && (
<Tag color={"orange"} key={1}>
Pending
</Tag>
)}
{status == "rejected" && (
<Tag color={"red"} key={1}>
Rejected
</Tag>
......@@ -412,7 +418,7 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
const adminActions = async ({ type, activityId }) => {
if (type == "approve") {
await updateActivityStatusAdmin({ status: true, activityId, rejectionReason: "" });
await updateActivityStatusAdmin({ status: "approved", activityId, rejectionReason: "" });
}
if (type == "reject") {
setrejectPopUp(true);
......@@ -455,7 +461,7 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
className="btnAdd btnApprove m-0"
disabled={rejectionReasonText == ""}
onClick={async () => {
await updateActivityStatusAdmin({ status: false, activityId: rejectionId, rejectionReason: rejectionReasonText });
await updateActivityStatusAdmin({ status: "rejected", activityId: rejectionId, rejectionReason: rejectionReasonText });
setrejectionId(null);
setrejectPopUp(false);
toast.success("Activity rejected.");
......
......@@ -382,7 +382,7 @@ export const updateActivityStatusAdmin = async ({ status, activityId, rejectionR
Authorization: `Bearer ${session.jwt}`
}
};
if (status) {
if (status == "approved") {
rejectionReason = "";
}
const response = await axios.put(
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!