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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    company: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    type: 'ID_CARD',
    
    
    
    
    
    
    
    
    
    
    keep_min_versions: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    keep_files_days: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    keep_version_days: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    keep_audit_after_file_removal: false,
    
    
    
    
    
    
    
    
}


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

    
    

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























  <FormField label="DocumentType" labelFor="type">
      <Field name="type" id="type" component="select">
      
        <option value="ID_CARD">ID_CARD</option>
      
        <option value="PASSPORT">PASSPORT</option>
      
        <option value="DRIVING_LICENSE">DRIVING_LICENSE</option>
      
        <option value="CPC_CODE95">CPC_CODE95</option>
      
        <option value="ADR">ADR</option>
      
        <option value="MEDICAL">MEDICAL</option>
      
        <option value="PSYCH">PSYCH</option>
      
        <option value="TACHO_CARD">TACHO_CARD</option>
      
        <option value="WORK_CONTRACT">WORK_CONTRACT</option>
      
        <option value="BANK_DETAILS">BANK_DETAILS</option>
      
        <option value="INCIDENT_REPORT">INCIDENT_REPORT</option>
      
        <option value="OTHER">OTHER</option>
      
      </Field>
  </FormField>



















    <FormField
        label="KeepMinimumVersions"
    >
        <Field
            type="number"
            name="keep_min_versions"
            placeholder="KeepMinimumVersions"
        />
    </FormField>



























    <FormField
        label="KeepFilesDays"
    >
        <Field
            type="number"
            name="keep_files_days"
            placeholder="KeepFilesDays"
        />
    </FormField>



























    <FormField
        label="KeepVersionDays"
    >
        <Field
            type="number"
            name="keep_version_days"
            placeholder="KeepVersionDays"
        />
    </FormField>





































  <FormField label='KeepAuditAfterFileRemoval' labelFor='keep_audit_after_file_removal'>
      <Field
          name='keep_audit_after_file_removal'
          id='keep_audit_after_file_removal'
          component={SwitchField}
      ></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('/document_retention_policies/document_retention_policies-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Document_retention_policiesNew
