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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    owner: '',
    
    
    
    
    company_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    company_legal_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    company_website: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    company_size: 'micro',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    verification_status: 'unverified',
    
    
    
    
    
    
    
    
    
    about: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    company_images: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    hq_address: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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









  <FormField
      label="CompanyName"
  >
      <Field
          name="company_name"
          placeholder="CompanyName"
      />
  </FormField>



























  <FormField
      label="CompanyLegalName"
  >
      <Field
          name="company_legal_name"
          placeholder="CompanyLegalName"
      />
  </FormField>



























  <FormField
      label="CompanyWebsite"
  >
      <Field
          name="company_website"
          placeholder="CompanyWebsite"
      />
  </FormField>









































  <FormField label="CompanySize" labelFor="company_size">
      <Field name="company_size" id="company_size" component="select">
      
        <option value="micro">micro</option>
      
        <option value="small">small</option>
      
        <option value="medium">medium</option>
      
        <option value="large">large</option>
      
        <option value="enterprise">enterprise</option>
      
      </Field>
  </FormField>



























  <FormField label="VerificationStatus" labelFor="verification_status">
      <Field name="verification_status" id="verification_status" component="select">
      
        <option value="unverified">unverified</option>
      
        <option value="pending">pending</option>
      
        <option value="verified">verified</option>
      
        <option value="rejected">rejected</option>
      
      </Field>
  </FormField>

















      <FormField label='About' hasTextareaHeight>
          <Field
              name='about'
              id='about'
              component={RichTextField}
          ></Field>
      </FormField>













































  <FormField>
      <Field
          label='CompanyImages'
          color='info'
          icon={mdiUpload}
          path={'job_companies/company_images'}
          name='company_images'
          id='company_images'
          schema={{
            size: undefined,
            formats: undefined,
          }}
          component={FormImagePicker}
      ></Field>
  </FormField>























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

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

export default Job_companiesNew
