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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    service_request: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    actor_user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    event_type: 'request_created',
    
    
    
    
    
    
    
    event_title: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    event_detail: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    event_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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



























  <FormField label="ActorUser" labelFor="actor_user">
      <Field name="actor_user" id="actor_user" component={SelectField} options={[]} itemRef={'users'}></Field>
  </FormField>























  <FormField label="EventType" labelFor="event_type">
      <Field name="event_type" id="event_type" component="select">
      
        <option value="request_created">request_created</option>
      
        <option value="coordinator_assigned">coordinator_assigned</option>
      
        <option value="status_changed">status_changed</option>
      
        <option value="message_sent">message_sent</option>
      
        <option value="document_uploaded">document_uploaded</option>
      
        <option value="payment_completed">payment_completed</option>
      
        <option value="case_closed">case_closed</option>
      
        <option value="note_added">note_added</option>
      
      </Field>
  </FormField>













  <FormField
      label="EventTitle"
  >
      <Field
          name="event_title"
          placeholder="EventTitle"
      />
  </FormField>





























    <FormField label="EventDetail" hasTextareaHeight>
        <Field name="event_detail" as="textarea" placeholder="EventDetail" />
    </FormField>



































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

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

export default Request_timeline_eventsNew
