From 4b06dfc64c4e4367535fc5fb04b61c7cbefa6f96 Mon Sep 17 00:00:00 2001 From: Rahul Garud Date: Tue, 3 Sep 2024 19:16:29 +0530 Subject: [PATCH 1/3] added all blocks option in dropdown --- src/pages/block.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/pages/block.tsx b/src/pages/block.tsx index 4a7fe390..90a62e81 100644 --- a/src/pages/block.tsx +++ b/src/pages/block.tsx @@ -118,11 +118,11 @@ const Block: React.FC = () => { const [showAllBlocks, setShowAllBlocks] = useState("All"); const [statusValue, setStatusValue] = useState(Status.ACTIVE); const [pageSize, setPageSize] = React.useState(10); - + const [filters, setFilters] = useState({ name: searchKeyword, states: stateCode, - districts: selectedDistrict, + districts: selectedDistrict || "", type: CohortTypes.BLOCK, status: [statusValue], }); @@ -255,7 +255,7 @@ const Block: React.FC = () => { const fetchBlocks = async () => { try { const response = await getBlocksForDistricts({ - controllingfieldfk: selectedDistrict || "", + controllingfieldfk: selectedDistrict === "All" ? "" : selectedDistrict || "All", fieldName: "blocks", }); console.log("selectedDistrict block", selectedDistrict); @@ -287,7 +287,13 @@ const Block: React.FC = () => { const reqParams = { limit: 0, offset: 0, - filters: filters, + filters: { + name: searchKeyword, + states: stateCode, + districts: selectedDistrict === "All" ? "" : selectedDistrict || "All", + type: CohortTypes.BLOCK, + status: [statusValue], + }, sort: sortBy, }; @@ -913,7 +919,7 @@ const Block: React.FC = () => { }, }} > - {/* {t("COMMON.ALL")} */} + {t("COMMON.ALL")} {districtData.map((districtDetail) => ( Date: Tue, 3 Sep 2024 19:37:42 +0530 Subject: [PATCH 2/3] used translations --- src/pages/block.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pages/block.tsx b/src/pages/block.tsx index 90a62e81..ce5101c9 100644 --- a/src/pages/block.tsx +++ b/src/pages/block.tsx @@ -255,7 +255,10 @@ const Block: React.FC = () => { const fetchBlocks = async () => { try { const response = await getBlocksForDistricts({ - controllingfieldfk: selectedDistrict === "All" ? "" : selectedDistrict || "All", + controllingfieldfk: + selectedDistrict === t("COMMON.ALL") + ? "" + : selectedDistrict || t("COMMON.ALL"), fieldName: "blocks", }); console.log("selectedDistrict block", selectedDistrict); @@ -290,7 +293,10 @@ const Block: React.FC = () => { filters: { name: searchKeyword, states: stateCode, - districts: selectedDistrict === "All" ? "" : selectedDistrict || "All", + districts: + selectedDistrict === t("COMMON.ALL") + ? "" + : selectedDistrict || t("COMMON.ALL"), type: CohortTypes.BLOCK, status: [statusValue], }, From 1771d7af8066b7a56d358d1a60efeda5666f0e02 Mon Sep 17 00:00:00 2001 From: Rahul Garud Date: Tue, 3 Sep 2024 19:39:19 +0530 Subject: [PATCH 3/3] used translations --- src/pages/block.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/block.tsx b/src/pages/block.tsx index ce5101c9..16b382fd 100644 --- a/src/pages/block.tsx +++ b/src/pages/block.tsx @@ -925,7 +925,7 @@ const Block: React.FC = () => { }, }} > - {t("COMMON.ALL")} + {t("COMMON.ALL")} {districtData.map((districtDetail) => (