Skip to content

Commit

Permalink
Merge pull request #314 from Rushikesh-Sonawane99/shiksha-2.0
Browse files Browse the repository at this point in the history
Issue #PS-793 chore: Added event to show modal on dropout label click
  • Loading branch information
itsvick authored Jun 21, 2024
2 parents 3cde565 + 7552265 commit 58f1040
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 11 deletions.
39 changes: 29 additions & 10 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,40 @@ export const dashboardDaysLimit: number = 30;
export const modifyAttendanceLimit: number = 6;
export const toastAutoHideDuration: number = 5000; // 5 seconds

// export const dropoutReasons = [
// {
// label: 'UNABLE_TO_COPE_WITH_STUDIES',
// value: 'unable_to_cope_with_studies',
// },
// { label: 'FAMILY_RESPONSIBILITIES', value: 'family_responsibilities' },
// {
// label: 'NEED_TO_GO_TO_WORK_OWN_WORK',
// value: 'need_to_go_to_work_own_work',
// },
// { label: 'MARRIAGE', value: 'marriage' },
// { label: 'ILLNESS', value: 'illness' },
// { label: 'MIGRATION', value: 'migration' },
// { label: 'PREGNANCY', value: 'pregnancy' },
// { label: 'DOCUMENT_ISSUE', value: 'document_issue' },
// { label: 'DISTANCE_ISSUE', value: 'distance_issue' },
// { label: 'SCHOOL_ADMISSION', value: 'school_admission' },
// ];

export const dropoutReasons = [
{
label: 'UNABLE_TO_COPE_WITH_STUDIES',
value: 'unable_to_cope_with_studies',
value: 'Unable to cope with studies',
},
{ label: 'FAMILY_RESPONSIBILITIES', value: 'family_responsibilities' },
{ label: 'FAMILY_RESPONSIBILITIES', value: 'Family responsibility' },
{
label: 'NEED_TO_GO_TO_WORK_OWN_WORK',
value: 'need_to_go_to_work_own_work',
value: 'Need to go to work/ own work',
},
{ label: 'MARRIAGE', value: 'marriage' },
{ label: 'ILLNESS', value: 'illness' },
{ label: 'MIGRATION', value: 'migration' },
{ label: 'PREGNANCY', value: 'pregnancy' },
{ label: 'DOCUMENT_ISSUE', value: 'document_issue' },
{ label: 'DISTANCE_ISSUE', value: 'distance_issue' },
{ label: 'SCHOOL_ADMISSION', value: 'school_admission' },
{ label: 'MARRIAGE', value: 'Marriage' },
{ label: 'ILLNESS', value: 'Illness' },
{ label: 'MIGRATION', value: 'Migration' },
{ label: 'PREGNANCY', value: 'Pregnancy' },
{ label: 'DOCUMENT_ISSUE', value: 'Document issue' },
{ label: 'DISTANCE_ISSUE', value: 'Distance issue' },
{ label: 'SCHOOL_ADMISSION', value: 'School admission' },
];
33 changes: 33 additions & 0 deletions src/components/DropOutModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ interface DropOutModalProps {
open: boolean;
onClose: (confirmed: boolean, reason?: string) => void;
cohortMembershipId: string | number;
isButtonAbsent?: boolean;
statusReason?: string;
reloadState: boolean;
setReloadState: React.Dispatch<React.SetStateAction<boolean>>;
}
Expand All @@ -34,6 +36,8 @@ function DropOutModal({
open,
onClose,
cohortMembershipId,
isButtonAbsent,
statusReason,
reloadState,
setReloadState
}: DropOutModalProps) {
Expand Down Expand Up @@ -140,6 +144,34 @@ function DropOutModal({
/>
</Box>
<Divider />
{
isButtonAbsent ?

<Box sx={{ padding: '18px 16px', width: '100%' }}>
<Typography
variant="h2"
sx={{
color: theme.palette.warning['400'],
fontSize: '14px',
}}
component="h2"
>
{t('COMMON.REASON_FOR_DROPOUT')}
</Typography>

<Typography
variant="h2"
sx={{
color: theme.palette.warning['300'],
fontSize: '16px',
}}
component="h2"
>
{statusReason}
</Typography>
</Box>
:
<>
<Box sx={{ padding: '10px 18px' }}>
<FormControl sx={{ mt: 1, width: '100%' }}>
<InputLabel
Expand Down Expand Up @@ -186,6 +218,7 @@ function DropOutModal({
{t('COMMON.MARK_DROP_OUT')}
</Button>
</Box>
</> }
</Box>
</Modal>
</React.Fragment>
Expand Down
17 changes: 16 additions & 1 deletion src/components/LearnersList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ const LearnersList: React.FC<LearnerListProps> = ({

const handleDroppedOutLabelClick = () => {
console.log('handleDroppedOutLabelClick');
setShowModal(true);
};

const renderCustomContent = () => {
Expand Down Expand Up @@ -297,13 +298,27 @@ const LearnersList: React.FC<LearnerListProps> = ({
renderCustomContent={renderCustomContent}
/>

<DropOutModal
{
isDropout?
<DropOutModal
open={showModal}
onClose={() => setShowModal(false)}
cohortMembershipId={cohortMembershipId}
isButtonAbsent = {true}
statusReason = {statusReason}
reloadState={reloadState}
setReloadState={setReloadState}
/>
:
<DropOutModal
open={showModal}
onClose={() => setShowModal(false)}
cohortMembershipId={cohortMembershipId}
reloadState={reloadState}
setReloadState={setReloadState}
/>
}

<ConfirmationModal
message={t('COMMON.SURE_REMOVE')}
handleAction={handleAction}
Expand Down

0 comments on commit 58f1040

Please sign in to comment.