Skip to content

Commit

Permalink
Merge pull request #133 from rahulg1254/admin-master
Browse files Browse the repository at this point in the history
Task #223691 feat: Resolved issue of sorting on dristrict and block
  • Loading branch information
itsvick authored Aug 13, 2024
2 parents d857d5b + 2a20757 commit 7efb6f0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
26 changes: 14 additions & 12 deletions src/pages/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,28 +214,29 @@ const Block: React.FC = () => {
width: "130",
},
{
key: "createdAt",
title: t("MASTER.CREATED_AT"),
key: "createdBy",
title: t("MASTER.CREATED_BY"),
dataType: DataType.String,
width: "130",
width: "160",
},
{
key: "updatedAt",
title: t("MASTER.UPDATED_AT"),
key: "updatedBy",
title: t("MASTER.UPDATED_BY"),
dataType: DataType.String,
width: "130",
width: "160",
},

{
key: "createdAt",
title: t("MASTER.CREATED_BY"),
title: t("MASTER.CREATED_AT"),
dataType: DataType.String,
width: "160",
width: "130",
},
{
key: "updatedAt",
title: t("MASTER.UPDATED_BY"),
title: t("MASTER.UPDATED_AT"),
dataType: DataType.String,
width: "160",
width: "130",
},
{
key: "actions",
Expand Down Expand Up @@ -402,14 +403,12 @@ const Block: React.FC = () => {
);

const userProps = {
selectedSort,
selectedFilter,
showStateDropdown: false,
userType: t("MASTER.BLOCKS"),
searchPlaceHolder: t("MASTER.SEARCHBAR_PLACEHOLDER_BLOCK"),
showFilter: false,
showSort: true,
handleSortChange: { handleSortChange },
};

const handleAddNewBlock = () => {
Expand Down Expand Up @@ -507,6 +506,9 @@ const Block: React.FC = () => {
{...userProps}
handleAddUserClick={handleAddNewBlock}
handleSearch={handleSearch}
selectedSort={selectedSort}
handleSortChange={handleSortChange}
showSort={true}
>
<>
<Box
Expand Down
14 changes: 2 additions & 12 deletions src/pages/district.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,16 +305,6 @@ const District: React.FC = () => {
event.target.value === "Z-A" ? SORT.DESCENDING : SORT.ASCENDING;
setSortBy(["name", sortOrder]);
setSelectedSort(event.target.value);

const afterFilter = stateData.filter((item) => {
return item.value === selectedState;
});
const setSort =
afterFilter[0]?.label === undefined ? "ALL" : afterFilter[0]?.label;

console.log(setSort);

fetchDistrictData(setSort);
};

const handlePaginationChange = (
Expand Down Expand Up @@ -383,8 +373,8 @@ const District: React.FC = () => {
<HeaderComponent
userType={t("MASTER.DISTRICTS")}
searchPlaceHolder={t("MASTER.SEARCHBAR_PLACEHOLDER_DISTRICT")}
states={stateData.map((state) => state.value)}
districts={districtData.map((district) => district.label)}
// states={stateData.map((state) => state.value)}
// districts={districtData.map((district) => district.label)}
selectedState={selectedState}
showStateDropdown={false}
handleSortChange={handleSortChange}
Expand Down

0 comments on commit 7efb6f0

Please sign in to comment.