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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    organization: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    timetable: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    class_subject: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    day_of_week: 'monday',
    
    
    
    
    
    
    
    
    
    
    
    
    starts_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    ends_at: '',
    
    
    
    
    
    
    
    
    
    
    room: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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



























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



























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























  <FormField label="DayofWeek" labelFor="day_of_week">
      <Field name="day_of_week" id="day_of_week" component="select">
      
        <option value="monday">monday</option>
      
        <option value="tuesday">tuesday</option>
      
        <option value="wednesday">wednesday</option>
      
        <option value="thursday">thursday</option>
      
        <option value="friday">friday</option>
      
        <option value="saturday">saturday</option>
      
        <option value="sunday">sunday</option>
      
      </Field>
  </FormField>























  <FormField
      label="StartsAt"
  >
      <Field
          type="datetime-local"
          name="starts_at"
          placeholder="StartsAt"
      />
  </FormField>



























  <FormField
      label="EndsAt"
  >
      <Field
          type="datetime-local"
          name="ends_at"
          placeholder="EndsAt"
      />
  </FormField>

















  <FormField
      label="Room"
  >
      <Field
          name="room"
          placeholder="Room"
      />
  </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('/timetable_periods/timetable_periods-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Timetable_periodsNew
