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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    workspace: '',
    
    
    
    
    name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    summary: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    project_type: 'startup',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'idea',
    
    
    
    
    
    
    
    industry: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    target_market: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    source_items: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    mind_maps: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    ai_runs: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    business_plan_versions: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    deal_packages: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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









  <FormField
      label="ProjectName"
  >
      <Field
          name="name"
          placeholder="ProjectName"
      />
  </FormField>































      <FormField label='Summary' hasTextareaHeight>
          <Field
              name='summary'
              id='summary'
              component={RichTextField}
          ></Field>
      </FormField>





































  <FormField label="ProjectType" labelFor="project_type">
      <Field name="project_type" id="project_type" component="select">
      
        <option value="startup">startup</option>
      
        <option value="acquisition">acquisition</option>
      
        <option value="partnership">partnership</option>
      
        <option value="expansion">expansion</option>
      
      </Field>
  </FormField>



























  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="idea">idea</option>
      
        <option value="research">research</option>
      
        <option value="planning">planning</option>
      
        <option value="fundraising">fundraising</option>
      
        <option value="negotiation">negotiation</option>
      
        <option value="launched">launched</option>
      
        <option value="archived">archived</option>
      
      </Field>
  </FormField>













  <FormField
      label="Industry"
  >
      <Field
          name="industry"
          placeholder="Industry"
      />
  </FormField>





























    <FormField label="TargetMarket" hasTextareaHeight>
        <Field name="target_market" as="textarea" placeholder="TargetMarket" />
    </FormField>













































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



























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



























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



























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



























    <FormField label='DealPackages' labelFor='deal_packages'>
        <Field
            name='deal_packages'
            id='deal_packages'
            itemRef={'deal_packages'}
            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('/projects/projects-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default ProjectsNew
