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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    driver_profile: '',
    
    
    
    
    license_country: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    license_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    license_issued_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    license_expires_at: '',
    
    
    
    
    
    
    
    
    
    
    
    license_restrictions: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    license_suspended: false,
    
    
    
    
    
    
    
    
    
    cpc_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    cpc_issued_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    cpc_expires_at: '',
    
    
    
    
    
    
    
    
    
    
    cpc_center: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    cpc_last_training_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    cpc_next_training_at: '',
    
    
    
    
    
    
    
    
    
    
    cpc_type: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    adr_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    adr_expires_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    adr_tank: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    adr_packages: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    adr_last_course_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    adr_next_course_at: '',
    
    
    
    
    
    
    
    
    
    
    
    adr_restrictions: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    medical_cert_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    medical_issued_by: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    medical_expires_at: '',
    
    
    
    
    
    
    
    
    
    
    psych_test_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    psych_expires_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    eye_exam_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    cardio_exam_at: '',
    
    
    
    
    
    
    
    
    
    
    
    medical_restrictions: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    tacho_card_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    tacho_country: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    tacho_expires_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    tacho_last_download_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    tacho_next_download_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    violations_count: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    warnings_count: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    driving_ban: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    driving_ban_until: '',
    
    
    
    
    
    
    
    
    
}


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

    
    

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









  <FormField
      label="LicenseCountry"
  >
      <Field
          name="license_country"
          placeholder="LicenseCountry"
      />
  </FormField>



























  <FormField
      label="LicenseNumber"
  >
      <Field
          name="license_number"
          placeholder="LicenseNumber"
      />
  </FormField>





































  <FormField
      label="LicenseIssuedAt"
  >
      <Field
          type="datetime-local"
          name="license_issued_at"
          placeholder="LicenseIssuedAt"
      />
  </FormField>



























  <FormField
      label="LicenseExpiresAt"
  >
      <Field
          type="datetime-local"
          name="license_expires_at"
          placeholder="LicenseExpiresAt"
      />
  </FormField>



















    <FormField label="LicenseRestrictions" hasTextareaHeight>
        <Field name="license_restrictions" as="textarea" placeholder="LicenseRestrictions" />
    </FormField>









































  <FormField label='LicenseSuspended' labelFor='license_suspended'>
      <Field
          name='license_suspended'
          id='license_suspended'
          component={SwitchField}
      ></Field>
  </FormField>











  <FormField
      label="CPCNumber"
  >
      <Field
          name="cpc_number"
          placeholder="CPCNumber"
      />
  </FormField>





































  <FormField
      label="CPCIssuedAt"
  >
      <Field
          type="datetime-local"
          name="cpc_issued_at"
          placeholder="CPCIssuedAt"
      />
  </FormField>



























  <FormField
      label="CPCExpiresAt"
  >
      <Field
          type="datetime-local"
          name="cpc_expires_at"
          placeholder="CPCExpiresAt"
      />
  </FormField>

















  <FormField
      label="CPCCenter"
  >
      <Field
          name="cpc_center"
          placeholder="CPCCenter"
      />
  </FormField>





































  <FormField
      label="CPCLastTrainingAt"
  >
      <Field
          type="datetime-local"
          name="cpc_last_training_at"
          placeholder="CPCLastTrainingAt"
      />
  </FormField>



























  <FormField
      label="CPCNextTrainingAt"
  >
      <Field
          type="datetime-local"
          name="cpc_next_training_at"
          placeholder="CPCNextTrainingAt"
      />
  </FormField>

















  <FormField
      label="CPCType"
  >
      <Field
          name="cpc_type"
          placeholder="CPCType"
      />
  </FormField>



























  <FormField
      label="ADRNumber"
  >
      <Field
          name="adr_number"
          placeholder="ADRNumber"
      />
  </FormField>





































  <FormField
      label="ADRExpiresAt"
  >
      <Field
          type="datetime-local"
          name="adr_expires_at"
          placeholder="ADRExpiresAt"
      />
  </FormField>

































  <FormField label='ADRTank' labelFor='adr_tank'>
      <Field
          name='adr_tank'
          id='adr_tank'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='ADRPackages' labelFor='adr_packages'>
      <Field
          name='adr_packages'
          id='adr_packages'
          component={SwitchField}
      ></Field>
  </FormField>





















  <FormField
      label="ADRLastCourseAt"
  >
      <Field
          type="datetime-local"
          name="adr_last_course_at"
          placeholder="ADRLastCourseAt"
      />
  </FormField>



























  <FormField
      label="ADRNextCourseAt"
  >
      <Field
          type="datetime-local"
          name="adr_next_course_at"
          placeholder="ADRNextCourseAt"
      />
  </FormField>



















    <FormField label="ADRRestrictions" hasTextareaHeight>
        <Field name="adr_restrictions" as="textarea" placeholder="ADRRestrictions" />
    </FormField>

























  <FormField
      label="MedicalCertificateNumber"
  >
      <Field
          name="medical_cert_number"
          placeholder="MedicalCertificateNumber"
      />
  </FormField>



























  <FormField
      label="MedicalIssuedBy"
  >
      <Field
          name="medical_issued_by"
          placeholder="MedicalIssuedBy"
      />
  </FormField>





































  <FormField
      label="MedicalExpiresAt"
  >
      <Field
          type="datetime-local"
          name="medical_expires_at"
          placeholder="MedicalExpiresAt"
      />
  </FormField>

















  <FormField
      label="PsychTestNumber"
  >
      <Field
          name="psych_test_number"
          placeholder="PsychTestNumber"
      />
  </FormField>





































  <FormField
      label="PsychExpiresAt"
  >
      <Field
          type="datetime-local"
          name="psych_expires_at"
          placeholder="PsychExpiresAt"
      />
  </FormField>



























  <FormField
      label="EyeExamAt"
  >
      <Field
          type="datetime-local"
          name="eye_exam_at"
          placeholder="EyeExamAt"
      />
  </FormField>



























  <FormField
      label="CardioExamAt"
  >
      <Field
          type="datetime-local"
          name="cardio_exam_at"
          placeholder="CardioExamAt"
      />
  </FormField>



















    <FormField label="MedicalRestrictions" hasTextareaHeight>
        <Field name="medical_restrictions" as="textarea" placeholder="MedicalRestrictions" />
    </FormField>

























  <FormField
      label="TachoCardNumber"
  >
      <Field
          name="tacho_card_number"
          placeholder="TachoCardNumber"
      />
  </FormField>



























  <FormField
      label="TachoCountry"
  >
      <Field
          name="tacho_country"
          placeholder="TachoCountry"
      />
  </FormField>





































  <FormField
      label="TachoExpiresAt"
  >
      <Field
          type="datetime-local"
          name="tacho_expires_at"
          placeholder="TachoExpiresAt"
      />
  </FormField>



























  <FormField
      label="TachoLastDownloadAt"
  >
      <Field
          type="datetime-local"
          name="tacho_last_download_at"
          placeholder="TachoLastDownloadAt"
      />
  </FormField>



























  <FormField
      label="TachoNextDownloadAt"
  >
      <Field
          type="datetime-local"
          name="tacho_next_download_at"
          placeholder="TachoNextDownloadAt"
      />
  </FormField>























    <FormField
        label="ViolationsCount"
    >
        <Field
            type="number"
            name="violations_count"
            placeholder="ViolationsCount"
        />
    </FormField>



























    <FormField
        label="WarningsCount"
    >
        <Field
            type="number"
            name="warnings_count"
            placeholder="WarningsCount"
        />
    </FormField>





































  <FormField label='DrivingBan' labelFor='driving_ban'>
      <Field
          name='driving_ban'
          id='driving_ban'
          component={SwitchField}
      ></Field>
  </FormField>





















  <FormField
      label="DrivingBanUntil"
  >
      <Field
          type="datetime-local"
          name="driving_ban_until"
          placeholder="DrivingBanUntil"
      />
  </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('/driver_compliances/driver_compliances-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Driver_compliancesNew
