Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue feat PS-3574:Add firstname , lastname gender changes of learner and facilitator #627

Merged
merged 5 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/components/AddFacilitator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
RoleId,
Status,
Telemetry,
fieldKeys,
} from '@/utils/app.constant';
import React, { useEffect } from 'react';
import ReactGA from 'react-ga4';
Expand Down Expand Up @@ -221,7 +222,7 @@ const AddFacilitatorModal: React.FC<AddFacilitatorModalprops> = ({
const fieldSchema = schemaProperties[fieldKey];
const fieldId = fieldSchema?.fieldId;

if (fieldId === null || fieldId === 'null') {
if (fieldId === null || fieldId === 'null' || fieldKey===fieldKeys.GENDER) {
if (typeof fieldValue !== 'object') {
apiBody[fieldKey] = fieldValue;
if (fieldKey === 'name') {
Expand Down Expand Up @@ -355,7 +356,7 @@ const AddFacilitatorModal: React.FC<AddFacilitatorModalprops> = ({
telemetryFactory.interact(telemetryInteract);

await sendEmail(
apiBody['name'],
apiBody['firstName'],
formData?.email,
password,
formData?.email
Expand Down
2 changes: 1 addition & 1 deletion src/components/CohortFacilitatorList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const CohortLearnerList: React.FC<CohortLearnerListProp> = ({
(field: { label: string }) => field.label === 'AGE'
);
return {
name: toPascalCase(user?.name),
name: toPascalCase(user?.firstName || '') + ' ' + (user?.lastName ? toPascalCase(user.lastName) : ""),
userId: user?.userId,
memberStatus: user?.status,
statusReason: user?.statusReason,
Expand Down
2 changes: 1 addition & 1 deletion src/components/CohortLearnerList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const CohortLearnerList: React.FC<CohortLearnerListProp> = ({
(field: { label: string }) => field.label === 'AGE'
);
return {
name: toPascalCase(user?.name),
name: toPascalCase(user?.firstName || '') + ' ' + (user?.lastName ? toPascalCase(user.lastName) : ""),
userId: user?.userId,
memberStatus: user?.status,
statusReason: user?.statusReason,
Expand Down
6 changes: 3 additions & 3 deletions src/components/LearnersListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -408,15 +408,15 @@ const LearnersListItem: React.FC<LearnerListProps> = ({
const stringAvatar = (name: string) => {
if (name) {
const nameParts = name.split(' ');

return {
children:
nameParts.length === 1
? nameParts[0][0]
: `${nameParts[0][0]}${nameParts[1][0]}`,
: `${nameParts[0][0]}${nameParts[1]?.[0] || ''}`,
};
}

return '';
};

Expand Down
2 changes: 1 addition & 1 deletion src/pages/attendance-history.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ const UserAttendanceHistory = () => {
const nameUserIdArray = resp
?.map((entry: any) => ({
userId: entry.userId,
name: toPascalCase(entry.name),
name: toPascalCase(entry?.firstName || '') + ' ' + (entry?.lastName ? toPascalCase(entry.lastName) : ""),
memberStatus: entry.status,
createdAt: entry.createdAt,
updatedAt: entry.updatedAt,
Expand Down
3 changes: 2 additions & 1 deletion src/pages/attendance-overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ const AttendanceOverview: React.FC<AttendanceOverviewProps> = () => {
if (resp) {
const nameUserIdArray = resp?.map((entry: any) => ({
userId: entry.userId,
name: toPascalCase(entry.name),
name: toPascalCase(entry?.firstName || '') + ' ' + (entry?.lastName ? toPascalCase(entry.lastName) : ""),

memberStatus: entry.status,
}));
if (nameUserIdArray) {
Expand Down
4 changes: 3 additions & 1 deletion src/pages/board-enrollment/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ const BoardEnrollment = () => {
return members.map((entry: any) => ({
userId: entry.userId,
cohortMembershipId: entry.cohortMembershipId,
name: toPascalCase(entry.name),
name: toPascalCase(entry?.firstName || '') + ' ' + (entry?.lastName ? toPascalCase(entry.lastName) : ""),


memberStatus: entry.status,
statusReason: entry.statusReason,
customField: entry.customField,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/observation/[observationId]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ setFilteredEntityData(result)
(field: { label: string }) => field.label === 'AGE'
);
return {
name: toPascalCase(user?.name),
name: toPascalCase(user?.firstName || '') + ' ' + (user?.lastName ? toPascalCase(user.lastName) : ""),
userId: user?.userId,
memberStatus: user?.status,
statusReason: user?.statusReason,
Expand Down
3 changes: 3 additions & 0 deletions src/utils/app.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,6 @@ export enum sessionType {
PLANNED = 'planned',
EXTRA = 'extra',
}
export enum fieldKeys {
GENDER="gender"
}