From b911619453b50f2f20529fd0373e1c01a8106f29 Mon Sep 17 00:00:00 2001 From: rachana-egov <137176770+rachana-egov@users.noreply.github.com> Date: Thu, 14 Nov 2024 11:48:13 +0530 Subject: [PATCH 1/5] Microplan name update (#1821) * updated start date for campaign * added update microplan name changes --------- Co-authored-by: rachana-egov --- .../src/components/MicroplanDetails.js | 4 +- .../hooks/services/createUpdatePlanProject.js | 114 +++++++++++++++--- 2 files changed, 96 insertions(+), 22 deletions(-) diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanDetails.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanDetails.js index 86d2f6d4090..2b66b55c175 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanDetails.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/MicroplanDetails.js @@ -25,7 +25,7 @@ const MicroplanDetails = ({ onSelect, props: customProps, ...props }) => { ); const [executionCount, setExecutionCount] = useState(0); const { campaignId, microplanId, key, ...queryParams } = Digit.Hooks.useQueryParams(); - const [isFreezed, setIsFreezed] = useState(campaignId && microplanId ? true : false); + //const [isFreezed, setIsFreezed] = useState(campaignId && microplanId ? true : false); const campaignData = customProps?.sessionData?.CAMPAIGN_DETAILS?.campaignDetails; const campaignCard = [ { @@ -119,7 +119,7 @@ const MicroplanDetails = ({ onSelect, props: customProps, ...props }) => { placeholder={t("MICROPLAN_NAME_INPUT_PLACEHOLDER")} value={microplan} onChange={onChangeMicroplanName} - disabled={isFreezed} + // disabled={isFreezed} /> diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js index 4800a51ac5d..0ca704050ae 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/hooks/services/createUpdatePlanProject.js @@ -60,6 +60,8 @@ const CreateResource = async (req) => { action: "draft", parentId: null, campaignName: totalFormData?.MICROPLAN_DETAILS?.microplanDetails?.microplanName, + startDate: Math.floor(new Date(new Date().setDate(new Date().getDate() + 30)).getTime()), + //hardcoding this rn to update campaign. Check with admin console team resources: [], projectType: totalFormData?.CAMPAIGN_DETAILS?.campaignDetails?.campaignType?.code, additionalDetails: { @@ -113,6 +115,54 @@ const CreateResource = async (req) => { } }; +/// we will update the name of microplan and and campaign +const UpdateResource = async (req, currentPlanObject, currentCampaignObject) => { + //creating a microplan and campaign instance here + const { totalFormData, state, setShowToast, setCurrentKey, setCurrentStep, config, campaignObject, planObject } = req; + try { + + // Update the campaign object by keeping existing properties and only changing the name + const updatedCampaignObject = { + ...currentCampaignObject, + campaignName: totalFormData?.MICROPLAN_DETAILS?.microplanDetails?.microplanName, + }; + + const campaignRes = await Digit.CustomService.getResponse({ + url: "/project-factory/v1/project-type/update", + body: { + CampaignDetails: updatedCampaignObject, + }, + }); + + // Update the plan object by keeping existing properties and only changing the name + const updatedPlanObject = { + ...currentPlanObject, + name: totalFormData?.MICROPLAN_DETAILS?.microplanDetails?.microplanName, + }; + + const planRes = await Digit.CustomService.getResponse({ + url: "/plan-service/config/_update", + useCache: false, + method: "POST", + userService: true, + body: { + PlanConfiguration: updatedPlanObject + }, + }); + + if (campaignRes?.CampaignDetails?.id && planRes?.PlanConfiguration?.[0]?.id) { + return true; + } + return false; + } catch (error) { + if (!error?.response?.data?.Errors[0].description) { + throw new Error(error?.response?.data?.Errors[0].code); + } else { + throw new Error(error?.response?.data?.Errors[0].description); + } + } +}; + const searchPlanConfig = async (body) => { //assuming it will be success const response = await Digit.CustomService.getResponse({ @@ -195,32 +245,58 @@ const createUpdatePlanProject = async (req) => { }; case "MICROPLAN_DETAILS": - //both the screens will be freezed so don't need to do anything - //here just check if microplanId and campaignId is already there then don't do anything (details will be freezed so only create will be required no update) - if (microplanId && campaignId) { + + //here just check if microplanId and campaignId is already there then if microplan name is same as old one no need to do anything + if (microplanId && campaignId && planObject?.name === totalFormData?.MICROPLAN_DETAILS?.microplanDetails?.microplanName) { setCurrentKey((prev) => prev + 1); setCurrentStep((prev) => prev + 1); return; } + + /// now check if microplan and campaign id is there but name need to be updated + if (microplanId && campaignId && planObject?.name !== totalFormData?.MICROPLAN_DETAILS?.microplanDetails?.microplanName) { + + // check if the name is valid + const isResourceNameValid = await isValidResourceName(totalFormData?.MICROPLAN_DETAILS?.microplanDetails?.microplanName); + if (!isResourceNameValid) { + setShowToast({ key: "error", label: "ERROR_MICROPLAN_NAME_ALREADY_EXISTS" }); + return; + } + // we will udpate the current planobject and campaign object + const isResourceCreated = await UpdateResource(req, planObject, campaignObject); + if (!isResourceCreated) { + setShowToast({ key: "error", label: "ERROR_CREATING_MICROPLAN" }); + return; + } + setCurrentKey((prev) => prev + 1); + setCurrentStep((prev) => prev + 1); + + return { + triggeredFrom, + }; + + }else{ //if we reach here then we need to create a plan and project instance // validate campaign and microplan name feasible or not -> search campaign + search plan - const isResourceNameValid = await isValidResourceName(totalFormData?.MICROPLAN_DETAILS?.microplanDetails?.microplanName); - if (!isResourceNameValid) { - setShowToast({ key: "error", label: "ERROR_MICROPLAN_NAME_ALREADY_EXISTS" }); - return; - } + const isResourceNameValid = await isValidResourceName(totalFormData?.MICROPLAN_DETAILS?.microplanDetails?.microplanName); + if (!isResourceNameValid) { + setShowToast({ key: "error", label: "ERROR_MICROPLAN_NAME_ALREADY_EXISTS" }); + return; + } + + const isResourceCreated = await CreateResource(req); + if (!isResourceCreated) { + setShowToast({ key: "error", label: "ERROR_CREATING_MICROPLAN" }); + return; + } + setCurrentKey((prev) => prev + 1); + setCurrentStep((prev) => prev + 1); - const isResourceCreated = await CreateResource(req); - if (!isResourceCreated) { - setShowToast({ key: "error", label: "ERROR_CREATING_MICROPLAN" }); - return; + return { + triggeredFrom, + }; } - setCurrentKey((prev) => prev + 1); - setCurrentStep((prev) => prev + 1); - - return { - triggeredFrom, - }; + case "BOUNDARY": // call an update to plan @@ -247,8 +323,6 @@ const createUpdatePlanProject = async (req) => { const updatedCampaignObject = { ...campaignObjectForBoundary, boundaries: totalFormData?.BOUNDARY?.boundarySelection?.selectedData, - startDate: Math.floor(new Date(new Date().setDate(new Date().getDate() + 100)).getTime()), - //hardcoding this rn to update campaign. Check with admin console team }; const campaignResBoundary = await updateProject(updatedCampaignObject); await new Promise((resolve) => setTimeout(resolve, 5000)); From 51dbc45b918cba556910a869c3b28fe1212e8d69 Mon Sep 17 00:00:00 2001 From: rachana-egov <137176770+rachana-egov@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:08:17 +0530 Subject: [PATCH 2/5] Internal demo fixes (#1827) * disabled the viewer card * updated suggested microplan name formate * updated assignee to assigner in timeline wrapper * updated button side in my microplan screen * updated sucurity and accessibility edit buttons * commented tranportation mode from accessibility details * added assignee next to village updated comment * updated plan inbox --------- Co-authored-by: rachana-egov --- .../example/src/UICustomizations.js | 3 +++ .../microplan/src/components/PopInboxTable.js | 12 ++++----- .../src/components/accessbilityPopUP.js | 26 +++++++++---------- .../src/components/timelinePopUpWrapper.js | 6 ++--- .../microplan/src/configs/UICustomizations.js | 3 +++ .../src/pages/employee/ChooseActivity.js | 15 ++++++----- .../microplan/src/pages/employee/PlanInbox.js | 15 ++++++----- .../microplan/src/pages/employee/PopInbox.js | 1 + .../src/pages/employee/viewVillage.js | 8 +++--- .../modules/microplan/src/utils/utilities.js | 12 +++++---- 10 files changed, 56 insertions(+), 45 deletions(-) diff --git a/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js b/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js index febbf820214..e5ba3cd51e5 100644 --- a/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js +++ b/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js @@ -982,6 +982,7 @@ export const UICustomizations = { label={t("START")} variation="secondary" icon={"ArrowForward"} + style={{minWidth:"240px"}} type="button" isDisabled={!hasRequiredRole} // className="dm-workbench-download-template-btn dm-hover" @@ -992,6 +993,7 @@ export const UICustomizations = { label={t("WBH_DOWNLOAD")} variation="secondary" icon={"FileDownload"} + style={{minWidth:"240px"}} type="button" // className="dm-workbench-download-template-btn dm-hover" onClick={(e) => onActionSelect("DOWNLOAD", row)} @@ -1001,6 +1003,7 @@ export const UICustomizations = { label={t("WBH_EDIT")} variation="secondary" icon={"Edit"} + style={{minWidth:"240px"}} type="button" // className="dm-workbench-download-template-btn dm-hover" onClick={(e) => onActionSelect("EDIT", row)} diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/PopInboxTable.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/PopInboxTable.js index d75790c95d8..4235d1087a4 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/PopInboxTable.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/PopInboxTable.js @@ -50,6 +50,12 @@ const PopInboxTable = ({ ...props }) => { }, width: "180px", }, + { + name: t("INBOX_ASSIGNEE"), + selector: (row, index) => props?.employeeNameData?.[row?.assignee] || t("ES_COMMON_NA"), + sortable: true, + width: "180px", + }, ...( (props?.censusData?.[0]?.additionalFields || []) .filter((field) => field.showOnUi) @@ -101,12 +107,6 @@ const PopInboxTable = ({ ...props }) => { sortable: false, width: "180px", }, - { - name: t("INBOX_ASSIGNEE"), - selector: (row, index) => props?.employeeNameData?.[row?.assignee] || t("ES_COMMON_NA"), - sortable: true, - width: "180px", - }, ]; }, [props.showEditColumn, props.employeeNameData, props.censusData]); diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/accessbilityPopUP.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/accessbilityPopUP.js index e7919ee6159..b7d8b806068 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/accessbilityPopUP.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/accessbilityPopUP.js @@ -11,22 +11,22 @@ const AccessibilityPopUp = ({ onClose, census, onSuccess }) => { // Initialize dropdown values with the existing accessibility details from additionalDetails if available const [dropdown1Value, setDropdown1Value] = useState(null); const [dropdown2Value, setDropdown2Value] = useState(null); - const [dropdown3Value, setDropdown3Value] = useState(null); + // const [dropdown3Value, setDropdown3Value] = useState(null); const [initialValues, setInitialValues] = useState({}); const [showToast, setShowToast] = useState(null); useEffect(() => { if (census?.additionalDetails?.accessibilityDetails) { - const { roadCondition, terrain, transportationMode } = census?.additionalDetails?.accessibilityDetails || {}; + const { roadCondition, terrain} = census?.additionalDetails?.accessibilityDetails || {}; /// removed transportationMode setDropdown1Value(roadCondition); setDropdown2Value(terrain); - setDropdown3Value(transportationMode); + // setDropdown3Value(transportationMode); // Store initial values to compare later setInitialValues({ roadCondition, terrain, - transportationMode, + // transportationMode, }); } }, [census]); @@ -46,9 +46,9 @@ const AccessibilityPopUp = ({ onClose, census, onSuccess }) => { case "dropdown2": setDropdown2Value(value); break; - case "dropdown3": - setDropdown3Value(value); - break; + // case "dropdown3": + // setDropdown3Value(value); + // break; default: break; } @@ -63,7 +63,7 @@ const AccessibilityPopUp = ({ onClose, census, onSuccess }) => { accessibilityDetails: { roadCondition: dropdown1Value, terrain: dropdown2Value, - transportationMode: dropdown3Value, + // transportationMode: dropdown3Value, }, }, }, @@ -73,10 +73,10 @@ const AccessibilityPopUp = ({ onClose, census, onSuccess }) => { const isChanged = React.useCallback(() => { return ( dropdown1Value !== initialValues.roadCondition || - dropdown2Value !== initialValues.terrain || - dropdown3Value !== initialValues.transportationMode + dropdown2Value !== initialValues.terrain + //dropdown3Value !== initialValues.transportationMode ); - }, [dropdown1Value, dropdown2Value, dropdown3Value, initialValues]); + }, [dropdown1Value, dropdown2Value, initialValues]); // Define the mutation configuration const mutation = Digit.Hooks.useCustomAPIMutationHook({ @@ -129,7 +129,7 @@ const AccessibilityPopUp = ({ onClose, census, onSuccess }) => { /> - + {/*
{t(`HCM_MICROPLAN_VILLAGE_TRANSPORTATION_MODE_LABEL`)}
{ select={(value) => handleDropdownChange(value, "dropdown3")} t={t} /> -
+
*/} , ]} onOverlayClick={onClose} diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/timelinePopUpWrapper.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/timelinePopUpWrapper.js index 22b4235d84e..1329d49347d 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/timelinePopUpWrapper.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/timelinePopUpWrapper.js @@ -36,9 +36,9 @@ const TimelinePopUpWrapper = ({ onClose, businessId, heading }) => { label: t(instance?.action), variant: 'completed', subElements: [Digit.Utils.microplanv1.epochToDateTime(instance?.auditDetails?.lastModifiedTime), - instance?.assignes?.length > 0 && - `${instance.assignes[0]?.name} - ${instance.assignes[0]?.roles?.[0]?.name || 'NA'}`, - instance.comment && t(`${instance.comment}`) + instance?.assigner && + `${instance.assigner?.name} - ${instance.assigner?.roles?.[0]?.name || 'NA'}`, + instance.comment && `${t('COMMENT_PREFIX')} "${instance.comment}"` ], showConnector: true })); diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js index 21bdbd4a9d8..17fb49c3d0a 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js @@ -267,6 +267,7 @@ export const UICustomizations = { variation="secondary" icon={"ArrowForward"} type="button" + style={{minWidth:"240px"}} isDisabled={!hasRequiredRole} // className="dm-workbench-download-template-btn dm-hover" onClick={(e) => onActionSelect("START", row)} @@ -276,6 +277,7 @@ export const UICustomizations = { label={t("WBH_DOWNLOAD")} variation="secondary" icon={"FileDownload"} + style={{minWidth:"240px"}} type="button" // className="dm-workbench-download-template-btn dm-hover" onClick={(e) => onActionSelect("DOWNLOAD", row)} @@ -285,6 +287,7 @@ export const UICustomizations = { label={t("WBH_EDIT")} variation="secondary" icon={"Edit"} + style={{minWidth:"240px"}} type="button" // className="dm-workbench-download-template-btn dm-hover" onClick={(e) => onActionSelect("EDIT", row)} diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/ChooseActivity.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/ChooseActivity.js index 701df69e6e3..f1c425f0389 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/ChooseActivity.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/ChooseActivity.js @@ -90,13 +90,14 @@ const ChooseActivity = () => { disable: isCardDisabled([], workflowData), optionKey: "GEOSPATIAL_MAP_VIEW" }, - { - name: t("VIEW_MICROPLAN_ESTIMATIONS"), - link: `pop-inbox?campaignId=${campaignId}µplanId=${microplanId}`, - icon: , - disable: isCardDisabled(["MICROPLAN_VIEWER"], workflowData), - optionKey: "VIEW_MICROPLAN_ESTIMATIONS" - } + //commenting this as for now we are not showing viewer + // { + // name: t("VIEW_MICROPLAN_ESTIMATIONS"), + // link: `pop-inbox?campaignId=${campaignId}µplanId=${microplanId}`, + // icon: , + // disable: isCardDisabled(["MICROPLAN_VIEWER"], workflowData), + // optionKey: "VIEW_MICROPLAN_ESTIMATIONS" + // } ]; const updatePlan = async (req) => { diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js index 1e67cfb674f..84b1db2a1d9 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PlanInbox.js @@ -150,7 +150,7 @@ const PlanInbox = () => { village: filteredCensus?.boundaryCode || "NA", villageRoadCondition: filteredCensus?.additionalDetails?.accessibilityDetails?.roadCondition?.code || "NA", villageTerrain: filteredCensus?.additionalDetails?.accessibilityDetails?.terrain?.code || "NA", - villageTransportMode: filteredCensus?.additionalDetails?.accessibilityDetails?.transportationMode?.code || "NA", + // villageTransportMode: filteredCensus?.additionalDetails?.accessibilityDetails?.transportationMode?.code || "NA", totalPop: filteredCensus?.additionalDetails?.totalPopulation || "NA", targetPop: filteredCensus?.additionalDetails?.targetPopulation || "NA", ...dynamicSecurityData, @@ -393,12 +393,12 @@ const PlanInbox = () => { sortable: true, width: "180px", }, - { - name: t(`HCM_MICROPLAN_VILLAGE_TRANSPORTATION_MODE_LABEL`), - cell: (row) => t(row?.villageTransportMode) || "NA", - sortable: true, - width: "180px", - }, + // { + // name: t(`HCM_MICROPLAN_VILLAGE_TRANSPORTATION_MODE_LABEL`), + // cell: (row) => t(row?.villageTransportMode) || "NA", + // sortable: true, + // width: "180px", + // }, ...getSecurityDetailsColumns(), ...getAdditionalFieldsColumns(), ...getResourceColumns(), @@ -483,6 +483,7 @@ const PlanInbox = () => { VALIDATE: { isSuffix: false, icon: "CheckCircle" }, EDIT_AND_SEND_FOR_APPROVAL: { isSuffix: false, icon: "Edit" }, APPROVE: { isSuffix: false, icon: "CheckCircle" }, + ROOT_APPROVE: { isSuffix: false, icon: "CheckCircle" }, SEND_BACK_FOR_CORRECTION: { isSuffix: true, icon: "ArrowForward" }, }; diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js index e40ad537bfd..862af08c671 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js @@ -398,6 +398,7 @@ const PopInbox = () => { "VALIDATE": { isSuffix: false, icon: "CheckCircle" }, "EDIT_AND_SEND_FOR_APPROVAL": { isSuffix: false, icon: "Edit" }, "APPROVE": { isSuffix: false, icon: "CheckCircle" }, + "ROOT_APPROVE": { isSuffix: false, icon: "CheckCircle" }, "SEND_BACK_FOR_CORRECTION": { isSuffix: true, icon: "ArrowForward" }, } diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js index a300c566553..e765783e107 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js @@ -243,7 +243,7 @@ const VillageView = () => { icon="ArrowForward" iconFill="" isSuffix - label={t(`HCM_MICROPLAN_VILLAGE_SECURITY_DETAIL_LINK`)} + label={data?.additionalDetails?.securityDetails ? t(`HCM_MICROPLAN_VILLAGE_SECURITY_EDIT_LINK`) : t(`HCM_MICROPLAN_VILLAGE_SECURITY_DETAIL_LINK`)} onClick={handleSecurityClick} options={[]} optionsKey="" @@ -262,7 +262,7 @@ const VillageView = () => { icon="ArrowForward" iconFill="" isSuffix - label={t(`HCM_MICROPLAN_VILLAGE_ACCESSIBILITY_DETAIL_LINK`)} + label={data?.additionalDetails?.accessibilityDetails ? t(`HCM_MICROPLAN_VILLAGE_ACCESSIBILITY_DETAIL_EDIT_LINK`) : t(`HCM_MICROPLAN_VILLAGE_ACCESSIBILITY_DETAIL_LINK`)} onClick={handleAccibilityClick} options={[]} optionsKey="" @@ -297,11 +297,11 @@ const VillageView = () => { className="custom-class" icon="Edit" iconFill="" - label="Edit Confirmed Population" + label={t(`HCM_MICROPLAN_EDIT_CONFIRM_POPULATION_LABEL`)} onClick={handleEditPopulationClick} options={[]} optionsKey="" - size="small" + size="medium" style={{}} title="" variation="secondary" diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/utils/utilities.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/utils/utilities.js index 0cc8e5c81c9..5451a443f91 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/utils/utilities.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/utils/utilities.js @@ -275,12 +275,14 @@ function generateCampaignString(sessionData, t) { const campaignTypeCode = sessionData.CAMPAIGN_DETAILS.campaignDetails.campaignType.i18nKey; const resourceDistributionStrategy = sessionData.CAMPAIGN_DETAILS.campaignDetails.distributionStrat.resourceDistributionStrategyCode; - // Get current year and take the last two digits - const currentYear = new Date().getFullYear(); - const yearLastTwoDigits = currentYear.toString().slice(-2); - const currentMonth = getCurrentMonth() + // Get current date details + const currentDate = new Date(); + const day = String(currentDate.getDate()).padStart(2, '0'); // Two-digit day + const monthAbbr = currentDate.toLocaleString('en-US', { month: 'short' }); // Three-letter month abbreviation + const yearLastTwoDigits = currentDate.getFullYear().toString().slice(-2); // Last two digits of the year + // Construct the final string - const result = `${t(diseaseCode)}-${t(campaignTypeCode)}-${t(resourceDistributionStrategy)}-${currentMonth} ${yearLastTwoDigits}`; + const result = `${t(diseaseCode)}-${t(campaignTypeCode)}-${t(resourceDistributionStrategy)}-${day} ${monthAbbr} ${yearLastTwoDigits}`; return result; } From af070ec2ccd5e6d516cede2a5a18e94a632f05ab Mon Sep 17 00:00:00 2001 From: Swathi-eGov <137176788+Swathi-eGov@users.noreply.github.com> Date: Thu, 14 Nov 2024 14:12:00 +0530 Subject: [PATCH 3/5] tenant logo css fix (#1828) --- .../micro-ui/web/micro-ui-internals/example/public/index.html | 2 +- .../micro-ui/web/micro-ui-internals/packages/css/package.json | 2 +- .../packages/css/src/pages/employee/facility.scss | 4 ++++ health/micro-ui/web/public/index.html | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/health/micro-ui/web/micro-ui-internals/example/public/index.html b/health/micro-ui/web/micro-ui-internals/example/public/index.html index dc611f20390..b849bd4ccbd 100644 --- a/health/micro-ui/web/micro-ui-internals/example/public/index.html +++ b/health/micro-ui/web/micro-ui-internals/example/public/index.html @@ -12,7 +12,7 @@ DIGIT - + diff --git a/health/micro-ui/web/micro-ui-internals/packages/css/package.json b/health/micro-ui/web/micro-ui-internals/packages/css/package.json index 5837c83ece5..25f1663e04d 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/css/package.json +++ b/health/micro-ui/web/micro-ui-internals/packages/css/package.json @@ -1,6 +1,6 @@ { "name": "@egovernments/digit-ui-health-css", - "version": "0.1.33", + "version": "0.1.34", "license": "MIT", "main": "dist/index.css", "author": "Jagankumar ", diff --git a/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/facility.scss b/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/facility.scss index 3195ec1c8a6..232e0e1230f 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/facility.scss +++ b/health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/facility.scss @@ -211,4 +211,8 @@ .search-component-table::-webkit-scrollbar-thumb { background-color: #d6d5d4; border-radius: 0.563rem; +} + +.digit-topbar .digit-logo-ulb-wrapper .digit-topbar-logo{ + width: fit-content !important; } \ No newline at end of file diff --git a/health/micro-ui/web/public/index.html b/health/micro-ui/web/public/index.html index 1298b592097..a64db5c6649 100644 --- a/health/micro-ui/web/public/index.html +++ b/health/micro-ui/web/public/index.html @@ -10,7 +10,7 @@ - + DIGIT HCM From a6da6728c5dce0bfdce4a5b291ee13ca51e3daa4 Mon Sep 17 00:00:00 2001 From: ashish-egov <137176738+ashish-egov@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:19:36 +0530 Subject: [PATCH 4/5] Facility data fix (#1829) FacilityData Fix --- .../micro-ui-internals/example/src/UICustomizations.js | 2 ++ .../modules/microplan/src/components/FacilityPopup.js | 8 ++------ .../microplan/src/configs/FacilityMappingConfig.js | 1 + .../modules/microplan/src/configs/UICustomizations.js | 2 ++ 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js b/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js index e5ba3cd51e5..b592dce9b03 100644 --- a/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js +++ b/health/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js @@ -1223,6 +1223,8 @@ export const UICustomizations = { const FacilityPopUp = Digit.ComponentRegistryService.getComponent("FacilityPopup"); switch (key) { + case "MICROPLAN_FACILITY_SERVINGPOPULATION": + return row?.additionalDetails?.servingPopulation; case "MICROPLAN_FACILITY_RESIDINGVILLAGE": return t(row?.residingBoundary); case "MICROPLAN_FACILITY_ASSIGNED_VILLAGES": diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FacilityPopup.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FacilityPopup.js index 8cbf2292380..1094fe0f67f 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FacilityPopup.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FacilityPopup.js @@ -20,7 +20,6 @@ const FacilityPopUp = ({ details, onClose, updateDetails }) => { const [searchKey, setSearchKey] = useState(0); // Key for forcing re-render of SearchJurisdiction const [loader, setLoader] = useState(false); const [selectedRows, setSelectedRows] = useState([]); // State for selected rows - const [isAllSelected, setIsAllSelected] = useState(false); const [censusData, setCensusData] = useState([]); const [showToast, setShowToast] = useState(null); const [accessibilityData, setAccessibilityData] = useState(null); @@ -58,7 +57,6 @@ const FacilityPopUp = ({ details, onClose, updateDetails }) => { // Reset selected rows when changing tabs setSelectedRows([]); setCurrentPage(1); - setIsAllSelected(false); }; useEffect(async () => { @@ -178,7 +176,6 @@ const FacilityPopUp = ({ details, onClose, updateDetails }) => { } ); setSelectedRows([]); - setIsAllSelected(false); await new Promise((resolve) => setTimeout(resolve, 500)); setTableLoader(false); } @@ -196,7 +193,6 @@ const FacilityPopUp = ({ details, onClose, updateDetails }) => { const newSelectedRows = event.selectedRows.map(row => row.id); // Update the state with the list of selected IDs setSelectedRows(newSelectedRows); - setIsAllSelected(event.allSelected); }; const handleViewDetailsForAccessibility = (row) => { @@ -280,11 +276,11 @@ const FacilityPopUp = ({ details, onClose, updateDetails }) => { { onSuccess: async (result) => { setSelectedRows([]); - setIsAllSelected(false); updateDetails(newDetails); }, onError: async (result) => { // setDownloadError(true); + setSelectedRows([]); setShowToast({ key: "error", label: t("ERROR_WHILE_UPDATING_PLANFACILITY"), transitionTime: 5000 }); }, } @@ -381,7 +377,7 @@ const FacilityPopUp = ({ details, onClose, updateDetails }) => { type="button" onClick={handleAssignUnassign} size={"large"} - icon={"AddIcon"} + icon={facilityAssignedStatus ? "Close" : "AddIcon"} /> diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/FacilityMappingConfig.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/FacilityMappingConfig.js index 6209a6f821c..334820a82d8 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/FacilityMappingConfig.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/FacilityMappingConfig.js @@ -133,6 +133,7 @@ const facilityMappingConfig = (projectType) => { { label: "MICROPLAN_FACILITY_SERVINGPOPULATION", jsonPath: "additionalDetails.servingPopulation", + additionalCustomization: true, }, { label: "MICROPLAN_FACILITY_FIXEDPOST", diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js index 17fb49c3d0a..afb0ae9cf32 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/configs/UICustomizations.js @@ -530,6 +530,8 @@ export const UICustomizations = { const [showPopup, setShowPopup] = useState(false); const FacilityPopUp = Digit.ComponentRegistryService.getComponent("FacilityPopup"); switch (key) { + case "MICROPLAN_FACILITY_SERVINGPOPULATION": + return row?.additionalDetails?.servingPopulation; case "MICROPLAN_FACILITY_RESIDINGVILLAGE": return t(row?.residingBoundary); case "MICROPLAN_FACILITY_ASSIGNED_VILLAGES": From aa672b16c51aa8e7324928125cdaed3626970f2c Mon Sep 17 00:00:00 2001 From: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com> Date: Thu, 14 Nov 2024 17:31:46 +0530 Subject: [PATCH 5/5] Added boundary manager access to the home card --- .../src/components/CampaignCard.js | 37 ++++++------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js index 41329a8d089..1eacfa59e9f 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js @@ -3,7 +3,9 @@ import React from "react"; import { useTranslation } from "react-i18next"; const ROLES = { - CAMPAIGN_MANAGER:["CAMPAIGN_MANAGER"], + CAMPAIGN_MANAGER:["CAMPAIGN_MANAGER","MICROPLAN_CAMPAIGN_INTEGRATOR"], + BOUNDARY_MANAGER:["BOUNDARY_MANAGER"], + CAMPAIGN_MANAGER_ONLY:["CAMPAIGN_MANAGER"], NATIONAL_SUPERVISOR:["NATIONAL_SUPERVISOR"] }; @@ -20,41 +22,24 @@ const CampaignCard = () => { } const { t } = useTranslation(); - const tenantId = Digit.ULBService.getCurrentTenantId(); - // const reqCriteria = { - // url: "/project-factory/v1/project-type/search", - // params: {}, - // body: { CampaignDetails:{ - // tenantId, - // createdBy: Digit.UserService.getUser().info.uuid, - // pagination: { - // "sortBy": "createdTime", - // "sortOrder": "desc", - // "limit": 1, - // "offset": 0 - // } - // } }, - // config: { - // select: (data) => { - // return data?.totalCount; - // }, - // }, - // }; - // const { isLoading, data } = Digit.Hooks.useCustomAPIHook( - // reqCriteria - // ); + let links = [ { label: t("ACTION_TEST_SETUP_CAMPAIGN"), link: `/${window?.contextPath}/employee/campaign/setup-campaign`, - roles: ROLES.CAMPAIGN_MANAGER + roles: ROLES.CAMPAIGN_MANAGER_ONLY }, { label: t("ACTION_TEST_MY_CAMPAIGN"), link: `/${window?.contextPath}/employee/campaign/my-campaign`, roles: ROLES.CAMPAIGN_MANAGER, // count: isLoading?"-":data + }, + { //@Bhavya put the new url and remove the comment + label: t("ACTION_TEST_SETUP_CAMPAIGN_FROM_MICROPLAN"), + link: `/${window?.contextPath}/employee/campaign/setup-campaign`, + roles: ROLES.CAMPAIGN_MANAGER }, { label: t("NATIONAL_DASHBOARD"), @@ -71,7 +56,7 @@ const CampaignCard = () => { { label: t("BOUNDARY_MANAGEMENT"), link: `/${window?.contextPath}/employee/campaign/boundary/home`, - roles: ROLES.CAMPAIGN_MANAGER, + roles: ROLES.BOUNDARY_MANAGER, // count: isLoading?"-":data }, ];