Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Jay Mehta
/
zango-frontend
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Registry
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 8634093b
authored
2024-06-10 16:31:28 +0530
by
jaymehta
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
.
1 parent
7ab9b79a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
16 deletions
components/home/SearchBar.js
components/layout/Header.js
components/vendor/ActivityDetails.js
components/vendor/UploadImageCustom.js
components/home/SearchBar.js
View file @
8634093
...
...
@@ -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);
...
...
components/layout/Header.js
View file @
8634093
...
...
@@ -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);
...
...
components/vendor/ActivityDetails.js
View file @
8634093
...
...
@@ -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%"
}}
>
...
...
components/vendor/UploadImageCustom.js
View file @
8634093
...
...
@@ -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
}
`
,
{
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment