From e77109b460b11f18011d7c1a61b5ba22fb666272 Mon Sep 17 00:00:00 2001
From: Abhishek P Anil
Date: Thu, 20 Jun 2024 12:52:46 +0530
Subject: [PATCH 01/20] fix: removed extra sentence from french translation for
image
---
src/locales/fr/transalationFr.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/locales/fr/transalationFr.json b/src/locales/fr/transalationFr.json
index b3460447..4c2e2036 100644
--- a/src/locales/fr/transalationFr.json
+++ b/src/locales/fr/transalationFr.json
@@ -254,7 +254,7 @@
"title": "Image",
"mainImage": "Image principale",
"additionalImages": "Images supplémentaires",
- "subHeading": "Les images doivent être au format paysage ou carré et mesurer au moins 600 px de large. Uniquement les fichiers .jpeg et .png sont acceptés.",
+ "subHeading": "Uniquement les fichiers .jpeg et .png sont acceptés.",
"dragAndDrop": "ou glisser pour télécharger",
"browse": "Parcourir",
"imageGallery": "Galerie d'images",
From 1f4cf71be1fcd77ddaf2c94fa82fcb6a2b43d3c9 Mon Sep 17 00:00:00 2001
From: Abhishek P Anil
Date: Thu, 20 Jun 2024 12:56:57 +0530
Subject: [PATCH 02/20] fix: fixed the font size of additional image label
---
src/constants/formFields.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/constants/formFields.js b/src/constants/formFields.js
index f2fa180c..95786897 100644
--- a/src/constants/formFields.js
+++ b/src/constants/formFields.js
@@ -390,7 +390,6 @@ export const formFieldValue = [
{name?.includes(mappedFieldTypes.IMAGE) && (
Date: Thu, 20 Jun 2024 15:42:08 +0530
Subject: [PATCH 03/20] fix: main image removed is removed from form
---
src/components/ImageUpload/ImageUpload.jsx | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/components/ImageUpload/ImageUpload.jsx b/src/components/ImageUpload/ImageUpload.jsx
index a45eece0..f0597d39 100644
--- a/src/components/ImageUpload/ImageUpload.jsx
+++ b/src/components/ImageUpload/ImageUpload.jsx
@@ -107,6 +107,9 @@ function ImageUpload(props) {
};
const onRemove = () => {
+ form.setFieldsValue({
+ imageCrop: null,
+ });
setImageUrl(false);
};
From bd4594e8ca806a6fdddfe497cf755f0f47c57a36 Mon Sep 17 00:00:00 2001
From: Abhishek P Anil
Date: Fri, 21 Jun 2024 12:42:26 +0530
Subject: [PATCH 04/20] fix: fixed issue with unable to remove main image
---
src/pages/Dashboard/AddEvent/AddEvent.jsx | 60 +++++++------
.../CreateNewOrganization.jsx | 89 +++++++++++--------
.../CreateNewPerson/CreateNewPerson.jsx | 58 ++++++------
.../CreateNewPlace/CreateNewPlace.jsx | 60 +++++++------
4 files changed, 149 insertions(+), 118 deletions(-)
diff --git a/src/pages/Dashboard/AddEvent/AddEvent.jsx b/src/pages/Dashboard/AddEvent/AddEvent.jsx
index 00f747b7..05daefc3 100644
--- a/src/pages/Dashboard/AddEvent/AddEvent.jsx
+++ b/src/pages/Dashboard/AddEvent/AddEvent.jsx
@@ -733,29 +733,31 @@ function AddEvent() {
subEventConfiguration: eventData?.subEventConfiguration,
};
- let imageCrop = [form.getFieldValue('imageCrop')];
- imageCrop = [
- {
- large: {
- xCoordinate: imageCrop[0]?.large?.x,
- yCoordinate: imageCrop[0]?.large?.y,
- height: imageCrop[0]?.large?.height,
- width: imageCrop[0]?.large?.width,
- },
- thumbnail: {
- xCoordinate: imageCrop[0]?.thumbnail?.x,
- yCoordinate: imageCrop[0]?.thumbnail?.y,
- height: imageCrop[0]?.thumbnail?.height,
- width: imageCrop[0]?.thumbnail?.width,
- },
- original: {
- entityId: imageCrop[0]?.original?.entityId,
- height: imageCrop[0]?.original?.height,
- width: imageCrop[0]?.original?.width,
+ let imageCrop = form.getFieldValue('imageCrop') ? [form.getFieldValue('imageCrop')] : [];
+ if (imageCrop.length > 0) {
+ imageCrop = [
+ {
+ large: {
+ xCoordinate: imageCrop[0]?.large?.x,
+ yCoordinate: imageCrop[0]?.large?.y,
+ height: imageCrop[0]?.large?.height,
+ width: imageCrop[0]?.large?.width,
+ },
+ thumbnail: {
+ xCoordinate: imageCrop[0]?.thumbnail?.x,
+ yCoordinate: imageCrop[0]?.thumbnail?.y,
+ height: imageCrop[0]?.thumbnail?.height,
+ width: imageCrop[0]?.thumbnail?.width,
+ },
+ original: {
+ entityId: imageCrop[0]?.original?.entityId,
+ height: imageCrop[0]?.original?.height,
+ width: imageCrop[0]?.original?.width,
+ },
+ isMain: true,
},
- isMain: true,
- },
- ];
+ ];
+ }
const uploadImageList = async () => {
for (let i = 0; i < values.multipleImagesCrop.length; i++) {
@@ -858,11 +860,15 @@ function AddEvent() {
});
} else {
if (values.multipleImagesCrop?.length > 0) await uploadImageList();
- if (values?.draggerWrap) {
- if (values?.dragger && values?.dragger?.length == 0 && values.multipleImagesCrop?.length == 0)
- eventObj['image'] = null;
- else eventObj['image'] = imageCrop;
- }
+ if (
+ values?.draggerWrap &&
+ values?.dragger?.length === 0 &&
+ (!values.multipleImagesCrop || values.multipleImagesCrop?.length === 0)
+ ) {
+ // Main image is removed and no new image is added
+ // No gallery images are added
+ eventObj['image'] = [];
+ } else eventObj['image'] = imageCrop;
addUpdateEventApiHandler(eventObj, toggle)
.then((id) => resolve(id))
diff --git a/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx b/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx
index 82961cfc..6aa77233 100644
--- a/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx
+++ b/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx
@@ -322,30 +322,31 @@ function CreateNewOrganization() {
},
};
}
- let imageCrop = [form.getFieldValue('imageCrop')];
- imageCrop = [
- {
- large: {
- xCoordinate: imageCrop[0]?.large?.x,
- yCoordinate: imageCrop[0]?.large?.y,
- height: imageCrop[0]?.large?.height,
- width: imageCrop[0]?.large?.width,
- },
- thumbnail: {
- xCoordinate: imageCrop[0]?.thumbnail?.x,
- yCoordinate: imageCrop[0]?.thumbnail?.y,
- height: imageCrop[0]?.thumbnail?.height,
- width: imageCrop[0]?.thumbnail?.width,
- },
- original: {
- entityId: imageCrop[0]?.original?.entityId,
- height: imageCrop[0]?.original?.height,
- width: imageCrop[0]?.original?.width,
+ let imageCrop = form.getFieldValue('imageCrop') ? [form.getFieldValue('imageCrop')] : [];
+ if (imageCrop.length > 0) {
+ imageCrop = [
+ {
+ large: {
+ xCoordinate: imageCrop[0]?.large?.x,
+ yCoordinate: imageCrop[0]?.large?.y,
+ height: imageCrop[0]?.large?.height,
+ width: imageCrop[0]?.large?.width,
+ },
+ thumbnail: {
+ xCoordinate: imageCrop[0]?.thumbnail?.x,
+ yCoordinate: imageCrop[0]?.thumbnail?.y,
+ height: imageCrop[0]?.thumbnail?.height,
+ width: imageCrop[0]?.thumbnail?.width,
+ },
+ original: {
+ entityId: imageCrop[0]?.original?.entityId,
+ height: imageCrop[0]?.original?.height,
+ width: imageCrop[0]?.original?.width,
+ },
+ isMain: true,
},
- isMain: true,
- },
- ];
-
+ ];
+ }
const uploadImageList = async () => {
for (let i = 0; i < values?.multipleImagesCrop.length; i++) {
const file = values.multipleImagesCrop[i]?.originFileObj;
@@ -445,11 +446,15 @@ function CreateNewOrganization() {
});
} else {
if (values.multipleImagesCrop?.length > 0) await uploadImageList();
- if (values?.image) {
- if (values?.image && values?.image?.length == 0 && values.multipleImagesCrop?.length == 0)
- organizationPayload['image'] = null;
- else organizationPayload['image'] = imageCrop;
- }
+ if (
+ values?.image &&
+ values?.image?.length === 0 &&
+ (!values.multipleImagesCrop || values.multipleImagesCrop?.length === 0)
+ ) {
+ // Main image is removed and no new image is added
+ // No gallery images are added
+ organizationPayload['image'] = [];
+ } else organizationPayload['image'] = imageCrop;
addUpdateOrganizationApiHandler(organizationPayload, toggle)
.then((id) => resolve(id))
.catch((error) => {
@@ -591,11 +596,15 @@ function CreateNewOrganization() {
await uploadImageList();
organizationPayload['image'] = imageCrop;
}
- if (values?.image) {
- if (values?.image && values?.image?.length == 0 && values.multipleImagesCrop?.length == 0)
- organizationPayload['image'] = null;
- else organizationPayload['image'] = imageCrop;
- }
+ if (
+ values?.image &&
+ values?.image?.length === 0 &&
+ (!values.multipleImagesCrop || values.multipleImagesCrop?.length === 0)
+ ) {
+ // Main image is removed and no new image is added
+ // No gallery images are added
+ organizationPayload['image'] = [];
+ } else organizationPayload['image'] = imageCrop;
if (values?.logo?.length > 0 && values?.logo[0]?.originFileObj) {
const formdata = new FormData();
formdata.append('file', values?.logo[0].originFileObj);
@@ -646,11 +655,15 @@ function CreateNewOrganization() {
await uploadImageList();
organizationPayload['image'] = imageCrop;
}
- if (values?.image) {
- if (values?.image && values?.image?.length == 0 && values.multipleImagesCrop?.length > 0)
- organizationPayload['image'] = null;
- else organizationPayload['image'] = imageCrop;
- }
+ if (
+ values?.image &&
+ values?.image?.length === 0 &&
+ (!values.multipleImagesCrop || values.multipleImagesCrop?.length === 0)
+ ) {
+ // Main image is removed and no new image is added
+ // No gallery images are added
+ organizationPayload['image'] = [];
+ } else organizationPayload['image'] = imageCrop;
addUpdateOrganizationApiHandler(organizationPayload, toggle)
.then((id) => resolve(id))
.catch((error) => {
diff --git a/src/pages/Dashboard/CreateNewPerson/CreateNewPerson.jsx b/src/pages/Dashboard/CreateNewPerson/CreateNewPerson.jsx
index 7a5ca107..78b43b93 100644
--- a/src/pages/Dashboard/CreateNewPerson/CreateNewPerson.jsx
+++ b/src/pages/Dashboard/CreateNewPerson/CreateNewPerson.jsx
@@ -255,30 +255,31 @@ function CreateNewPerson() {
};
}
});
- let imageCrop = [form.getFieldValue('imageCrop')];
- imageCrop = [
- {
- large: {
- xCoordinate: imageCrop[0]?.large?.x,
- yCoordinate: imageCrop[0]?.large?.y,
- height: imageCrop[0]?.large?.height,
- width: imageCrop[0]?.large?.width,
- },
- thumbnail: {
- xCoordinate: imageCrop[0]?.thumbnail?.x,
- yCoordinate: imageCrop[0]?.thumbnail?.y,
- height: imageCrop[0]?.thumbnail?.height,
- width: imageCrop[0]?.thumbnail?.width,
- },
- original: {
- entityId: imageCrop[0]?.original?.entityId,
- height: imageCrop[0]?.original?.height,
- width: imageCrop[0]?.original?.width,
+ let imageCrop = form.getFieldValue('imageCrop') ? [form.getFieldValue('imageCrop')] : [];
+ if (imageCrop.length > 0) {
+ imageCrop = [
+ {
+ large: {
+ xCoordinate: imageCrop[0]?.large?.x,
+ yCoordinate: imageCrop[0]?.large?.y,
+ height: imageCrop[0]?.large?.height,
+ width: imageCrop[0]?.large?.width,
+ },
+ thumbnail: {
+ xCoordinate: imageCrop[0]?.thumbnail?.x,
+ yCoordinate: imageCrop[0]?.thumbnail?.y,
+ height: imageCrop[0]?.thumbnail?.height,
+ width: imageCrop[0]?.thumbnail?.width,
+ },
+ original: {
+ entityId: imageCrop[0]?.original?.entityId,
+ height: imageCrop[0]?.original?.height,
+ width: imageCrop[0]?.original?.width,
+ },
+ isMain: true,
},
- isMain: true,
- },
- ];
-
+ ];
+ }
const uploadImageList = async () => {
for (let i = 0; i < values.multipleImagesCrop.length; i++) {
const file = values.multipleImagesCrop[i]?.originFileObj;
@@ -372,9 +373,14 @@ function CreateNewPerson() {
});
} else {
if (values.multipleImagesCrop?.length > 0) await uploadImageList();
- if (values?.image) {
- if (values?.image && values?.image?.length == 0 && values.multipleImagesCrop?.length == 0)
- personPayload['image'] = null;
+ if (
+ values?.image &&
+ values?.image?.length === 0 &&
+ (!values.multipleImagesCrop || values.multipleImagesCrop?.length === 0)
+ ) {
+ // Main image is removed and no new image is added
+ // No gallery images are added
+ personPayload['image'] = [];
} else personPayload['image'] = imageCrop;
addUpdatePersonApiHandler(personPayload);
}
diff --git a/src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx b/src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx
index 719393f5..542d0ced 100644
--- a/src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx
+++ b/src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx
@@ -475,29 +475,31 @@ function CreateNewPlace() {
};
});
}
- let imageCrop = [form.getFieldValue('imageCrop')];
- imageCrop = [
- {
- large: {
- xCoordinate: imageCrop[0]?.large?.x,
- yCoordinate: imageCrop[0]?.large?.y,
- height: imageCrop[0]?.large?.height,
- width: imageCrop[0]?.large?.width,
- },
- thumbnail: {
- xCoordinate: imageCrop[0]?.thumbnail?.x,
- yCoordinate: imageCrop[0]?.thumbnail?.y,
- height: imageCrop[0]?.thumbnail?.height,
- width: imageCrop[0]?.thumbnail?.width,
- },
- original: {
- entityId: imageCrop[0]?.original?.entityId,
- height: imageCrop[0]?.original?.height,
- width: imageCrop[0]?.original?.width,
+ let imageCrop = form.getFieldValue('imageCrop') ? [form.getFieldValue('imageCrop')] : [];
+ if (imageCrop.length > 0) {
+ imageCrop = [
+ {
+ large: {
+ xCoordinate: imageCrop[0]?.large?.x,
+ yCoordinate: imageCrop[0]?.large?.y,
+ height: imageCrop[0]?.large?.height,
+ width: imageCrop[0]?.large?.width,
+ },
+ thumbnail: {
+ xCoordinate: imageCrop[0]?.thumbnail?.x,
+ yCoordinate: imageCrop[0]?.thumbnail?.y,
+ height: imageCrop[0]?.thumbnail?.height,
+ width: imageCrop[0]?.thumbnail?.width,
+ },
+ original: {
+ entityId: imageCrop[0]?.original?.entityId,
+ height: imageCrop[0]?.original?.height,
+ width: imageCrop[0]?.original?.width,
+ },
+ isMain: true,
},
- isMain: true,
- },
- ];
+ ];
+ }
if (values?.containedInPlace || values?.containedInPlace?.length > 0) {
if (containedInPlace?.source === sourceOptions.CMS)
containedInPlaceObj = {
@@ -680,11 +682,15 @@ function CreateNewPlace() {
});
} else {
if (values.multipleImagesCrop?.length > 0) await uploadImageList();
- if (values?.draggerWrap) {
- if (values?.dragger && values?.dragger?.length == 0 && values.multipleImagesCrop?.length == 0)
- placeObj['image'] = null;
- else placeObj['image'] = imageCrop;
- }
+ if (
+ values?.draggerWrap &&
+ values?.dragger?.length === 0 &&
+ (!values.multipleImagesCrop || values.multipleImagesCrop?.length === 0)
+ ) {
+ // Main image is removed and no new image is added
+ // No gallery images are added
+ placeObj['image'] = [];
+ } else placeObj['image'] = imageCrop;
addUpdatePlaceApiHandler(placeObj, postalObj)
.then((id) => resolve(id))
From 59e1c7d04ce3c5526028063f1a479520d6aa9a5c Mon Sep 17 00:00:00 2001
From: Abhishek P Anil
Date: Fri, 21 Jun 2024 12:43:02 +0530
Subject: [PATCH 05/20] fix: fixed image name going behind image thumbnail
---
src/components/MultipleImageUpload/multipleImageUpload.css | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/components/MultipleImageUpload/multipleImageUpload.css b/src/components/MultipleImageUpload/multipleImageUpload.css
index 5672ddd9..1e4b17a9 100644
--- a/src/components/MultipleImageUpload/multipleImageUpload.css
+++ b/src/components/MultipleImageUpload/multipleImageUpload.css
@@ -52,6 +52,13 @@
font-size: 16px;
}
+.multiple-image-upload-wrapper .ant-upload-list-picture .ant-upload-list-item-name {
+ flex: auto;
+ margin: 0;
+ padding-right: 8px;
+ padding-left: 48px;
+}
+
@media (max-width: 480px) {
.multiple-image-upload-wrapper .image-footer .image-name {
text-wrap: wrap;
From 20d0c88290930ad29d9108bd3e687dfabd7dc52a Mon Sep 17 00:00:00 2001
From: Abhishek P Anil
Date: Fri, 21 Jun 2024 14:56:16 +0530
Subject: [PATCH 06/20] fix: fixed issue with image thumbnail squished
---
.../MultipleImageUpload.jsx | 55 +++++++++++++++++--
1 file changed, 50 insertions(+), 5 deletions(-)
diff --git a/src/components/MultipleImageUpload/MultipleImageUpload.jsx b/src/components/MultipleImageUpload/MultipleImageUpload.jsx
index 7be958df..1c0ba3c3 100644
--- a/src/components/MultipleImageUpload/MultipleImageUpload.jsx
+++ b/src/components/MultipleImageUpload/MultipleImageUpload.jsx
@@ -1,5 +1,5 @@
import { DownloadOutlined, DeleteOutlined } from '@ant-design/icons';
-import { Tooltip, Upload, message } from 'antd';
+import { Upload, message } from 'antd';
import update from 'immutability-helper';
import React, { useCallback, useRef, useState } from 'react';
import { DndProvider, useDrag, useDrop } from 'react-dnd';
@@ -8,8 +8,10 @@ import { useTranslation } from 'react-i18next';
import Outlined from '../Button/Outlined';
const type = 'DragableUploadList';
import './multipleImageUpload.css';
+import { getWidthFromAspectRatio } from '../../utils/getWidthFromAspectRatio';
+import { useOutletContext } from 'react-router-dom';
-const DragableUploadListItem = ({ originNode, moveRow, file, fileList }) => {
+const DragableUploadListItem = ({ moveRow, file, fileList, actions, width }) => {
const ref = useRef(null);
const index = fileList.indexOf(file);
@@ -39,7 +41,7 @@ const DragableUploadListItem = ({ originNode, moveRow, file, fileList }) => {
}),
});
drop(drag(ref));
- const errorNode = {originNode.props.children};
+ // const errorNode = {originNode.props.children};
return (
{
style={{
cursor: 'grab',
}}>
- {file.status === 'error' ? errorNode : originNode}
+
+
+
+
+ {file?.name}
+
+
+
+
+
+
+
+
+ {/* {file.status === 'error' ? errorNode : originNode} */}
);
};
@@ -65,6 +92,7 @@ const getBase64 = (img, callback) => {
const MultipleImageUpload = (props) => {
const { eventImageData, form, imageReadOnly } = props;
const { t } = useTranslation();
+ const [currentCalendarData] = useOutletContext();
const [fileList, setFileList] = useState(
eventImageData?.length > 0
@@ -98,6 +126,14 @@ const MultipleImageUpload = (props) => {
: [],
);
+ let aspectRatio;
+ let width;
+
+ if (currentCalendarData?.imageConfig[0]?.thumbnail?.aspectRatio) {
+ aspectRatio = currentCalendarData.imageConfig[0]?.large.aspectRatio;
+ width = getWidthFromAspectRatio(aspectRatio, 48);
+ }
+
const moveRow = useCallback(
(dragIndex, hoverIndex) => {
const dragRow = fileList[dragIndex];
@@ -174,6 +210,7 @@ const MultipleImageUpload = (props) => {
customRequest={customRequest}
beforeUpload={beforeUpload}
showUploadList={{
+ showRemoveIcon: imageReadOnly ? false : true,
removeIcon: ,
}}
multiple
@@ -185,11 +222,19 @@ const MultipleImageUpload = (props) => {
fileList={currFileList}
moveRow={moveRow}
actions={actions}
+ width={width}
/>
) : (
-
+
Date: Fri, 21 Jun 2024 15:25:11 +0530
Subject: [PATCH 07/20] fix: added holder icon and corrected the border color
and radius
---
src/components/MultipleImageUpload/MultipleImageUpload.jsx | 7 ++++++-
src/components/MultipleImageUpload/multipleImageUpload.css | 4 ++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/components/MultipleImageUpload/MultipleImageUpload.jsx b/src/components/MultipleImageUpload/MultipleImageUpload.jsx
index 1c0ba3c3..2961c9ef 100644
--- a/src/components/MultipleImageUpload/MultipleImageUpload.jsx
+++ b/src/components/MultipleImageUpload/MultipleImageUpload.jsx
@@ -1,4 +1,4 @@
-import { DownloadOutlined, DeleteOutlined } from '@ant-design/icons';
+import { DownloadOutlined, DeleteOutlined, HolderOutlined } from '@ant-design/icons';
import { Upload, message } from 'antd';
import update from 'immutability-helper';
import React, { useCallback, useRef, useState } from 'react';
@@ -51,6 +51,11 @@ const DragableUploadListItem = ({ moveRow, file, fileList, actions, width }) =>
}}>
+
+
+
+
+
Date: Wed, 26 Jun 2024 17:07:40 +0530
Subject: [PATCH 08/20] fix: added grabby hand for holder outlined
---
src/components/MultipleImageUpload/MultipleImageUpload.jsx | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/components/MultipleImageUpload/MultipleImageUpload.jsx b/src/components/MultipleImageUpload/MultipleImageUpload.jsx
index 2961c9ef..aef8182f 100644
--- a/src/components/MultipleImageUpload/MultipleImageUpload.jsx
+++ b/src/components/MultipleImageUpload/MultipleImageUpload.jsx
@@ -52,7 +52,12 @@ const DragableUploadListItem = ({ moveRow, file, fileList, actions, width }) =>
-
+
From 8e09d8621243ce0e5a076ebf8c59290f28ec3e9d Mon Sep 17 00:00:00 2001
From: Abhishek P Anil
Date: Fri, 28 Jun 2024 12:53:08 +0530
Subject: [PATCH 09/20] fix: added support for unsaved changes in multiple
image upload across forms
---
src/components/MultipleImageUpload/MultipleImageUpload.jsx | 3 ++-
src/constants/formFields.js | 4 ++++
src/pages/Dashboard/AddEvent/AddEvent.jsx | 1 +
.../Dashboard/CreateNewOrganization/CreateNewOrganization.jsx | 1 +
src/pages/Dashboard/CreateNewPerson/CreateNewPerson.jsx | 1 +
src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx | 1 +
6 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/components/MultipleImageUpload/MultipleImageUpload.jsx b/src/components/MultipleImageUpload/MultipleImageUpload.jsx
index aef8182f..8dc47676 100644
--- a/src/components/MultipleImageUpload/MultipleImageUpload.jsx
+++ b/src/components/MultipleImageUpload/MultipleImageUpload.jsx
@@ -100,7 +100,7 @@ const getBase64 = (img, callback) => {
});
};
const MultipleImageUpload = (props) => {
- const { eventImageData, form, imageReadOnly } = props;
+ const { eventImageData, form, imageReadOnly, setShowDialog } = props;
const { t } = useTranslation();
const [currentCalendarData] = useOutletContext();
@@ -194,6 +194,7 @@ const MultipleImageUpload = (props) => {
form.setFieldsValue({
multipleImagesCrop: newFileList,
});
+ if (setShowDialog) setShowDialog(true);
};
const beforeUpload = (file) => {
diff --git a/src/constants/formFields.js b/src/constants/formFields.js
index 95786897..f823a467 100644
--- a/src/constants/formFields.js
+++ b/src/constants/formFields.js
@@ -370,6 +370,7 @@ export const formFieldValue = [
eventImageGalleryData,
enableGallery,
t,
+ setShowDialog,
}) => (
<>
{position === 'top' && datatype === dataTypes.IMAGE && {userTips}
}
@@ -393,6 +394,7 @@ export const formFieldValue = [
data-cy="form-item-event-multiple-image"
hidden={!enableGallery}>
{
return renderFormFields({
fieldName: field?.name,
@@ -766,6 +769,7 @@ export const returnFormDataWithFields = ({
isExternalSourceFetching,
isEntitiesFetching,
// required: checkMandatoryAdminOnlyFields(field?.name, mandatoryFields),
+ setShowDialog,
}),
key: index,
initialValue: formInitialValueHandler(field?.type, field?.mappedField, field?.datatype, entityData),
diff --git a/src/pages/Dashboard/AddEvent/AddEvent.jsx b/src/pages/Dashboard/AddEvent/AddEvent.jsx
index 8695dbb7..20fe79d9 100644
--- a/src/pages/Dashboard/AddEvent/AddEvent.jsx
+++ b/src/pages/Dashboard/AddEvent/AddEvent.jsx
@@ -3622,6 +3622,7 @@ function AddEvent() {
: null
}
eventImageData={eventData?.image?.filter((image) => !image?.isMain)}
+ setShowDialog={setShowDialog}
/>
diff --git a/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx b/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx
index f47111ec..63cd2b9d 100644
--- a/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx
+++ b/src/pages/Dashboard/CreateNewOrganization/CreateNewOrganization.jsx
@@ -1261,6 +1261,7 @@ function CreateNewOrganization() {
isExternalSourceFetching,
mandatoryFields: formFieldProperties?.mandatoryFields?.standardFields ?? [],
adminOnlyFields: formFieldProperties?.adminOnlyFields?.standardFields ?? [],
+ setShowDialog,
});
}
});
diff --git a/src/pages/Dashboard/CreateNewPerson/CreateNewPerson.jsx b/src/pages/Dashboard/CreateNewPerson/CreateNewPerson.jsx
index e306ebb9..035daeab 100644
--- a/src/pages/Dashboard/CreateNewPerson/CreateNewPerson.jsx
+++ b/src/pages/Dashboard/CreateNewPerson/CreateNewPerson.jsx
@@ -789,6 +789,7 @@ function CreateNewPerson() {
form,
mandatoryFields: formFieldProperties?.mandatoryFields?.standardFields ?? [],
adminOnlyFields: formFieldProperties?.adminOnlyFields?.standardFields ?? [],
+ setShowDialog,
});
}
});
diff --git a/src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx b/src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx
index 48bf9bd6..f4186cd0 100644
--- a/src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx
+++ b/src/pages/Dashboard/CreateNewPlace/CreateNewPlace.jsx
@@ -1884,6 +1884,7 @@ function CreateNewPlace() {
data-cy="form-item-event-multiple-image"
hidden={!imageConfig?.enableGallery}>
0
From d6f17143bce9b205790835b8fcbd1124a150ffed Mon Sep 17 00:00:00 2001
From: syam babu
Date: Fri, 28 Jun 2024 13:37:59 +0530
Subject: [PATCH 10/20] fix: disabled selecting same date as start and end date
on range picker
---
.../RecurringEvents/RecurringEvents.jsx | 4 +++
src/pages/Dashboard/AddEvent/AddEvent.jsx | 35 +++++++++++++++++--
2 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/src/components/RecurringEvents/RecurringEvents.jsx b/src/components/RecurringEvents/RecurringEvents.jsx
index 0cbee163..09187266 100644
--- a/src/components/RecurringEvents/RecurringEvents.jsx
+++ b/src/components/RecurringEvents/RecurringEvents.jsx
@@ -24,6 +24,8 @@ const RecurringEvents = function ({
eventDetails,
setFormFields,
dateType,
+ disabledDate,
+ onCalendarChange,
}) {
const [nummberofDates, setNumberofDates] = useState(numberOfDaysEvent);
const [isModalVisible, setIsModalVisible] = useState(false);
@@ -341,6 +343,8 @@ const RecurringEvents = function ({
0 && (
tags at the end
+ if (values.dateRangePicker) {
+ const [startDate, endDate] = values.dateRangePicker;
+ if (moment(startDate).isSame(endDate, 'day')) {
+ setDateType(dateTypes.SINGLE);
+ }
+ }
+
+ console.log(values);
+
if (dateType === dateTypes.SINGLE) {
if (values?.startTime) startDateTime = dateTimeConverter(values?.datePicker, values?.startTime);
else
@@ -2306,7 +2318,7 @@ function AddEvent() {
- {t('dashboard.events.addEditEvent.dates.heading')}
+ {t('dashboard.events.addEditEvent.dates.heading')} hello
@@ -2442,7 +2454,18 @@ function AddEvent() {
},
]}
data-cy="form-item-date-range-label">
-
+ {
+ setStartDate(dates?.[0]);
+ setEndDate(dates?.[1]);
+ }}
+ disabledDate={(current) =>
+ (startDate && current.isSame(startDate, 'day')) ||
+ (endDate && current.isSame(endDate, 'day'))
+ }
+ data-cy="date-range"
+ />
)}
{dateType === dateTypes.MULTIPLE && (
@@ -2453,6 +2476,14 @@ function AddEvent() {
numberOfDaysEvent={eventData?.subEvents?.length}
form={form}
eventDetails={eventData}
+ onCalendarChange={(dates) => {
+ setStartDate(dates?.[0]);
+ setEndDate(dates?.[1]);
+ }}
+ disabledDate={(current) =>
+ (startDate && current.isSame(startDate, 'day')) ||
+ (endDate && current.isSame(endDate, 'day'))
+ }
setFormFields={setFormValue}
dateType={dateType}
/>
From 8ee87552e5842b463534b0c5624f39acc69470d7 Mon Sep 17 00:00:00 2001
From: syam babu
Date: Fri, 28 Jun 2024 15:36:42 +0530
Subject: [PATCH 11/20] fix: useBlocker trigger not resetting issue fixed.
closes #1191
---
.../Card/MandatoryField/MandatoryField.jsx | 4 +--
src/pages/Dashboard/AddUser/AddUser.jsx | 2 ++
.../CalendarSettings/CalendarSettings.jsx | 3 ++-
.../MandatoryFields/MandatoryFields.jsx | 1 +
src/pages/Dashboard/Settings/Settings.jsx | 27 +++----------------
.../WidgetSettings/WidgetSettings.jsx | 2 +-
6 files changed, 11 insertions(+), 28 deletions(-)
diff --git a/src/components/Card/MandatoryField/MandatoryField.jsx b/src/components/Card/MandatoryField/MandatoryField.jsx
index 87b8347c..b05b3912 100644
--- a/src/components/Card/MandatoryField/MandatoryField.jsx
+++ b/src/components/Card/MandatoryField/MandatoryField.jsx
@@ -34,7 +34,7 @@ function MandatoryField(props) {
setAddedFields(updatedFields);
setAvailableFields([...availableFields, removedField]);
- setDirtyStatus();
+ setDirtyStatus(true);
}
};
@@ -54,7 +54,7 @@ function MandatoryField(props) {
});
setAddedFields([...addedFields, { ...field, isRequiredField: true }]);
setAvailableFields(updatedFields);
- setDirtyStatus();
+ setDirtyStatus(true);
};
useEffect(() => {
diff --git a/src/pages/Dashboard/AddUser/AddUser.jsx b/src/pages/Dashboard/AddUser/AddUser.jsx
index c18eeb39..7f059330 100644
--- a/src/pages/Dashboard/AddUser/AddUser.jsx
+++ b/src/pages/Dashboard/AddUser/AddUser.jsx
@@ -270,6 +270,7 @@ const AddUser = () => {
formInstance
.validateFields()
.then((values) => {
+ setIsFormDirty(false);
let organizations = values?.organizers[calendarId];
organizations = organizations?.map((organizer) => {
return { entityId: organizer?.value };
@@ -317,6 +318,7 @@ const AddUser = () => {
formInstance
.validateFields()
.then((values) => {
+ setIsFormDirty(false);
let organizations = values?.organizers[calendarId];
organizations = organizations?.map((organizer) => {
return { entityId: organizer?.value };
diff --git a/src/pages/Dashboard/Settings/CalendarSettings/CalendarSettings.jsx b/src/pages/Dashboard/Settings/CalendarSettings/CalendarSettings.jsx
index 1216f0c3..68a49aff 100644
--- a/src/pages/Dashboard/Settings/CalendarSettings/CalendarSettings.jsx
+++ b/src/pages/Dashboard/Settings/CalendarSettings/CalendarSettings.jsx
@@ -150,6 +150,7 @@ function CalendarSettings({ setDirtyStatus, tabKey }) {
updateCalendar({ calendarId, data })
.unwrap()
.then(() => {
+ setDirtyStatus(false);
getCalendar({ id: calendarId, sessionId: timestampRef })
.unwrap()
.then((response) => {
@@ -358,7 +359,7 @@ function CalendarSettings({ setDirtyStatus, tabKey }) {
name="calendar-settings"
initialValues={initialValues}
onFieldsChange={() => {
- setDirtyStatus();
+ setDirtyStatus(true);
}}>
{calendarSettingsFormFields.GENERAL_SETTINGS.map((item, index) => {
return (
diff --git a/src/pages/Dashboard/Settings/MandatoryFields/MandatoryFields.jsx b/src/pages/Dashboard/Settings/MandatoryFields/MandatoryFields.jsx
index a3c11452..7b9cfd47 100644
--- a/src/pages/Dashboard/Settings/MandatoryFields/MandatoryFields.jsx
+++ b/src/pages/Dashboard/Settings/MandatoryFields/MandatoryFields.jsx
@@ -185,6 +185,7 @@ function MandatoryFields({ setDirtyStatus, tabKey }) {
updateCalendar({ data: calendarData, calendarId: currentCalendarData.id })
.unwrap()
.then(() => {
+ setDirtyStatus(false);
getCalendar({ id: calendarId, sessionId: timestampRef })
.unwrap()
.then(() => {
diff --git a/src/pages/Dashboard/Settings/Settings.jsx b/src/pages/Dashboard/Settings/Settings.jsx
index 7a181f7d..52fa2ee5 100644
--- a/src/pages/Dashboard/Settings/Settings.jsx
+++ b/src/pages/Dashboard/Settings/Settings.jsx
@@ -84,42 +84,21 @@ const Settings = () => {
{
label: t('dashboard.settings.tab2'),
key: '2',
- children: (
- {
- if (!isFormDirty) setIsFormDirty(true);
- }}
- />
- ),
+ children: ,
disabled: false,
adminOnly: true,
},
{
label: t('dashboard.settings.tab3'),
key: '3',
- children: currentCalendarData && (
- {
- if (!isFormDirty) setIsFormDirty(true);
- }}
- />
- ),
+ children: currentCalendarData && ,
disabled: false,
adminOnly: true,
},
{
label: t('dashboard.settings.tab4'),
key: '4',
- children: (
- {
- if (!isFormDirty) setIsFormDirty(true);
- }}
- />
- ),
+ children: ,
disabled: false,
adminOnly: true,
},
diff --git a/src/pages/Dashboard/Settings/WidgetSettings/WidgetSettings.jsx b/src/pages/Dashboard/Settings/WidgetSettings/WidgetSettings.jsx
index 1099a54f..9b70cec4 100644
--- a/src/pages/Dashboard/Settings/WidgetSettings/WidgetSettings.jsx
+++ b/src/pages/Dashboard/Settings/WidgetSettings/WidgetSettings.jsx
@@ -192,7 +192,7 @@ const WidgetSettings = ({ setDirtyStatus, tabKey }) => {
setIframeCode(
``,
);
- setDirtyStatus();
+ setDirtyStatus(true);
}
};
From 06718d963fb74a439829a47ad77afd6d143d9639 Mon Sep 17 00:00:00 2001
From: syam babu
Date: Fri, 28 Jun 2024 15:45:59 +0530
Subject: [PATCH 12/20] fix: fixed language select dropdown not working on the
first click. closes #1191
---
src/pages/Dashboard/AddUser/AddUser.jsx | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/pages/Dashboard/AddUser/AddUser.jsx b/src/pages/Dashboard/AddUser/AddUser.jsx
index 7f059330..9be7cd49 100644
--- a/src/pages/Dashboard/AddUser/AddUser.jsx
+++ b/src/pages/Dashboard/AddUser/AddUser.jsx
@@ -93,10 +93,6 @@ const AddUser = () => {
return calendar?.calendarId === calendarId;
});
- useEffect(() => {
- console.log(selectedCalendars);
- }, [selectedCalendars]);
-
const [getUser, { isFetching: isUserFetching }] = useLazyGetUserByIdQuery({ sessionId: timestampRef });
const [getUserSearch] = useLazyGetAllUsersQuery({ sessionId: timestampRef });
@@ -846,7 +842,11 @@ const AddUser = () => {
validateNotEmpty(_, value, t('dashboard.settings.addUser.validationTexts.language')),
},
]}>
-
+