Commit 61d982d8 by jaymehta

enquiries

1 parent 2fb6bccd
...@@ -95,57 +95,59 @@ const DetailGallery = ({ activityById }) => { ...@@ -95,57 +95,59 @@ const DetailGallery = ({ activityById }) => {
</div> </div>
</div> </div>
<div className="row hide-on-mobile"> <div className="row hide-on-mobile">
<div className="col-12"> {activityById && (
<ul className="availability-wrappper"> <div className="col-12">
<li> <ul className="availability-wrappper">
<span className="image-container"> <li>
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/month.svg" /> <span className="image-container">
</span> <Image layout="fill" alt="" className="image img-fluid" src="/images/availability/month.svg" />
From: {activityById.data.attributes.fromDate} To: {activityById.data.attributes.toDate} </span>
</li> From: {activityById.data.attributes.fromDate} To: {activityById.data.attributes.toDate}
<li> </li>
<span className="image-container"> <li>
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/time.svg" /> <span className="image-container">
</span> <Image layout="fill" alt="" className="image img-fluid" src="/images/availability/time.svg" />
Time: {activityById.data.attributes.fromTime} - {activityById.data.attributes.toTime} </span>
</li> Time: {activityById.data.attributes.fromTime} - {activityById.data.attributes.toTime}
<li> </li>
<span className="image-container"> <li>
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/duration.svg" /> <span className="image-container">
</span> <Image layout="fill" alt="" className="image img-fluid" src="/images/availability/duration.svg" />
Duration: {activityById.data.attributes.minimumDuration}-{activityById.data.attributes.maximumDuration} Hours </span>
</li> Duration: {activityById.data.attributes.minimumDuration}-{activityById.data.attributes.maximumDuration} Hours
<li> </li>
<span className="image-container"> <li>
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/contact.svg" /> <span className="image-container">
</span> <Image layout="fill" alt="" className="image img-fluid" src="/images/availability/contact.svg" />
Contact: {activityById.data.attributes.phoneNumber} </span>
</li> Contact: {activityById.data.attributes.phoneNumber}
<li> </li>
<span className="image-container"> <li>
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/date.svg" /> <span className="image-container">
</span> <Image layout="fill" alt="" className="image img-fluid" src="/images/availability/date.svg" />
Active on:{" "} </span>
{returnAvilablleDaysArray({ data: activityById.data }) Active on:{" "}
.map(item => { {returnAvilablleDaysArray({ data: activityById.data })
return item.name; .map(item => {
}) return item.name;
.join(", ")} })
</li> .join(", ")}
<li> </li>
<span className="image-container"> <li>
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/age.svg" /> <span className="image-container">
</span> <Image layout="fill" alt="" className="image img-fluid" src="/images/availability/age.svg" />
Age: {activityById.data.attributes.ageLowerLimit}+ </span>
<div className="info-div"> Age: {activityById.data.attributes.ageLowerLimit}+
<a className="image-container info" onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}> <div className="info-div">
<Image layout="fill" alt="" className="image img-fluid" src="/images/icons/info.svg" /> <a className="image-container info" onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}>
</a> <Image layout="fill" alt="" className="image img-fluid" src="/images/icons/info.svg" />
{showInfo && <div className="info-text">13+. Climbers aged 13-17 must be accompanied by an adult (18+)</div>} </a>
</div> {showInfo && <div className="info-text">13+. Climbers aged 13-17 must be accompanied by an adult (18+)</div>}
</li> </div>
</ul> </li>
</div> </ul>
</div>
)}
</div> </div>
</div> </div>
</> </>
......
...@@ -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 /> This feature will be available shortly. <br /> Thank 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>
......
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/orders" ? "active" : ""}> <li className={router.pathname === "/vendor/enquiries" ? "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>
......
...@@ -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);
......
...@@ -6,30 +6,28 @@ import Sidebar from "../../../components/layout/VendorDashboardSidebar"; ...@@ -6,30 +6,28 @@ 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"> <Sidebar />
<Sidebar /> <div className="content">
<div className="content"> <OrderListing />
<OrderListing /> </div>
</div> </div>
</div> </Layout>
</Layout> );
);
}; };
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.
// await store.dispatch(getVendorDetails())
return { // get the locations data.
props: {}, // await store.dispatch(loadUser());
}; return {
props: {}
};
}); });
...@@ -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) {
......
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,
endUser: userId, end_user: 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) {}
};
...@@ -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
......
...@@ -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
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;
}
};
...@@ -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;
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!