Commit 61d982d8 by jaymehta

enquiries

1 parent 2fb6bccd
......@@ -95,57 +95,59 @@ const DetailGallery = ({ activityById }) => {
</div>
</div>
<div className="row hide-on-mobile">
<div className="col-12">
<ul className="availability-wrappper">
<li>
<span className="image-container">
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/month.svg" />
</span>
From: {activityById.data.attributes.fromDate} To: {activityById.data.attributes.toDate}
</li>
<li>
<span className="image-container">
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/time.svg" />
</span>
Time: {activityById.data.attributes.fromTime} - {activityById.data.attributes.toTime}
</li>
<li>
<span className="image-container">
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/duration.svg" />
</span>
Duration: {activityById.data.attributes.minimumDuration}-{activityById.data.attributes.maximumDuration} Hours
</li>
<li>
<span className="image-container">
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/contact.svg" />
</span>
Contact: {activityById.data.attributes.phoneNumber}
</li>
<li>
<span className="image-container">
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/date.svg" />
</span>
Active on:{" "}
{returnAvilablleDaysArray({ data: activityById.data })
.map(item => {
return item.name;
})
.join(", ")}
</li>
<li>
<span className="image-container">
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/age.svg" />
</span>
Age: {activityById.data.attributes.ageLowerLimit}+
<div className="info-div">
<a className="image-container info" onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}>
<Image layout="fill" alt="" className="image img-fluid" src="/images/icons/info.svg" />
</a>
{showInfo && <div className="info-text">13+. Climbers aged 13-17 must be accompanied by an adult (18+)</div>}
</div>
</li>
</ul>
</div>
{activityById && (
<div className="col-12">
<ul className="availability-wrappper">
<li>
<span className="image-container">
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/month.svg" />
</span>
From: {activityById.data.attributes.fromDate} To: {activityById.data.attributes.toDate}
</li>
<li>
<span className="image-container">
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/time.svg" />
</span>
Time: {activityById.data.attributes.fromTime} - {activityById.data.attributes.toTime}
</li>
<li>
<span className="image-container">
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/duration.svg" />
</span>
Duration: {activityById.data.attributes.minimumDuration}-{activityById.data.attributes.maximumDuration} Hours
</li>
<li>
<span className="image-container">
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/contact.svg" />
</span>
Contact: {activityById.data.attributes.phoneNumber}
</li>
<li>
<span className="image-container">
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/date.svg" />
</span>
Active on:{" "}
{returnAvilablleDaysArray({ data: activityById.data })
.map(item => {
return item.name;
})
.join(", ")}
</li>
<li>
<span className="image-container">
<Image layout="fill" alt="" className="image img-fluid" src="/images/availability/age.svg" />
</span>
Age: {activityById.data.attributes.ageLowerLimit}+
<div className="info-div">
<a className="image-container info" onMouseEnter={handleMouseEnter} onMouseLeave={handleMouseLeave}>
<Image layout="fill" alt="" className="image img-fluid" src="/images/icons/info.svg" />
</a>
{showInfo && <div className="info-text">13+. Climbers aged 13-17 must be accompanied by an adult (18+)</div>}
</div>
</li>
</ul>
</div>
)}
</div>
</div>
</>
......
......@@ -8,6 +8,7 @@ import axios from "axios";
import { toast } from "react-toastify";
import { Loader } from "react-bootstrap-typeahead";
import { finishVendorOtpVerification } from "../../redux/actions/vendorActions";
import { useRouter } from "next/router";
// import { getCurrentEndUser } from "../../redux/actions/userActions";
const validationSchema = Yup.object().shape({
......@@ -21,6 +22,7 @@ const validationSchema = Yup.object().shape({
let formik1;
const GiftCard = () => {
const router = useRouter()
const dispatch = useDispatch();
// useEffect(() => {
// dispatch(getCurrentEndUser());
......@@ -389,11 +391,13 @@ const GiftCard = () => {
<div className="col-12">
<div className="result-box">
<p>
Sorry, unable to process the Gift Card now.
<br /> This feature will be available shortly.
Gift card sent for approval, please wait till the vendor contacts you
<br /> Thank you.
</p>
<div>
<button className="btn btn-primary" type="button" onClick={handleclose}>
<button className="btn btn-primary" type="button" onClick={()=>{
router.push("/listing")
}}>
Browse Experiences
</button>
</div>
......
import Image from "next/image";
import Link from "next/link";
import { useRouter } from "next/router";
import React, { useState } from "react";
import { ToastContainer } from "react-toastify";
......@@ -21,22 +22,28 @@ const Sidebar = () => {
</button> */}
<ul>
<li className={router.pathname === "/vendor/dashboard" ? "active" : ""}>
<a href="/vendor/dashboard">
<Image alt="" width={22} height={15} src="/images/vendor/icon-dashboard.svg" />
<span>Dashboard</span>
</a>
<span className="d-flex">
<Image className="" alt="" width={22} height={15} src="/images/vendor/icon-dashboard.svg" />
<div className="mx-2 text-center">
<Link href="/vendor/dashboard">Dashboard</Link>
</div>
</span>
</li>
<li className={router.pathname === "/vendor/orders" ? "active" : ""}>
<a href="/vendor/orders">
<li className={router.pathname === "/vendor/enquiries" ? "active" : ""}>
<span className="d-flex">
<Image alt="" width={22} height={15} src="/images/vendor/icon-orders.svg" />
<span>Orders</span>
</a>
<div className="mx-2 text-center">
<Link href="/vendor/enquiries">Enquiries</Link>
</div>
</span>
</li>
<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" />
<span>Activities</span>
</a>
<div className="mx-2 text-center">
<Link href="/vendor/activities">Activities</Link>
</div>
</span>
</li>
</ul>
</div>
......
......@@ -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 };
});
const subCategoryFilterArray = subCategories.data.map((item, index) => {
const subCategoryFilterArray = subCategories?.data.map((item, index) => {
return { text: item.attributes.name, value: item.attributes.name };
});
setdata(initialData);
......
......@@ -6,30 +6,28 @@ import Sidebar from "../../../components/layout/VendorDashboardSidebar";
// import { loadUser } from "../redux/actions/userActions";
// import { wrapper } from "../redux/store";
export default function OrderListingPage() {
return (
<Layout>
<div className="sidebarContainer">
<Sidebar />
<div className="content">
<OrderListing />
</div>
</div>
</Layout>
);
const OrderListingPage = () => {
return (
<Layout>
<div className="sidebarContainer">
<Sidebar />
<div className="content">
<OrderListing />
</div>
</div>
</Layout>
);
};
export default OrderListingPage;
/** For server side rendering */
export const getServerSideProps = wrapper.getServerSideProps(store => async ({ req, query }) => {
// Get the menu data.
// get the locations data.
// await store.dispatch(getVendorDetails())
// Get the menu data.
return {
props: {},
// get the locations data.
// await store.dispatch(loadUser());
};
return {
props: {}
};
});
......@@ -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);
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) {
......
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 = {
data: {
experience: activityId,
endUser: userId,
end_user: userId,
vendor: vendorId,
date,
status: "pending"
status: "pending",
quantity
}
};
const config = {
......@@ -28,3 +39,85 @@ export const clearErrors = () => async dispatch => {
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 => {
try {
console.log("here action");
const session = await getSession();
if (!session) {
return;
}
console.log("session action", session);
dispatch({
type: GET_END_USER_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_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 TOGGLE_SUCCESS
\ 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) => {
switch (action.type) {
......@@ -11,7 +18,7 @@ export const enquiryReducer = (state = { enquiry: null }, action) => {
return {
loading: false,
success: true,
referral: action.payload
enquiry: action.payload
};
case ENQUIRY_SUBMIT_FAIL:
return {
......@@ -24,3 +31,25 @@ export const enquiryReducer = (state = { enquiry: null }, action) => {
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";
import { projectReducer, projectsReducer, similarProjectsReducer } from "./projectsReducer";
import { townshipReducer, townshipsReducer } from "./townshipsReducer";
import { authReducer, forgotPasswordReducer, getEndUserReducer, loadedUserReducer, resetPasswordReducer, userReducer } from "./userReducers";
import { enquiryReducer } from "./enquiryReducer";
import { enquiryReducer, getEnquiriesReducer } from "./enquiryReducer";
import { displayEnquireNowReducer } from "./enquireNowModalReducer";
import { getAllVendorsReducer, getVendorDetailsReducer, loggedInVendorReducer, updateVendorReducer } from "./vendorReducers";
import { createActivityReducer, getActivitiesReducer, getActivityByIdReducer, updateActivityByIdReducer } from "./activitiesReducer";
......@@ -39,6 +39,7 @@ const reducers = combineReducers({
homeBanner: getAllHomeBannerReducer,
allVendors: getAllVendorsReducer,
endUser: getEndUserReducer,
enquiriesByVendor: getEnquiriesReducer,
});
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!