Skip to content

Commit

Permalink
Merge pull request #150 from upendraTekdi/admin_uk
Browse files Browse the repository at this point in the history
Task #223738: disable ka-table datarow if status is archived,add blockId with check of type is block and set Block Id in create center
  • Loading branch information
itsvick authored Aug 22, 2024
2 parents c1ddfaa + a720bb4 commit 5708637
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
14 changes: 14 additions & 0 deletions src/components/KaTableComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,20 @@ const KaTableComponent: React.FC<KaTableComponentProps> = ({
return <div className="table-cell">{props?.value}</div>;
},
},
dataRow: {
elementAttributes: ({ rowData }) => {
// Condition to disable or style the row
const isDisabled = rowData.status === Status.ARCHIVED;

return {
className: isDisabled ? "disabled-row" : "",
style: isDisabled
? { pointerEvents: "none", opacity: 0.5 }
: {},
};
},
},

// headCell: {
// content: (props) => {
// return <div className="table-header">{props?.column?.title}</div>;
Expand Down
19 changes: 12 additions & 7 deletions src/utils/useLocationState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,18 @@ export const useLocationState = (
},
};
const response = await getCenterList(object);
setSelectedBlockCohortId(
response?.result?.results?.cohortDetails[0].cohortId
);
console.log(
"response?.result?.results?.cohortDetails[0].cohortId",
response?.result?.results?.cohortDetails[0].cohortId
);
const getCohortDetails = response?.result?.results?.cohortDetails;
const blockId = getCohortDetails?.map((item: any) => {
if (item?.type === "BLOCK") {
return item?.cohortId;
}
});
if (blockId) {
console.log("blockId", blockId[0]);
setSelectedBlockCohortId(blockId[0]);
} else {
console.log("No Block Id found");
}
} else {
const getCentersObject = {
limit: 200,
Expand Down

0 comments on commit 5708637

Please sign in to comment.