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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    business: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    badge_type: 'VERIFIED_BUSINESS',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'PENDING',
    
    
    
    
    
    
    
    
    
    
    
    
    granted_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    revoked_at: '',
    
    
    
    
    
    
    
    
    
    
    
    notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    created_at_ts: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    updated_at_ts: '',
    
    
    
    
    
    
    
    
    
}


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

    
    

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























  <FormField label="BadgeType" labelFor="badge_type">
      <Field name="badge_type" id="badge_type" component="select">
      
        <option value="VERIFIED_BUSINESS">VERIFIED_BUSINESS</option>
      
        <option value="VERIFIED_LICENSE">VERIFIED_LICENSE</option>
      
        <option value="VERIFIED_INSURANCE">VERIFIED_INSURANCE</option>
      
        <option value="VERIFIED_PRICING">VERIFIED_PRICING</option>
      
        <option value="FAST_RESPONDER">FAST_RESPONDER</option>
      
        <option value="VERIFIED_JOBS">VERIFIED_JOBS</option>
      
      </Field>
  </FormField>



























  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="PENDING">PENDING</option>
      
        <option value="APPROVED">APPROVED</option>
      
        <option value="REJECTED">REJECTED</option>
      
      </Field>
  </FormField>























  <FormField
      label="GrantedAt"
  >
      <Field
          type="datetime-local"
          name="granted_at"
          placeholder="GrantedAt"
      />
  </FormField>



























  <FormField
      label="RevokedAt"
  >
      <Field
          type="datetime-local"
          name="revoked_at"
          placeholder="RevokedAt"
      />
  </FormField>



















    <FormField label="Notes" hasTextareaHeight>
        <Field name="notes" as="textarea" placeholder="Notes" />
    </FormField>



































  <FormField
      label="CreatedAt"
  >
      <Field
          type="datetime-local"
          name="created_at_ts"
          placeholder="CreatedAt"
      />
  </FormField>



























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

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

export default Business_badgesNew
