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

const initialValues = {
    
    
    name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    description: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    transmission: 'automatic',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    fuel_type: 'petrol',
    
    
    
    
    
    
    
    
    
    
    seats: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    doors: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    large_bags: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    small_bags: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    has_air_conditioning: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    image: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/vehicle_categories/vehicle_categories-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="CategoryName"
  >
      <Field
          name="name"
          placeholder="CategoryName"
      />
  </FormField>





























    <FormField label="Description" hasTextareaHeight>
        <Field name="description" as="textarea" placeholder="Description" />
    </FormField>







































  <FormField label="Transmission" labelFor="transmission">
      <Field name="transmission" id="transmission" component="select">
      
        <option value="automatic">automatic</option>
      
        <option value="manual">manual</option>
      
        <option value="any">any</option>
      
      </Field>
  </FormField>



























  <FormField label="FuelType" labelFor="fuel_type">
      <Field name="fuel_type" id="fuel_type" component="select">
      
        <option value="petrol">petrol</option>
      
        <option value="diesel">diesel</option>
      
        <option value="hybrid">hybrid</option>
      
        <option value="electric">electric</option>
      
        <option value="plugin_hybrid">plugin_hybrid</option>
      
        <option value="any">any</option>
      
      </Field>
  </FormField>



















    <FormField
        label="Seats"
    >
        <Field
            type="number"
            name="seats"
            placeholder="Seats"
        />
    </FormField>



























    <FormField
        label="Doors"
    >
        <Field
            type="number"
            name="doors"
            placeholder="Doors"
        />
    </FormField>



























    <FormField
        label="LargeBags"
    >
        <Field
            type="number"
            name="large_bags"
            placeholder="LargeBags"
        />
    </FormField>



























    <FormField
        label="SmallBags"
    >
        <Field
            type="number"
            name="small_bags"
            placeholder="SmallBags"
        />
    </FormField>





































  <FormField label='HasAirConditioning' labelFor='has_air_conditioning'>
      <Field
          name='has_air_conditioning'
          id='has_air_conditioning'
          component={SwitchField}
      ></Field>
  </FormField>

































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

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

export default Vehicle_categoriesNew
