diff --git a/micro-ui/web/micro-ui-internals/example/package.json b/micro-ui/web/micro-ui-internals/example/package.json index b48114d8150..7c60f4a1d6c 100644 --- a/micro-ui/web/micro-ui-internals/example/package.json +++ b/micro-ui/web/micro-ui-internals/example/package.json @@ -14,7 +14,7 @@ "@egovernments/digit-ui-components": "0.0.2-beta.1", "@egovernments/digit-ui-module-core": "1.8.2-beta.2", "@egovernments/digit-ui-module-utilities": "1.0.1-beta.30", - "@egovernments/digit-ui-react-components": "1.8.2-beta.3", + "@egovernments/digit-ui-react-components": "1.8.2-beta.6", "@egovernments/digit-ui-module-hcmworkbench":"0.0.38", "@egovernments/digit-ui-module-campaign-manager": "0.0.1", "http-proxy-middleware": "^1.0.5", diff --git a/micro-ui/web/micro-ui-internals/package.json b/micro-ui/web/micro-ui-internals/package.json index e1bd54950f3..92f1e334d77 100644 --- a/micro-ui/web/micro-ui-internals/package.json +++ b/micro-ui/web/micro-ui-internals/package.json @@ -45,7 +45,7 @@ "ajv": "8.12.0", "lodash": "4.17.21", "microbundle-crl": "0.13.11", - "@egovernments/digit-ui-react-components": "1.8.2-beta.3", + "@egovernments/digit-ui-react-components": "1.8.2-beta.6", "@egovernments/digit-ui-components": "0.0.2-beta.1", "react": "17.0.2", "react-dom": "17.0.2", diff --git a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json index 70c06522089..41e43fdb6fd 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json +++ b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json @@ -18,7 +18,7 @@ "react-router-dom": "5.3.0" }, "dependencies": { - "@egovernments/digit-ui-react-components": "1.8.2-beta.3", + "@egovernments/digit-ui-react-components": "1.8.2-beta.6", "@egovernments/digit-ui-components": "0.0.2-beta.1", "@rjsf/core": "5.10.0", "@rjsf/utils": "5.10.0", diff --git a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js index e41f61ee9da..6f37dfb6ae2 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js @@ -255,6 +255,7 @@ const CampaignSummary = (props) => { // data?.[0]?.resources?.find((i) => i?.type === "boundaryWithTarget") ? { name: "target", + errorName: "target", sections: [ { name: "target", @@ -277,6 +278,7 @@ const CampaignSummary = (props) => { // data?.[0]?.resources?.find((i) => i?.type === "facility") ? { name: "facility", + errorName: "facility", sections: [ { name: "facility", @@ -299,6 +301,7 @@ const CampaignSummary = (props) => { // data?.[0]?.resources?.find((i) => i?.type === "user") ? { name: "user", + errorName: "user", sections: [ { name: "user", @@ -348,13 +351,15 @@ const CampaignSummary = (props) => { values: [ { key: "CAMPAIGN_NO_OF_CYCLES", - value: data?.[0]?.deliveryRules + value: + data?.[0]?.deliveryRules && data?.[0]?.deliveryRules.map((item) => item.cycleNumber)?.length > 0 ? Math.max(...data?.[0]?.deliveryRules.map((item) => item.cycleNumber)) : t("CAMPAIGN_SUMMARY_NA"), }, { key: "CAMPAIGN_NO_OF_DELIVERIES", - value: data?.[0]?.deliveryRules + value: + data?.[0]?.deliveryRules && data?.[0]?.deliveryRules.map((item) => item.deliveryNumber)?.length > 0 ? Math.max(...data?.[0]?.deliveryRules.map((item) => item.deliveryNumber)) : t("CAMPAIGN_SUMMARY_NA"), }, diff --git a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js index 77d8367dbb4..ec2c95adb5d 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/SetupCampaign.js @@ -654,7 +654,6 @@ const SetupCampaign = ({ hierarchyType }) => { }; if (totalFormData?.HCM_CAMPAIGN_DELIVERY_DATA?.deliveryRule) { const temp = restructureData(totalFormData?.HCM_CAMPAIGN_DELIVERY_DATA?.deliveryRule); - payloadData.deliveryRules = temp; } @@ -709,10 +708,14 @@ const SetupCampaign = ({ hierarchyType }) => { }; if (totalFormData?.HCM_CAMPAIGN_CYCLE_CONFIGURE?.cycleConfigure) { payloadData.additionalDetails.cycleData = totalFormData?.HCM_CAMPAIGN_CYCLE_CONFIGURE?.cycleConfigure; + } else { + payloadData.additionalDetails.cycleData = {}; } if (totalFormData?.HCM_CAMPAIGN_DELIVERY_DATA?.deliveryRule) { const temp = restructureData(totalFormData?.HCM_CAMPAIGN_DELIVERY_DATA?.deliveryRule); payloadData.deliveryRules = temp; + } else { + payloadData.deliveryRules = []; } if (!payloadData?.startDate && !payloadData?.endDate) { delete payloadData?.startDate; @@ -750,9 +753,9 @@ const SetupCampaign = ({ hierarchyType }) => { const cycleData = data.cycleConfigure.cycleData; let dateError = []; // Validate cycle and deliveries - if (cycle <= 0 || deliveries <= 0) { - return { error: true, message: "DELIVERY_CYCLE_EMPTY_ERROR" }; - } + // if (cycle <= 0 || deliveries <= 0) { + // return { error: true, message: "DELIVERY_CYCLE_EMPTY_ERROR" }; + // } [...Array(cycle)].forEach((item, index) => { const check = cycleData?.find((i) => i?.key === index + 1); @@ -767,30 +770,31 @@ const SetupCampaign = ({ hierarchyType }) => { }); } }); - setSummaryErrors((prev) => { - return { - ...prev, - deliveryErrors: prev?.deliveryErrors ? [...prev.deliveryErrors, ...dateError] : [...dateError], - }; - }); + // setSummaryErrors((prev) => { + // return { + // ...prev, + // deliveryErrors: prev?.deliveryErrors ? [...prev.deliveryErrors, ...dateError] : [...dateError], + // }; + // }); // Validate cycleData length - if (cycleData.length !== cycle) { - return { error: true, message: "DELIVERY_CYCLE_MISMATCH_LENGTH_ERROR" }; - } + // if (cycleData.length !== cycle) { + // return { error: true, message: "DELIVERY_CYCLE_MISMATCH_LENGTH_ERROR" }; + // } // Validate fromDate and startDate in cycleData - for (const item of cycleData) { - if (!item.fromDate || !item.toDate) { - return { error: true, message: "DELIVERY_CYCLE_DATE_ERROR" }; - } - } + // for (const item of cycleData) { + // if (!item.fromDate || !item.toDate) { + // return { error: true, message: "DELIVERY_CYCLE_DATE_ERROR" }; + // } + // } - return false; + return dateError; } - function validateDeliveryRules(data, projectType) { + function validateDeliveryRules(data, projectType, cycleConfigureData) { let isValid = true; let deliveryRulesError = []; + let dateError = validateCycleData(cycleConfigureData); // Iterate over deliveryRule array data.deliveryRule.forEach((cycle) => { @@ -878,7 +882,7 @@ const SetupCampaign = ({ hierarchyType }) => { setSummaryErrors((prev) => { return { ...prev, - deliveryErrors: prev?.deliveryErrors ? [...prev.deliveryErrors, ...deliveryRulesError] : deliveryRulesError, + deliveryErrors: [...deliveryRulesError, ...dateError], }; }); return isValid; @@ -1112,7 +1116,11 @@ const SetupCampaign = ({ hierarchyType }) => { const cycleConfigureData = totalFormData?.HCM_CAMPAIGN_CYCLE_CONFIGURE; const isCycleError = validateCycleData(cycleConfigureData); const deliveryCycleData = totalFormData?.HCM_CAMPAIGN_DELIVERY_DATA; - const isDeliveryError = validateDeliveryRules(deliveryCycleData, totalFormData?.["HCM_CAMPAIGN_TYPE"]?.projectType?.code?.toUpperCase()); + const isDeliveryError = validateDeliveryRules( + deliveryCycleData, + totalFormData?.["HCM_CAMPAIGN_TYPE"]?.projectType?.code?.toUpperCase(), + cycleConfigureData + ); const isTargetError = totalFormData?.HCM_CAMPAIGN_UPLOAD_BOUNDARY_DATA?.uploadBoundary?.uploadedFile?.[0]?.filestoreId ? false : (setSummaryErrors((prev) => { diff --git a/micro-ui/web/package.json b/micro-ui/web/package.json index b1a5445947d..59ebb7ece05 100644 --- a/micro-ui/web/package.json +++ b/micro-ui/web/package.json @@ -18,7 +18,7 @@ "@egovernments/digit-ui-module-workbench": "1.0.1-beta.16", "@egovernments/digit-ui-module-core": "1.8.2-beta.2", "@egovernments/digit-ui-module-hrms": "1.8.0-beta.2", - "@egovernments/digit-ui-react-components": "1.8.2-beta.3", + "@egovernments/digit-ui-react-components": "1.8.2-beta.6", "@egovernments/digit-ui-components": "0.0.2-beta.1", "@egovernments/digit-ui-module-dss": "1.8.0-beta", "@egovernments/digit-ui-module-common": "1.8.0-beta", diff --git a/micro-ui/web/workbench/package.json b/micro-ui/web/workbench/package.json index ab2528477f2..7cc60ef7bff 100644 --- a/micro-ui/web/workbench/package.json +++ b/micro-ui/web/workbench/package.json @@ -17,7 +17,7 @@ "@egovernments/digit-ui-components": "0.0.2-beta.1", "@egovernments/digit-ui-module-core": "1.8.2-beta.2", "@egovernments/digit-ui-module-utilities": "1.0.1-beta.30", - "@egovernments/digit-ui-react-components": "1.8.2-beta.3", + "@egovernments/digit-ui-react-components": "1.8.2-beta.6", "@egovernments/digit-ui-module-hcmworkbench":"0.0.38", "@egovernments/digit-ui-module-campaign-manager": "0.0.1", "babel-loader": "8.1.0",