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 #1708

Merged
merged 16 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 15 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 @@ -934,7 +934,7 @@ export const UICustomizations = {
additionalCustomizations: (row, key, column, value, t, searchResult) => {
const rolesCodes = Digit.Hooks.useSessionStorage("User", {})[0]?.info?.roles;
const roles = rolesCodes.map((item) => item.code);
const hasRequiredRole = roles.some((role) => role === "ROOT_POPULATION_DATA_APPROVER" || role === "ROOT_POPULATION_APPROVER");
const hasRequiredRole = roles.some((role) => role === "ROOT_POPULATION_DATA_APPROVER" || role === "POPULATION_DATA_APPROVER");
switch (key) {
case "ACTIONS":
const onActionSelect = (key, row) => {
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.13",
"version": "0.1.14",
"license": "MIT",
"main": "dist/index.css",
"author": "Jagankumar <[email protected]>",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
a{
text-decoration: none !important;
}
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
.search-tabs-container {
display: flex;
justify-content: space-between;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,13 @@ function RoleTableComposer({ nationalRoles }) {
: false;
return (
<MultiSelectDropdown
disabled={isUserAlreadyAssignedActive || nationalRoles?.includes(category) ? true : false}
disabled={
isUserAlreadyAssignedActive ||
nationalRoles?.includes(category) ||
!rowData?.find((item) => item?.rowIndex === row?.rowIndex)?.selectedHierarchy
? 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 @@ -407,6 +413,10 @@ function RoleTableComposer({ nationalRoles }) {

return (
<Button
isDisabled={
!rowData?.find((item) => item?.rowIndex === row?.rowIndex)?.selectedBoundaries ||
rowData?.find((item) => item?.rowIndex === row?.rowIndex)?.selectedBoundaries?.length === 0
}
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
className={"roleTableCell"}
variation={isUserAlreadyAssignedActive ? "secondary" : "primary"}
label={isUserAlreadyAssignedActive ? t(`UNASSIGN`) : t(`ASSIGN`)}
Expand All @@ -429,11 +439,10 @@ function RoleTableComposer({ nationalRoles }) {
refetchHrms(); // Fetch the updated data with the new rows per page
};
const handleSearchSubmit = (e) => {
if (number?.length > 0 && number?.length <= 10) {
if (number?.length > 0 && number?.length !== 10) {
setShowToast({ key: "error", label: t("INVALID_MOBILE_NUMBER_LENGTH") });
return;
}
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved

setCurrentPage(1);
setFilters({
name: name,
Expand Down Expand Up @@ -492,7 +501,7 @@ function RoleTableComposer({ nationalRoles }) {
<CardLabel style={{ marginBottom: "0.4rem" }}>{t("Number")}</CardLabel>
<TextInput
value={number}
type={"number"}
type={"text"}
name={"number"}
onChange={(e) => {
const newValue = e.target.value.replace(/\D/g, ""); // Remove non-numeric characters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function UserAccess({ category, setData, nationalRoles }) {
</Card>

<Card>
{planEmployee?.data?.length > 0 ? (
{planEmployee?.data?.length > 0 || searchQuery ? (
<div style={styles.container}>
<TableSearchField onSearch={handleSearch} />
<Button
Expand All @@ -248,7 +248,7 @@ function UserAccess({ category, setData, nationalRoles }) {
</div>
) : null}
{!isPlanEmpSearchLoading && (!planEmployee?.data || planEmployee?.data?.length === 0) ? (
<Card>
<Card style={{ boxShadow: "none" }}>
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
<NoResultsFound />
<Button
variation="secondary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const defaultSearchValues = {
showTab: true, // setting true will enable tab screen
TabSearchconfig: [ // all tab config should be added in json array
{
label: "MY_MICROPLANS",
label: "ALL",
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
type: "search",
apiDetails: {
serviceName: "/plan-service/config/_search",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export const UICustomizations = {
additionalCustomizations: (row, key, column, value, t, searchResult) => {
const rolesCodes = Digit.Hooks.useSessionStorage("User", {})[0]?.info?.roles;
const roles = rolesCodes.map((item) => item.code);
const hasRequiredRole = roles.some((role) => role === "ROOT_POPULATION_DATA_APPROVER" || role === "ROOT_POPULATION_APPROVER");
const hasRequiredRole = roles.some((role) => role === "ROOT_POPULATION_DATA_APPROVER" || role === "POPULATION_DATA_APPROVER");
switch (key) {
case "ACTIONS":
const onActionSelect = (key, row) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ const createUpdatePlanProject = async (req) => {
backlink: `/${window.contextPath}/employee`,
responseId: planResForCompleteSetup?.PlanConfiguration?.[0]?.name,
info: "SETUP_MICROPLAN_SUCCESS_NAME",
description: "SETUP_MICROPLAN_SUCCESS_RESPONSE_DESC",
// description: "SETUP_MICROPLAN_SUCCESS_RESPONSE_DESC",
},
};
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const searchPlanWithCensus = async ({ tenantId, microplanId, body, limit, offset
CensusSearchCriteria: {
tenantId: tenantId,
source: microplanId,
limit: body?.PlanSearchCriteria?.limit,
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
jurisdiction: localityArray,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const PlanInbox = () => {
);

useEffect(() => {
if (selectedFilter === "PENDING_FOR_VALIDATION") {
if (selectedFilter === "VALIDATED") {
setActiveLink({ code: "", name: "" });
setShowTab(false);
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
}
Expand Down Expand Up @@ -102,8 +102,7 @@ const PlanInbox = () => {
active: true,
jurisdiction: jurisdiction,
status: selectedFilter !== null && selectedFilter !== undefined ? selectedFilter : "",
assignee: activeLink.code === "ASSIGNED_TO_ME" && selectedFilter !== "PENDING_FOR_VALIDATION" ? user?.info?.uuid : "",
// assignee: activeLink.code === "ASSIGNED_TO_ME" ? user?.info?.uuid : "",
assignee: activeLink.code === "ASSIGNED_TO_ALL" || selectedFilter === "VALIDATED" ? "" : user?.info?.uuid,
planConfigurationId: microplanId, //list of plan ids
limit: limitAndOffset?.limit,
offset: limitAndOffset?.offset,
Expand Down Expand Up @@ -269,16 +268,16 @@ const PlanInbox = () => {
}, [selectedFilter, activeLink, jurisdiction, limitAndOffset]);

useEffect(() => {
if (selectedFilter === "PENDING_FOR_VALIDATION") {
if (selectedFilter === "VALIDATED") {
setActiveLink({ code: "", name: "" });
setShowTab(false);
} else {
if (!showTab) {
setShowTab(true);
setActiveLink({
code: "ASSIGNED_TO_ME",
name: "ASSIGNED_TO_ME",
});
setShowTab(true);
}
}
}, [selectedFilter]);
Expand All @@ -288,8 +287,8 @@ const PlanInbox = () => {
};

const clearFilters = () => {
if (selectedFilter !== Object.entries(planWithCensus?.StatusCount)?.[0]?.[0]) {
setSelectedFilter(Object.entries(planWithCensus?.StatusCount)?.[0]?.[0]);
if (selectedFilter !== Object.entries(activeFilter)?.[0]?.[0]) {
setSelectedFilter(Object.entries(activeFilter)?.[0]?.[0]);
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
}
};

Expand Down Expand Up @@ -465,7 +464,7 @@ const PlanInbox = () => {
variation="secondary"
label={t(action.action)}
type="button"
onClick={(action) => handleActionClick(action?.target?.textContent)}
onClick={(curr) => handleActionClick(action?.action)}
nabeelmd-eGov marked this conversation as resolved.
Show resolved Hide resolved
size={"large"}
/>
))}
Expand Down Expand Up @@ -544,7 +543,7 @@ const PlanInbox = () => {
commentPath="workflow.comments"
onSuccess={(data) => {
history.push(`/${window.contextPath}/employee/microplan/microplan-success`, {
fileName: data?.PlanConfiguration?.[0]?.name,
responseId: data?.PlanConfiguration?.[0]?.name,
message: t(`FINALISED_MICROPLAN_SUCCESSFUL`),
back: t(`GO_BACK_TO_HOME`),
backlink: `/${window.contextPath}/employee`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ const PopInbox = () => {
tenantId: tenantId,
source: microplanId,
status: selectedFilter !== null && selectedFilter !== undefined ? selectedFilter : "",
assignee: activeLink.code === "ASSIGNED_TO_ALL" || selectedFilter === "PENDING_FOR_VALIDATION" ? "" : user?.info?.uuid,
assignee: activeLink.code === "ASSIGNED_TO_ALL" || selectedFilter === "VALIDATED" ? "" : user?.info?.uuid,
jurisdiction: jurisdiction,
limit: limitAndOffset?.limit,
offset: limitAndOffset?.offset
Expand Down Expand Up @@ -278,7 +278,7 @@ const PopInbox = () => {
}, [selectedFilter, jurisdiction, limitAndOffset, activeLink]);

useEffect(() => {
if (selectedFilter === "PENDING_FOR_VALIDATION") {
if (selectedFilter === "VALIDATED") {
setActiveLink({ code: "", name: "" });
setShowTab(false);
} else {
Expand Down