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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    vendor: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    document_type: 'rccm',
    
    
    
    
    
    
    
    reference_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    issued_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    expires_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'valid',
    
    
    
    
    
    
    
    
    review_comment: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    file: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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























  <FormField label="DocumentType" labelFor="document_type">
      <Field name="document_type" id="document_type" component="select">
      
        <option value="rccm">rccm</option>
      
        <option value="tax_clearance">tax_clearance</option>
      
        <option value="cnss">cnss</option>
      
        <option value="business_license">business_license</option>
      
        <option value="bank_letter">bank_letter</option>
      
        <option value="id">id</option>
      
        <option value="other">other</option>
      
      </Field>
  </FormField>













  <FormField
      label="ReferenceNumber"
  >
      <Field
          name="reference_number"
          placeholder="ReferenceNumber"
      />
  </FormField>





































  <FormField
      label="IssuedAt"
  >
      <Field
          type="datetime-local"
          name="issued_at"
          placeholder="IssuedAt"
      />
  </FormField>



























  <FormField
      label="ExpiresAt"
  >
      <Field
          type="datetime-local"
          name="expires_at"
          placeholder="ExpiresAt"
      />
  </FormField>































  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="valid">valid</option>
      
        <option value="expiring">expiring</option>
      
        <option value="expired">expired</option>
      
        <option value="rejected">rejected</option>
      
        <option value="pending_review">pending_review</option>
      
      </Field>
  </FormField>















    <FormField label="ReviewComment" hasTextareaHeight>
        <Field name="review_comment" as="textarea" placeholder="ReviewComment" />
    </FormField>
















































  <FormField>
      <Field
          label='File'
          color='info'
          icon={mdiUpload}
          path={'vendor_compliance_documents/file'}
          name='file'
          id='file'
          schema={{
            size: undefined,
            formats: undefined,
          }}
          component={FormFilePicker}
      ></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('/vendor_compliance_documents/vendor_compliance_documents-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Vendor_compliance_documentsNew
