From c64b2518f4915052c011cafbfe37062e1b4ec867 Mon Sep 17 00:00:00 2001 From: Swathi-eGov <137176788+Swathi-eGov@users.noreply.github.com> Date: Mon, 2 Dec 2024 15:44:33 +0530 Subject: [PATCH] sort issue fix, title for buttons, actionbar fix (#1955) --- .../example/public/index.html | 2 +- .../packages/css/package.json | 2 +- .../css/src/components/microplan.scss | 6 +++++ .../microplan/src/components/FacilityPopup.js | 5 ++++ .../microplan/src/components/PopInboxTable.js | 14 ++++++++++ .../src/components/RoleTableComposer.js | 1 + .../microplan/src/components/UserAccess.js | 27 ++++++++++++++++--- .../microplan/src/pages/employee/PlanInbox.js | 16 ++++++++++- .../src/pages/employee/SetupMicroplan.js | 2 +- health/micro-ui/web/public/index.html | 2 +- 10 files changed, 68 insertions(+), 9 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 e7f0495f857..e888e976f41 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 ad781a1b359..aa5c6bdaa0b 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.54", + "version": "0.1.55", "license": "MIT", "main": "dist/index.css", "author": "Jagankumar ", diff --git a/health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss b/health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss index c09e3def6cd..5b6a86668b6 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss +++ b/health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplan.scss @@ -501,4 +501,10 @@ tbody tr:last-child td:last-child .digit-dropdown-employee-select-wrap .digit-dr .microplan-employee-module-card{ min-height: 16.25rem; +} + +.action-bar-wrap{ + &.microplan-actionbar{ + z-index: 19 !important; + } } \ No newline at end of file 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 739eb79308f..e84825253a0 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 @@ -509,6 +509,11 @@ const FacilityPopUp = ({ detail, onClose }) => { ? `${t("MICROPLAN_UNASSIGN_FACILITY")} ${details?.additionalDetails?.facilityName}` : `${t("MICROPLAN_ASSIGN_FACILITY")} ${details?.additionalDetails?.facilityName}` } + title={ + facilityAssignedStatus + ? `${t("MICROPLAN_UNASSIGN_FACILITY")} ${details?.additionalDetails?.facilityName}` + : `${t("MICROPLAN_ASSIGN_FACILITY")} ${details?.additionalDetails?.facilityName}` + } type="button" onClick={handleAssignUnassign} size={"large"} 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 f1dd764766d..9711ce238da 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 @@ -95,6 +95,20 @@ const PopInboxTable = ({ ...props }) => { fieldValue ); }, + sortFunction: (rowA, rowB) => { + const fieldA = rowA.additionalFields.find((f) => f.key === field.key); + const fieldB = rowB.additionalFields.find((f) => f.key === field.key); + + const valueA = parseFloat(fieldA?.value || 0); // Converting to number, default to 0 if undefined + const valueB = parseFloat(fieldB?.value || 0); + + if (fieldA?.editable && !fieldB?.editable) return 1; // Editable rows after non-editable + if (!fieldA?.editable && fieldB?.editable) return -1; // Non-editable rows before editable + + // Numeric comparison for rows with same editability + return valueA - valueB; + }, + sortable: true, width: "180px", style: { diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js index 6eab1e89825..538a375aa7d 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js @@ -447,6 +447,7 @@ function RoleTableComposer({ nationalRoles }) { rowData?.find((item) => item?.rowIndex === row?.rowIndex)?.selectedBoundaries?.length === 0 } style={{width:"100%"}} + title={isUserAlreadyAssignedActive ? t(`UNASSIGN`) : t(`ASSIGN`)} size="medium" className={"roleTableCell"} variation={isUserAlreadyAssignedActive ? "secondary" : "primary"} diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserAccess.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserAccess.js index 5797120b338..65640bd00f4 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserAccess.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/UserAccess.js @@ -137,7 +137,11 @@ function UserAccess({ category, setData, nationalRoles }) { { name: t("NAME"), selector: (row) => { - return row.name || t("NA"); + return ( +
+ {row.name || t("NA")} +
+ ); }, sortable: true, sortFunction: (rowA, rowB) => { @@ -150,13 +154,23 @@ function UserAccess({ category, setData, nationalRoles }) { }, { name: t("EMAIL"), - selector: (row) => row.email || t("NA"), + selector: (row) => { + return ( +
+ {row.email || t("NA")} +
+ ); + }, sortable: false, }, { name: t("CONTACT_NUMBER"), selector: (row) => { - return row.number || t("NA"); + return ( +
+ {row?.number || t("NA")} +
+ ); }, sortable: true, sortFunction: (rowA, rowB) => { @@ -178,7 +192,11 @@ function UserAccess({ category, setData, nationalRoles }) { // } else { // return row?.hierarchyLevel; // Otherwise, return the existing hierarchy level // } - return t(row?.hierarchyLevel || "NA"); + return ( +
+ {t(row?.hierarchyLevel || "NA")} +
+ ); }, sortable: true, sortFunction: (rowA, rowB) => { @@ -191,6 +209,7 @@ function UserAccess({ category, setData, nationalRoles }) { }, { name: t("ADMINISTRATIVE_BOUNDARY"), + grow: 2, selector: (row) => { return (
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 0139a160a3f..e4a3d2d8ceb 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 @@ -539,6 +539,13 @@ const PlanInbox = () => { }, sortable: true, width: "180px", + sortFunction: (rowA, rowB) => { + const fieldA = rowA?.[resource?.resourceType]; + const fieldB = rowB?.[resource?.resourceType]; + const valueA = parseFloat(fieldA || 0); + const valueB = parseFloat(fieldB || 0); + return valueA - valueB; + }, })); return (operationArr || []) @@ -570,10 +577,17 @@ const PlanInbox = () => { return { name: t(i?.question), - sortable: false, + sortable: true, cell: (row) => { return t(`${row?.[`securityDetail_${i?.question}`]}`) || t("ES_COMMON_NA")}, width: "180px", + sortFunction: (rowA, rowB) => { + const valueA = (rowA?.[`securityDetail_${i?.question}`] || t("ES_COMMON_NA")).toLowerCase(); + const valueB = (rowB?.[`securityDetail_${i?.question}`] || t("ES_COMMON_NA")).toLowerCase(); + if (valueA < valueB) return -1; + if (valueA > valueB) return 1; + return 0; + }, }; }); // const securityColumns = Object.keys(sampleSecurityData).map((key) => ({ diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/SetupMicroplan.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/SetupMicroplan.js index 1e715de5890..036f1c582c5 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/SetupMicroplan.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/SetupMicroplan.js @@ -398,7 +398,7 @@ const SetupMicroplan = ({ hierarchyType, hierarchyData }) => { onSubmit={onSubmit} showSecondaryLabel={true} secondaryLabel={t("MP_BACK")} - actionClassName={"actionBarClass"} + actionClassName={"actionBarClass microplan-actionbar"} className="setup-campaign" cardClassName="setup-compaign-card" noCardStyle={true} diff --git a/health/micro-ui/web/public/index.html b/health/micro-ui/web/public/index.html index e8fdf9d31f5..fcae48d3c67 100644 --- a/health/micro-ui/web/public/index.html +++ b/health/micro-ui/web/public/index.html @@ -10,7 +10,7 @@ - + DIGIT HCM