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

Changes role access #1617

Merged
merged 16 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
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
Expand Up @@ -16,7 +16,7 @@
/> -->
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].6/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].7/dist/index.css" />
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved

<!-- added below css for hcm-workbench module inclusion-->
<!-- <link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" /> -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-health-css",
"version": "0.1.6",
"version": "0.1.7",
"license": "MIT",
"main": "dist/index.css",
"author": "Jagankumar <[email protected]>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2590,7 +2590,7 @@ $border-color: rgba(214, 213, 212, 1);

.digit-popup-wrapper.roleComposer {
max-width: max-content;
min-width: 100rem;
min-width: 90vw;
}

.search-field-wrapper.roleComposer {
Expand Down Expand Up @@ -2623,6 +2623,7 @@ $border-color: rgba(214, 213, 212, 1);
.digit-multiselectdropdown-wrap.roleTableCell.nestedmultiselect {
margin: 0;
width: 15rem;
min-width: 15rem !important;
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
.digit-multiselectdropdown-server {
top: unset !important;
position: fixed !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ function RoleTableComposer({ nationalRoles }) {
const { mutate: planEmployeeUpdate } = Digit.Hooks.microplanv1.usePlanEmployeeUpdate();

const topBoundary = state?.boundaryHierarchy.find(boundary => boundary.parentBoundaryType === null);
const topBoundaryValue = totalFormData?.BOUNDARY?.boundarySelection?.boundaryData?.Country
? Object.values(totalFormData.BOUNDARY.boundarySelection.boundaryData.Country)[0]
: undefined;
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
const { isLoading: isHrmsLoading, data: HrmsData, error: hrmsError, refetch: refetchHrms } = Digit.Hooks.microplanv1.useSearchHRMSEmployee({
tenantId: tenantId,
microplanId: microplanId,
Expand All @@ -51,7 +54,8 @@ function RoleTableComposer({ nationalRoles }) {
state?.boundaryHierarchy?.find(
(j) => j.boundaryType === data?.planData?.find((i) => i.employeeId === item?.user?.userServiceUuid)?.hierarchyLevel
),
selectedBoundaries: data?.planData?.find((i) => i.employeeId === item?.user?.userServiceUuid)?.jurisdiction,
selectedBoundaries: nationalRoles?.includes(category) ? topBoundaryValue :
data?.planData?.find((i) => i.employeeId === item?.user?.userServiceUuid)?.jurisdiction,
userServiceUuid: item?.user?.userServiceUuid,
planData: data?.planData?.find((i) => i.employeeId === item?.user?.userServiceUuid),
};
Expand Down Expand Up @@ -80,13 +84,15 @@ function RoleTableComposer({ nationalRoles }) {
userServiceUuid: employee?.userServiceUuid,
selectedHierarchy: employee?.selectedHierarchy || null,
boundaryOptions: boundaryOptions || [],
selectedBoundaries: filteredBoundary.filter((item) => employee?.selectedBoundaries?.includes(item?.code)) || [],
};
selectedBoundaries: nationalRoles?.includes(category)
? filteredBoundary.filter((item) => employee?.selectedBoundaries?.includes(topBoundaryValue))
: filteredBoundary.filter((item) => employee?.selectedBoundaries?.includes(item?.code)) || [],
}; // Closing brace for the returned object
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
});

setRowData(initializedRowData); // Set the initialized data in the state
}
}, [HrmsData]);
}, [HrmsData]);

useEffect(() => {
refetchHrms();
Expand Down Expand Up @@ -314,6 +320,7 @@ function RoleTableComposer({ nationalRoles }) {
name: t("SELECTED_BOUNDARY"),
cell: (row) => (
<MultiSelectDropdown
disabled={nationalRoles?.includes(category) ? true : false}
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
props={{ className: "roleTableCell" }}
t={t}
options={rowData?.find((item) => item?.rowIndex === row?.rowIndex)?.boundaryOptions || []}
Expand Down Expand Up @@ -424,6 +431,7 @@ function RoleTableComposer({ nationalRoles }) {
</div>
</div>
</Card>
<div style={{overflowY:"auto"}}>
<DataTable
columns={columns}
data={HrmsData?.data}
Expand All @@ -435,6 +443,7 @@ function RoleTableComposer({ nationalRoles }) {
paginationPerPage={rowsPerPage}
paginationRowsPerPageOptions={[5, 10, 15, 20]}
/>
</div>
{showToast && (
<Toast
type={showToast?.key === "error" ? "error" : showToast?.key === "info" ? "info" : showToast?.key === "warning" ? "warning" : "success"}
Expand Down
2 changes: 1 addition & 1 deletion health/micro-ui/web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected]/dist/index.css" />
<!-- added below css for hcm-workbench module inclusion-->

<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].6/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/[email protected].7/dist/index.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#00bcd1" />
<title>DIGIT HCM</title>
Expand Down