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

const initialValues = {
    
    
    company_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    business_type: 'proprietorship',
    
    
    
    
    
    
    
    industry: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    gst_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    pan_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    cin_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    state: 'andaman_and_nicobar_islands',
    
    
    
    
    
    
    
    
    
    
    employee_count: '',
    
    
    
    
    
    
    
    
    
    
    
    
    compliance_score: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    risk_score: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    is_demo: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    owner_user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/companies/companies-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="CompanyName"
  >
      <Field
          name="company_name"
          placeholder="CompanyName"
      />
  </FormField>









































  <FormField label="BusinessType" labelFor="business_type">
      <Field name="business_type" id="business_type" component="select">
      
        <option value="proprietorship">proprietorship</option>
      
        <option value="partnership">partnership</option>
      
        <option value="llp">llp</option>
      
        <option value="private_limited">private_limited</option>
      
        <option value="public_limited">public_limited</option>
      
        <option value="opc">opc</option>
      
        <option value="huf">huf</option>
      
        <option value="trust">trust</option>
      
        <option value="society">society</option>
      
        <option value="ngo">ngo</option>
      
        <option value="other">other</option>
      
      </Field>
  </FormField>













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



























  <FormField
      label="GSTNumber"
  >
      <Field
          name="gst_number"
          placeholder="GSTNumber"
      />
  </FormField>



























  <FormField
      label="PANNumber"
  >
      <Field
          name="pan_number"
          placeholder="PANNumber"
      />
  </FormField>



























  <FormField
      label="CINNumber"
  >
      <Field
          name="cin_number"
          placeholder="CINNumber"
      />
  </FormField>









































  <FormField label="State" labelFor="state">
      <Field name="state" id="state" component="select">
      
        <option value="andaman_and_nicobar_islands">andaman_and_nicobar_islands</option>
      
        <option value="andhra_pradesh">andhra_pradesh</option>
      
        <option value="arunachal_pradesh">arunachal_pradesh</option>
      
        <option value="assam">assam</option>
      
        <option value="bihar">bihar</option>
      
        <option value="chandigarh">chandigarh</option>
      
        <option value="chhattisgarh">chhattisgarh</option>
      
        <option value="dadra_and_nagar_haveli_and_daman_and_diu">dadra_and_nagar_haveli_and_daman_and_diu</option>
      
        <option value="delhi">delhi</option>
      
        <option value="goa">goa</option>
      
        <option value="gujarat">gujarat</option>
      
        <option value="haryana">haryana</option>
      
        <option value="himachal_pradesh">himachal_pradesh</option>
      
        <option value="jammu_and_kashmir">jammu_and_kashmir</option>
      
        <option value="jharkhand">jharkhand</option>
      
        <option value="karnataka">karnataka</option>
      
        <option value="kerala">kerala</option>
      
        <option value="ladakh">ladakh</option>
      
        <option value="lakshadweep">lakshadweep</option>
      
        <option value="madhya_pradesh">madhya_pradesh</option>
      
        <option value="maharashtra">maharashtra</option>
      
        <option value="manipur">manipur</option>
      
        <option value="meghalaya">meghalaya</option>
      
        <option value="mizoram">mizoram</option>
      
        <option value="nagaland">nagaland</option>
      
        <option value="odisha">odisha</option>
      
        <option value="puducherry">puducherry</option>
      
        <option value="punjab">punjab</option>
      
        <option value="rajasthan">rajasthan</option>
      
        <option value="sikkim">sikkim</option>
      
        <option value="tamil_nadu">tamil_nadu</option>
      
        <option value="telangana">telangana</option>
      
        <option value="tripura">tripura</option>
      
        <option value="uttar_pradesh">uttar_pradesh</option>
      
        <option value="uttarakhand">uttarakhand</option>
      
        <option value="west_bengal">west_bengal</option>
      
      </Field>
  </FormField>



















    <FormField
        label="EmployeeCount"
    >
        <Field
            type="number"
            name="employee_count"
            placeholder="EmployeeCount"
        />
    </FormField>



























    <FormField
        label="ComplianceScore"
    >
        <Field
            type="number"
            name="compliance_score"
            placeholder="ComplianceScore"
        />
    </FormField>



























    <FormField
        label="RiskScore"
    >
        <Field
            type="number"
            name="risk_score"
            placeholder="RiskScore"
        />
    </FormField>





































  <FormField label='DemoCompany' labelFor='is_demo'>
      <Field
          name='is_demo'
          id='is_demo'
          component={SwitchField}
      ></Field>
  </FormField>





























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

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

export default CompaniesNew
