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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    jobRequisition: '',
    
    
    
    
    
    
    
    
    
    applicationDate: '',
    
    
    
    
    
    
    
    
    
    
    firstName: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    lastName: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    email: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    mobile: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    source: 'WALK_IN',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    resumeFile: [],
    
    
    
    
    
    
    
    
    
    
    
    interviewSchedule: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    interviewResult: 'PASS',
    
    
    
    
    
    
    
    psychTestResult: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    medicalResult: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    backgroundCheck: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    jobOfferStatus: 'PENDING',
    
    
    
    
    
    
    
    
    
    
    
    
    expectedStartDate: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    convertedEmployee: '',
    
    
    
}


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

    
    

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



















  <FormField
      label="ApplicationDate"
  >
      <Field
          type="datetime-local"
          name="applicationDate"
          placeholder="ApplicationDate"
      />
  </FormField>

















  <FormField
      label="FirstName"
  >
      <Field
          name="firstName"
          placeholder="FirstName"
      />
  </FormField>



























  <FormField
      label="LastName"
  >
      <Field
          name="lastName"
          placeholder="LastName"
      />
  </FormField>



























  <FormField
      label="Email"
  >
      <Field
          name="email"
          placeholder="Email"
      />
  </FormField>



























  <FormField
      label="Mobile"
  >
      <Field
          name="mobile"
          placeholder="Mobile"
      />
  </FormField>









































  <FormField label="Source" labelFor="source">
      <Field name="source" id="source" component="select">
      
        <option value="WALK_IN">WALK_IN</option>
      
        <option value="REFERRAL">REFERRAL</option>
      
        <option value="JOB_BOARD">JOB_BOARD</option>
      
        <option value="INTERNAL">INTERNAL</option>
      
      </Field>
  </FormField>




































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














  <FormField
      label="InterviewSchedule"
  >
      <Field
          type="datetime-local"
          name="interviewSchedule"
          placeholder="InterviewSchedule"
      />
  </FormField>































  <FormField label="InterviewResult" labelFor="interviewResult">
      <Field name="interviewResult" id="interviewResult" component="select">
      
        <option value="PASS">PASS</option>
      
        <option value="FAIL">FAIL</option>
      
        <option value="SECOND_INTERVIEW">SECOND_INTERVIEW</option>
      
        <option value="PENDING">PENDING</option>
      
      </Field>
  </FormField>













  <FormField
      label="PsychTestResult"
  >
      <Field
          name="psychTestResult"
          placeholder="PsychTestResult"
      />
  </FormField>



























  <FormField
      label="MedicalResult"
  >
      <Field
          name="medicalResult"
          placeholder="MedicalResult"
      />
  </FormField>



























  <FormField
      label="BackgroundCheckResult"
  >
      <Field
          name="backgroundCheck"
          placeholder="BackgroundCheckResult"
      />
  </FormField>









































  <FormField label="JobOfferStatus" labelFor="jobOfferStatus">
      <Field name="jobOfferStatus" id="jobOfferStatus" component="select">
      
        <option value="PENDING">PENDING</option>
      
        <option value="ACCEPTED">ACCEPTED</option>
      
        <option value="DECLINED">DECLINED</option>
      
      </Field>
  </FormField>























  <FormField
      label="ExpectedStartDate"
  >
      <Field
          type="datetime-local"
          name="expectedStartDate"
          placeholder="ExpectedStartDate"
      />
  </FormField>



































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

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

export default ApplicantsNew
