diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/NoResultsFound.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/NoResultsFound.js new file mode 100644 index 00000000000..d24c4df96f2 --- /dev/null +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/NoResultsFound.js @@ -0,0 +1,29 @@ +import React from "react"; +import PropTypes from "prop-types"; +import { useTranslation } from "react-i18next"; +import { SVG } from "@egovernments/digit-ui-components"; + +const NoResultsFound = (props) => { + const { t } = useTranslation(); + const iconHeight = props?.height || 262; + const iconWidth = props?.width || 336; + return ( +
+ + {props?.text ? t(props?.text) : t("COMMON_NO_RESULTS_FOUND")} +
+ ); +}; +NoResultsFound.propTypes = { + style: PropTypes.object, + className: PropTypes.string, + height: PropTypes.number, // Prop for the height of the NoResultsFoundIcon + width: PropTypes.number, // Prop for the width of the NoResultsFoundIcon +}; + +// Default props for height and width +NoResultsFound.defaultProps = { + height: 262, + width: 336, +}; +export default NoResultsFound; 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 80f3b819a64..88f104a692c 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 @@ -86,8 +86,8 @@ function RoleTableComposer({ nationalRoles }) { selectedHierarchy: nationalRoles?.includes(category) ? topBoundary : state?.boundaryHierarchy?.find( - (j) => j.boundaryType === data?.planData?.find((i) => i.employeeId === item?.user?.userServiceUuid)?.hierarchyLevel - ), + (j) => j.boundaryType === data?.planData?.find((i) => i.employeeId === item?.user?.userServiceUuid)?.hierarchyLevel + ), selectedBoundaries: nationalRoles?.includes(category) ? topBoundaryValue : data?.planData?.find((i) => i.employeeId === item?.user?.userServiceUuid)?.jurisdiction, @@ -162,11 +162,11 @@ function RoleTableComposer({ nationalRoles }) { return prev.map((i) => i.rowIndex === row.rowIndex ? { - ...i, - selectedHierarchy: value, - boundaryOptions, - selectedBoundaries: [], // Keep existing selected boundaries - } + ...i, + selectedHierarchy: value, + boundaryOptions, + selectedBoundaries: [], // Keep existing selected boundaries + } : i ); } else { @@ -220,9 +220,9 @@ function RoleTableComposer({ nationalRoles }) { return prev.map((i) => i.rowIndex === row.rowIndex ? { - ...i, - selectedBoundaries: [], // Clear selected boundaries - } + ...i, + selectedBoundaries: [], // Clear selected boundaries + } : i ); } else { @@ -251,9 +251,9 @@ function RoleTableComposer({ nationalRoles }) { return prev.map((i) => i.rowIndex === row.rowIndex ? { - ...i, - selectedBoundaries: boundariesInEvent, // Update boundaries - } + ...i, + selectedBoundaries: boundariesInEvent, // Update boundaries + } : i ); } else { @@ -322,19 +322,19 @@ function RoleTableComposer({ nationalRoles }) { { name: t("NAME"), selector: (row) => { - return row.name; + return
{row.name || t("NA")}
; }, sortable: true, }, { name: t("EMAIL"), - selector: (row) => row.email, + selector: (row) =>
{row?.email || t("NA")}
, sortable: true, }, { name: t("CONTACT_NUMBER"), selector: (row) => { - return row.number; + return row.number || t("NA"); }, sortable: true, }, @@ -343,7 +343,7 @@ function RoleTableComposer({ nationalRoles }) { cell: (row) => { const isUserAlreadyAssignedActive = HrmsData?.planSearchData?.filter((i) => i.employeeId === row.employeeId)?.length > 0 && - HrmsData?.planSearchData?.filter((i) => i.employeeId === row.employeeId)?.[0]?.active + HrmsData?.planSearchData?.filter((i) => i.employeeId === row.employeeId)?.[0]?.active ? true : false; return ( @@ -369,15 +369,15 @@ function RoleTableComposer({ nationalRoles }) { cell: (row) => { const isUserAlreadyAssignedActive = HrmsData?.planSearchData?.filter((i) => i.employeeId === row.employeeId)?.length > 0 && - HrmsData?.planSearchData?.filter((i) => i.employeeId === row.employeeId)?.[0]?.active + HrmsData?.planSearchData?.filter((i) => i.employeeId === row.employeeId)?.[0]?.active ? true : false; return ( item?.rowIndex === row?.rowIndex)?.selectedHierarchy + nationalRoles?.includes(category) || + !rowData?.find((item) => item?.rowIndex === row?.rowIndex)?.selectedHierarchy ? true : false } @@ -400,7 +400,7 @@ function RoleTableComposer({ nationalRoles }) { const isUserAlreadyAssigned = HrmsData?.planSearchData?.filter((i) => i.employeeId === row.employeeId)?.length > 0 ? true : false; const isUserAlreadyAssignedActive = HrmsData?.planSearchData?.filter((i) => i.employeeId === row.employeeId)?.length > 0 && - HrmsData?.planSearchData?.filter((i) => i.employeeId === row.employeeId)?.[0]?.active + HrmsData?.planSearchData?.filter((i) => i.employeeId === row.employeeId)?.[0]?.active ? true : false; @@ -514,18 +514,9 @@ function RoleTableComposer({ nationalRoles }) { />
+
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 42145854632..7b209bee3bd 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 @@ -1,4 +1,4 @@ -import { Button, Card, Chip, Header, Loader, NoResultsFound, PopUp, Toast } from "@egovernments/digit-ui-components"; +import { Button, Card, Chip, Header, Loader, PopUp, Toast } from "@egovernments/digit-ui-components"; import React, { Fragment, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import RoleTableComposer, { CustomLoader } from "./RoleTableComposer"; @@ -6,6 +6,7 @@ import DataTable from "react-data-table-component"; import { tableCustomStyle } from "./tableCustomStyle"; import TableSearchField from "./TableSearchBar"; import { useQueryClient } from "react-query"; +import NoResultsFound from "./NoResultsFound"; const Wrapper = ({ setShowPopUp, alreadyQueuedSelectedState }) => { const { t } = useTranslation(); @@ -129,19 +130,19 @@ function UserAccess({ category, setData, nationalRoles }) { { name: t("NAME"), selector: (row) => { - return row.name; + return row.name || t("NA"); }, sortable: true, }, { name: t("EMAIL"), - selector: (row) => row.email, + selector: (row) => row.email || t("NA"), sortable: true, }, { name: t("CONTACT_NUMBER"), selector: (row) => { - return row.number; + return row.number || t("NA"); }, sortable: true, }, @@ -210,6 +211,8 @@ function UserAccess({ category, setData, nationalRoles }) { className={"roleTableCell"} variation={"secondary"} label={t(`UNASSIGN`)} + title={t(`UNASSIGN`)} + style={{ padding: "1rem" }} icon={"Close"} isSuffix={false} onClick={(value) => handleUpdateAssignEmployee(row)} @@ -249,7 +252,7 @@ function UserAccess({ category, setData, nationalRoles }) { ) : null} {!isPlanEmpSearchLoading && (!planEmployee?.data || planEmployee?.data?.length === 0) ? ( - +