Skip to content

Commit

Permalink
Merge pull request #27 from Aar-if/lernerDelete
Browse files Browse the repository at this point in the history
Issue #PS-1282 feat: Implementation of remove learner from the centre or mark learner as dropout
  • Loading branch information
itsvick authored Jul 19, 2024
2 parents b0973f1 + 428577e commit 849b742
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/components/DeleteUserModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import { showToastMessage } from './Toastify';
import { getCohortList } from '@/services/CohortServices';
import { updateFacilitator } from '@/services/ManageUser';
import { updateCohortMemberStatus } from '@/services/MyClassDetailsService';
import { Status } from '@/utils/app.constant';
import { Role, Status } from '@/utils/app.constant';
import manageUserStore from '@/store/manageUserStore';

interface DeleteUserModalProps {
type: 'student' | 'teacher';
type: Role.STUDENT | Role.TEACHER;
userId: string;
open: boolean;
onClose: () => void;
Expand Down Expand Up @@ -67,14 +67,14 @@ const DeleteUserModal: React.FC<DeleteUserModalProps> = ({
};

const handleDeleteAction = async () => {
if (type == 'teacher') {
if (type == Role.TEACHER) {
const studentData = {
status: 'archived',
status: Status.ARCHIVED,
reason: selectedValue,
};

const studentResponse = await updateFacilitator(userId, studentData);
} else if (type == 'student') {
} else if (type == Role.STUDENT) {
const memberStatus = Status.ARCHIVED;
const statusReason = selectedValue;
const membershipId = store?.learnerDeleteId;
Expand Down
4 changes: 2 additions & 2 deletions src/components/LearnersListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
updateCustomField,
} from '@/utils/Interfaces';
import React, { useEffect } from 'react';
import { Status, names } from '@/utils/app.constant';
import { Status, names, Role } from '@/utils/app.constant';

import ApartmentIcon from '@mui/icons-material/Apartment';
import BottomDrawer from './BottomDrawer';
Expand Down Expand Up @@ -627,7 +627,7 @@ const LearnersListItem: React.FC<LearnerListProps> = ({
isForLearner={true}
/>

<DeleteUserModal type='student' userId={userId} open={openDeleteUserModal} onClose={handleCloseModal} />
<DeleteUserModal type={Role.STUDENT} userId={userId} open={openDeleteUserModal} onClose={handleCloseModal} />
</>
);
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/ManageUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline';
import LocationOnOutlinedIcon from '@mui/icons-material/LocationOnOutlined';
import { editEditUser } from '@/services/ProfileService';
import ConfirmationModal from '@/components/ConfirmationModal';
import { Status } from '@/utils/app.constant';
import { Role, Status } from '@/utils/app.constant';
import AddIcon from '@mui/icons-material/Add';
import LearnersList from '@/components/LearnersListItem';
import Link from 'next/link';
Expand Down Expand Up @@ -757,7 +757,7 @@ const manageUsers: React.FC<ManageUsersProps> = ({
/>

<DeleteUserModal
type='teacher'
type={Role.TEACHER}
userId={userId}
open={openDeleteUserModal}
onClose={handleCloseModal}
Expand Down

0 comments on commit 849b742

Please sign in to comment.