Commit 2bda2289 by jaymehta

.

1 parent fd123e8b
...@@ -154,7 +154,7 @@ const ActivityDetailsModal = ({ show, handleClose, activityDetailInfo }) => { ...@@ -154,7 +154,7 @@ const ActivityDetailsModal = ({ show, handleClose, activityDetailInfo }) => {
variant="" variant=""
className="btnAdd btnApprove m-0" className="btnAdd btnApprove m-0"
onClick={async () => { onClick={async () => {
await updateActivityStatusAdmin({ status: true, activityId: activityDetailInfo[0].id, rejectionReason: "" }); await updateActivityStatusAdmin({ status: "approved", activityId: activityDetailInfo[0].id, rejectionReason: "" });
toast.success("Activity approved."); toast.success("Activity approved.");
}} }}
> >
...@@ -217,7 +217,7 @@ const ActivityDetailsModal = ({ show, handleClose, activityDetailInfo }) => { ...@@ -217,7 +217,7 @@ const ActivityDetailsModal = ({ show, handleClose, activityDetailInfo }) => {
className="btnAdd btnApprove m-0" className="btnAdd btnApprove m-0"
disabled={rejectionReasonText == ""} disabled={rejectionReasonText == ""}
onClick={async () => { onClick={async () => {
await updateActivityStatusAdmin({ status: false, activityId: activityDetailInfo[0].id, rejectionReason: rejectionReasonText }); await updateActivityStatusAdmin({ status: "rejected", activityId: activityDetailInfo[0].id, rejectionReason: rejectionReasonText });
// setrejectionId(null); // setrejectionId(null);
setrejectPopUp(false); setrejectPopUp(false);
toast.success("Activity rejected."); toast.success("Activity rejected.");
......
...@@ -173,7 +173,7 @@ const VendorListing = () => { ...@@ -173,7 +173,7 @@ const VendorListing = () => {
setDetail(allVendors.filter(item => item.id == record.key)); setDetail(allVendors.filter(item => item.id == record.key));
}} }}
/> />
<StopTwoTone style={{ fontSize: "20px" }} twoToneColor="red" /> {/* <StopTwoTone style={{ fontSize: "20px" }} twoToneColor="red" /> */}
</Space> </Space>
) )
} }
......
...@@ -17,12 +17,12 @@ const Sidebar = () => { ...@@ -17,12 +17,12 @@ const Sidebar = () => {
Toggle Sidebar Toggle Sidebar
</button> */} </button> */}
<ul> <ul>
<li className={router.pathname === "/admin/orders" ? "active" : ""}> {/* <li className={router.pathname === "/admin/orders" ? "active" : ""}>
<a href="/admin/orders"> <a href="/admin/orders">
<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> <span>Orders</span>
</a> </a>
</li> </li> */}
<li className={router.pathname === "/admin/activities" ? "active" : ""}> <li className={router.pathname === "/admin/activities" ? "active" : ""}>
<a href="/admin/activities"> <a href="/admin/activities">
<Image alt="" width={22} height={15} src="/images/vendor/icon-activities.svg" /> <Image alt="" width={22} height={15} src="/images/vendor/icon-activities.svg" />
......
...@@ -5,7 +5,7 @@ import LetDiscover from "./LetDiscover"; ...@@ -5,7 +5,7 @@ import LetDiscover from "./LetDiscover";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
const Listing = () => { const Listing = () => {
const { allActivitiesData } = useSelector(sate => sate.allActivitiesData); const { allActivitiesData, loading } = useSelector(sate => sate.allActivitiesData);
const { categories } = useSelector(sate => sate.categories); const { categories } = useSelector(sate => sate.categories);
const { subCategories } = useSelector(sate => sate.subCategories); const { subCategories } = useSelector(sate => sate.subCategories);
...@@ -16,7 +16,7 @@ const Listing = () => { ...@@ -16,7 +16,7 @@ const Listing = () => {
<Fragment> <Fragment>
<main> <main>
<LetDiscover categories={categories} subCategories={subCategories}/> <LetDiscover categories={categories} subCategories={subCategories}/>
<ListingInner allActivitiesData={allActivitiesData} /> <ListingInner allActivitiesData={allActivitiesData} loading={loading} />
<SignUpToExperienceOurPlatform /> <SignUpToExperienceOurPlatform />
</main> </main>
</Fragment> </Fragment>
......
...@@ -5,7 +5,7 @@ import Image from "next/image"; ...@@ -5,7 +5,7 @@ import Image from "next/image";
import { getActivitiesByFilters, getWishlists, setActivityFilters } from "../../redux/actions/activityAction"; import { getActivitiesByFilters, getWishlists, setActivityFilters } from "../../redux/actions/activityAction";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
const ListingInner = ({ allActivitiesData }) => { const ListingInner = ({ allActivitiesData, loading }) => {
console.log("allActivitiesData", allActivitiesData); console.log("allActivitiesData", allActivitiesData);
const [isFilterViewOpen, setIsFilterViewOpen] = useState(false); const [isFilterViewOpen, setIsFilterViewOpen] = useState(false);
const [isGridViewOpen, setIsGridViewOpen] = useState(false); const [isGridViewOpen, setIsGridViewOpen] = useState(false);
...@@ -210,7 +210,7 @@ const ListingInner = ({ allActivitiesData }) => { ...@@ -210,7 +210,7 @@ const ListingInner = ({ allActivitiesData }) => {
)} )}
<div className="col-md-9"> <div className="col-md-9">
<ListingItems allActivitiesData={allActivitiesData} /> <ListingItems allActivitiesData={allActivitiesData} loading={loading} />
</div> </div>
</div> </div>
</div> </div>
......
import { Empty } from "antd";
import Image from "next/image"; import Image from "next/image";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import React from "react"; import React from "react";
import { Button } from "react-bootstrap"; import { Button } from "react-bootstrap";
import { Loader } from "react-bootstrap-typeahead";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { cleanImage } from "../../services/imageHandling"; import { cleanImage } from "../../services/imageHandling";
import WishlistComponent from "../detail/WIshlistComponent"; import WishlistComponent from "../detail/WIshlistComponent";
const ListingItems = ({ allActivitiesData }) => { const ListingItems = ({ allActivitiesData, loading }) => {
const { endUser } = useSelector(state => state.endUser); const { endUser } = useSelector(state => state.endUser);
console.log("endUser", endUser); console.log("endUser", endUser);
const router = useRouter(); const router = useRouter();
return ( return (
<> <>
{allActivitiesData && !allActivitiesData.data.length == 0 ? (
<div className="listing-items"> <div className="listing-items">
{!loading ? (
<div className="row"> <div className="row">
{allActivitiesData && {allActivitiesData &&
allActivitiesData.data.map(data => { allActivitiesData.data.map(data => {
...@@ -66,7 +70,13 @@ const ListingItems = ({ allActivitiesData }) => { ...@@ -66,7 +70,13 @@ const ListingItems = ({ allActivitiesData }) => {
); );
})} })}
</div> </div>
) : (
<Loader />
)}
</div> </div>
) : (
<Empty />
)}
</> </>
); );
}; };
......
...@@ -14,7 +14,7 @@ import { Select as AntSelect, Switch } from "antd"; ...@@ -14,7 +14,7 @@ import { Select as AntSelect, Switch } from "antd";
// import { getMasterDays } from "../../redux/actions/activityAction"; // import { getMasterDays } from "../../redux/actions/activityAction";
import axios from "axios"; import axios from "axios";
import { sanitizeTimeFormat, sanitizeTimeRange } from "../../services/imageHandling"; 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 { toast } from "react-toastify";
import { DatePicker, Space } from "antd"; import { DatePicker, Space } from "antd";
import dayjs from "dayjs"; import dayjs from "dayjs";
...@@ -185,7 +185,7 @@ const ActivityDetails = ({ isUpdate }) => { ...@@ -185,7 +185,7 @@ const ActivityDetails = ({ isUpdate }) => {
subCategory: Yup.string().required("Sub Category is Required"), subCategory: Yup.string().required("Sub Category is Required"),
activityName: Yup.string().required("Activity Name is Required"), activityName: Yup.string().required("Activity Name is Required"),
activityDescription: Yup.string().required("Activity Description 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"), addressLine1: Yup.string().required("Address is Required"),
addressLine2: Yup.string(), addressLine2: Yup.string(),
pricePerPerson: Yup.string().required("Price Per Person is Required"), pricePerPerson: Yup.string().required("Price Per Person is Required"),
...@@ -368,8 +368,11 @@ const ActivityDetails = ({ isUpdate }) => { ...@@ -368,8 +368,11 @@ const ActivityDetails = ({ isUpdate }) => {
daysBoolean, daysBoolean,
contactPersonForActivity: values.contactPersonForActivity, contactPersonForActivity: values.contactPersonForActivity,
duration: values.durationUnit.toString(), duration: values.durationUnit.toString(),
approved: false approved: "pending"
}; };
if (!ref.current.state.selected[0]) {
toast.error("Please select location!");
}
console.log("values 123", values); console.log("values 123", values);
if (isUpdate) { if (isUpdate) {
console.log("router", router); console.log("router", router);
...@@ -387,6 +390,7 @@ const ActivityDetails = ({ isUpdate }) => { ...@@ -387,6 +390,7 @@ const ActivityDetails = ({ isUpdate }) => {
// setMonths([]); // setMonths([]);
} }
} }
dispatch(getActivityById(router.query.id));
}} }}
> >
<div className="activityDetails"> <div className="activityDetails">
...@@ -409,6 +413,7 @@ const ActivityDetails = ({ isUpdate }) => { ...@@ -409,6 +413,7 @@ const ActivityDetails = ({ isUpdate }) => {
console.log(categoryRef); console.log(categoryRef);
// console.log("subCategories", categoryRef.current.value); // console.log("subCategories", categoryRef.current.value);
await dispatch(getAllSubCategories(categoryRef.current.value)); await dispatch(getAllSubCategories(categoryRef.current.value));
setFieldValue("subCategory", "");
}} }}
onBlur={handleBlur} onBlur={handleBlur}
> >
...@@ -451,6 +456,7 @@ const ActivityDetails = ({ isUpdate }) => { ...@@ -451,6 +456,7 @@ const ActivityDetails = ({ isUpdate }) => {
</span> </span>
)} )}
</div> </div>
{console.log("errors", errors)}
</div> </div>
</div> </div>
<div className="row"> <div className="row">
...@@ -1032,7 +1038,7 @@ const ActivityDetails = ({ isUpdate }) => { ...@@ -1032,7 +1038,7 @@ const ActivityDetails = ({ isUpdate }) => {
<div className="row"> <div className="row">
<div className="col-6 col-lg-5"> <div className="col-6 col-lg-5">
<div className="input-group"> <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 Submit
</Button> </Button>
</div> </div>
......
...@@ -331,11 +331,17 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta ...@@ -331,11 +331,17 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
dataIndex: "status", dataIndex: "status",
render: (_, { status }) => ( render: (_, { status }) => (
<> <>
{status ? ( {status == "approved" && (
<Tag color={"green"} key={1}> <Tag color={"green"} key={1}>
Approved Approved
</Tag> </Tag>
) : ( )}
{status == "pending" && (
<Tag color={"orange"} key={1}>
Pending
</Tag>
)}
{status == "rejected" && (
<Tag color={"red"} key={1}> <Tag color={"red"} key={1}>
Rejected Rejected
</Tag> </Tag>
...@@ -412,7 +418,7 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta ...@@ -412,7 +418,7 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
const adminActions = async ({ type, activityId }) => { const adminActions = async ({ type, activityId }) => {
if (type == "approve") { if (type == "approve") {
await updateActivityStatusAdmin({ status: true, activityId, rejectionReason: "" }); await updateActivityStatusAdmin({ status: "approved", activityId, rejectionReason: "" });
} }
if (type == "reject") { if (type == "reject") {
setrejectPopUp(true); setrejectPopUp(true);
...@@ -455,7 +461,7 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta ...@@ -455,7 +461,7 @@ export const ActivityListingRBAC = ({ setactivityDetailInfo, setShowActivityDeta
className="btnAdd btnApprove m-0" className="btnAdd btnApprove m-0"
disabled={rejectionReasonText == ""} disabled={rejectionReasonText == ""}
onClick={async () => { onClick={async () => {
await updateActivityStatusAdmin({ status: false, activityId: rejectionId, rejectionReason: rejectionReasonText }); await updateActivityStatusAdmin({ status: "rejected", activityId: rejectionId, rejectionReason: rejectionReasonText });
setrejectionId(null); setrejectionId(null);
setrejectPopUp(false); setrejectPopUp(false);
toast.success("Activity rejected."); toast.success("Activity rejected.");
......
...@@ -382,7 +382,7 @@ export const updateActivityStatusAdmin = async ({ status, activityId, rejectionR ...@@ -382,7 +382,7 @@ export const updateActivityStatusAdmin = async ({ status, activityId, rejectionR
Authorization: `Bearer ${session.jwt}` Authorization: `Bearer ${session.jwt}`
} }
}; };
if (status) { if (status == "approved") {
rejectionReason = ""; rejectionReason = "";
} }
const response = await axios.put( 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!