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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    ir_company: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    statement_type: 'income_statement',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    period_type: 'annual',
    
    
    
    
    
    
    
    
    
    
    
    
    period_end_at: '',
    
    
    
    
    
    
    
    
    
    
    total_revenue: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    net_income: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    total_assets: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    total_liabilities: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    free_cash_flow: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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























  <FormField label="StatementType" labelFor="statement_type">
      <Field name="statement_type" id="statement_type" component="select">
      
        <option value="income_statement">income_statement</option>
      
        <option value="balance_sheet">balance_sheet</option>
      
        <option value="cash_flow">cash_flow</option>
      
      </Field>
  </FormField>



























  <FormField label="PeriodType" labelFor="period_type">
      <Field name="period_type" id="period_type" component="select">
      
        <option value="annual">annual</option>
      
        <option value="quarterly">quarterly</option>
      
      </Field>
  </FormField>























  <FormField
      label="PeriodEndAt"
  >
      <Field
          type="datetime-local"
          name="period_end_at"
          placeholder="PeriodEndAt"
      />
  </FormField>























    <FormField
        label="TotalRevenue"
    >
        <Field
            type="number"
            name="total_revenue"
            placeholder="TotalRevenue"
        />
    </FormField>



























    <FormField
        label="NetIncome"
    >
        <Field
            type="number"
            name="net_income"
            placeholder="NetIncome"
        />
    </FormField>



























    <FormField
        label="TotalAssets"
    >
        <Field
            type="number"
            name="total_assets"
            placeholder="TotalAssets"
        />
    </FormField>



























    <FormField
        label="TotalLiabilities"
    >
        <Field
            type="number"
            name="total_liabilities"
            placeholder="TotalLiabilities"
        />
    </FormField>



























    <FormField
        label="FreeCashFlow"
    >
        <Field
            type="number"
            name="free_cash_flow"
            placeholder="FreeCashFlow"
        />
    </FormField>























    <FormField label="Notes" hasTextareaHeight>
        <Field name="notes" as="textarea" placeholder="Notes" />
    </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('/ir_financial_statement_summaries/ir_financial_statement_summaries-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Ir_financial_statement_summariesNew
