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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    mind_map: '',
    
    
    
    
    title: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    node_type: 'idea',
    
    
    
    
    
    
    
    
    
    content: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    x_position: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    y_position: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    confidence_level: 'low',
    
    
    
    
    
    
    
    
    
    
    
    
    
    ai_generated: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    evidence_items: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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









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









































  <FormField label="NodeType" labelFor="node_type">
      <Field name="node_type" id="node_type" component="select">
      
        <option value="idea">idea</option>
      
        <option value="problem">problem</option>
      
        <option value="solution">solution</option>
      
        <option value="customer_segment">customer_segment</option>
      
        <option value="value_proposition">value_proposition</option>
      
        <option value="channel">channel</option>
      
        <option value="revenue_stream">revenue_stream</option>
      
        <option value="cost_structure">cost_structure</option>
      
        <option value="key_activity">key_activity</option>
      
        <option value="key_resource">key_resource</option>
      
        <option value="key_partner">key_partner</option>
      
        <option value="competitor">competitor</option>
      
        <option value="assumption">assumption</option>
      
        <option value="risk">risk</option>
      
        <option value="metric">metric</option>
      
        <option value="milestone">milestone</option>
      
        <option value="task">task</option>
      
        <option value="note">note</option>
      
      </Field>
  </FormField>

















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





























    <FormField
        label="XPosition"
    >
        <Field
            type="number"
            name="x_position"
            placeholder="XPosition"
        />
    </FormField>



























    <FormField
        label="YPosition"
    >
        <Field
            type="number"
            name="y_position"
            placeholder="YPosition"
        />
    </FormField>



































  <FormField label="ConfidenceLevel" labelFor="confidence_level">
      <Field name="confidence_level" id="confidence_level" component="select">
      
        <option value="low">low</option>
      
        <option value="medium">medium</option>
      
        <option value="high">high</option>
      
      </Field>
  </FormField>





























  <FormField label='AIGenerated' labelFor='ai_generated'>
      <Field
          name='ai_generated'
          id='ai_generated'
          component={SwitchField}
      ></Field>
  </FormField>































    <FormField label='EvidenceItems' labelFor='evidence_items'>
        <Field
            name='evidence_items'
            id='evidence_items'
            itemRef={'node_evidence_items'}
            options={[]}
            component={SelectFieldMany}>
        </Field>
    </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('/map_nodes/map_nodes-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Map_nodesNew
