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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    employee: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    documentType: 'NBI_CLEARANCE',
    
    
    
    
    
    
    
    fileName: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    filePath: [],
    
    
    
    
    
    
    
    
    
    
    
    uploadedAt: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    uploadedByUser: '',
    
    
    
}


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

    
    

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























  <FormField label="DocumentType" labelFor="documentType">
      <Field name="documentType" id="documentType" component="select">
      
        <option value="NBI_CLEARANCE">NBI_CLEARANCE</option>
      
        <option value="MEDICAL_CERTIFICATE">MEDICAL_CERTIFICATE</option>
      
        <option value="SSS_FORM">SSS_FORM</option>
      
        <option value="PHILHEALTH_MDR">PHILHEALTH_MDR</option>
      
        <option value="PAGIBIG_MMID">PAGIBIG_MMID</option>
      
        <option value="BIR_FORM">BIR_FORM</option>
      
        <option value="EMPLOYMENT_CONTRACT">EMPLOYMENT_CONTRACT</option>
      
        <option value="JOB_OFFER">JOB_OFFER</option>
      
        <option value="DIPLOMA">DIPLOMA</option>
      
        <option value="TRAINING_CERTIFICATE">TRAINING_CERTIFICATE</option>
      
        <option value="PERFORMANCE_APPRAISAL">PERFORMANCE_APPRAISAL</option>
      
        <option value="CONSENT_FORM">CONSENT_FORM</option>
      
        <option value="OTHER">OTHER</option>
      
      </Field>
  </FormField>













  <FormField
      label="FileName"
  >
      <Field
          name="fileName"
          placeholder="FileName"
      />
  </FormField>


















































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














  <FormField
      label="UploadedAt"
  >
      <Field
          type="datetime-local"
          name="uploadedAt"
          placeholder="UploadedAt"
      />
  </FormField>



































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

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

export default Employee_documentsNew
