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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    subject: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    grade: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    stream: '',
    
    
    
    
    
    
    learning_objectives_om: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    learning_objectives_am: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    learning_objectives_en: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    topics_outline: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    responsible_teacher: '',
    
    
    
}


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

    
    

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



























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



























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













      <FormField label='LearningObjectivesAfaanOromoo' hasTextareaHeight>
          <Field
              name='learning_objectives_om'
              id='learning_objectives_om'
              component={RichTextField}
          ></Field>
      </FormField>



























      <FormField label='LearningObjectivesAmharic' hasTextareaHeight>
          <Field
              name='learning_objectives_am'
              id='learning_objectives_am'
              component={RichTextField}
          ></Field>
      </FormField>



























      <FormField label='LearningObjectivesEnglish' hasTextareaHeight>
          <Field
              name='learning_objectives_en'
              id='learning_objectives_en'
              component={RichTextField}
          ></Field>
      </FormField>

























    <FormField label="TopicsOutline" hasTextareaHeight>
        <Field name="topics_outline" as="textarea" placeholder="TopicsOutline" />
    </FormField>











































  <FormField label="ResponsibleTeacher" labelFor="responsible_teacher">
      <Field name="responsible_teacher" id="responsible_teacher" component={SelectField} options={[]} itemRef={'staff_members'}></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('/subject_offerings/subject_offerings-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Subject_offeringsNew
