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

fix: update

desc : update project
parent 1d1620d0
...@@ -2,6 +2,7 @@ import { useState } from 'react'; ...@@ -2,6 +2,7 @@ import { useState } from 'react';
// material-ui // material-ui
import { import {
Box,
Button, Button,
DialogActions, DialogActions,
DialogContent, DialogContent,
...@@ -19,7 +20,7 @@ import { LocalizationProvider } from '@mui/x-date-pickers'; ...@@ -19,7 +20,7 @@ import { LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns'; import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
// third-party // third-party
import { Form, FormikProvider, FormikValues, useFormik } from 'formik'; import { FieldArray, Form, FormikProvider, FormikValues, useFormik } from 'formik';
import _ from 'lodash'; import _ from 'lodash';
import * as Yup from 'yup'; import * as Yup from 'yup';
...@@ -28,6 +29,7 @@ import IconButton from 'components/@extended/IconButton'; ...@@ -28,6 +29,7 @@ import IconButton from 'components/@extended/IconButton';
// assets // assets
import { DeleteFilled } from '@ant-design/icons'; import { DeleteFilled } from '@ant-design/icons';
import MainCard from 'components/MainCard';
import AlertCurriculumDelete from './AlertCurriculumDelete'; import AlertCurriculumDelete from './AlertCurriculumDelete';
// types // types
...@@ -106,7 +108,7 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => { ...@@ -106,7 +108,7 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => {
} }
}); });
const { errors, touched, handleSubmit, isSubmitting, getFieldProps } = formik; const { errors, touched, handleSubmit, isSubmitting, getFieldProps, values } = formik;
// const { handleSubmit, isSubmitting } = formik; // const { handleSubmit, isSubmitting } = formik;
return ( return (
...@@ -187,6 +189,62 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => { ...@@ -187,6 +189,62 @@ const AddEditCurriculum = ({ curriculum, onCancel }: Props) => {
/> />
</Stack> </Stack>
</Grid> </Grid>
<Grid item xs={12}>
<FieldArray name="tutorials">
{({ insert, remove, push, }) => {
return (
<>
<MainCard content={false} title="Tutorials" sx={{ '& .MuiInputLabel-root': { fontSize: '0.875rem' } }}
secondary={
<Button
style={{
float: "right"
}}
onClick={() => push("")}
variant="contained"
>
Add Tutorial
</Button>
}
>
<Box sx={{ p: 2.5 }}>
<Grid container spacing={3}>
{values.tutorials.length > 0 &&
values.tutorials.map((item, index) => {
return (
<>
<Grid item xs={11}>
<Stack spacing={1.25}>
<InputLabel htmlFor={`tutorials.${index}`}>Tutorial</InputLabel>
<TextField
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}
/>
</Stack>
</Grid>
<Grid item xs={1} style={{ marginTop: "4%" }}>
<Tooltip title="Delete Nutrition" placement="right-start">
<IconButton onClick={() => { remove(index) }} size="large" color="error">
<DeleteFilled />
</IconButton>
</Tooltip>
</Grid>
</>
)
})
}
</Grid >
</Box>
</MainCard>
</>
)
}}
</FieldArray>
</Grid>
</Grid> </Grid>
</Grid> </Grid>
</Grid> </Grid>
......
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