Skip to content

Commit

Permalink
Merge pull request #188 from rahulg1254/admin-master
Browse files Browse the repository at this point in the history
Task #226341 feat: Added all blocks & district option in dropdown
  • Loading branch information
itsvick authored Sep 3, 2024
2 parents b7cc7d1 + 1771d7a commit 7b91c92
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/pages/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ const Block: React.FC = () => {
const [showAllBlocks, setShowAllBlocks] = useState("All");
const [statusValue, setStatusValue] = useState(Status.ACTIVE);
const [pageSize, setPageSize] = React.useState<string | number>(10);

const [filters, setFilters] = useState({
name: searchKeyword,
states: stateCode,
districts: selectedDistrict,
districts: selectedDistrict || "",
type: CohortTypes.BLOCK,
status: [statusValue],
});
Expand Down Expand Up @@ -255,7 +255,10 @@ const Block: React.FC = () => {
const fetchBlocks = async () => {
try {
const response = await getBlocksForDistricts({
controllingfieldfk: selectedDistrict || "",
controllingfieldfk:
selectedDistrict === t("COMMON.ALL")
? ""
: selectedDistrict || t("COMMON.ALL"),
fieldName: "blocks",
});
console.log("selectedDistrict block", selectedDistrict);
Expand Down Expand Up @@ -287,7 +290,16 @@ const Block: React.FC = () => {
const reqParams = {
limit: 0,
offset: 0,
filters: filters,
filters: {
name: searchKeyword,
states: stateCode,
districts:
selectedDistrict === t("COMMON.ALL")
? ""
: selectedDistrict || t("COMMON.ALL"),
type: CohortTypes.BLOCK,
status: [statusValue],
},
sort: sortBy,
};

Expand Down Expand Up @@ -913,7 +925,7 @@ const Block: React.FC = () => {
},
}}
>
{/* <MenuItem value="All">{t("COMMON.ALL")}</MenuItem> */}
<MenuItem value={t("COMMON.ALL")}>{t("COMMON.ALL")}</MenuItem>
{districtData.map((districtDetail) => (
<MenuItem
key={districtDetail.value}
Expand Down

0 comments on commit 7b91c92

Please sign in to comment.