Skip to content

Commit

Permalink
Merge pull request #624 from mahajanmahesh935/teachers
Browse files Browse the repository at this point in the history
TASK #0000 : Show all user fields on user profile popup
  • Loading branch information
itsvick authored Jan 20, 2025
2 parents 5405281 + 0a7034c commit 137d450
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 1 deletion.
4 changes: 3 additions & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,9 @@
"SCIENCE": "Science",
"SOCIAL_SCIENCE": "Social Science",
"LIFE_SKILLS": "Life Skills",
"PROGRAM": "Program Name"
"PROGRAM": "Program Name",
"GRADE":"Grade",
"SUB_PROGRAM":"Sub Program Name"
},
"FORM_ERROR_MESSAGES": {
"INVALID_INPUT": "Invalid Input.",
Expand Down
72 changes: 72 additions & 0 deletions src/components/LearnerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ const LearnerModal = ({
userName,
contactNumber,
enrollmentNumber,
fatherName,
motherName,
subProgram,
grade,
accessToWhatsApp,
program,
}: {
userId?: string;
open: boolean;
Expand All @@ -108,6 +114,12 @@ const LearnerModal = ({
userName?: string;
contactNumber?: any;
enrollmentNumber?: any;
fatherName?: string;
motherName?: string;
subProgram?: string;
grade?: number;
accessToWhatsApp?: string;
program? :string;
}) => {
const { t } = useTranslation();

Expand Down Expand Up @@ -187,6 +199,66 @@ const LearnerModal = ({
</Typography>
</Box>
</Grid>
<Grid item xs={6} textAlign="left">
<Typography sx={fieldTitleStyles(theme)}>
{t('FIELDS.FATHER_NAME')}
</Typography>
<Box display="flex">
<Typography sx={fieldValueStyles(theme)}>
{fatherName || '-'}
</Typography>
</Box>
</Grid>
<Grid item xs={6} textAlign="left">
<Typography sx={fieldTitleStyles(theme)}>
{t('FORM.MOTHER_NAME')}
</Typography>
<Box display="flex">
<Typography sx={fieldValueStyles(theme)}>
{motherName || '-'}
</Typography>
</Box>
</Grid>
<Grid item xs={6} textAlign="left">
<Typography sx={fieldTitleStyles(theme)}>
{t('FORM.PROGRAM')}
</Typography>
<Box display="flex">
<Typography sx={fieldValueStyles(theme)}>
{program || '-'}
</Typography>
</Box>
</Grid>
<Grid item xs={6} textAlign="left">
<Typography sx={fieldTitleStyles(theme)}>
{t('FORM.SUB_PROGRAM')}
</Typography>
<Box display="flex">
<Typography sx={fieldValueStyles(theme)}>
{subProgram || '-'}
</Typography>
</Box>
</Grid>
<Grid item xs={6} textAlign="left">
<Typography sx={fieldTitleStyles(theme)}>
{t('FORM.GRADE')}
</Typography>
<Box display="flex">
<Typography sx={fieldValueStyles(theme)}>
{grade || '-'}
</Typography>
</Box>
</Grid>
<Grid item xs={6} textAlign="left">
<Typography sx={fieldTitleStyles(theme)}>
{t('FORM.ACCESS_TO_WHATSAPP')}
</Typography>
<Box display="flex">
<Typography sx={fieldValueStyles(theme)}>
{accessToWhatsApp || '-'}
</Typography>
</Box>
</Grid>
{learnerDetailsByOrder?.map((item: any, index: number) => (
<Grid item xs={6} key={index} textAlign="left">
<Typography sx={fieldTitleStyles(theme)}>
Expand Down
33 changes: 33 additions & 0 deletions src/components/LearnersListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ const LearnersListItem: React.FC<LearnerListProps> = ({
const [openDeleteUserModal, setOpenDeleteUserModal] = React.useState(false);
const [centers, setCenters] = React.useState();
const [centersName, setCentersName] = React.useState();
const [fatherName, setFatherName]=React.useState()
const [motherName, setMotherName]=React.useState()
const [subProgram, setSubProgramName]=React.useState();
const[program , setProgram]=React.useState();
const [grade, setGradeName]=React.useState()
const [accessToWhatsApp, setAccessToWhatsAppName]=React.useState()
const store = manageUserStore();
const reassignStore = reassignLearnerStore();
const setReassignId = reassignLearnerStore((state) => state.setReassignId);
Expand Down Expand Up @@ -302,6 +308,27 @@ const LearnersListItem: React.FC<LearnerListProps> = ({
const userData = data?.userData;
setUserData(userData);
setUserName(userData?.name);
const customFields = userData?.customFields;
customFields.forEach((field: any) => {
if (field.label === "MOTHER_NAME") {
setMotherName(field.value);
}
else if(field.label === "FATHER_NAME"){
setFatherName(field.value);
}
else if(field.label === "SUB_PROGRAM"){
setSubProgramName(field.value)
}
else if(field.label === "GRADE"){
setGradeName(field.value)
}
else if(field.label === "ACCESS_TO_WHATSAPP"){
setAccessToWhatsAppName(field.value)
}
else if(field.label === "PROGRAM"){
setProgram(field.value)
}
});
setContactNumber(userData?.mobile);
setEnrollmentNumber(capitalizeEachWord(userData?.username));
const customDataFields = userData?.customFields;
Expand Down Expand Up @@ -421,6 +448,12 @@ const LearnersListItem: React.FC<LearnerListProps> = ({
userName={learnerState.userName}
contactNumber={learnerState.contactNumber}
enrollmentNumber={learnerState.enrollmentNumber}
fatherName={fatherName}
motherName={motherName}
subProgram={subProgram}
grade={grade}
accessToWhatsApp={accessToWhatsApp}
program={program}
/>
)}
<Box
Expand Down

0 comments on commit 137d450

Please sign in to comment.