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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    lead: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    business: '',
    
    
    
    
    
    
    
    match_score: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'SENT',
    
    
    
    
    
    
    
    
    
    
    
    
    sent_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    viewed_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    responded_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    scheduled_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    completed_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    declined_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    created_at_ts: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    updated_at_ts: '',
    
    
    
    
    
    
    
    
    
}


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

    
    

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



























  <FormField label="Business" labelFor="business">
      <Field name="business" id="business" component={SelectField} options={[]} itemRef={'businesses'}></Field>
  </FormField>















    <FormField
        label="MatchScore"
    >
        <Field
            type="number"
            name="match_score"
            placeholder="MatchScore"
        />
    </FormField>



































  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="SENT">SENT</option>
      
        <option value="VIEWED">VIEWED</option>
      
        <option value="RESPONDED">RESPONDED</option>
      
        <option value="DECLINED">DECLINED</option>
      
        <option value="SCHEDULED">SCHEDULED</option>
      
        <option value="COMPLETED">COMPLETED</option>
      
      </Field>
  </FormField>























  <FormField
      label="SentAt"
  >
      <Field
          type="datetime-local"
          name="sent_at"
          placeholder="SentAt"
      />
  </FormField>



























  <FormField
      label="ViewedAt"
  >
      <Field
          type="datetime-local"
          name="viewed_at"
          placeholder="ViewedAt"
      />
  </FormField>



























  <FormField
      label="RespondedAt"
  >
      <Field
          type="datetime-local"
          name="responded_at"
          placeholder="RespondedAt"
      />
  </FormField>



























  <FormField
      label="ScheduledAt"
  >
      <Field
          type="datetime-local"
          name="scheduled_at"
          placeholder="ScheduledAt"
      />
  </FormField>



























  <FormField
      label="CompletedAt"
  >
      <Field
          type="datetime-local"
          name="completed_at"
          placeholder="CompletedAt"
      />
  </FormField>



























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

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

export default Lead_matchesNew
