Skip to content

Commit 8d46402

Browse files
authored
Merge pull request #2908 from tekdi/prod-fix-23-apr
Prod fix 23 apr to teacher prod
2 parents 74f20dc + 0ad014e commit 8d46402

7 files changed

Lines changed: 92 additions & 47 deletions

File tree

apps/learner-web-app/src/components/EditProfile/EditProfile.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ const EditProfile = ({ completeProfile, enrolledProgram, uponEnrollCompletion }:
172172
delete responseFormForEnroll?.schema?.properties?.ptm_id;
173173
delete responseFormForEnroll?.schema?.properties?.poc_id;
174174
delete responseFormForEnroll?.schema?.properties?.org_id;
175+
delete responseFormForEnroll?.schema?.properties?.what_do_you_want_to_become;
175176
responseFormForEnroll?.schema?.required?.pop('batch');
176177
console.log('responseFormForEnroll', responseFormForEnroll?.schema);
177178

@@ -200,6 +201,9 @@ const EditProfile = ({ completeProfile, enrolledProgram, uponEnrollCompletion }:
200201
delete responseForm?.schema?.properties?.ptm_id;
201202
delete responseForm?.schema?.properties?.poc_id;
202203
delete responseForm?.schema?.properties?.org_id;
204+
delete responseForm?.schema?.properties?.consent_file;
205+
delete responseForm?.schema?.properties?.what_do_you_want_to_become;
206+
203207

204208
responseForm?.schema?.required.pop('batch');
205209
let userId = localStorage.getItem('userId');
@@ -233,6 +237,10 @@ const EditProfile = ({ completeProfile, enrolledProgram, uponEnrollCompletion }:
233237
responseForm?.schema,
234238
useInfo?.result?.userData
235239
);
240+
delete updatedSchema?.properties?.consent_file;
241+
delete updatedSchema?.properties?.what_do_you_want_to_become;
242+
243+
236244
const updatedSchemaForEnroll = getMissingFields(
237245
responseFormForEnroll?.schema,
238246
useInfo?.result?.userData

apps/learner-web-app/src/components/UserProfileCard/UserProfileCard.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ console.log('######### updateUserResponse', updateUserResponse);
698698

699699
// Group fields into sections
700700
const contactFields = ['mobile', 'phone_type_accessible', 'own_phone_check', 'parent_phone', 'guardian_name', 'guardian_relation'];
701-
const personalFields = ['firstName', 'middleName', 'lastName', 'dob', 'gender', 'class', 'marital_status', 'state', 'district', 'block', 'village', 'mother_name', 'father_name', 'spouse_name', 'family_member_details'];
701+
const personalFields = ['firstName', 'middleName', 'lastName', 'dob', 'gender', 'class', 'marital_status', 'state', 'district', 'block', 'village', 'mother_name', 'father_name', 'spouse_name', 'family_member_details', 'enrollmentId'];
702702

703703
const getSectionFields = (sectionFieldNames: string[]) => {
704704
return displayFields.filter((field) => sectionFieldNames.includes(field.name));
@@ -732,6 +732,16 @@ console.log('######### updateUserResponse', updateUserResponse);
732732
const personalFieldsFiltered = personalSectionFields.filter(
733733
(field) => !['state', 'district', 'block', 'village', 'firstName', 'middleName', 'lastName'].includes(field.name)
734734
);
735+
736+
// enrollmentId is a core field not present in form schema, inject it manually if it exists
737+
if (userData.enrollmentId && !personalFieldsFiltered.some((f) => f.name === 'enrollmentId') && localStorage.getItem('userProgram')==="Vocational Training") {
738+
personalFieldsFiltered.push({
739+
name: 'enrollmentId',
740+
schema: { coreField: 1, title: 'Enrollment Id' },
741+
value: String(userData.enrollmentId),
742+
rawValue: userData.enrollmentId,
743+
});
744+
}
735745
{console.log('personalFieldsFiltered==========>', personalFieldsFiltered)
736746
console.log('getLocationFields==========>', getLocationFields())
737747
console.log('getNameFields==========>', getNameFields())

apps/learner-web-app/src/components/themantic/subHeader/SubHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const SubHeader = ({
6767
],
6868
},
6969
fields: ['contentLanguage'],
70-
limit: 200,
70+
limit: 1000,
7171
offset: 0,
7272
});
7373

apps/learner-web-app/src/utils/API/userService.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ export const profileComplitionCheck = async (): Promise<any> => {
117117
delete responseForm?.schema.properties.mobile;
118118
}
119119
const result = getMissingFields(responseForm?.schema, userData);
120+
delete result?.properties?.what_do_you_want_to_become;
121+
delete result?.properties?.consent_file;
120122
console.log('result', result);
121123
delete result?.properties?.is_volunteer;
122124

mfes/content/src/components/Content/List.tsx

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -317,23 +317,42 @@ export default function Content(props: Readonly<ContentProps>) {
317317
// }
318318
if(props.onTotalCountChange)
319319
{
320-
//console.log("hellooo")
321-
// filter.primaryCategory = [
322-
// 'Learning Resource','Practice Question Set','Activity','Story'];
323-
console.log("filter====>" , filter);
324-
resultResponse = await ContentSearch({
325-
...filter,
326-
offset: adjustedOffset,
327-
limit: adjustedLimit,
328-
signal: controller.signal,
329-
primaryCategory: ['Course'],
330-
});
320+
const isCourseType = ['course', 'self'].includes(filter.type?.toLowerCase() || '');
321+
if (isCourseType) {
322+
resultResponse = await ContentSearch({
323+
...filter,
324+
offset: adjustedOffset,
325+
limit: adjustedLimit,
326+
signal: controller.signal,
327+
primaryCategory: ['Course'],
328+
});
329+
const resultResponse2 = await ContentSearch({
330+
...filter,
331+
offset: adjustedOffset,
332+
limit: adjustedLimit,
333+
signal: controller.signal,
334+
isPrimaryCategory: true,
335+
primaryCategory: [
336+
'Learning Resource','Practice Question Set','Activity','Story','Interactive'],
337+
});
338+
setTotalCount(resultResponse2?.result?.count);
339+
} else {
340+
resultResponse = await ContentSearch({
341+
...filter,
342+
offset: adjustedOffset,
343+
limit: adjustedLimit,
344+
signal: controller.signal,
345+
isPrimaryCategory: true,
346+
primaryCategory: [
347+
'Learning Resource','Practice Question Set','Activity','Story','Interactive'],
348+
});
349+
setTotalCount(resultResponse?.result?.count);
350+
}
331351
}
332-
else{
352+
else{
333353
const program = searchParams.get('program');
334354
const search = searchParams.get('q');
335355

336-
337356
if(program || (search && (tab === '0' || tab === null)))
338357
{
339358
resultResponse = await ContentSearch({
@@ -344,48 +363,28 @@ export default function Content(props: Readonly<ContentProps>) {
344363
isPrimaryCategory: true,
345364
primaryCategory: [
346365
'Learning Resource','Practice Question Set','Activity','Story' ,'Interactive']
347-
}); }
366+
});
367+
}
348368
else{
349-
350-
resultResponse = await ContentSearch({
351-
...filter,
352-
offset: adjustedOffset,
353-
limit: adjustedLimit,
354-
signal: controller.signal,
355-
});
356-
}
357-
}
358-
359-
360-
if(props.onTotalCountChange) {
361-
console.log("hellooo")
362-
// filter.primaryCategory = [
363-
// 'Learning Resource','Practice Question Set','Activity','Story'];
364-
console.log("filter====>" , filter);
365-
const resultResponse2 = await ContentSearch({
366-
...filter,
367-
offset: adjustedOffset,
368-
limit: adjustedLimit,
369-
signal: controller.signal,
370-
isPrimaryCategory: true,
371-
primaryCategory: [
372-
'Learning Resource','Practice Question Set','Activity','Story' ,'Interactive'],
373-
});
374-
375-
setTotalCount(resultResponse2?.result?.count);
369+
resultResponse = await ContentSearch({
370+
...filter,
371+
offset: adjustedOffset,
372+
limit: adjustedLimit,
373+
signal: controller.signal,
374+
});
375+
}
376376
}
377377
if(props.setTotalResources && resultResponse?.result?.count)
378378
{
379379
props.setTotalResources(resultResponse?.result?.count);
380380
}
381381

382382

383-
383+
console.log('API response for content search:', resultResponse);
384384
const response = resultResponse?.result;
385385
if (props?._config?.getContentData) {
386386
props._config.getContentData(response);
387387
}
388-
389388
content.push(...(response?.content || []));
390389
QuestionSet.push(...(response?.QuestionSet || []));
391390
count = response?.count || 0;
@@ -523,6 +522,7 @@ export default function Content(props: Readonly<ContentProps>) {
523522
setIsLoading(true);
524523
try {
525524
const response = await fetchAllContent(localFilters);
525+
console.log('Content response:', response);
526526
if (!response || !isMounted) return;
527527
const newContentData = [
528528
...(response.content ?? []),

mfes/youthNet/src/components/youthNet/Profile.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Card, CardContent, Typography, Grid } from '@mui/material';
33
import { useTheme } from '@mui/material/styles';
44
import { useTranslation } from 'react-i18next';
55
import { Role } from '../../utils/app.constant';
6+
import { TENANT_DATA } from '../../utils/app.config';
67

78
interface ProfileDetailsProps {
89
fullName: string;
@@ -23,6 +24,7 @@ interface ProfileDetailsProps {
2324
firstName?: string | null;
2425
lastName?: string | null;
2526
workingVillages?: string | null;
27+
enrollmentId?: string | null;
2628
}
2729

2830
const Profile: React.FC<ProfileDetailsProps> = ({
@@ -44,6 +46,7 @@ const Profile: React.FC<ProfileDetailsProps> = ({
4446
firstName,
4547
lastName,
4648
workingVillages,
49+
enrollmentId,
4750
}) => {
4851
const { t } = useTranslation();
4952
const theme = useTheme<any>();
@@ -56,7 +59,8 @@ const Profile: React.FC<ProfileDetailsProps> = ({
5659
}
5760
}, []);
5861

59-
const isPragyanpath = userProgram === 'Pragyanpath';
62+
const isPragyanpath = userProgram === TENANT_DATA.PRAGYANPATH;
63+
const isVocationalTraining = userProgram === TENANT_DATA.YOUTHNET;
6064

6165
console.log('designation', designation);
6266
return (
@@ -338,6 +342,24 @@ const Profile: React.FC<ProfileDetailsProps> = ({
338342
</Typography>
339343
</Grid>
340344
)}
345+
346+
{designation === Role.LEARNER && isVocationalTraining && (
347+
<Grid item xs={6}>
348+
<Typography
349+
color={theme.palette.warning['500']}
350+
sx={{ fontSize: '12px', fontWeight: 600, mt: 2 }}
351+
>
352+
{t('YOUTHNET_PROFILE.ENROLLMENT_ID', { defaultValue: 'Enrollment ID' })}
353+
</Typography>
354+
<Typography
355+
color={theme.palette.warning['A200']}
356+
sx={{ fontSize: '16px', fontWeight: 400 }}
357+
gutterBottom
358+
>
359+
{enrollmentId || "-"}
360+
</Typography>
361+
</Grid>
362+
)}
341363
</Grid>
342364
</CardContent>
343365
</Card>

mfes/youthNet/src/pages/user-profile/[userId].tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ const UserId = () => {
6262
userName?: string | null;
6363
joinedOn?: string | null;
6464
workingVillages?: string | null;
65+
enrollmentId?: string | null;
6566
}>({
6667
userRole: null,
6768
userID: null,
@@ -79,6 +80,7 @@ const UserId = () => {
7980
userName: null,
8081
joinedOn: null,
8182
workingVillages: null,
83+
enrollmentId: null,
8284
});
8385

8486
// Get current user ID and userProgram from localStorage on mount
@@ -460,7 +462,6 @@ const UserId = () => {
460462
? toPascalCase(role)
461463
: (
462464
getRoleFromTenant() ||
463-
localStorage.getItem('roleName') ||
464465
toPascalCase(userData?.tenantData?.[0]?.roles?.[0]?.roleName) ||
465466
toPascalCase(role)
466467
),
@@ -470,6 +471,7 @@ const UserId = () => {
470471
state: getFieldValue('STATE'),
471472
village: getFieldValue('VILLAGE'),
472473
workingVillages: getWorkingVillages(),
474+
enrollmentId: userData?.enrollmentId || null,
473475
});
474476
}
475477
};
@@ -617,6 +619,7 @@ const UserId = () => {
617619
firstName={user.firstName || ''}
618620
lastName={user.lastName || ''}
619621
workingVillages={user.workingVillages || null}
622+
enrollmentId={user.enrollmentId || null}
620623
/>
621624
</Box>
622625
<Button

0 commit comments

Comments
 (0)