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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    project: '',
    
    
    
    
    title: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    audience: 'investor_vc',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    stage: 'draft',
    
    
    
    
    
    
    
    
    
    executive_summary: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    full_plan: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    assumptions: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    exports: [],
    
    
    
    
    
    
    
    
    
    
    
    generated_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    generated_by_run: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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









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









































  <FormField label="Audience" labelFor="audience">
      <Field name="audience" id="audience" component="select">
      
        <option value="investor_vc">investor_vc</option>
      
        <option value="bank_lender">bank_lender</option>
      
        <option value="strategic_partner">strategic_partner</option>
      
        <option value="seller_owner">seller_owner</option>
      
        <option value="internal">internal</option>
      
      </Field>
  </FormField>



























  <FormField label="Stage" labelFor="stage">
      <Field name="stage" id="stage" component="select">
      
        <option value="draft">draft</option>
      
        <option value="review">review</option>
      
        <option value="final">final</option>
      
      </Field>
  </FormField>

















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



























      <FormField label='FullPlan' hasTextareaHeight>
          <Field
              name='full_plan'
              id='full_plan'
              component={RichTextField}
          ></Field>
      </FormField>



























      <FormField label='Assumptions' hasTextareaHeight>
          <Field
              name='assumptions'
              id='assumptions'
              component={RichTextField}
          ></Field>
      </FormField>














































  <FormField>
      <Field
          label='Exports'
          color='info'
          icon={mdiUpload}
          path={'business_plan_versions/exports'}
          name='exports'
          id='exports'
          schema={{
            size: undefined,
            formats: undefined,
          }}
          component={FormFilePicker}
      ></Field>
  </FormField>














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



































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

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

export default Business_plan_versionsNew
