From bb12f5b83875361cec2f4abfedd0d50173034a10 Mon Sep 17 00:00:00 2001 From: Abhishek P Anil Date: Fri, 20 Sep 2024 14:54:28 +0530 Subject: [PATCH 1/2] fix: hide virtual location from mandatory fields section. closes #1224 --- src/pages/Dashboard/AddEvent/AddEvent.jsx | 7 +++-- .../MandatoryFields/MandatoryFields.jsx | 31 +++++++++++-------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/pages/Dashboard/AddEvent/AddEvent.jsx b/src/pages/Dashboard/AddEvent/AddEvent.jsx index 85bef395..b16e670a 100644 --- a/src/pages/Dashboard/AddEvent/AddEvent.jsx +++ b/src/pages/Dashboard/AddEvent/AddEvent.jsx @@ -1856,12 +1856,13 @@ function AddEvent() { publishValidateFields.push('targetAudience'); break; case eventFormRequiredFieldNames.LOCATION: - publishValidateFields.push('location-form-wrapper'); - break; - case eventFormRequiredFieldNames.VIRTUAL_LOCATION: initialAddedFields = initialAddedFields?.concat(locationType?.fieldNames); publishValidateFields.push('location-form-wrapper'); break; + // case eventFormRequiredFieldNames.VIRTUAL_LOCATION: + // initialAddedFields = initialAddedFields?.concat(locationType?.fieldNames); + // publishValidateFields.push('location-form-wrapper'); + // break; case eventFormRequiredFieldNames.IMAGE: publishValidateFields.push('draggerWrap'); break; diff --git a/src/pages/Dashboard/Settings/MandatoryFields/MandatoryFields.jsx b/src/pages/Dashboard/Settings/MandatoryFields/MandatoryFields.jsx index 26d6c385..58f66f85 100644 --- a/src/pages/Dashboard/Settings/MandatoryFields/MandatoryFields.jsx +++ b/src/pages/Dashboard/Settings/MandatoryFields/MandatoryFields.jsx @@ -38,6 +38,7 @@ function MandatoryFields({ setDirtyStatus, tabKey }) { formLabel: t('dashboard.settings.mandatoryFields.event'), taxonomyClass: entitiesClass.event, // prefilledFields: ['name', 'startDateTime', 'startDate', 'endDateTime', 'endDate', 'locationId'], + hiddenFields: ['VIRTUAL_LOCATION'], }, { formName: 'Place', @@ -78,19 +79,23 @@ function MandatoryFields({ setDirtyStatus, tabKey }) { standardAdminOnlyFields = field?.formFieldProperties?.adminOnlyFields?.standardFields?.map((f) => f?.fieldName) ?? []; - let modifiedField = field?.formFields?.map((f) => { - return { - ...f, - preFilled: minimumRequiredFields.includes(f?.name), - isRequiredField: standardAdminOnlyFields?.includes(f?.name) - ? false - : requiredFields.includes(f?.name) || minimumRequiredFields.includes(f?.name), - isAdminOnlyField: standardAdminOnlyFields?.includes(f?.name) || false, - rule: field?.formFieldProperties?.mandatoryFields?.standardFields?.find( - (standardField) => f?.name === standardField?.fieldName, - )?.rule, - }; - }); + let modifiedField = field?.formFields + ?.map((f) => { + if (preFilled?.hiddenFields?.includes(f?.name)) return null; + else + return { + ...f, + preFilled: minimumRequiredFields.includes(f?.name), + isRequiredField: standardAdminOnlyFields?.includes(f?.name) + ? false + : requiredFields.includes(f?.name) || minimumRequiredFields.includes(f?.name), + isAdminOnlyField: standardAdminOnlyFields?.includes(f?.name) || false, + rule: field?.formFieldProperties?.mandatoryFields?.standardFields?.find( + (standardField) => f?.name === standardField?.fieldName, + )?.rule, + }; + }) + ?.filter((f) => f); modifiedField = modifiedField?.concat( allTaxonomyData?.data ?.filter((f) => f?.taxonomyClass === preFilled?.taxonomyClass && f?.isDynamicField) From 4a7d716ae21be326a25b4e149a5ff4362e634436 Mon Sep 17 00:00:00 2001 From: Abhishek P Anil Date: Mon, 23 Sep 2024 11:53:54 +0530 Subject: [PATCH 2/2] fix: virtual location not shown initially --- src/pages/Dashboard/AddEvent/AddEvent.jsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pages/Dashboard/AddEvent/AddEvent.jsx b/src/pages/Dashboard/AddEvent/AddEvent.jsx index b16e670a..e635366b 100644 --- a/src/pages/Dashboard/AddEvent/AddEvent.jsx +++ b/src/pages/Dashboard/AddEvent/AddEvent.jsx @@ -1856,13 +1856,9 @@ function AddEvent() { publishValidateFields.push('targetAudience'); break; case eventFormRequiredFieldNames.LOCATION: - initialAddedFields = initialAddedFields?.concat(locationType?.fieldNames); publishValidateFields.push('location-form-wrapper'); break; - // case eventFormRequiredFieldNames.VIRTUAL_LOCATION: - // initialAddedFields = initialAddedFields?.concat(locationType?.fieldNames); - // publishValidateFields.push('location-form-wrapper'); - // break; + case eventFormRequiredFieldNames.IMAGE: publishValidateFields.push('draggerWrap'); break;