Skip to content

Commit

Permalink
Merge branch 'release-1.0.0' of github.com:tekdi/teachers-app into re…
Browse files Browse the repository at this point in the history
…lease-1.0.0
  • Loading branch information
Rushikesh-Sonawane99 committed Aug 16, 2024
2 parents 1543580 + f342e7c commit fc8078a
Show file tree
Hide file tree
Showing 8 changed files with 494 additions and 185 deletions.
20 changes: 14 additions & 6 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"REMOVE": "Remove",
"SEND_REQUEST": "Send Request",
"MARK_DROP_OUT": "Mark as Drop Out",
"MARK_ALL_AS":"Mark All As",
"MARK_ALL_AS": "Mark All As",
"UNMARK_DROP_OUT": "Unmark as Drop Out",
"SOMETHING_WENT_WRONG": "Something went wrong",
"NO_GO_BACK": "No, go back",
Expand Down Expand Up @@ -126,7 +126,8 @@
"CREATE": "Create",
"OKAY": "Okay",
"HELD_EVERY_WEEK_ON": "Held every week on {{days}}",
"SESSION_SCHEDULED_SUCCESSFULLY": "Session has been scheduled successfully!"
"SESSION_SCHEDULED_SUCCESSFULLY": "Session has been scheduled successfully!",
"CENTER": "Center"
},
"LOGIN_PAGE": {
"USERNAME": "Username",
Expand Down Expand Up @@ -286,7 +287,7 @@
"STEP_4": "Use this button to view a detailed overview of center attendance and see a list of learners categorized by low, average, and good attendance for any custom date range.",
"STEP_5": "Update your preferred language anytime from here.",
"STEP_6": "Access your teaching centers and manage tasks like adding, editing, or removing learners, marking dropouts, and reassigning centers or blocks. You can also easily schedule online or offline sessions for your subjects.",
"STEP_7":"Access the full academic year’s course plan for each subject, along with resources like videos and documents for every topic. Track your teaching progress by updating topic completion status.",
"STEP_7": "Access the full academic year’s course plan for each subject, along with resources like videos and documents for every topic. Track your teaching progress by updating topic completion status.",
"STEP_8": "View detailed scores and summaries of Pre and Post tests for each learner. Track which students have completed, are in progress or yet to start the test.",
"PREVIOUS": "Previous",
"NEXT": "Next",
Expand Down Expand Up @@ -373,7 +374,6 @@
"MANAGE_USERS": {
"CENTERS_REQUESTED_SUCCESSFULLY": "Center Requested Successfully",
"CENTERS_REQUEST_FAILED": "Center Requested Failed"

},
"FORM": {
"FULL_NAME": "Full Name",
Expand Down Expand Up @@ -450,7 +450,14 @@
"DROP_OUT_REASON": "Reason for Drop Out From School",
"ASSIGN_CENTERS": "Assign Centers",
"TYPE_OF_COHORT": "Center type",
"NOTE_THIS_WILL_BE_CENTER_NAME": "Note this will be Center name"
"NOTE_THIS_WILL_BE_CENTER_NAME": "Note this will be Center name",
"ENGLISH": "English",
"HOME_SCIENCE": "Home Science",
"MATH": "Math",
"LANGUAGE": "Language",
"SCIENCE": "Science",
"SOCIAL_SCIENCE": "Social Science",
"LIFE_SKILLS": "Life Skills"
},
"FORM_ERROR_MESSAGES": {
"INVALID_INPUT": "Invalid Input.",
Expand Down Expand Up @@ -484,6 +491,7 @@
"SUBMITTED_ON": "Submitted On",
"CORRECT_ANSWER": "correct answers",
"NO_DATA_FOUND": "No data found",
"SEARCH_STUDENT": "search student"
"SEARCH_STUDENT": "search student",
"NO_ASSESSMENTS_FOUND": "No assessments found"
}
}
62 changes: 41 additions & 21 deletions src/components/CohortSelectionSection.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
Box,
FormControl,
InputLabel,
MenuItem,
Select,
SelectChangeEvent,
Expand Down Expand Up @@ -37,12 +38,13 @@ interface CohortSelectionSectionProps {
setManipulatedCohortData?: React.Dispatch<
React.SetStateAction<Array<ICohort>>
>;
blockName: string;
blockName?: string;
isManipulationRequired?: boolean;
setBlockName: React.Dispatch<React.SetStateAction<string>>;
setBlockName?: React.Dispatch<React.SetStateAction<string>>;
handleSaveHasRun?: boolean;
setHandleSaveHasRun?: React.Dispatch<React.SetStateAction<boolean>>;
isCustomFieldRequired?: boolean;
showFloatingLabel?: boolean;
}

