Skip to content

added text inputs instead of datetimepicker #3

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

Open
wants to merge 1 commit into
base: pseudo-master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 10 additions & 1 deletion src/layouts/register.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const Register = () => {
try {
const body = JSON.parse(JSON.stringify(newUserData));
body.dob = '2018-03-29T13:34:00.000';
console.log('user is : ', body);
const res = await registerNewUser(body);
console.log(res);
dispatch(setUserAndToken({ user: res.data.data.user, token: res.data.data.token }));
Expand Down Expand Up @@ -122,13 +123,21 @@ const Register = () => {
/>
</Grid>
<Grid item xs={12} md={5} style={{ margin: 'auto' }}>
<DatePicker
{/* <DatePicker
fullWidth
label='Date of Birth'
name='dob'
required
value={newUserData.dob}
onChange={(newDate) => handleDataChange('dob', newDate)}
/> */}
<TextInputField
fullWidth
label='Date of Birth'
name='dob'
required
value={newUserData.dob}
onChange={(e) => handleDataChange('dob', e.target.value)}
/>
</Grid>
<Grid item xs={12} md={5} style={{ margin: 'auto' }}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/exam-creation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const ExamCreation = () => {
examData.duration = +new Date(examData.endTime) - +new Date(examData.startTime);
examData.startTime = +new Date(examData.startTime);
delete examData.endTime;

console.log('exam Is : ', examData);
examData.image = await handleUploadBannerImage();
console.log(examData.image);

Expand Down
28 changes: 19 additions & 9 deletions src/pages/exam-creation/page1.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { getExamTags, getExamTypes } from 'api/exam';
import { csvToJSON } from 'utilities/functions';

const Page1 = (props) => {

const { examDetails, handleDetailsChange } = props;
const [selectedTags, setSelectedTags] = useState([]);
const [tags, setTags] = useState([]);
Expand Down Expand Up @@ -82,23 +81,39 @@ const Page1 = (props) => {
/>
</Grid>
<Grid item lg={6}>
<DateTimePicker
{/* <DateTimePicker
fullWidth
label='Starts From'
required
name='startTime'
value={examDetails.startTime}
onChange={(newTime) => handleDetailsChange('startTime', newTime)}
/> */}
<TextInputField
name='startTime'
label='Starts From'
fullWidth
required
value={examDetails.startTime}
onChange={(e) => handleDetailsChange('startTime', e.target.value)}
/>
</Grid>
<Grid item lg={6}>
<DateTimePicker
{/* <DateTimePicker
fullWidth
label='Ends On'
required
name='endTime'
value={examDetails.endTime}
onChange={(newTime) => handleDetailsChange('endTime', newTime)}
/> */}
<TextInputField
name='endTime'
label='Ends On'
fullWidth
required
value={examDetails.endTime}
onChange={(e) => handleDetailsChange('endTime', e.target.value)}
/>
</Grid>
<Grid item lg={6}>
Expand Down Expand Up @@ -143,12 +158,7 @@ const Page1 = (props) => {
<Typography variant='p' component='p' style={{ marginBottom: '0.5rem' }}>
Description
</Typography>
<TextEditor
width='100%'
height={295}
value={examDetails.description}
onChange={(value) => handleDetailsChange('description', value)}
/>
<TextEditor width='100%' height={295} value={examDetails.description} onChange={(value) => handleDetailsChange('description', value)} />
</Grid>
</Grid>
</>
Expand Down
61 changes: 21 additions & 40 deletions src/pages/profile/exams-list.jsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
import { useState, useEffect } from 'react';
import {
Box,
Card,
CardActions,
CardContent,
Button,
Typography,
Paper,
Grid,
} from '@mui/material';
import { Box, Card, CardActions, CardContent, Button, Typography, Paper, Grid } from '@mui/material';
import { useSnackbar } from 'notistack';
import TextInputField from 'components/text-input-field';
import DatePicker from 'components/date-time-picker/date';
import TimePicker from 'components/date-time-picker/time';
import MultiSelect from 'components/multi-select-dropdown';
import DropdownField from 'components/dropdown-field';
import FilterListIcon from '@mui/icons-material/FilterList';
import {
DialogActions,
DialogContent,
DialogTitle,
Dialog,
} from 'components/dialog';
import { DialogActions, DialogContent, DialogTitle, Dialog } from 'components/dialog';
import ExamDetailsCard from 'components/exam-details-card';
import ExamDetailsCard2 from 'components/exam-details-card2';
import { getHostedExams, getGivenExams } from 'api/user';
Expand Down Expand Up @@ -59,46 +45,48 @@ const ExamsList = (props) => {
}
};

const handleFilterChange = (e) =>
setSelectedFilters((f) => ({ ...f, [e.target.name]: e.target.value }));
const handleFilterChange = (e) => setSelectedFilters((f) => ({ ...f, [e.target.name]: e.target.value }));

const hideFilters = () => setShowFilters(false);
return (
<>
<Dialog
open={showFilters}
handleClose={hideFilters}
style={{ padding: '2rem' }}
maxWidth="md"
>
<Dialog open={showFilters} handleClose={hideFilters} style={{ padding: '2rem' }} maxWidth='md'>
<DialogTitle>Filters</DialogTitle>
<DialogContent>
<Grid container spacing={2}>
<Grid item md={6}>
<DatePicker
{/* <DatePicker
fullWidth
label="Start Date"
name="startDate"
value={selectedFilters.startDate}
onChange={(e) => handleFilterChange(e)}
/> */}
<TextInputField
name='startDate'
label='Start Date'
placeholder='Start Date'
fullWidth={true}
value={selectedFilters.startDate}
onChange={(e) => handleFilterChange(e)}
/>
</Grid>
<Grid item md={6}>
<DropdownField
label="Exam Visibility"
label='Exam Visibility'
fullWidth
options={examVisibilities}
name="examVisibility"
name='examVisibility'
value={selectedFilters.examVisibility}
handler={(e) => handleFilterChange(e)}
/>
</Grid>
<Grid item md={6}>
<DropdownField
label="Status"
label='Status'
fullWidth
options={examStatuses}
name="examStatus"
name='examStatus'
value={selectedFilters.examStatus}
handler={(e) => handleFilterChange(e)}
/>
Expand All @@ -110,28 +98,21 @@ const ExamsList = (props) => {
display: 'flex',
width: '100%',
justifyContent: 'flex-end',
}}
>
<Button size="small" onClick={(e) => hideFilters(e)}>
}}>
<Button size='small' onClick={(e) => hideFilters(e)}>
Apply
</Button>
</Box>
</DialogContent>
</Dialog>
<Box style={{ display: 'flex', flexDirection: 'column' }}>
<TextInputField
placeholder="Search Exams"
fullWidth
endIcon={<FilterListIcon />}
endIconOnClick={() => setShowFilters(true)}
/>
<TextInputField placeholder='Search Exams' fullWidth endIcon={<FilterListIcon />} endIconOnClick={() => setShowFilters(true)} />
<Box
style={{
marginTop: '1rem',
height: `calc(100vh - 25rem)`,
overflowY: 'auto',
}}
>
}}>
{/* {exams.map((exam, i) => (
<ExamDetailsCard2
cardDetails={exam}
Expand Down