From 6fe93812068cfc53eafe388cb8ce5bc1d26df42f Mon Sep 17 00:00:00 2001 From: rachana-egov <137176770+rachana-egov@users.noreply.github.com> Date: Wed, 27 Nov 2024 17:23:26 +0530 Subject: [PATCH] Pop inbox Pagination fix (#1907) Co-authored-by: rachana-egov --- .../microplan/src/pages/employee/PopInbox.js | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js index 27a38e7287b..04edaaf1ef4 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/PopInbox.js @@ -86,7 +86,7 @@ const PopInbox = () => { source: microplanId, ...(isRootApprover ? {} - : { jurisdiction: jurisdiction }), + : { assignee: user.info.uuid }), }, } }, @@ -164,6 +164,12 @@ const PopInbox = () => { code: "ASSIGNED_TO_ME", name: "ASSIGNED_TO_ME" }); + setLimitAndOffset((prev)=>{ + return { + limit: prev.limit, + offset: 0 + } + }); setDefaultSelectedHierarchy(selectedHierarchy); setDefaultBoundaries(selectedBoundaries); @@ -244,6 +250,12 @@ const PopInbox = () => { const onClear = () => { setDefaultBoundaries([]); setDefaultSelectedHierarchy(null); + setLimitAndOffset((prev)=>{ + return { + limit: prev.limit, + offset: 0 + } + }); setCensusJurisdiction(planEmployee?.planData?.[0]?.jurisdiction); }; @@ -415,6 +427,13 @@ const PopInbox = () => { }, [selectedFilter]); const onFilter = (selectedStatus) => { + setLimitAndOffset((prev)=>{ + return { + limit: prev.limit, + offset: 0 + } + }); + setCurrentPage(1); setSelectedFilter(selectedStatus?.code); setActiveLink({ code: "ASSIGNED_TO_ME", @@ -437,6 +456,13 @@ const PopInbox = () => { if (selectedFilter !== Object.entries(activeFilter)?.[0]?.[0]) { setSelectedFilter(Object.entries(activeFilter)?.[0]?.[0]); } + setLimitAndOffset((prev)=>{ + return { + limit: prev.limit, + offset: 0 + } + }); + setCurrentPage(1); }; const handleActionClick = (action) => { @@ -596,6 +622,13 @@ const PopInbox = () => { ]} navStyles={{}} onTabClick={(e) => { + setLimitAndOffset((prev)=>{ + return { + limit: prev.limit, + offset: 0 + } + }); + setCurrentPage(1); setActiveLink(e); }} setActiveLink={setActiveLink} @@ -668,6 +701,13 @@ const PopInbox = () => { onSuccess={(data) => { closePopUp(); setShowToast({ key: "success", label: t(`POP_INBOX_WORKFLOW_FOR_${workFlowPopUp}_UPDATE_SUCCESS`), transitionTime: 5000 }); + setLimitAndOffset((prev)=>{ + return { + limit: prev.limit, + offset: 0 + } + }); + setCurrentPage(1); refetch(); refetchPlan(); fetchStatusCount();