interface ChildData {
Expand Down Expand Up @@ -78,6 +80,7 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
handleSaveHasRun,
setHandleSaveHasRun,
isCustomFieldRequired = true,
showFloatingLabel = false,
}) => {
const router = useRouter();
const theme = useTheme<any>();
Expand Down Expand Up @@ -217,8 +220,12 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
}
}
} else if (response[0].type === cohortHierarchy.BLOCK) {
setBlockName(response[0].name || response[0].cohortName);
setBlock(response[0].name || response[0].cohortName)
if (setBlockName) {
setBlockName(
response?.[0]?.name || response?.[0]?.cohortName || ''
);
}
setBlock(response[0].name || response[0].cohortName);
const filteredData = response[0].childData
?.map((item: any) => {
const typeOfCohort = item?.customField?.find(
Expand All @@ -229,7 +236,7 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
cohortId: item?.cohortId,
parentId: item?.parentId,
name: item?.cohortName || item?.name,
typeOfCohort: typeOfCohort || (t('ATTENDANCE.UNKNOWN')),
typeOfCohort: typeOfCohort || t('ATTENDANCE.UNKNOWN'),
};
})
?.filter(Boolean);
Expand Down Expand Up @@ -276,7 +283,7 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
]);

const handleCohortSelection = (event: SelectChangeEvent<string>) => {
setClassId(event.target.value as string);
setClassId(event.target.value);
ReactGA.event('cohort-selection-dashboard', {
selectedCohortID: event.target.value,
});
Expand Down Expand Up @@ -355,17 +362,21 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
{cohortsData?.length !== 0 ? (
manipulatedCohortData?.map((cohort) => (
<MenuItem
key={cohort.cohortId}
value={cohort.cohortId}
style={{
fontWeight: '500',
fontSize: '14px',
color: theme.palette.warning['A200'],
textTransform: 'capitalize',
}}
>
{cohort.name} {cohort?.typeOfCohort === CenterType.REGULAR || CenterType.UNKNOWN &&`(${cohort.typeOfCohort})`}
</MenuItem>
key={cohort.cohortId}
value={cohort.cohortId}
style={{
fontWeight: '500',
fontSize: '14px',
color: theme.palette.warning['A200'],
textTransform: 'capitalize',
}}
>
{cohort.name}{' '}
{cohort?.typeOfCohort ===
CenterType.REGULAR ||
(CenterType.UNKNOWN &&
`(${cohort?.typeOfCohort?.toLowerCase()})`)}
</MenuItem>
))
) : (
<Typography
Expand Down Expand Up @@ -395,16 +406,25 @@ const CohortSelectionSection: React.FC<CohortSelectionSectionProps> = ({
<Box sx={{ minWidth: 120, gap: '15px' }} display={'flex'}>
{cohortsData?.length > 1 ? (
<FormControl
className="drawer-select "
className={showFloatingLabel ? '' : "drawer-select"}
sx={{ m: 0, width: '100%' }}
>
{showFloatingLabel && (
<InputLabel id="center-select-label">
{t('COMMON.CENTER')}
</InputLabel>
)}
<Select
labelId="center-select-label"
label={showFloatingLabel ? t('COMMON.CENTER') : ''}
value={classId}
onChange={handleCohortSelection}
displayEmpty
// displayEmpty
// style={{ borderRadius: '4px' }}

inputProps={{ 'aria-label': 'Without label' }}
className="select-languages fs-14 fw-500 bg-white"
style={{
className={showFloatingLabel ? '' : "select-languages fs-14 fw-500 bg-white"}
style={showFloatingLabel ? {borderRadius: '4px'} : {
borderRadius: '0.5rem',
color: theme.palette.warning['200'],
width: '100%',
Expand Down
2 changes: 1 addition & 1 deletion src/components/DynamicForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const DynamicForm: React.FC<DynamicFormProps> = ({
schema.properties?.[property]?.validation?.includes('numeric')
) {
error.message = t('FORM_ERROR_MESSAGES.MUST_BE_LESS_THAN', {
fieldname: property,
fieldname: t('FIELDS.AGE'),
maxLength: schema.properties?.[property]?.maxLength,
});
}
Expand Down
Loading

0 comments on commit fc8078a

Please sign in to comment.