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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    mock_trial: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    role: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    turn_type: 'opening',
    
    
    
    
    
    
    
    
    
    content: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    audio_file: '',
    
    
    
    
    
    
    
    
    
    spoken_at: '',
    
    
    
    
    
    
    
    
    
}


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

    
    

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



























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























  <FormField label="TurnType" labelFor="turn_type">
      <Field name="turn_type" id="turn_type" component="select">
      
        <option value="opening">opening</option>
      
        <option value="direct_exam">direct_exam</option>
      
        <option value="cross_exam">cross_exam</option>
      
        <option value="argument">argument</option>
      
        <option value="ruling">ruling</option>
      
        <option value="objection">objection</option>
      
        <option value="sidebar">sidebar</option>
      
        <option value="closing">closing</option>
      
        <option value="general">general</option>
      
      </Field>
  </FormField>

















      <FormField label='Content' hasTextareaHeight>
          <Field
              name='content'
              id='content'
              component={RichTextField}
          ></Field>
      </FormField>









































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



















  <FormField
      label="SpokenAt"
  >
      <Field
          type="datetime-local"
          name="spoken_at"
          placeholder="SpokenAt"
      />
  </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('/mock_trial_turns/mock_trial_turns-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Mock_trial_turnsNew
