Commit 8634093b by jaymehta

.

1 parent 7ab9b79a
...@@ -25,8 +25,8 @@ const SearchBar = () => { ...@@ -25,8 +25,8 @@ const SearchBar = () => {
open={open} open={open}
id="select" id="select"
placeholder="Search for products, brands or categories" placeholder="Search for products, brands or categories"
onBlur={()=> { onBlur={() => {
setopen(false) setopen(false);
}} }}
onChange={selected => { onChange={selected => {
console.log("selected", selected); console.log("selected", selected);
...@@ -54,17 +54,17 @@ const SearchBar = () => { ...@@ -54,17 +54,17 @@ const SearchBar = () => {
console.log("res", res.data); console.log("res", res.data);
if (res.data.success) { if (res.data.success) {
let opts = res.data.data.categories?.map(item => { let opts = res.data.data.categories?.map(item => {
return { id: item.id, label: `${item.name} - category` }; return { id: item.id, label: `Category - ${item.name}` };
}); });
console.log("here", opts); console.log("here", opts);
if (opts?.length > 0) { if (opts?.length > 0) {
const a = res.data.data.activities?.map(item => { const a = res.data.data.activities?.map(item => {
return { id: item.id, label: `${item.name} - experience` }; return { id: item.id, label: `Experience - ${item.name}` };
}); });
opts = [...opts, ...a]; opts = [...opts, ...a];
} else { } else {
opts = res.data.data.activities?.map(item => { opts = res.data.data.activities?.map(item => {
return { id: item.id, label: `${item.name} - experience` }; return { id: item.id, label: `Experience - ${item.name}` };
}); });
} }
// console.log("opts", opts); // console.log("opts", opts);
......
...@@ -111,17 +111,17 @@ const Header = () => { ...@@ -111,17 +111,17 @@ const Header = () => {
console.log("res", res.data); console.log("res", res.data);
if (res.data.success) { if (res.data.success) {
let opts = res.data.data.categories?.map(item => { let opts = res.data.data.categories?.map(item => {
return { id: item.id, label: `${item.name} - category` }; return { id: item.id, label: `Category - ${item.name}` };
}); });
console.log("here", opts); console.log("here", opts);
if (opts?.length > 0) { if (opts?.length > 0) {
const a = res.data.data.activities?.map(item => { const a = res.data.data.activities?.map(item => {
return { id: item.id, label: `${item.name} - experience` }; return { id: item.id, label: `Experience - ${item.name}` };
}); });
opts = [...opts, ...a]; opts = [...opts, ...a];
} else { } else {
opts = res.data.data.activities?.map(item => { opts = res.data.data.activities?.map(item => {
return { id: item.id, label: `${item.name} - experience` }; return { id: item.id, label: `Experience - ${item.name}` };
}); });
} }
// console.log("opts", opts); // console.log("opts", opts);
......
...@@ -443,7 +443,7 @@ const ActivityDetails = ({ isUpdate }) => { ...@@ -443,7 +443,7 @@ const ActivityDetails = ({ isUpdate }) => {
vendor: loggedInVendor, vendor: loggedInVendor,
name: values.activityName, name: values.activityName,
description: values.activityDescription, description: values.activityDescription,
address: `${values.addressLine1}, ${values.addressLine2}`, address: `${values.addressLine1}`,
minimumDuration: values.minDuration, minimumDuration: values.minDuration,
maximumDuration: values.maxDuration, maximumDuration: values.maxDuration,
ageLowerLimit: values.ageGroup, ageLowerLimit: values.ageGroup,
...@@ -630,12 +630,12 @@ const ActivityDetails = ({ isUpdate }) => { ...@@ -630,12 +630,12 @@ const ActivityDetails = ({ isUpdate }) => {
)} )}
</div> </div>
</div> </div>
<div className="col-12 col-lg-6"> {/* <div className="col-12 col-lg-6">
<div className="input-group"> <div className="input-group">
<label>Address Line 2</label> <label>Address Line 2</label>
<input type="text" name={`addressLine2`} onChange={handleChange} onBlur={handleBlur} value={values.addressLine2} /> <input type="text" name={`addressLine2`} onChange={handleChange} onBlur={handleBlur} value={values.addressLine2} />
</div> </div>
</div> </div> */}
</div> </div>
<div className="row"> <div className="row">
<div className="col-12 col-lg-6"> <div className="col-12 col-lg-6">
...@@ -1050,7 +1050,13 @@ const ActivityDetails = ({ isUpdate }) => { ...@@ -1050,7 +1050,13 @@ const ActivityDetails = ({ isUpdate }) => {
<div className="input-group"> <div className="input-group">
<label>Cancellation Policy</label> <label>Cancellation Policy</label>
<div className="custom-file"> <div className="custom-file">
<UploadImageCustom isUpdate={isUpdate} setImage={setCancellationPolicy} populatedImages={activityById?.data.attributes.termsConditions} /> <UploadImageCustom
isUpdate={isUpdate}
setImage={setCancellationPolicy}
populatedImages={activityById?.data.attributes.termsConditions}
isPdf={true}
/>
{console.log("cancellationPolicy", cancellationPolicy, termsConditions)}
</div> </div>
{values.cancellationPolicyFile && ( {values.cancellationPolicyFile && (
<div className="d-flex align-items-center justify-content-between p-1" style={{ width: "100%" }}> <div className="d-flex align-items-center justify-content-between p-1" style={{ width: "100%" }}>
...@@ -1069,7 +1075,12 @@ const ActivityDetails = ({ isUpdate }) => { ...@@ -1069,7 +1075,12 @@ const ActivityDetails = ({ isUpdate }) => {
<div className="input-group"> <div className="input-group">
<label>Terms & Conditions</label> <label>Terms & Conditions</label>
<div className="custom-file"> <div className="custom-file">
<UploadImageCustom isUpdate={isUpdate} setImage={settermsConditions} populatedImages={activityById?.data.attributes.cancellationPolicy} /> <UploadImageCustom
isUpdate={isUpdate}
setImage={settermsConditions}
populatedImages={activityById?.data.attributes.cancellationPolicy}
isPdf={true}
/>
</div> </div>
{values.termsConditionsFile && ( {values.termsConditionsFile && (
<div className="d-flex align-items-center justify-content-between p-1" style={{ width: "100%" }}> <div className="d-flex align-items-center justify-content-between p-1" style={{ width: "100%" }}>
......
...@@ -5,7 +5,7 @@ import { getSession } from "next-auth/react"; ...@@ -5,7 +5,7 @@ import { getSession } from "next-auth/react";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { cleanImage } from "../../services/imageHandling"; import { cleanImage } from "../../services/imageHandling";
const UploadImageCustom = ({ isUpdate, setImage, populatedImages, imagesArrayComponent }) => { const UploadImageCustom = ({ isUpdate, setImage, populatedImages, imagesArrayComponent, isPdf }) => {
// const { loadedUser } = useSelector(state => state.loadedUser); // const { loadedUser } = useSelector(state => state.loadedUser);
const [session, setSession] = useState(); const [session, setSession] = useState();
const [previewOpen, setPreviewOpen] = useState(false); const [previewOpen, setPreviewOpen] = useState(false);
...@@ -45,8 +45,21 @@ const UploadImageCustom = ({ isUpdate, setImage, populatedImages, imagesArrayCom ...@@ -45,8 +45,21 @@ const UploadImageCustom = ({ isUpdate, setImage, populatedImages, imagesArrayCom
console.log("fileList", fileList); console.log("fileList", fileList);
// let formData = new FormData(); // let formData = new FormData();
let finalId; let finalId;
const getUrls = url => {
// let a = activityDetailInfo[0]?.attributes?.cancellationPolicy?.data;
console.log("checking data", url);
if (url !== null) {
window.open(url, "_blank");
} else {
toast.warning("No Data Found");
}
};
const handlePreview = async file => { const handlePreview = async file => {
// console.log(file);
if (isPdf) {
getUrls(file.url);
return;
}
if (!file.url && !file.preview) { if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj); file.preview = await getBase64(file.originFileObj);
} }
...@@ -118,7 +131,7 @@ const UploadImageCustom = ({ isUpdate, setImage, populatedImages, imagesArrayCom ...@@ -118,7 +131,7 @@ const UploadImageCustom = ({ isUpdate, setImage, populatedImages, imagesArrayCom
message.error(`Failed to remove ${file.name}. Image ID not found.`); message.error(`Failed to remove ${file.name}. Image ID not found.`);
return; return;
} }
setImage() setImage();
setFileList([]); setFileList([]);
try { try {
await axios.delete(`${process.env.NEXT_PUBLIC_BACKEND_API_URL}/api/upload/files/${imageId}`, { await axios.delete(`${process.env.NEXT_PUBLIC_BACKEND_API_URL}/api/upload/files/${imageId}`, {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!