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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    vehicle_type: 'walking',
    
    
    
    
    
    
    
    government_id_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    verification_files: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    profile_images: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'pending',
    
    
    
    
    
    
    
    
    
    
    
    
    
    is_available: false,
    
    
    
    
    
    
    
    
    
    rating_average: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    rating_count: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    current_address: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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























  <FormField label="VehicleType" labelFor="vehicle_type">
      <Field name="vehicle_type" id="vehicle_type" component="select">
      
        <option value="walking">walking</option>
      
        <option value="bicycle">bicycle</option>
      
        <option value="motorbike">motorbike</option>
      
        <option value="car">car</option>
      
        <option value="van">van</option>
      
      </Field>
  </FormField>













  <FormField
      label="GovernmentIDNumber"
  >
      <Field
          name="government_id_number"
          placeholder="GovernmentIDNumber"
      />
  </FormField>


















































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


























  <FormField>
      <Field
          label='ProfileImages'
          color='info'
          icon={mdiUpload}
          path={'courier_profiles/profile_images'}
          name='profile_images'
          id='profile_images'
          schema={{
            size: undefined,
            formats: undefined,
          }}
          component={FormImagePicker}
      ></Field>
  </FormField>



















  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="pending">pending</option>
      
        <option value="active">active</option>
      
        <option value="suspended">suspended</option>
      
      </Field>
  </FormField>





























  <FormField label='IsAvailable' labelFor='is_available'>
      <Field
          name='is_available'
          id='is_available'
          component={SwitchField}
      ></Field>
  </FormField>

















    <FormField
        label="RatingAverage"
    >
        <Field
            type="number"
            name="rating_average"
            placeholder="RatingAverage"
        />
    </FormField>



























    <FormField
        label="RatingCount"
    >
        <Field
            type="number"
            name="rating_count"
            placeholder="RatingCount"
        />
    </FormField>







































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

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

export default Courier_profilesNew
