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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    ai_companion_session: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    item_type: 'decision',
    
    
    
    
    
    
    
    title: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    details: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    importance: 'low',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    item_status: 'open',
    
    
    
    
    
    
    
    
    
    
    
    
    captured_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    due_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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























  <FormField label="ItemType" labelFor="item_type">
      <Field name="item_type" id="item_type" component="select">
      
        <option value="decision">decision</option>
      
        <option value="action_item">action_item</option>
      
        <option value="fact">fact</option>
      
        <option value="risk">risk</option>
      
        <option value="question">question</option>
      
        <option value="answer">answer</option>
      
        <option value="follow_up">follow_up</option>
      
      </Field>
  </FormField>













  <FormField
      label="Title"
  >
      <Field
          name="title"
          placeholder="Title"
      />
  </FormField>





























    <FormField label="Details" hasTextareaHeight>
        <Field name="details" as="textarea" placeholder="Details" />
    </FormField>







































  <FormField label="Importance" labelFor="importance">
      <Field name="importance" id="importance" component="select">
      
        <option value="low">low</option>
      
        <option value="medium">medium</option>
      
        <option value="high">high</option>
      
        <option value="critical">critical</option>
      
      </Field>
  </FormField>



























  <FormField label="ItemStatus" labelFor="item_status">
      <Field name="item_status" id="item_status" component="select">
      
        <option value="open">open</option>
      
        <option value="in_progress">in_progress</option>
      
        <option value="done">done</option>
      
        <option value="dismissed">dismissed</option>
      
      </Field>
  </FormField>























  <FormField
      label="CapturedAt"
  >
      <Field
          type="datetime-local"
          name="captured_at"
          placeholder="CapturedAt"
      />
  </FormField>



























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

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

export default Knowledge_graph_itemsNew
