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 cf1a2379
authored
2024-06-03 17:39:39 +0530
by
jaymehta
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
.
1 parent
b944355e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
components/vendor/ActivityDetails.js
components/vendor/UploadImageCustom.js
components/vendor/ActivityDetails.js
View file @
cf1a237
...
@@ -425,6 +425,10 @@ const ActivityDetails = ({ isUpdate }) => {
...
@@ -425,6 +425,10 @@ const ActivityDetails = ({ isUpdate }) => {
return
;
return
;
}
}
if
(
!
displayImage
)
{
toast
.
error
(
"You need to upload a display image!"
);
return
;
}
handleSubmit
();
handleSubmit
();
values
=
{
values
=
{
...
values
,
...
values
,
...
@@ -447,8 +451,7 @@ const ActivityDetails = ({ isUpdate }) => {
...
@@ -447,8 +451,7 @@ const ActivityDetails = ({ isUpdate }) => {
contactPersonForActivity
:
values
.
contactPersonForActivity
,
contactPersonForActivity
:
values
.
contactPersonForActivity
,
duration
:
values
.
durationUnit
.
toString
(),
duration
:
values
.
durationUnit
.
toString
(),
imagesComponent
:
imagesArrayComponent
,
imagesComponent
:
imagesArrayComponent
,
// imagesComponent: [103, 104, 105, 106,107],
image
:
displayImage
,
approved
:
"pending"
approved
:
"pending"
};
};
if
(
!
ref
.
current
.
state
.
selected
[
0
])
{
if
(
!
ref
.
current
.
state
.
selected
[
0
])
{
...
@@ -1118,7 +1121,8 @@ const ActivityDetails = ({ isUpdate }) => {
...
@@ -1118,7 +1121,8 @@ const ActivityDetails = ({ isUpdate }) => {
<
/div
>
<
/div
>
<
div
className
=
"row d-flex mt-4"
>
<
div
className
=
"row d-flex mt-4"
>
<
p
className
=
"textH"
>
Add
display
image
<
/p
>
<
p
className
=
"textH"
>
Add
display
image
<
/p
>
<
UploadImageCustom
isUpdate
=
{
isUpdate
}
setImage
=
{
setdisplayImage
}
populatedImages
=
{
displayImage
}
/
>
{
console
.
log
(
displayImage
)}
<
UploadImageCustom
isUpdate
=
{
isUpdate
}
setImage
=
{
setdisplayImage
}
populatedImages
=
{
activityById
?.
data
.
attributes
}
/
>
<
hr
/>
<
hr
/>
<
/div
>
<
/div
>
<
div
className
=
"row d-flex "
>
<
div
className
=
"row d-flex "
>
...
...
components/vendor/UploadImageCustom.js
View file @
cf1a237
import
{
PlusOutlined
}
from
"@ant-design/icons"
;
import
{
PlusOutlined
}
from
"@ant-design/icons"
;
import
{
Upload
}
from
"antd"
;
import
{
message
,
Upload
}
from
"antd"
;
import
axios
from
"axios"
;
import
axios
from
"axios"
;
import
{
getSession
}
from
"next-auth/react"
;
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
,
set
imagesArrayComponent
,
populatedImages
,
imagesArrayComponent
})
=>
{
const
UploadImageCustom
=
({
isUpdate
,
set
Image
,
populatedImages
,
imagesArrayComponent
})
=>
{
// 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
);
...
@@ -92,7 +92,7 @@ const UploadImageCustom = ({ isUpdate, setimagesArrayComponent, populatedImages,
...
@@ -92,7 +92,7 @@ const UploadImageCustom = ({ isUpdate, setimagesArrayComponent, populatedImages,
});
});
setFileList
(
updatedFileList
);
setFileList
(
updatedFileList
);
set
imagesArrayComponent
([...
imagesArrayComponent
,
newFileId
]
);
set
Image
(
newFileId
);
message
.
success
(
`
${
info
.
file
.
name
}
uploaded successfully.`
);
message
.
success
(
`
${
info
.
file
.
name
}
uploaded successfully.`
);
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -118,7 +118,7 @@ const UploadImageCustom = ({ isUpdate, setimagesArrayComponent, populatedImages,
...
@@ -118,7 +118,7 @@ const UploadImageCustom = ({ isUpdate, setimagesArrayComponent, populatedImages,
message
.
error
(
`Failed to remove
${
file
.
name
}
. Image ID not found.`
);
message
.
error
(
`Failed to remove
${
file
.
name
}
. Image ID not found.`
);
return
;
return
;
}
}
setimagesArrayComponent
(
imagesArrayComponent
.
filter
(
item
=>
item
!=
imageId
)
);
newFileId
(
);
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
}
`
,
{
...
...
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