Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

myMicroplanFixes #1719

Merged
merged 25 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
03a801b
My microplan data fixes, localisation fixes
NabeelAyubee Oct 29, 2024
e838cec
setup response screen fixes, breadcrumb localisation code correctify
NabeelAyubee Oct 29, 2024
e1113aa
search bar fix
NabeelAyubee Oct 29, 2024
860e998
Merge branch 'console' into myMicroplanFixes
NabeelAyubee Oct 29, 2024
14fe7cb
fixes
NabeelAyubee Oct 29, 2024
732b6da
Merge branch 'console' into myMicroplanFixes
NabeelAyubee Oct 29, 2024
1306f6f
ADD NEW LOCALE
NabeelAyubee Oct 29, 2024
3ce765a
roletable fixes for mobile number search, qa issue fix
NabeelAyubee Oct 29, 2024
f76a106
Merge branch 'console' into myMicroplanFixes
NabeelAyubee Oct 29, 2024
f12f40e
FIXES
NabeelAyubee Oct 29, 2024
844e6ac
Merge branch 'console' into myMicroplanFixes
NabeelAyubee Oct 29, 2024
8b69979
quickfixes
NabeelAyubee Oct 29, 2024
34278ab
quick fixes/ Tagging UI UX fixes
NabeelAyubee Oct 30, 2024
2be2d4c
Merge branch 'console' into myMicroplanFixes
NabeelAyubee Oct 30, 2024
72a4d1b
fix
NabeelAyubee Oct 30, 2024
9f36cf7
added locale
NabeelAyubee Oct 30, 2024
216f549
Merge branch 'console' into myMicroplanFixes
NabeelAyubee Oct 30, 2024
34b548c
census table assignee issue fixes
NabeelAyubee Oct 30, 2024
aef7227
Merge branch 'console' into myMicroplanFixes
NabeelAyubee Oct 30, 2024
8741cc7
role table pop up css fix and my microplan click fix
NabeelAyubee Oct 30, 2024
9898c59
Merge branch 'console' into myMicroplanFixes
NabeelAyubee Oct 30, 2024
6fd8875
fixes and stepper click enable for back
NabeelAyubee Oct 30, 2024
0bdd7f6
Merge branch 'console' into myMicroplanFixes
NabeelAyubee Oct 30, 2024
5d5b3b6
added user tag fixes
NabeelAyubee Oct 30, 2024
e502889
Merge branch 'console' into myMicroplanFixes
NabeelAyubee Oct 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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 (
<div className={`digit-no-data-found ${props?.className ? props?.className : ""}`} style={props?.style}>
<SVG.NoResultsFoundIcon height={iconHeight} width={iconWidth} />
<span className="digit-error-msg">{props?.text ? t(props?.text) : t("COMMON_NO_RESULTS_FOUND")}</span>
</div>
);
};
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
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,
};
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
export default NoResultsFound;
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
selectedBoundaries: nationalRoles?.includes(category)
? topBoundaryValue
: data?.planData?.find((i) => i.employeeId === item?.user?.userServiceUuid)?.jurisdiction,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
: i
);
} else {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -322,19 +322,19 @@ function RoleTableComposer({ nationalRoles }) {
{
name: t("NAME"),
selector: (row) => {
return row.name;
return <div title={row?.name || t("NA")}>{row.name || t("NA")}</div>;
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
},
sortable: true,
},
{
name: t("EMAIL"),
selector: (row) => row.email,
selector: (row) => <div title={row?.email || t("NA")}>{row?.email || t("NA")}</div>,
sortable: true,
},
{
name: t("CONTACT_NUMBER"),
selector: (row) => {
return row.number;
return row.number || t("NA");
},
sortable: true,
},
Expand All @@ -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
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
? true
: false;
return (
Expand All @@ -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 (
<MultiSelectDropdown
disabled={
isUserAlreadyAssignedActive ||
nationalRoles?.includes(category) ||
!rowData?.find((item) => item?.rowIndex === row?.rowIndex)?.selectedHierarchy
nationalRoles?.includes(category) ||
!rowData?.find((item) => item?.rowIndex === row?.rowIndex)?.selectedHierarchy
? true
: false
}
Expand All @@ -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;

Expand Down Expand Up @@ -514,18 +514,9 @@ function RoleTableComposer({ nationalRoles }) {
/>
</LabelFieldPair>
<div className={`search-field-wrapper roleComposer`} style={{ display: "flex", justifyContent: "flex-end" }}>
<Button variation="teritiary" label={t("Clear")} onClick={handleClearSearch} />

<Button
variation="teritiary"
label={t("Clear")}
onClick={handleClearSearch}
/>

<Button
variation="primary"
label={t("Search")}
onClick={handleSearchSubmit}
/>
<Button variation="primary" label={t("Search")} onClick={handleSearchSubmit} />
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
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";
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();
Expand Down Expand Up @@ -129,19 +130,19 @@ function UserAccess({ category, setData, nationalRoles }) {
{
name: t("NAME"),
selector: (row) => {
return row.name;
return row.name || t("NA");
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
},
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,
},
Expand Down Expand Up @@ -210,6 +211,8 @@ function UserAccess({ category, setData, nationalRoles }) {
className={"roleTableCell"}
variation={"secondary"}
label={t(`UNASSIGN`)}
title={t(`UNASSIGN`)}
style={{ padding: "1rem" }}
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
icon={"Close"}
isSuffix={false}
onClick={(value) => handleUpdateAssignEmployee(row)}
Expand Down Expand Up @@ -249,7 +252,7 @@ function UserAccess({ category, setData, nationalRoles }) {
) : null}
{!isPlanEmpSearchLoading && (!planEmployee?.data || planEmployee?.data?.length === 0) ? (
<Card style={{ boxShadow: "none" }}>
<NoResultsFound />
<NoResultsFound text={Digit.Utils.locale.getTransformedLocale(`NO_RESULTS_${category}`)} />
<Button
variation="secondary"
label={t(Digit.Utils.locale.getTransformedLocale(`ASSIGN_` + category))}
Expand Down Expand Up @@ -283,8 +286,17 @@ function UserAccess({ category, setData, nationalRoles }) {
type={"default"}
heading={t(`${category}_POPUP_HEADING`)}
children={[<RoleTableComposer category={category} nationalRoles={nationalRoles} />]}
onOverlayClick={() => { }}
footerChildren={[<Button type={"button"} size={"large"} variation={"secondary"} label={t("CLOSE")} onClick={() => setShowPopUp(false)} style={{ minWidth: "200px" }} />]}
onOverlayClick={() => {}}
footerChildren={[
<Button
type={"button"}
size={"large"}
variation={"secondary"}
label={t("CLOSE")}
onClick={() => setShowPopUp(false)}
style={{ minWidth: "200px" }}
/>,
]}
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
sortFooterChildren={true}
onClose={() => setShowPopUp(false)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const UserAccessWrapper = ({ onSelect, props: customProps }) => {
const rolesArray = state?.rolesForMicroplan?.sort((a, b) => a.orderNumber - b.orderNumber).map((item) => item.roleCode);
let mpRolesArray = rolesArray.map((item) => t(`MP_ROLE_${item}`));

const nationalRoles = ["ROOT_PLAN_ESTIMATION_APPROVER", "ROOT_POPULATION_DATA_APPROVER", "ROOT_FACILITY_CATCHMENT_MAPPER"]
const nationalRoles = ["ROOT_PLAN_ESTIMATION_APPROVER", "ROOT_POPULATION_DATA_APPROVER", "ROOT_FACILITY_CATCHMENT_MAPPER"];
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
const hierarchyData = customProps?.hierarchyData;
const campaignType = customProps?.sessionData?.CAMPAIGN_DETAILS?.campaignDetails?.campaignType?.code;

Expand All @@ -33,7 +33,6 @@ const UserAccessWrapper = ({ onSelect, props: customProps }) => {
const [showToast, setShowToast] = useState(null);
const [showErrorToast, setShowErrorToast] = useState(null);


const [executionCount, setExecutionCount] = useState(0);

const tenantId = Digit.ULBService.getCurrentTenantId();
Expand All @@ -45,13 +44,25 @@ const UserAccessWrapper = ({ onSelect, props: customProps }) => {
setInternalKey((prevKey) => prevKey - 1);
}
};

useEffect(() => {
window.addEventListener("UserAccessVerticalStepper", moveToPreviousStep);
return () => {
window.removeEventListener("UserAccessVerticalStepper", moveToPreviousStep);
};
}, [internalKey]);
const isLastStep = () => {
//deleting these params on last step
Digit.Utils.microplanv1.updateUrlParams({ isLastVerticalStep: null });
Digit.Utils.microplanv1.updateUrlParams({ internalKey: null });
};

useEffect(() => {
if (internalKey === mpRolesArray.length) {
Digit.Utils.microplanv1.updateUrlParams({ isLastVerticalStep: true });
} else {
// Assuming 1 is the first step
Digit.Utils.microplanv1.updateUrlParams({ isLastVerticalStep: false });
}
}, [internalKey]);
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
const updateUrlParams = (params) => {
const url = new URL(window.location.href);
Object.entries(params).forEach(([key, value]) => {
Expand All @@ -72,7 +83,6 @@ const UserAccessWrapper = ({ onSelect, props: customProps }) => {
});
};


const handleBack = () => {
if (internalKey > 1) {
setInternalKey((prevKey) => prevKey - 1); // Update key in URL
Expand Down Expand Up @@ -136,11 +146,7 @@ const UserAccessWrapper = ({ onSelect, props: customProps }) => {
</div>

<div style={{ width: "100%" }}>
<UserAccess
category={rolesArray?.[internalKey - 1]}
setData={setData}
nationalRoles={nationalRoles}
/>
<UserAccess category={rolesArray?.[internalKey - 1]} setData={setData} nationalRoles={nationalRoles} />
</div>
</div>

Expand Down Expand Up @@ -177,4 +183,4 @@ const UserAccessWrapper = ({ onSelect, props: customProps }) => {
);
};

export default UserAccessWrapper;
export default UserAccessWrapper;