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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    matter: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    party_role: 'plaintiff',
    
    
    
    
    
    
    
    display_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organization_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    email: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    phone: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    address: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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























  <FormField label="PartyRole" labelFor="party_role">
      <Field name="party_role" id="party_role" component="select">
      
        <option value="plaintiff">plaintiff</option>
      
        <option value="defendant">defendant</option>
      
        <option value="petitioner">petitioner</option>
      
        <option value="respondent">respondent</option>
      
        <option value="witness">witness</option>
      
        <option value="judge">judge</option>
      
        <option value="attorney">attorney</option>
      
        <option value="opposing_counsel">opposing_counsel</option>
      
        <option value="expert">expert</option>
      
        <option value="provider">provider</option>
      
        <option value="other">other</option>
      
      </Field>
  </FormField>













  <FormField
      label="DisplayName"
  >
      <Field
          name="display_name"
          placeholder="DisplayName"
      />
  </FormField>



























  <FormField
      label="OrganizationName"
  >
      <Field
          name="organization_name"
          placeholder="OrganizationName"
      />
  </FormField>



























  <FormField
      label="Email"
  >
      <Field
          name="email"
          placeholder="Email"
      />
  </FormField>



























  <FormField
      label="Phone"
  >
      <Field
          name="phone"
          placeholder="Phone"
      />
  </FormField>





























    <FormField label="Address" hasTextareaHeight>
        <Field name="address" as="textarea" placeholder="Address" />
    </FormField>





























      <FormField label='Notes' hasTextareaHeight>
          <Field
              name='notes'
              id='notes'
              component={RichTextField}
          ></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('/matter_parties/matter_parties-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Matter_partiesNew
