import { mdiAccount, mdiChartTimelineVariant, mdiMail, mdiUpload } from '@mdi/js'
import Head from 'next/head'
import React, { ReactElement } from 'react'
import CardBox from '../../components/CardBox'
import LayoutAuthenticated from '../../layouts/Authenticated'
import SectionMain from '../../components/SectionMain'
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton'
import { getPageTitle } from '../../config'

import { Field, Form, Formik } from 'formik'
import FormField from '../../components/FormField'
import BaseDivider from '../../components/BaseDivider'
import BaseButtons from '../../components/BaseButtons'
import BaseButton from '../../components/BaseButton'
import FormCheckRadio from '../../components/FormCheckRadio'
import FormCheckRadioGroup from '../../components/FormCheckRadioGroup'
import FormFilePicker from '../../components/FormFilePicker'
import FormImagePicker from '../../components/FormImagePicker'
import { SwitchField } from '../../components/SwitchField'

import { SelectField } from '../../components/SelectField'
import { SelectFieldMany } from "../../components/SelectFieldMany";
import {RichTextField} from "../../components/RichTextField";

import { create } from '../../stores/submission_grades/submission_gradesSlice'
import { useAppDispatch } from '../../stores/hooks'
import { useRouter } from 'next/router'
import moment from 'moment';

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    submission: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    graded_by_teacher: '',
    
    
    
    
    
    
    
    
    
    graded_at: '',
    
    
    
    
    
    
    
    
    
    
    total_score: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    max_score_snapshot: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    grade_status: 'not_graded',
    
    
    
    
    
    
    
    
    
    teacher_feedback: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    returned_to_student: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    returned_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    schools: '',
    
    
    
}


const Submission_gradesNew = () => {
  const router = useRouter()
  const dispatch = useAppDispatch()

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/submission_grades/submission_grades-list')
  }
  return (
    <>
      <Head>
        <title>{getPageTitle('New Item')}</title>
      </Head>
      <SectionMain>
        <SectionTitleLineWithButton icon={mdiChartTimelineVariant} title="New Item" main>
        {''}
        </SectionTitleLineWithButton>
        <CardBox>
          <Formik
            initialValues={
                
                initialValues
                
            }
            onSubmit={(values) => handleSubmit(values)}
          >
            <Form>





















  <FormField label="Submission" labelFor="submission">
      <Field name="submission" id="submission" component={SelectField} options={[]} itemRef={'homework_submissions'}></Field>
  </FormField>



























  <FormField label="GradedByTeacher" labelFor="graded_by_teacher">
      <Field name="graded_by_teacher" id="graded_by_teacher" component={SelectField} options={[]} itemRef={'users'}></Field>
  </FormField>



















  <FormField
      label="GradedAt"
  >
      <Field
          type="datetime-local"
          name="graded_at"
          placeholder="GradedAt"
      />
  </FormField>























    <FormField
        label="TotalScore"
    >
        <Field
            type="number"
            name="total_score"
            placeholder="TotalScore"
        />
    </FormField>



























    <FormField
        label="MaxScoreSnapshot"
    >
        <Field
            type="number"
            name="max_score_snapshot"
            placeholder="MaxScoreSnapshot"
        />
    </FormField>



































  <FormField label="GradeStatus" labelFor="grade_status">
      <Field name="grade_status" id="grade_status" component="select">
      
        <option value="not_graded">not_graded</option>
      
        <option value="in_review">in_review</option>
      
        <option value="graded">graded</option>
      
        <option value="reopened">reopened</option>
      
      </Field>
  </FormField>

















      <FormField label='TeacherFeedback' hasTextareaHeight>
          <Field
              name='teacher_feedback'
              id='teacher_feedback'
              component={RichTextField}
          ></Field>
      </FormField>







































  <FormField label='ReturnedToStudent' labelFor='returned_to_student'>
      <Field
          name='returned_to_student'
          id='returned_to_student'
          component={SwitchField}
      ></Field>
  </FormField>





















  <FormField
      label="ReturnedAt"
  >
      <Field
          type="datetime-local"
          name="returned_at"
          placeholder="ReturnedAt"
      />
  </FormField>



































  <FormField label="schools" labelFor="schools">
      <Field name="schools" id="schools" component={SelectField} options={[]} itemRef={'schools'}></Field>
  </FormField>







              <BaseDivider />
              <BaseButtons>
                <BaseButton type="submit" color="info" label="Submit" />
                <BaseButton type="reset" color="info" outline label="Reset" />
                <BaseButton type='reset' color='danger' outline label='Cancel' onClick={() => router.push('/submission_grades/submission_grades-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

Submission_gradesNew.getLayout = function getLayout(page: ReactElement) {
  return (
      <LayoutAuthenticated
        
          permission={'CREATE_SUBMISSION_GRADES'}
        
      >
          {page}
      </LayoutAuthenticated>
  )
}

export default Submission_gradesNew
