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/gradebook_entries/gradebook_entriesSlice'
import { useAppDispatch } from '../../stores/hooks'
import { useRouter } from 'next/router'
import moment from 'moment';

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    gradebook_column: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    student: '',
    
    
    
    
    score: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    entry_status: 'normal',
    
    
    
    
    
    
    
    
    
    
    
    
    recorded_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    recorded_by: '',
    
    
    
    
    
    remarks: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    schools: '',
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/gradebook_entries/gradebook_entries-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="GradebookColumn" labelFor="gradebook_column">
      <Field name="gradebook_column" id="gradebook_column" component={SelectField} options={[]} itemRef={'gradebook_columns'}></Field>
  </FormField>



























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















    <FormField
        label="Score"
    >
        <Field
            type="number"
            name="score"
            placeholder="Score"
        />
    </FormField>



































  <FormField label="EntryStatus" labelFor="entry_status">
      <Field name="entry_status" id="entry_status" component="select">
      
        <option value="normal">normal</option>
      
        <option value="excused">excused</option>
      
        <option value="missing">missing</option>
      
        <option value="incomplete">incomplete</option>
      
      </Field>
  </FormField>























  <FormField
      label="RecordedAt"
  >
      <Field
          type="datetime-local"
          name="recorded_at"
          placeholder="RecordedAt"
      />
  </FormField>



































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











    <FormField label="Remarks" hasTextareaHeight>
        <Field name="remarks" as="textarea" placeholder="Remarks" />
    </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('/gradebook_entries/gradebook_entries-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Gradebook_entriesNew
