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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    facta_query: '',
    
    
    
    
    
    
    executive_summary: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    truth_score_percent: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    verification_status: 'verified',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    citations: [],
    
    
    
    
    
    ready_to_cite_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    neutral_perspective: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    pro_perspective: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    contra_perspective: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    generated_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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













      <FormField label='ExecutiveSummary' hasTextareaHeight>
          <Field
              name='executive_summary'
              id='executive_summary'
              component={RichTextField}
          ></Field>
      </FormField>





























    <FormField
        label="TruthScorePercent"
    >
        <Field
            type="number"
            name="truth_score_percent"
            placeholder="TruthScorePercent"
        />
    </FormField>



































  <FormField label="VerificationStatus" labelFor="verification_status">
      <Field name="verification_status" id="verification_status" component="select">
      
        <option value="verified">verified</option>
      
        <option value="partially_verified">partially_verified</option>
      
        <option value="unverified">unverified</option>
      
        <option value="conflicting">conflicting</option>
      
      </Field>
  </FormField>

































    <FormField label='Citations' labelFor='citations'>
        <Field
            name='citations'
            id='citations'
            itemRef={'citations'}
            options={[]}
            component={SelectFieldMany}>
        </Field>
    </FormField>











      <FormField label='ReadyToCiteText' hasTextareaHeight>
          <Field
              name='ready_to_cite_text'
              id='ready_to_cite_text'
              component={RichTextField}
          ></Field>
      </FormField>



























      <FormField label='NeutralPerspective' hasTextareaHeight>
          <Field
              name='neutral_perspective'
              id='neutral_perspective'
              component={RichTextField}
          ></Field>
      </FormField>



























      <FormField label='ProPerspective' hasTextareaHeight>
          <Field
              name='pro_perspective'
              id='pro_perspective'
              component={RichTextField}
          ></Field>
      </FormField>



























      <FormField label='ContraPerspective' hasTextareaHeight>
          <Field
              name='contra_perspective'
              id='contra_perspective'
              component={RichTextField}
          ></Field>
      </FormField>

































  <FormField
      label="GeneratedAt"
  >
      <Field
          type="datetime-local"
          name="generated_at"
          placeholder="GeneratedAt"
      />
  </FormField>



































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

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

export default Facta_answersNew
