Commit 2b72055b authored by janithgamage1.ed's avatar janithgamage1.ed

fix: update

Desc : update project
parent 2ae4f7cc
export interface CurriculumLevelsType {
id: number
code: string
description: string
}
// ==============================|| DATA - CURRICULUM LEVELS ||============================== //
const curriculumLevels: readonly CurriculumLevelsType[] = [
{ id: 1, code: "Level 1", description: "Preliminary" },
{ id: 2, code: "Level 2", description: "Intermediate" },
{ id: 3, code: "Level 3", description: "Advance" },
];
export default curriculumLevels;
......@@ -3,7 +3,7 @@ import { Column } from 'react-table';
export interface dataProps {
_id: number | string | undefined;
curriculumCode: String;
curriculumLevel: String;
curriculumLevel: number;
curriculumName: String;
curriculumImage: String;
tutorials: tutorialItemProps[];
......@@ -23,7 +23,7 @@ export interface ReactTableProps {
export interface curriculumProps {
_id: number | string | undefined;
curriculumCode: String;
curriculumLevel: String;
curriculumLevel: number;
curriculumTitle: String;
curriculumDescription: String;
curriculumImage: String;
......
......@@ -2,19 +2,21 @@ import { useState } from 'react';
// material-ui
import {
Autocomplete,
Box,
Button,
DialogActions,
DialogContent,
DialogTitle,
Divider,
FormHelperText,
Grid,
InputLabel,
Stack,
TextField,
Tooltip
} from '@mui/material';
// import { useTheme } from '@mui/material/styles';
import { useTheme } from '@mui/material/styles';
import { LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
......@@ -30,6 +32,7 @@ import IconButton from 'components/@extended/IconButton';
// assets
import { DeleteFilled } from '@ant-design/icons';
import MainCard from 'components/MainCard';
import curriculumLevels, { CurriculumLevelsType } from 'data/curriculumLevels';
import AlertCurriculumDelete from './AlertCurriculumDelete';
// types
......@@ -40,7 +43,7 @@ const getInitialValues = (curriculum: FormikValues | null) => {
const newCurriculum = {
_id: undefined,
curriculumCode: "",
curriculumLevel: "",
curriculumLevel: undefined,
curriculumTitle: "",
curriculumDescription: "",
curriculumImage: "",
......@@ -60,7 +63,7 @@ export interface Props {
curriculum?: {
_id: number | string | undefined;
curriculumCode: String;
curriculumLevel: String;
curriculumLevel: number;
curriculumTitle: String;
curriculumDescription: String;
curriculumImage: String;
......@@ -75,7 +78,7 @@ export interface Props {
}
const AddEditCurriculum = ({ curriculum, onCancel }: Props) => {
// const theme = useTheme();
const theme = useTheme();
const isCreating = !curriculum;
......@@ -138,14 +141,30 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => {
<Grid item xs={4}>
<Stack spacing={1.25}>
<InputLabel htmlFor="curriculumLevel">Curriculum Level</InputLabel>
<TextField
<Autocomplete
fullWidth
id="curriculumLevel"
placeholder="Enter Curriculum Level"
{...getFieldProps('curriculumLevel')}
error={Boolean(touched.curriculumLevel && errors.curriculumLevel)}
helperText={touched.curriculumLevel && errors.curriculumLevel}
value={curriculumLevels.find((option) => option.id === formik.values.curriculumLevel) || null}
onChange={(event: any, newValue: CurriculumLevelsType | null) => {
formik.setFieldValue('curriculumLevel', newValue?.id);
}}
options={curriculumLevels}
getOptionLabel={(item) => `${item.description}`}
renderInput={(params) => {
return (
<TextField
{...params}
placeholder="Select Curriculum Level"
sx={{ '& .MuiAutocomplete-input.Mui-disabled': { WebkitTextFillColor: theme.palette.text.primary } }}
/>
)
}}
/>
{formik.touched.curriculumLevel && formik.errors.curriculumLevel && (
<FormHelperText error id="helper-text-curriculumLevel">
{formik.errors.curriculumLevel}
</FormHelperText>
)}
</Stack>
</Grid>
<Grid item xs={4}>
......@@ -216,14 +235,30 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => {
<Grid item xs={11}>
<Stack spacing={1.25}>
<InputLabel htmlFor={`tutorials.${index}`}>Tutorial</InputLabel>
<TextField
<Autocomplete
fullWidth
id={`tutorials.${index}`}
placeholder="Enter Tutorial"
{...getFieldProps(`tutorials.${index}`)}
// error={Boolean(touched.ingredientNutritions![index].nutritionCategory && errors.ingredientNutritions![index].nutritionCategory)}
// helperText={touched.ingredientNutritions![index].nutritionCategory && errors.ingredientNutritions![index].nutritionCategory}
// value={tutorials.find((option) => option.id === formik.values.curriculumLevel) || null}
// onChange={(event: any, newValue: CurriculumLevelsType | null) => {
// formik.setFieldValue(`tutorials.${index}`, newValue?.id);
// }}
options={[]}
// getOptionLabel={(item) => `${item.description}`}
renderInput={(params) => {
return (
<TextField
{...params}
placeholder="Select Tutorial"
sx={{ '& .MuiAutocomplete-input.Mui-disabled': { WebkitTextFillColor: theme.palette.text.primary } }}
/>
)
}}
/>
{/* {formik.touched.curriculumLevel && formik.errors.curriculumLevel && (
<FormHelperText error id="helper-text-curriculumLevel">
{formik.errors.curriculumLevel}
</FormHelperText>
)} */}
</Stack>
</Grid>
<Grid item xs={1} style={{ marginTop: "4%" }}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment