Skip to content

Commit

Permalink
Merge pull request #396 from AkshataKatwal16/relese-changes
Browse files Browse the repository at this point in the history
Issue feat:Resolve reassign newly created center to faciliator and center
  • Loading branch information
itsvick authored Dec 3, 2024
2 parents 21b1134 + dc6c644 commit 6de2e96
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
3 changes: 2 additions & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@
"STATE_CODE": "State Code",
"DISTRICT_CODE": "District Code",
"BLOCK_CODE": "Block Code",
"CODE": "Code"
"CODE": "Code",
"MASTER":"Master"
},
"CENTERS": {
"CENTER": "center",
Expand Down
18 changes: 7 additions & 11 deletions src/components/ReassignCenterModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,10 @@ const ReassignCenterModal: React.FC<ReassignCohortModalProps> = ({
} = useLocationState(open, onClose, roleType, true);
let cohorts: Cohort[] = allCenters?.map(
(cohort: { cohortId: any; name: string }) => ({
name: cohort.name,
name: cohort.name.toLowerCase(),
id: cohort.cohortId,
})
);

console.log(blockCode);
console.log(selectedBlock);
const names = cohortData.map((item: any) => item.name);
Expand All @@ -123,7 +122,6 @@ const ReassignCenterModal: React.FC<ReassignCohortModalProps> = ({
const reassignButtonStatus = useSubmittedButtonStore(
(state: any) => state.reassignButtonStatus
);
console.log(names);
// const [filters, setFilters] = useState<FilterDetails>({
// // cohortId:selectedBlockCohortId,
// role: Role.TEAM_LEADER,
Expand Down Expand Up @@ -163,12 +161,12 @@ const ReassignCenterModal: React.FC<ReassignCohortModalProps> = ({

const handleToggle = (name: string) => {
if (userType === Role.LEARNERS) {
setCheckedCenters([name]);
setCheckedCenters([name?.toLowerCase()]);
} else {
setCheckedCenters((prev) =>
prev.includes(name)
? prev.filter((center) => center !== name)
: [...prev, name]
: [...prev, name?.toLowerCase()]
);
}
};
Expand All @@ -180,7 +178,7 @@ const ReassignCenterModal: React.FC<ReassignCohortModalProps> = ({
if (centers) {
if (userType !== Role.TEAM_LEADERS)
setCheckedCenters(
centers?.split(",").map((center: any) => center.trim())
centers?.split(",").map((center: any) => center?.trim()?.toLowerCase())
);
}
}, [blockName, centers, open]);
Expand All @@ -197,7 +195,7 @@ const ReassignCenterModal: React.FC<ReassignCohortModalProps> = ({
if (userType !== Role.TEAM_LEADERS) {
selectedData = cohorts
.filter(
(center) => center?.name && checkedCenters.includes(center.name)
(center) => center?.name && checkedCenters.includes((center?.name)?.toLowerCase())
)
.map((center) => center!.id);

Expand Down Expand Up @@ -522,11 +520,9 @@ console.log(filteredCBlocks)
console.log(formattedBlocks)

const handleToggle2 = (centerName: string) => {
// If the selected center is already checked, uncheck it
if (checkedCenters.includes(centerName)) {
setCheckedCenters([]);
} else {
// Otherwise, clear any previous selection and check the new one
setCheckedCenters([centerName]);
}
};
Expand Down Expand Up @@ -742,11 +738,11 @@ console.log(formattedBlocks)
<Checkbox
checked={
center?.name
? checkedCenters.includes(center.name)
? checkedCenters.includes(center.name?.toLowerCase())
: false
}
onChange={() =>
center?.name && handleToggle(center.name)
center?.name && handleToggle((center.name)?.toLowerCase())
}
sx={{
color: theme.palette.text.primary,
Expand Down
2 changes: 1 addition & 1 deletion src/components/layouts/sidebar/MenuItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const Menuitems = [
],
},
{
title: "Master",
title: "MASTER.MASTER",
icon: masterIcon,
subOptions: [
{
Expand Down

0 comments on commit 6de2e96

Please sign in to comment.