Commit 8634093b by jaymehta

.

1 parent 7ab9b79a
......@@ -25,8 +25,8 @@ const SearchBar = () => {
open={open}
id="select"
placeholder="Search for products, brands or categories"
onBlur={()=> {
setopen(false)
onBlur={() => {
setopen(false);
}}
onChange={selected => {
console.log("selected", selected);
......@@ -54,17 +54,17 @@ const SearchBar = () => {
console.log("res", res.data);
if (res.data.success) {
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);
if (opts?.length > 0) {
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];
} else {
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);
......
......@@ -111,17 +111,17 @@ const Header = () => {
console.log("res", res.data);
if (res.data.success) {
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);
if (opts?.length > 0) {
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];
} else {
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);
......
......@@ -443,7 +443,7 @@ const ActivityDetails = ({ isUpdate }) => {
vendor: loggedInVendor,
name: values.activityName,
description: values.activityDescription,
address: `${values.addressLine1}, ${values.addressLine2}`,
address: `${values.addressLine1}`,
minimumDuration: values.minDuration,
maximumDuration: values.maxDuration,
ageLowerLimit: values.ageGroup,
......@@ -630,12 +630,12 @@ const ActivityDetails = ({ isUpdate }) => {
)}
</div>
</div>
<div className="col-12 col-lg-6">
{/* <div className="col-12 col-lg-6">
<div className="input-group">
<label>Address Line 2</label>
<input type="text" name={`addressLine2`} onChange={handleChange} onBlur={handleBlur} value={values.addressLine2} />
</div>
</div>
</div> */}
</div>
<div className="row">
<div className="col-12 col-lg-6">
......@@ -1050,7 +1050,13 @@ const ActivityDetails = ({ isUpdate }) => {
<div className="input-group">
<label>Cancellation Policy</label>
<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>
{values.cancellationPolicyFile && (
<div className="d-flex align-items-center justify-content-between p-1" style={{ width: "100%" }}>
......@@ -1069,7 +1075,12 @@ const ActivityDetails = ({ isUpdate }) => {
<div className="input-group">
<label>Terms & Conditions</label>
<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>
{values.termsConditionsFile && (
<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";
import React, { useEffect, useState } from "react";
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 [session, setSession] = useState();
const [previewOpen, setPreviewOpen] = useState(false);
......@@ -45,8 +45,21 @@ const UploadImageCustom = ({ isUpdate, setImage, populatedImages, imagesArrayCom
console.log("fileList", fileList);
// let formData = new FormData();
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 => {
// console.log(file);
if (isPdf) {
getUrls(file.url);
return;
}
if (!file.url && !file.preview) {
file.preview = await getBase64(file.originFileObj);
}
......@@ -118,7 +131,7 @@ const UploadImageCustom = ({ isUpdate, setImage, populatedImages, imagesArrayCom
message.error(`Failed to remove ${file.name}. Image ID not found.`);
return;
}
setImage()
setImage();
setFileList([]);
try {
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!