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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    session: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    exercise: '',
    
    
    
    
    
    
    
    
    
    attempted_at: '',
    
    
    
    
    
    
    
    
    
    
    score: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    accuracy: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    duration_seconds: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    result: 'success',
    
    
    
    
    
    
    
    
    raw_response: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    accounts: '',
    
    
    
}


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

    
    

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



























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



















  <FormField
      label="Attemptedat"
  >
      <Field
          type="datetime-local"
          name="attempted_at"
          placeholder="Attemptedat"
      />
  </FormField>























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



























    <FormField
        label="Accuracy"
    >
        <Field
            type="number"
            name="accuracy"
            placeholder="Accuracy"
        />
    </FormField>



























    <FormField
        label="Durationseconds"
    >
        <Field
            type="number"
            name="duration_seconds"
            placeholder="Durationseconds"
        />
    </FormField>



































  <FormField label="Result" labelFor="result">
      <Field name="result" id="result" component="select">
      
        <option value="success">success</option>
      
        <option value="partial">partial</option>
      
        <option value="failed">failed</option>
      
      </Field>
  </FormField>















    <FormField label="Rawresponse" hasTextareaHeight>
        <Field name="raw_response" as="textarea" placeholder="Rawresponse" />
    </FormField>











































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

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

export default Cognitive_attemptsNew
