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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    document: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    story: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    created_by_user: '',
    
    
    
    
    anchor_key: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    anchor_excerpt: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    is_resolved: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    opened_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    resolved_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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



























  <FormField label="UserStory" labelFor="story">
      <Field name="story" id="story" component={SelectField} options={[]} itemRef={'user_stories'}></Field>
  </FormField>



























  <FormField label="CreatedBy" labelFor="created_by_user">
      <Field name="created_by_user" id="created_by_user" component={SelectField} options={[]} itemRef={'users'}></Field>
  </FormField>









  <FormField
      label="AnchorKey"
  >
      <Field
          name="anchor_key"
          placeholder="AnchorKey"
      />
  </FormField>





























    <FormField label="AnchorExcerpt" hasTextareaHeight>
        <Field name="anchor_excerpt" as="textarea" placeholder="AnchorExcerpt" />
    </FormField>









































  <FormField label='Resolved' labelFor='is_resolved'>
      <Field
          name='is_resolved'
          id='is_resolved'
          component={SwitchField}
      ></Field>
  </FormField>





















  <FormField
      label="OpenedAt"
  >
      <Field
          type="datetime-local"
          name="opened_at"
          placeholder="OpenedAt"
      />
  </FormField>



























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

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

export default Comment_threadsNew
